10 static void do_exec(const char *path
, const char *arg
, const sigset_t
*mask
)
21 sigprocmask(SIG_SETMASK
, mask
, NULL
);
22 execl(path
, path
, arg
, (char *) NULL
);
24 fprintf(stderr
, "FAILED: execl failed with %s\n",
29 ret
= waitpid(pid
, &status
, 0);
30 while(ret
== -1 && errno
== EINTR
);
36 fprintf(stderr
, "child exec failed\n");
42 int main(int argc
, char **argv
)
48 do_exec(argv
[0], "full", &mask
);
51 do_exec(argv
[0], "empty", &mask
);
57 if (strcmp(argv
[1], "full") == 0)
59 else if (strcmp(argv
[1], "empty") == 0)
62 fprintf(stderr
, "empty or full?\n");
66 sigprocmask(SIG_SETMASK
, NULL
, &mask
);
68 for(i
= 1; i
< NSIG
; i
++) {
69 if (i
== SIGKILL
|| i
== SIGSTOP
)
73 if (sigismember(&mask
, i
))
74 printf("empty: signal %d added to mask\n", i
);
76 if (!sigismember(&mask
, i
))
77 printf("full: signal %d missing from mask\n", i
);