<div dir="ltr">Hi,<div><br></div><div>Please ignore this patch. I sent another one (the correct patch) later.</div><div><br></div><div>Best regards,</div><div>-Amin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 7, 2016 at 2:09 PM, <span dir="ltr"><<a href="mailto:aminkhorsandi@gmail.com" target="_blank">aminkhorsandi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Amin Khorsandi <<a href="mailto:amin.khorsandi@infinera.com">amin.khorsandi@infinera.com</a>><br>
<br>
---<br>
strace.1 | 5 +++++<br>
syscall.c | 31 ++++++++++++++++++++++++++++++-<br>
2 files changed, 35 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/strace.1 b/strace.1<br>
index b7dddc0..c2088fa 100644<br>
--- a/strace.1<br>
+++ b/strace.1<br>
@@ -403,6 +403,11 @@ Furthermore, using the abbreviation will ensure that you don't<br>
accidentally forget to include a call like<br>
.B lstat<br>
in the list. Betchya woulda forgot that one.<br>
+To see a list of all system calls in a class you can use<br>
+.BR "-e\ trace?" = classname .<br>
+For example you can see what are the system calls in the network<br>
+class running strace using the option<br>
+.BR "-e\ trace?" = network .<br>
.TP<br>
.BR "\-e\ trace" = process<br>
Trace all system calls which involve process management. This<br>
diff --git a/syscall.c b/syscall.c<br>
index c61f827..0df7fd9 100644<br>
--- a/syscall.c<br>
+++ b/syscall.c<br>
@@ -503,6 +503,30 @@ lookup_class(const char *s)<br>
return -1;<br>
}<br>
<br>
+static void<br>
+print_class_syscalls(int class)<br>
+{<br>
+ unsigned int i;<br>
+ unsigned pers = 0; /* only print system calls in personality 0 */<br>
+ for (i = 0; i < nsyscall_vec[pers]; i++)<br>
+ if (sysent_vec[pers][i].sys_flags & class) {<br>
+ printf("\t%s \n", sysent_vec[pers][i].sys_name);<br>
+ }<br>
+}<br>
+<br>
+static void<br>
+print_trace_class(const char* trace_class)<br>
+{<br>
+ int class = lookup_class(trace_class);<br>
+ if (class != -1) {<br>
+ printf("List of system calls in %s class\n", trace_class);<br>
+ printf("%s\n", "-------------------------------------");<br>
+ print_class_syscalls(class);<br>
+ } else {<br>
+ error_msg_and_die("invalid class name '%s'", trace_class);<br>
+ }<br>
+}<br>
+<br>
void<br>
qualify(const char *s)<br>
{<br>
@@ -518,7 +542,12 @@ qualify(const char *s)<br>
opt = &qual_options[0];<br>
for (i = 0; (p = qual_options[i].option_name); i++) {<br>
unsigned int len = strlen(p);<br>
- if (strncmp(s, p, len) == 0 && s[len] == '=') {<br>
+ if (strncmp(s, p, len) == 0 && s[len] == '?' && s[len + 1] == '=') {<br>
+ s += len + 2;<br>
+ print_trace_class(s);<br>
+ exit(0);<br>
+ }<br>
+ else if (strncmp(s, p, len) == 0 && s[len] == '=') {<br>
opt = &qual_options[i];<br>
s += len + 1;<br>
break;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.4.10<br>
<br>
</font></span></blockquote></div><br></div>