summaryrefslogtreecommitdiff
path: root/source3/tests
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-09-05 13:35:54 +0000
committerAndrew Tridgell <tridge@samba.org>1998-09-05 13:35:54 +0000
commitf5e6f03389e53c6575c68f7bde5f9fa7dc496240 (patch)
treedd0b8285ab7c56d9e32ab83d93d042fe2da68dad /source3/tests
parentf6044c87c021342d68d614d59bc8dacd32d223b9 (diff)
downloadsamba-f5e6f03389e53c6575c68f7bde5f9fa7dc496240.tar.gz
samba-f5e6f03389e53c6575c68f7bde5f9fa7dc496240.tar.bz2
samba-f5e6f03389e53c6575c68f7bde5f9fa7dc496240.zip
expand the sysv shmem test to look for semaphores as well as shared
memory. Some FreeBSD systems have sysv shared memory but no semaphores! (This used to be commit 3f4959a065ed987a8254903a5aaf6234bb88ad5c)
Diffstat (limited to 'source3/tests')
-rw-r--r--source3/tests/sysv_ipc.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/source3/tests/sysv_ipc.c b/source3/tests/sysv_ipc.c
index 2374174e8f..13956ec6f0 100644
--- a/source3/tests/sysv_ipc.c
+++ b/source3/tests/sysv_ipc.c
@@ -6,15 +6,27 @@
#include <sys/stat.h>
#include <sys/ipc.h>
#include <sys/shm.h>
+#include <sys/sem.h>
#define KEY 0x963796
+#define SEMKEY 0x963797
#define SIZE (32*1024)
+#ifndef HAVE_UNION_SEMUN
+union semun {
+ int val;
+ struct semid_ds *buf;
+ unsigned short *array;
+};
+#endif
+
+
main()
{
- int id;
+ int id, sem_id;
int *buf;
int count=7;
+ union semun su;
#ifdef LINUX
if (sizeof(struct shmid_ds) == 52) {
@@ -23,6 +35,14 @@ main()
}
#endif
+
+ sem_id = semget(SEMKEY, 1, IPC_CREAT|IPC_EXCL|0600);
+
+ if (sem_id == -1) exit(1);
+
+ su.val = 1;
+ semctl(sem_id, 0, IPC_RMID, su);
+
id = shmget(KEY, 0, 0);
if (id != -1) {
if (shmctl(id, IPC_RMID, 0) != 0) exit(1);