1/* Verify that the workarounds in config/mips/irix6-libc-compat.c are still 2 needed. */ 3 4/* IRIX 6, unlike other Unix systems, defines union semun in <sys/sem.h>. 5 Inhibit this definition to be able to run this test on other platforms. */ 6#define _XOPEN_SOURCE 7 8#include <sys/types.h> 9#include <netinet/in.h> 10#include <arpa/inet.h> 11#include <sys/ipc.h> 12#include <sys/sem.h> 13 14union semun { 15 int val; 16 struct semid_ds *buf; 17 ushort_t *array; 18}; 19 20int 21main (void) 22{ 23 struct in_addr ia; 24 int semid; 25 union semun su; 26 27 ia.s_addr = INADDR_BROADCAST; 28 29 if (strcmp (inet_ntoa (ia), "255.255.255.255") != 0) 30 abort (); 31 32 ia.s_addr = INADDR_LOOPBACK; 33 34 if (inet_lnaof (ia) != 1) 35 abort (); 36 37 if (inet_netof (ia) != IN_LOOPBACKNET) 38 abort (); 39 40 ia = inet_makeaddr (IN_LOOPBACKNET, 1); 41 if (ia.s_addr != INADDR_LOOPBACK) 42 abort (); 43 44 if ((semid = semget (IPC_PRIVATE, 1, IPC_CREAT | IPC_EXCL | SEM_R | SEM_A)) < 0) 45 abort (); 46 47 su.val = 10; 48 49 if (semctl (semid, 0, SETVAL, su) != 0) 50 abort (); 51 52 if (semctl (semid, 0, GETVAL) != 10) 53 abort (); 54 55 if (semctl (semid, 0, IPC_RMID) != 0) 56 abort (); 57 58 return 0; 59} 60