Update SHM_* constants

* 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.
This commit is contained in:
Дмитрий Левин 2017-11-17 00:24:41 +00:00
parent df819c7249
commit bdc500a563
5 changed files with 27 additions and 10 deletions

2
NEWS
View File

@ -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)
===============================================

View 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);

View 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;

View File

@ -1,3 +1,4 @@
SHM_REMAP
SHM_RDONLY
SHM_RND
SHM_REMAP
SHM_EXEC

View File

@ -1,3 +1,4 @@
IPC_CREAT
IPC_EXCL
SHM_HUGETLB
SHM_NORESERVE