summaryrefslogtreecommitdiff
path: root/tests/integration/project/files/test_shm.c
blob: 9d9dcea847cc0562b48a8eae1c7cd7adb8849929 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
}