]> granicus.if.org Git - strace/commitdiff
Update SHM_* constants
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 17 Nov 2017 00:24:41 +0000 (00:24 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 17 Nov 2017 00:24:41 +0000 (00:24 +0000)
* xlat/shm_flags.in: Add SHM_EXEC introduced by kernel commit
v2.6.9-rc2~23^2~93^2~78.
* xlat/shm_resource_flags.in: Add SHM_NORESERVE introduced by kernel
commit v2.6.15-rc1~622.
* NEWS: Mention this.
* tests/ipc_shm.c (main): Update expected output.
* tests/shmxt.c (main): Update expected output, check SHM_EXEC decoding.

NEWS
tests/ipc_shm.c
tests/shmxt.c
xlat/shm_flags.in
xlat/shm_resource_flags.in

diff --git a/NEWS b/NEWS
index 87b85c7da44042005fd08221b730744c84121682..35d19773e59a4dbf0922f13c3f0c10eb51633d0c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,7 @@ Noteworthy changes in release ?.?? (????-??-??)
   * Implemented decoding of netlink descriptor attributes as file descriptors.
   * Enhanced decoding of getsockopt and setsockopt syscalls for SOL_NETLINK
     level.
-  * Updated the list of MSG_* constants.
+  * Updated lists of MSG_* and SHM_* constants.
 
 Noteworthy changes in release 4.20 (2017-11-13)
 ===============================================
index 66960ff9fb98e43229e567203a1fc4050d567176..9e9c5609ee932e36538a04163fd77c2dea6a7494 100644 (file)
@@ -70,12 +70,14 @@ main(void)
        struct shmid_ds ds;
 
        rc = shmget(bogus_key, bogus_size, bogus_flags);
-       printf("shmget\\(%#llx, %zu, %s%s%s%#x\\|%#04o\\) += %s\n",
+       printf("shmget\\(%#llx, %zu, %s%s%s%s%#x\\|%#04o\\) += %s\n",
               zero_extend_signed_to_ull(bogus_key), bogus_size,
               IPC_CREAT & bogus_flags ? "IPC_CREAT\\|" : "",
               IPC_EXCL & bogus_flags ? "IPC_EXCL\\|" : "",
               SHM_HUGETLB & bogus_flags ? "SHM_HUGETLB\\|" : "",
-              bogus_flags & ~(0777 | IPC_CREAT | IPC_EXCL | SHM_HUGETLB),
+              SHM_NORESERVE & bogus_flags ? "SHM_NORESERVE\\|" : "",
+              bogus_flags & ~(0777 | IPC_CREAT | IPC_EXCL
+                                   | SHM_HUGETLB | SHM_NORESERVE),
               bogus_flags & 0777, sprintrc_grep(rc));
 
        id = shmget(private_key, 1, 0600);
index 23cc7ccf4900bf4f680a6c277c90a7e0bdcede06..64312d43ba5df52626e4ce892bf208b3a42c62e5 100644 (file)
@@ -34,8 +34,8 @@ main(void)
        atexit(cleanup);
 
        rc = (long) shmat(bogus_shmid, bogus_shmaddr, bogus_shmflg);
-       printf("%s(%d, %p, SHM_REMAP|SHM_RDONLY|SHM_RND|%#x) = %s\n",
-              SHMAT, bogus_shmid, bogus_shmaddr, bogus_shmflg & ~0x7000,
+       printf("%s(%d, %p, SHM_RDONLY|SHM_RND|SHM_REMAP|SHM_EXEC|%#x) = %s\n",
+              SHMAT, bogus_shmid, bogus_shmaddr, bogus_shmflg & ~0xf000,
               sprintrc(rc));
 
        shmat(id, NULL, SHM_REMAP);
@@ -50,18 +50,31 @@ main(void)
        rc = shmdt(NULL);
        printf("shmdt(NULL) = %s\n", sprintrc(rc));
 
-       if (shmdt(shmaddr))
-               perror_msg_and_skip("shmdt");
-       printf("shmdt(%p) = 0\n", shmaddr);
+       rc = shmdt(shmaddr);
+       printf("shmdt(%p) = %s\n", shmaddr, sprintrc(rc));
 
        ++shmaddr;
        void *shmaddr2 = shmat(id, shmaddr, SHM_RND);
        if (shmaddr2 == (void *)(-1))
                printf("%s(%d, %p, SHM_RND) = -1 %s (%m)\n",
                       SHMAT, id, shmaddr, errno2name());
-       else
+       else {
                printf("%s(%d, %p, SHM_RND) = %p\n",
                       SHMAT, id, shmaddr, shmaddr2);
+               rc = shmdt(shmaddr2);
+               printf("shmdt(%p) = %s\n", shmaddr2, sprintrc(rc));
+       }
+
+       shmaddr = shmat(id, NULL, SHM_RDONLY|SHM_EXEC);
+       if (shmaddr == (void *)(-1))
+               printf("%s(%d, NULL, SHM_RDONLY|SHM_EXEC) = %s\n",
+                      SHMAT, id, sprintrc(-1));
+       else {
+               printf("%s(%d, NULL, SHM_RDONLY|SHM_EXEC) = %p\n",
+                      SHMAT, id, shmaddr);
+               rc = shmdt(shmaddr);
+               printf("shmdt(%p) = %s\n", shmaddr, sprintrc(rc));
+       }
 
        puts("+++ exited with 0 +++");
        return 0;
index a6206347aefa875bfaaed783575cebbab52cc97e..4432e71951556c4e3f61ecb0935d012bd2de4254 100644 (file)
@@ -1,3 +1,4 @@
-SHM_REMAP
 SHM_RDONLY
 SHM_RND
+SHM_REMAP
+SHM_EXEC
index f3fc0dc45a402a35022bbef9a103a804af8e67ae..1b07687e79f9d4433bde4ce75c8ea4d084ee36cb 100644 (file)
@@ -1,3 +1,4 @@
 IPC_CREAT
 IPC_EXCL
 SHM_HUGETLB
+SHM_NORESERVE