2 * $DragonFly: src/test/caps/client.c,v 1.3 2004/03/31 20:27:34 dillon Exp $
14 main(int ac, char **av)
24 struct caps_msgid msgid;
29 cid = caps_sys_client("test", getuid(), getgid(), 0, CAPF_ANYCLIENT);
33 msgcid = caps_sys_put(cid, "xyz", 3);
34 ngen = caps_sys_getgen(cid);
36 if (cid < 0 || (msgcid < 0 && errno == ENOTCONN)) {
38 printf("%d client forked or lost connection, reconnecting\n", which);
41 cid = caps_sys_client("test", getuid(), getgid(), 0,
42 CAPF_ANYCLIENT | CAPF_WAITSVC);
46 printf("%d client resume on reconnect after lost connection\n", which);
50 printf("%d client: note generation change %lld\n", which, ngen);
54 printf("msgcid = %016llx %d\n", msgcid, errno);
56 n = caps_sys_wait(cid, buf, sizeof(buf), &msgid, NULL);
58 printf("n = %d msgid=%016llx state=%d errno=%d\n", n, msgid.c_id, msgid.c_state, errno);
60 printf("REPLY: %*.*s\n", n, n, buf);
64 if ((count & 65535) == 0)
65 printf("%d %lld\n", which, xcount);
66 if (count == 100000000)
68 if (count == 1000 && didfork == 0 && which < 10) {
73 printf("forked pid %d client #%d\n", (int)getpid(), which + 1);