2 * $DragonFly: src/test/caps/client.c,v 1.2 2004/03/06 22:15:00 dillon Exp $
14 main(int ac, char **av)
23 struct caps_msgid msgid;
28 cid = caps_sys_client("test", getuid(), getgid(), 0, CAPF_ANYCLIENT);
32 msgcid = caps_sys_put(cid, "xyz", 3);
33 ngen = caps_sys_getgen(cid);
35 if (cid < 0 || (msgcid < 0 && errno == ENOTCONN)) {
39 printf("%d client forked, reconnecting to service\n", which);
41 printf("%d client lost connection, reconnecting\n", which);
46 cid = caps_sys_client("test", getuid(), getgid(), 0,
47 CAPF_ANYCLIENT | CAPF_WAITSVC);
51 printf("%d client resume on reconnect after lost connection\n", which);
55 printf("%d client: note generation change %lld\n", which, ngen);
59 printf("msgcid = %016llx %d\n", msgcid, errno);
61 n = caps_sys_wait(cid, buf, sizeof(buf), &msgid, NULL);
63 printf("n = %d msgid=%016llx state=%d errno=%d\n", n, msgid.c_id, msgid.c_state, errno);
65 printf("REPLY: %*.*s\n", n, n, buf);
68 if ((count & 65535) == 0)
69 printf("%d %d\n", which, count);
70 if (count == 1000 && which == 0) {
76 printf("forked pid %d\n", (int)getpid());