aboutsummaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Linux/shmctl.cc
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-01-07 19:55:37 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-01-07 19:55:37 +0000
commitca9211ecdede9bdedb812b2243a4abdb8dacd1b9 (patch)
tree9b19e801150082c33e9152275829a6ce90614b55 /test/asan/TestCases/Linux/shmctl.cc
parent8ef50bf3d1c287b5013c3168de77a462dfce3495 (diff)
Notes
Diffstat (limited to 'test/asan/TestCases/Linux/shmctl.cc')
-rw-r--r--test/asan/TestCases/Linux/shmctl.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/asan/TestCases/Linux/shmctl.cc b/test/asan/TestCases/Linux/shmctl.cc
new file mode 100644
index 000000000000..e1752bc894c0
--- /dev/null
+++ b/test/asan/TestCases/Linux/shmctl.cc
@@ -0,0 +1,27 @@
+// FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316
+// XFAIL: android
+//
+// RUN: %clangxx_asan -O1 %s -o %t && %run %t 2>&1
+// Regression test for
+// https://code.google.com/p/address-sanitizer/issues/detail?id=250
+#include <stdio.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <assert.h>
+
+int main() {
+ int id = shmget(IPC_PRIVATE, 4096, 0644 | IPC_CREAT);
+ assert(id > -1);
+ struct shmid_ds ds;
+ int res = shmctl(id, IPC_STAT, &ds);
+ assert(res > -1);
+ printf("shm_segsz: %zd\n", ds.shm_segsz);
+ assert(ds.shm_segsz == 4096);
+ assert(-1 != shmctl(id, IPC_RMID, 0));
+
+ struct shm_info shmInfo;
+ res = shmctl(0, SHM_INFO, (struct shmid_ds *)&shmInfo);
+ assert(res > -1);
+
+ return 0;
+}