[PATCH] fix sigtimedwait display

Denys Vlasenko dvlasenk at redhat.com
Tue Mar 31 15:36:35 UTC 2009


Before this patch:

27192 rt_sigtimedwait([HUP INT QUIT TERM TSTP TTIN TTOU], 0x8cb4594) = -1 EAGAIN (Resource temporarily unavailable)
                                                          ^^^^^^^^^ wrong (must be 0)! also, rest is not decoded
27192 rt_sigtimedwait([HUP INT QUIT TERM TSTP TTIN TTOU], 0x8cb4594) = -1 EAGAIN (Resource temporarily unavailable)
27192 rt_sigtimedwait([HUP INT QUIT TERM TSTP TTIN TTOU], 0, 0x80ed85c, 8) = 2
                                                             ^^^^^^^^^ timespec is not decoded
27192 rt_sigtimedwait([HUP INT QUIT TERM TSTP TTIN TTOU], 0x8cb4594) = -1 EAGAIN (Resource temporarily unavailable)
27192 rt_sigtimedwait([HUP INT QUIT TERM TSTP TTIN TTOU], 0x8cb4594) = -1 EAGAIN (Resource temporarily unavailable)

After:

rt_sigtimedwait([HUP INT QUIT TERM TSTP TTIN TTOU], NULL, {0, 0}, 8) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigtimedwait([HUP INT QUIT TERM TSTP TTIN TTOU], NULL, {0, 0}, 8) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigtimedwait([HUP INT QUIT TERM TSTP TTIN TTOU], NULL, {0, 0}, 8) = 2
rt_sigtimedwait([HUP INT QUIT TERM TSTP TTIN TTOU], NULL, {0, 0}, 8) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigtimedwait([HUP INT QUIT TERM TSTP TTIN TTOU], NULL, {0, 0}, 8) = -1 EAGAIN (Resource temporarily unavailable)

Changelog:

	* signal.c (sys_rt_sigtimedwait): Fix siginfo display,
	show timespec and sigset length too.

--
vda


diff -d -urpN strace.4/signal.c strace.5/signal.c
--- strace.4/signal.c	2009-03-31 17:29:09.000000000 +0200
+++ strace.5/signal.c	2009-03-31 17:29:16.000000000 +0200
@@ -2032,21 +2032,32 @@ int sys_rt_sigtimedwait(struct tcb *tcp)
 		else
 			printsigmask(&sigset, 1);
 		tprintf(", ");
+		/* This is the only "return" parameter, */
+		if (tcp->u_arg[1] != 0)
+			return 0;
+		/* ... if it's NULL, can decode all on entry */
+		tprintf("NULL, ");
 	}
-	else {
+	else if (tcp->u_arg[1] != 0) {
+		/* syscall exit, and u_arg[1] wasn't NULL */
 		if (syserror(tcp))
-			tprintf("%#lx", tcp->u_arg[0]);
+			tprintf("%#lx, ", tcp->u_arg[1]);
 		else {
 			siginfo_t si;
 			if (umove(tcp, tcp->u_arg[1], &si) < 0)
-				tprintf("%#lx", tcp->u_arg[1]);
-			else
+				tprintf("%#lx, ", tcp->u_arg[1]);
+			else {
 				printsiginfo(&si, verbose(tcp));
-			/* XXX For now */
-			tprintf(", %#lx", tcp->u_arg[2]);
-			tprintf(", %d", (int) tcp->u_arg[3]);
+				tprintf(", ");
+			}
 		}
 	}
+	else {
+		/* syscall exit, and u_arg[1] was NULL */
+		return 0;
+	}
+	print_timespec(tcp, tcp->u_arg[2]);
+	tprintf(", %d", (int) tcp->u_arg[3]);
 	return 0;
 };
 






More information about the Strace-devel mailing list