Attachment 'signal.stp-psig.patch'
Download 1 diff -Naur src.default/tapset/ChangeLog src/tapset/ChangeLog
2 --- src.default/tapset/ChangeLog 2008-01-05 03:39:54.000000000 +0800
3 +++ src/tapset/ChangeLog 2008-01-15 00:18:14.000000000 +0800
4 @@ -1,3 +1,16 @@
5 +2008-1-14 Eugene Teo <eteo@redhat.com>
6 +
7 + * signal.stp (get_sa_flags, get_sa_handler): New functions to
8 + return addresses of sa_flags and sa_handler of struct k_sigaction.
9 + (sigset_mask_str): New function. Returns a string containing the
10 + set of signals to be blocked when executing the signal handler.
11 + (is_sig_blocked): New function. Checks task_struct->blocked signal
12 + mask for signals that are currently blocked.
13 + (signal_str): New function. Translates a signal number.
14 + (sa_flags_str): New function. Translates the sa_flags.
15 + (sa_handler_str): New function. Returns the signal action or handler
16 + associated to the signal.
17 +
18 2008-1-4 Masami Hiramatsu <mhiramat@redhat.com>
19
20 * aux_syscalls.stp (_stp_fork_list): Check kernel version for new
21 diff -Naur src.default/tapset/signal.stp src/tapset/signal.stp
22 --- src.default/tapset/signal.stp 2007-12-27 14:58:23.000000000 +0800
23 +++ src/tapset/signal.stp 2008-01-15 00:32:36.000000000 +0800
24 @@ -1,6 +1,7 @@
25 // Signal tapset
26 // Copyright (C) 2006 IBM Corp.
27 // Copyright (C) 2006 Intel Corporation.
28 +// Copyright (C) 2008 Red Hat, Inc.
29 //
30 // This file is part of systemtap, and is free software. You can
31 // redistribute it and/or modify it under the terms of the GNU General
32 @@ -505,3 +506,155 @@
33 sig_pid = $t->pid
34 pid_name = kernel_string($t->comm)
35 }
36 +
37 +function get_sa_flags:long (act:long) %{ /* pure */
38 + struct k_sigaction *act = (struct k_sigaction *)((long)THIS->act);
39 + THIS->__retvalue = (long)act->sa.sa_flags;
40 +%}
41 +
42 +function get_sa_handler:long (act:long) %{ /* pure */
43 + struct k_sigaction *act = (struct k_sigaction *)((long)THIS->act);
44 + THIS->__retvalue = (long)act->sa.sa_handler;
45 +%}
46 +
47 +/*
48 + * sa_mask contains the set of signals to be blocked when executing the
49 + * signal handler. This function returns a string, delimited by ",".
50 + *
51 + * struct task_struct {
52 + * [...]
53 + * struct signal_struct *signal;
54 + * struct sighand_struct *sighand;
55 + * [...]
56 + * struct sighand_struct {
57 + * atomic_t count;
58 + * struct k_sigaction action[_NSIG];
59 + * [...]
60 + * struct k_sigaction {
61 + * struct sigaction sa;
62 + * };
63 + *
64 + * struct sigaction {
65 + * [...]
66 + * sigset_t sa_mask;
67 + * };
68 + */
69 +function sigset_mask_str:string (mask:long) %{ /* pure */
70 + int i;
71 + char str[256], tmp[10];
72 + str[0] = '\0';
73 + for (i = 1; i < _NSIG; ++i) {
74 + if (THIS->mask & 1) {
75 + sprintf(tmp, "%u,", i);
76 + strcat(str, tmp);
77 + }
78 + THIS->mask >>= 1;
79 + }
80 + if (str[0] != '\0') str[strlen(str)-1] = '\0';
81 + strlcpy (THIS->__retvalue, str, MAXSTRINGLEN);
82 +%}
83 +
84 +/*
85 + * task_struct->blocked signal mask contains the set of signals that are
86 + * currently blocked.
87 + *
88 + * struct task_struct {
89 + * [...]
90 + * sigset_t blocked, real_blocked;
91 + */
92 +function is_sig_blocked:long (task:long, sig:long) %{ /* pure */
93 + struct task_struct *p = (struct task_struct *)((long)THIS->task);
94 + THIS->__retvalue = !p ? -1 : sigismember(&p->blocked, THIS->sig);
95 +%}
96 +
97 +/*
98 + * Signals start from 1 not 0.
99 + */
100 +function signal_str(sig) {
101 + if (sig == 1) return "HUP";
102 + if (sig == 2) return "INT";
103 + if (sig == 3) return "QUIT";
104 + if (sig == 4) return "ILL";
105 + if (sig == 5) return "TRAP";
106 + if (sig == 6) return "ABRT"; /* or IOT */
107 + if (sig == 7) return "BUS";
108 + if (sig == 8) return "FPE";
109 + if (sig == 9) return "KILL";
110 + if (sig == 10) return "USR1";
111 + if (sig == 11) return "SEGV";
112 + if (sig == 12) return "USR2";
113 + if (sig == 13) return "PIPE";
114 + if (sig == 14) return "ALRM";
115 + if (sig == 15) return "TERM";
116 + if (sig == 16) return "STKFLT";
117 + if (sig == 17) return "CHLD"; /* or CLD */
118 + if (sig == 18) return "CONT";
119 + if (sig == 19) return "STOP";
120 + if (sig == 20) return "TSTP";
121 + if (sig == 21) return "TTIN";
122 + if (sig == 22) return "TTOU";
123 + if (sig == 23) return "URG";
124 + if (sig == 24) return "XCPU";
125 + if (sig == 25) return "XFSZ";
126 + if (sig == 26) return "VTALRM";
127 + if (sig == 27) return "PROF";
128 + if (sig == 28) return "WINCH";
129 + if (sig == 29) return "IO/POLL";
130 + if (sig == 30) return "PWR";
131 + if (sig == 31) return "SYS"; /* or UNUSED */
132 + if (sig == 32) return "RTMIN";
133 + if (sig == 33) return "RTMIN+1";
134 + if (sig == 34) return "RTMIN+2";
135 + if (sig == 35) return "RTMIN+3";
136 + if (sig == 36) return "RTMIN+4";
137 + if (sig == 37) return "RTMIN+5";
138 + if (sig == 38) return "RTMIN+6";
139 + if (sig == 39) return "RTMIN+7";
140 + if (sig == 40) return "RTMIN+8";
141 + if (sig == 41) return "RTMIN+9";
142 + if (sig == 42) return "RTMIN+10";
143 + if (sig == 43) return "RTMIN+11";
144 + if (sig == 44) return "RTMIN+12";
145 + if (sig == 45) return "RTMIN+13";
146 + if (sig == 46) return "RTMIN+14";
147 + if (sig == 47) return "RTMIN+15";
148 + if (sig == 48) return "RTMIN+16";
149 + if (sig == 49) return "RTMIN+17";
150 + if (sig == 50) return "RTMIN+18";
151 + if (sig == 51) return "RTMIN+19";
152 + if (sig == 52) return "RTMIN+20";
153 + if (sig == 53) return "RTMIN+21";
154 + if (sig == 54) return "RTMIN+22";
155 + if (sig == 55) return "RTMIN+23";
156 + if (sig == 56) return "RTMIN+24";
157 + if (sig == 57) return "RTMIN+25";
158 + if (sig == 58) return "RTMIN+26";
159 + if (sig == 59) return "RTMIN+27";
160 + if (sig == 60) return "RTMIN+28";
161 + if (sig == 61) return "RTMIN+29";
162 + if (sig == 62) return "RTMIN+30";
163 + if (sig == 63) return "RTMIN+31";
164 + if (sig == 64) return "RTMIN+32";
165 +}
166 +
167 +function sa_flags_str:string (sa_flags:long) %{ /* pure */
168 + char str[256];
169 + str[0] = '\0';
170 + if (THIS->sa_flags & 0x00000001u) strcat(str, "NOCLDSTOP|");
171 + if (THIS->sa_flags & 0x00000002u) strcat(str, "NOCLDWAIT|");
172 + if (THIS->sa_flags & 0x00000004u) strcat(str, "SIGINFO|");
173 + if (THIS->sa_flags & 0x08000000u) strcat(str, "ONSTACK|");
174 + if (THIS->sa_flags & 0x10000000u) strcat(str, "RESTART|");
175 + if (THIS->sa_flags & 0x40000000u) strcat(str, "NODEFER|");
176 + if (THIS->sa_flags & 0x80000000u) strcat(str, "RESETHAND|");
177 + if (THIS->sa_flags & 0x04000000) strcat(str, "RESTORER|");
178 + if (str[0] != '\0') str[strlen(str)-1] = '\0';
179 + strlcpy (THIS->__retvalue, str, MAXSTRINGLEN);
180 +%}
181 +
182 +function sa_handler_str(handler) {
183 + if (handler == 0) return "default"; /* SIG_DFL */
184 + if (handler == 1) return "ignored"; /* SIG_IGN */
185 + if (handler == -1) return "error"; /* SIG_ERR */
186 + return sprintf("%p", handler); /* userspace address */
187 +}
188
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.- [get | view] (2008-01-14 16:49:36, 5.6 KB) [[attachment:psig.sh]]
- [get | view] (2008-01-13 14:30:00, 16.7 KB) [[attachment:signal.stp]]
- [get | view] (2008-01-14 16:49:24, 6.3 KB) [[attachment:signal.stp-psig.patch]]
- [get | view] (2008-01-13 14:30:17, 12.1 KB) [[attachment:signal.stp.default]]
You are not allowed to attach a file to this page.
