5 #include <sys/capability.h>
7 #define FNAME "test.dat"
10 static int have_lease;
11 static int got_signal;
13 static void sig_usr1(int sig)
18 int main(int argc, char *argv[])
21 cap_t cap = cap_get_proc();
23 cap->cap_effective |= CAP_NETWORK_MGT;
24 if (cap_set_proc(cap) == -1) failed("cap_set_proc");
27 if (pipe(pfd) != 0) failed("pipe");
29 if ((fd = open(FNAME, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600)) == -1) failed("open");
31 if (fcntl(fd, F_SETSIG, SIGUSR1) == -1) failed("setsig");
33 signal(SIGUSR1, sig_usr1);
39 if (fcntl(fd, F_OPLKACK, OP_REVOKE) == -1) failed("revoke");
44 if (!have_lease && fcntl(fd, F_OPLKREG, pfd[1]) == -1) continue;