summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <mkraai@beckman.com>2009-09-16 16:04:02 -0700
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-09-13 10:49:28 +0200
commitcce3e66665b30b3d0bf44e892aa88dfb73e6c167 (patch)
tree7705d4a3b09eaad9fcf506e82b6019153aca5cdf
parentaa7aa664dcf8753c7d17b39094f6eb981a154756 (diff)
downloadsamba-cce3e66665b30b3d0bf44e892aa88dfb73e6c167.tar.gz
samba-cce3e66665b30b3d0bf44e892aa88dfb73e6c167.tar.bz2
samba-cce3e66665b30b3d0bf44e892aa88dfb73e6c167.zip
Port the Samba 4 shm_setup to QNX.
-rwxr-xr-x[-rw-r--r--]source4/torture/util_smb.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c
index 1c50694279..99b00d2329 100644..100755
--- a/source4/torture/util_smb.c
+++ b/source4/torture/util_smb.c
@@ -257,6 +257,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, SHM_R | SHM_W);
if (shmid == -1) {
printf("can't get shared memory\n");
@@ -275,6 +292,7 @@ void *shm_setup(int size)
See Stevens "advanced programming in unix env" for details
*/
shmctl(shmid, IPC_RMID, 0);
+#endif
return ret;
}