1 /*
2 * Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com>
3 * Copyright (c) 2015-2021 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 "pidns.h"
11 #include <assert.h>
12 #include <stdio.h>
13 #include <signal.h>
14 #include <unistd.h>
15
16 int
17 main(void)
18 {
19 PIDNS_TEST_INIT;
20
21 struct sigaction sa = {
22 .sa_handler = SIG_IGN
23 };
24 union sigval value = {
25 .sival_ptr = (void *) (unsigned long) 0xdeadbeefbadc0dedULL
26 };
27 pid_t pid = getpid();
28 const char *pid_str = pidns_pid2str(PT_TGID);
29
30 assert(sigaction(SIGUSR1, &sa, NULL) == 0);
31 if (sigqueue(pid, SIGUSR1, value))
32 perror_msg_and_skip("sigqueue");
33 pidns_print_leader();
34 printf("rt_sigqueueinfo(%d%s, SIGUSR1, {si_signo=SIGUSR1, "
35 "si_code=SI_QUEUE, si_pid=%d%s, si_uid=%u, "
36 "si_int=%d, si_ptr=%p}) = 0\n",
37 pid, pid_str, pid, pid_str,
38 getuid(), value.sival_int, value.sival_ptr);
39 pidns_print_leader();
40 puts("+++ exited with 0 +++");
41
42 return 0;
43 }