diff options
Diffstat (limited to 'tests/integration/project/files/test_shm.c')
-rw-r--r-- | tests/integration/project/files/test_shm.c | 28 |
1 files changed, 28 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..9d9dcea84 --- /dev/null +++ b/tests/integration/project/files/test_shm.c @@ -0,0 +1,28 @@ +#include <errno.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <fnctl.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; +} |