summaryrefslogtreecommitdiff
path: root/source3/tests
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-02-07 14:27:04 +0000
committerJeremy Allison <jra@samba.org>2000-02-07 14:27:04 +0000
commit868c81eefa72b31023eeac32788eaa439013c0f8 (patch)
treebf6d5a4ddfc72d27fa47dd7e4c60d14d1e9e129a /source3/tests
parent427a3baa9ccb942b82832f255e09acc87afca166 (diff)
downloadsamba-868c81eefa72b31023eeac32788eaa439013c0f8.tar.gz
samba-868c81eefa72b31023eeac32788eaa439013c0f8.tar.bz2
samba-868c81eefa72b31023eeac32788eaa439013c0f8.zip
Added check for SGI IRIX brokenness with semaphores when using gcc.
Code from Don Badrak <dbadrak@census.gov> Jeremy. (This used to be commit 773d6e504b1ac97f0d8136002ace2c0c0771a163)
Diffstat (limited to 'source3/tests')
-rw-r--r--source3/tests/sgi_sysv_hack.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/source3/tests/sgi_sysv_hack.c b/source3/tests/sgi_sysv_hack.c
new file mode 100644
index 0000000000..0fb16f11f8
--- /dev/null
+++ b/source3/tests/sgi_sysv_hack.c
@@ -0,0 +1,46 @@
+/* this tests if we need to define SGI_SEMUN_HACK
+ if we're using gcc on IRIX 6.5.x. */
+
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/sem.h>
+
+#ifndef HAVE_UNION_SEMUN
+union semun {
+ int val;
+ struct semid_ds *buf;
+ unsigned short *array;
+};
+#endif
+
+union semun_hack {
+ int val;
+ struct semid_ds *buf;
+ unsigned short *array;
+ char __dummy[5];
+};
+
+main() {
+ struct semid_ds sem_ds;
+ union semun_hack suh;
+ union semun su;
+ int sem_id, ret;
+
+ ret = 1;
+ sem_id = semget(0xdead6666,1,IPC_CREAT|IPC_EXCL|0777);
+ su.buf = &sem_ds;
+ suh.buf = &sem_ds;
+ if (sem_id != -1) {
+ if ((semctl(sem_id, 0, IPC_STAT, su) == -1) &&
+ (semctl(sem_id, 0, IPC_STAT, suh) != -1)) {
+ ret = 0;
+ }
+ }
+ semctl(sem_id, 0, IPC_RMID, 0);
+ return ret;
+}