]> granicus.if.org Git - strace/blob - print_sigevent.c
Fix preprocessor indentation
[strace] / print_sigevent.c
1 /*
2  * Copyright (c) 2003, 2004 Ulrich Drepper <drepper@redhat.com>
3  * Copyright (c) 2005-2018 Dmitry V. Levin <ldv@altlinux.org>
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: LGPL-2.1-or-later
7  */
8
9 #include "defs.h"
10
11 #include DEF_MPERS_TYPE(struct_sigevent)
12 #include "sigevent.h"
13 #include MPERS_DEFS
14
15 #include <signal.h>
16 #include "xlat/sigev_value.h"
17
18 MPERS_PRINTER_DECL(void, print_sigevent,
19                    struct tcb *const tcp, const kernel_ulong_t addr)
20 {
21         struct_sigevent sev;
22
23         if (umove_or_printaddr(tcp, addr, &sev))
24                 return;
25
26         tprints("{");
27         if (sev.sigev_value.sival_ptr) {
28                 tprintf("sigev_value={sival_int=%d, sival_ptr=",
29                         sev.sigev_value.sival_int);
30                 printaddr(sev.sigev_value.sival_ptr);
31                 tprints("}, ");
32         }
33
34         tprints("sigev_signo=");
35         switch (sev.sigev_notify) {
36         case SIGEV_SIGNAL:
37         case SIGEV_THREAD:
38         case SIGEV_THREAD_ID:
39                 printsignal(sev.sigev_signo);
40                 break;
41         default:
42                 tprintf("%u", sev.sigev_signo);
43         }
44
45         tprints(", sigev_notify=");
46         printxval(sigev_value, sev.sigev_notify, "SIGEV_???");
47
48         switch (sev.sigev_notify) {
49         case SIGEV_THREAD_ID:
50                 tprintf(", sigev_notify_thread_id=%d", sev.sigev_un.tid);
51                 break;
52         case SIGEV_THREAD:
53                 tprints(", sigev_notify_function=");
54                 printaddr(sev.sigev_un.sigev_thread.function);
55                 tprints(", sigev_notify_attributes=");
56                 printaddr(sev.sigev_un.sigev_thread.attribute);
57                 break;
58         }
59         tprints("}");
60 }