From f6a29f7dd368acf3f053fc4e1330c7314fc3e41f Mon Sep 17 00:00:00 2001 From: Matt Kraai Date: Wed, 16 Sep 2009 14:23:16 -0700 Subject: Port the Samba 3 shm_setup to QNX. --- source3/torture/torture.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source3/torture/torture.c b/source3/torture/torture.c index ed592f169b..98694ed3d0 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -76,6 +76,23 @@ void *shm_setup(int size) int shmid; void *ret; +#ifdef __QNXNTO__ + shmid = shm_open("private", O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); + if (shmid == -1) { + printf("can't get shared memory\n"); + exit(1); + } + shm_unlink("private"); + if (ftruncate(shmid, size) == -1) { + printf("can't set shared memory size\n"); + exit(1); + } + ret = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, shmid, 0); + if (ret == MAP_FAILED) { + printf("can't map shared memory\n"); + exit(1); + } +#else shmid = shmget(IPC_PRIVATE, size, S_IRUSR | S_IWUSR); if (shmid == -1) { printf("can't get shared memory\n"); @@ -94,6 +111,7 @@ void *shm_setup(int size) See Stevens "advanced programming in unix env" for details */ shmctl(shmid, IPC_RMID, 0); +#endif return ret; } -- cgit