[PATCH 7/8] futex: Avoid printing val when it is not used by the command

Eugene Syromyatnikov evgsyr at gmail.com
Mon Aug 29 15:14:43 UTC 2016


Analogous to timeout argument omitting in FUTEX_WAKE_BITSET command.

* futex.c (SYS_FUNC(futex)): Remove common val argument print call, add
  it into specific command cases (all except FUTEX_LOCK_PI,
  FUTEX_UNLOCK_PI, FUTEX_TRYLOCK_PI).
---
 futex.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/futex.c b/futex.c
index a49677a..8b96264 100644
--- a/futex.c
+++ b/futex.c
@@ -59,32 +59,40 @@ SYS_FUNC(futex)
 	printaddr(uaddr);
 	tprints(", ");
 	printxval(futexops, op, "FUTEX_???");
-	tprintf(", %u", val);
 	switch (cmd) {
 	case FUTEX_WAIT:
+		tprintf(", %u", val);
+		tprints(", ");
+		print_timespec(tcp, timeout);
+		break;
 	case FUTEX_LOCK_PI:
 		tprints(", ");
 		print_timespec(tcp, timeout);
 		break;
 	case FUTEX_WAIT_BITSET:
+		tprintf(", %u", val);
 		tprints(", ");
 		print_timespec(tcp, timeout);
 		tprintf(", %#x", val3);
 		break;
 	case FUTEX_WAKE_BITSET:
+		tprintf(", %u", val);
 		tprintf(", %#x", val3);
 		break;
 	case FUTEX_REQUEUE:
+		tprintf(", %u", val);
 		tprints(", ");
 		printaddr(uaddr2);
 		break;
 	case FUTEX_CMP_REQUEUE:
 	case FUTEX_CMP_REQUEUE_PI:
+		tprintf(", %u", val);
 		tprints(", ");
 		printaddr(uaddr2);
 		tprintf(", %u", val3);
 		break;
 	case FUTEX_WAKE_OP:
+		tprintf(", %u", val);
 		tprintf(", %u, ", val2);
 		printaddr(uaddr2);
 		tprints(", {");
@@ -96,6 +104,7 @@ SYS_FUNC(futex)
 		tprintf(", %u}", val3 & 0xfff);
 		break;
 	case FUTEX_WAIT_REQUEUE_PI:
+		tprintf(", %u", val);
 		tprints(", ");
 		print_timespec(tcp, timeout);
 		tprints(", ");
@@ -103,10 +112,13 @@ SYS_FUNC(futex)
 		break;
 	case FUTEX_FD:
 	case FUTEX_WAKE:
+		tprintf(", %u", val);
+		break;
 	case FUTEX_UNLOCK_PI:
 	case FUTEX_TRYLOCK_PI:
 		break;
 	default:
+		tprintf(", %u", val);
 		tprintf(", %#lx", timeout);
 		tprints(", ");
 		printaddr(uaddr2);
-- 
1.7.10.4





More information about the Strace-devel mailing list