Page MenuHomeFreeBSD

parent --> libcasper

Authored By
jfree
Jul 21 2023, 9:36 PM
Size
1 KB
Referenced Files
None
Subscribers
None

parent --> libcasper

#include <sys/nv.h>
#define WITH_CASPER 1
#include <err.h>
#include <libcasper.h>
#include <libcasper_service.h>
#include <stdio.h>
#include <string.h>
int val;
cap_channel_t *cap_config;
int
main(void)
{
val = 1024;
cap_channel_t *cap_casper = cap_init();
if (cap_casper == NULL)
err(1, "failed to contact casper");
cap_config = cap_service_open(cap_casper, "casper.test");
if (cap_config == NULL)
err(1, "failed to open test service");
cap_close(cap_casper);
nvlist_t *nvl = nvlist_create(0);
nvlist_add_string(nvl, "cmd", "print");
printf("parent cap_config: %p\n", cap_config);
printf("parent val: %d\n", val);
if (cap_send_nvlist(cap_config, nvl) == -1)
err(1, "send failed");
return (0);
}
static int
cmd(const char *cmd, const nvlist_t *nvlim,
nvlist_t *nvnew, nvlist_t *nvold)
{
if (strcmp(cmd, "print") == 0) {
printf("casper cap_config: %p\n", cap_config);
printf("casper val: %d\n", val);
}
return (0);
}
CREATE_SERVICE("casper.test", NULL, cmd, CASPER_SERVICE_STDIO);

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6140779
Default Alt Text
parent --> libcasper (1 KB)

Event Timeline