summaryrefslogtreecommitdiff
path: root/tests/integration/project/files/test_shm.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/project/files/test_shm.c')
-rw-r--r--tests/integration/project/files/test_shm.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/integration/project/files/test_shm.c b/tests/integration/project/files/test_shm.c
new file mode 100644
index 000000000..4ee71cb2b
--- /dev/null
+++ b/tests/integration/project/files/test_shm.c
@@ -0,0 +1,29 @@
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+int main ()
+{
+ int fd = shm_open ("/foo", O_RDONLY | O_CREAT, S_IRWXU);
+ if (fd < 0)
+ {
+ fprintf (stderr, "Failed to open shm: %s\n", strerror (errno));
+ exit(1);
+ }
+
+ int success = shm_unlink ("/foo");
+ if (success < 0)
+ {
+ fprintf (stderr, "Failed to close shm: %s\n", strerror (errno));
+ exit(2);
+ }
+
+ close (fd);
+
+ return 0;
+}