]> granicus.if.org Git - strace/commitdiff
futex: recognise FUTEX_BITSET_MATCH_ANY bitmask
authorEugene Syromyatnikov <evgsyr@gmail.com>
Wed, 29 Aug 2018 20:18:36 +0000 (22:18 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 2 Sep 2018 17:44:26 +0000 (17:44 +0000)
* xlat/futexbitset.in: New file.
* futex.c: Include "xlat/futexbitset.h".
(futex) <FUTEX_WAIT_BITSET, FUTEX_WAKE_BITSET>: Decode val3 using
futexbitset xlat.
* tests/futex.c: Add checks for 0xffffffff bitset mask printing.

Closes: Linux commit v4.16-rc1~166^2^2~2
futex.c
tests/futex.c
xlat/futexbitset.in [new file with mode: 0644]

diff --git a/futex.c b/futex.c
index 9ce4ced53db1408f48a7036220b9b63347c1748f..e4dfa08605e426040a6edd500a8cb089c464ef87 100644 (file)
--- a/futex.c
+++ b/futex.c
@@ -41,6 +41,7 @@
 # define FUTEX_OP_OPARG_SHIFT 8
 #endif
 
+#include "xlat/futexbitset.h"
 #include "xlat/futexops.h"
 #include "xlat/futexwakeops.h"
 #include "xlat/futexwakecmps.h"
@@ -74,11 +75,13 @@ SYS_FUNC(futex)
                tprintf(", %u", val);
                tprints(", ");
                print_timespec(tcp, timeout);
-               tprintf(", %#x", val3);
+               tprints(", ");
+               printxval(futexbitset, val3, NULL);
                break;
        case FUTEX_WAKE_BITSET:
                tprintf(", %u", val);
-               tprintf(", %#x", val3);
+               tprints(", ");
+               printxval(futexbitset, val3, NULL);
                break;
        case FUTEX_REQUEUE:
                tprintf(", %u", val);
index 174100f31665d511762f49e864f7f960ff2d328c..5250d600b86fa47d0265e843108ce9aed6f8aa67 100644 (file)
@@ -166,6 +166,9 @@ void invalid_op(int *val, int op, uint32_t argmask, ...)
 # define VAL3     ((unsigned long) 0xbadda7a09caffee1LLU)
 # define VAL3_PR  ((unsigned) VAL3)
 
+# define VAL3A    ((unsigned long) 0xbadda7a0ffffffffLLU)
+# define VAL3A_PR "FUTEX_BITSET_MATCH_ANY"
+
 int
 main(int argc, char *argv[])
 {
@@ -288,6 +291,14 @@ main(int argc, char *argv[])
               zero_extend_signed_to_ull(tmout->tv_nsec), VAL3_PR,
               sprintrc(rc));
 
+       CHECK_FUTEX_ENOSYS(uaddr, FUTEX_WAIT_BITSET, VAL, tmout, uaddr2 + 1,
+               VAL3A, (rc == -1) && (errno == EAGAIN));
+       printf("futex(%p, FUTEX_WAIT_BITSET, %u, {tv_sec=%lld, tv_nsec=%llu}"
+              ", %s) = %s\n",
+              uaddr, VAL_PR, (long long) tmout->tv_sec,
+              zero_extend_signed_to_ull(tmout->tv_nsec), VAL3A_PR,
+              sprintrc(rc));
+
        /* val3 of 0 is invalid  */
        CHECK_FUTEX_ENOSYS(uaddr, FUTEX_WAIT_BITSET, VAL, tmout, uaddr2 + 1, 0,
                (rc == -1) && (errno == EINVAL));
@@ -375,6 +386,11 @@ main(int argc, char *argv[])
        printf("futex(%p, FUTEX_WAKE_BITSET, %u, %#x) = %s\n", uaddr, 10,
                VAL3_PR, sprintrc(rc));
 
+       CHECK_FUTEX_ENOSYS(uaddr, FUTEX_WAKE_BITSET, 10, NULL, NULL,
+               VAL3A, (rc == 0));
+       printf("futex(%p, FUTEX_WAKE_BITSET, %u, %s) = %s\n", uaddr, 10,
+               VAL3A_PR, sprintrc(rc));
+
        /* bitset 0 is invalid */
        CHECK_FUTEX_ENOSYS(uaddr, FUTEX_WAKE_BITSET, 10, NULL, NULL, 0,
                (rc == -1) && (errno == EINVAL));
diff --git a/xlat/futexbitset.in b/xlat/futexbitset.in
new file mode 100644 (file)
index 0000000..1290c87
--- /dev/null
@@ -0,0 +1 @@
+FUTEX_BITSET_MATCH_ANY 0xffffffff