1 /* Test program that invokes the Linux system call rt_sigqueueinfo(). */
2
3 #include <signal.h>
4 #include <string.h>
5 #include <stddef.h>
6 #include <stdlib.h>
7 #include <stdio.h>
8 #include <syscall.h>
9 #include <unistd.h>
10
main(int argc,char ** argv)11 int main(int argc, char **argv)
12 {
13 siginfo_t *si;
14 const size_t sz = sizeof(*si);
15
16 if (argc == 1) {
17 fprintf(stderr, "sizeof(*si) = %zu\n", sz);
18 fprintf(stdout, "offsetof(siginfo_t, si_signo) = %zd\n",
19 offsetof(siginfo_t, si_signo));
20 fprintf(stdout, "offsetof(siginfo_t, si_errno) = %zd\n",
21 offsetof(siginfo_t, si_errno));
22 fprintf(stdout, "offsetof(siginfo_t, si_code) = %zd\n",
23 offsetof(siginfo_t, si_code));
24 fprintf(stdout, "offsetof(siginfo_t, _sifields) = %zd\n",
25 offsetof(siginfo_t, _sifields));
26 }
27 si = calloc(1, sz);
28 si->si_signo = SIGWINCH;
29 si->si_code = SI_QUEUE;
30 si->si_pid = getpid();
31 si->si_uid = getuid();
32 syscall(__NR_rt_sigqueueinfo, getpid(), SIGWINCH, si);
33 free(si);
34 fprintf(stderr, "Done.\n");
35 return 0;
36 }
37