1 /* this tests whether we can use a sysv shared memory segment
2 as needed for the sysv varient of FAST_SHARE_MODES */
4 #if defined(HAVE_UNISTD_H)
14 #define SEMKEY 0x963797
15 #define SIZE (32*1024)
17 #ifndef HAVE_UNION_SEMUN
21 unsigned short *array;
34 if (sizeof(struct shmid_ds) == 52) {
35 printf("WARNING: You probably have a broken set of glibc2 include files - disabling sysv shared memory\n");
41 sem_id = semget(SEMKEY, 1, IPC_CREAT|IPC_EXCL|0600);
43 if (sem_id == -1) exit(1);
46 semctl(sem_id, 0, IPC_RMID, su);
48 id = shmget(KEY, 0, 0);
50 if (shmctl(id, IPC_RMID, 0) != 0) exit(1);
54 /* uggh - need locking */
57 /* get an existing area */
58 id = shmget(KEY, 0, 0);
59 if (id == -1) exit(1);
61 buf = (int *)shmat(id, 0, 0);
62 if (buf == (int *)-1) exit(1);
65 while (count-- && buf[6124] != 55732) sleep(1);
67 if (count <= 0) exit(1);
73 id = shmget(KEY, SIZE, IPC_CREAT | IPC_EXCL | 0600);
74 if (id == -1) exit(1);
76 buf = (int *)shmat(id, 0, 0);
78 if (buf == (int *)-1) exit(1);
82 while (count-- && buf[1763] != 7268) sleep(1);
84 shmctl(id, IPC_RMID, 0);
86 if (count <= 0) exit(1);