]> granicus.if.org Git - strace/blob - tests/rt_sigqueueinfo.c
tests: change the license to GPL-2.0-or-later
[strace] / tests / rt_sigqueueinfo.c
1 /*
2  * Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com>
3  * Copyright (c) 2015-2017 The strace developers.
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8
9 #include "tests.h"
10 #include <assert.h>
11 #include <stdio.h>
12 #include <signal.h>
13 #include <unistd.h>
14
15 int
16 main(void)
17 {
18         struct sigaction sa = {
19                 .sa_handler = SIG_IGN
20         };
21         union sigval value = {
22                 .sival_ptr = (void *) (unsigned long) 0xdeadbeefbadc0dedULL
23         };
24         pid_t pid = getpid();
25
26         assert(sigaction(SIGUSR1, &sa, NULL) == 0);
27         if (sigqueue(pid, SIGUSR1, value))
28                 perror_msg_and_skip("sigqueue");
29         printf("rt_sigqueueinfo(%u, SIGUSR1, {si_signo=SIGUSR1, "
30                 "si_code=SI_QUEUE, si_pid=%u, si_uid=%u, "
31                 "si_value={int=%d, ptr=%p}}) = 0\n",
32                 pid, pid, getuid(), value.sival_int, value.sival_ptr);
33         printf("+++ exited with 0 +++\n");
34
35         return 0;
36 }