diff options
author | Matt Kraai <mkraai@beckman.com> | 2009-09-16 14:23:16 -0700 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-09-13 12:55:26 +0200 |
commit | f6a29f7dd368acf3f053fc4e1330c7314fc3e41f (patch) | |
tree | 1e5b0d6a7af0baf7692a6cfd597f403d72f6f5cf | |
parent | 5f58119fe5b313fe7b0cb9426ea82ea400e09482 (diff) | |
download | samba-f6a29f7dd368acf3f053fc4e1330c7314fc3e41f.tar.gz samba-f6a29f7dd368acf3f053fc4e1330c7314fc3e41f.tar.bz2 samba-f6a29f7dd368acf3f053fc4e1330c7314fc3e41f.zip |
Port the Samba 3 shm_setup to QNX.
-rw-r--r-- | source3/torture/torture.c | 18 |
1 files changed, 18 insertions, 0 deletions
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; } |