summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1998-05-24 19:13:21 +0300
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1998-05-28 17:42:21 +0000
commitf0784f6a4c3e45e13aac90c9b07dd4163084f9a4 (patch)
treef87fde59f27c8e84fce94e8b177fa8875818155d /doio.c
parentdd64f1c34f78dffc99057d229091d8331d2ddf2d (diff)
downloadperl-f0784f6a4c3e45e13aac90c9b07dd4163084f9a4.tar.gz
This change really is:
Subject: [PATCH] 5.004_65: the infamous semctl() Date: Sun, 24 May 1998 16:13:21 +0300 (EET DST) Change 1041 claimed to be this patch but was really: Subject: [PATCH] 5.004_65: t/op/ipc*.t Date: Sat, 16 May 1998 00:52:39 +0300 (EET DST) From: Jarkko Hietaniemi <jhi@iki.fi> p4raw-id: //depot/perl@1043
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c57
1 files changed, 8 insertions, 49 deletions
diff --git a/doio.c b/doio.c
index bbf3837e1b..37d6167451 100644
--- a/doio.c
+++ b/doio.c
@@ -1389,21 +1389,6 @@ do_ipcget(I32 optype, SV **mark, SV **sp)
return -1; /* should never happen */
}
-#if defined(__sun) && defined(__svr4__) /* XXX Need metaconfig test */
-/* Solaris manpage says that it uses (like linux)
- int semctl (int semid, int semnum, int cmd, union semun arg)
- but the system include files do not define union semun !!!!
- Note: Linux/glibc *does* declare union semun in <sys/sem_buf.h>
- but, unlike the older Linux libc and Solaris, it has an extra
- struct seminfo * on the end.
-*/
-union semun {
- int val;
- struct semid_ds *buf;
- ushort *array;
-};
-#endif
-
I32
do_ipcctl(I32 optype, SV **mark, SV **sp)
{
@@ -1412,26 +1397,6 @@ do_ipcctl(I32 optype, SV **mark, SV **sp)
char *a;
I32 id, n, cmd, infosize, getinfo;
I32 ret = -1;
-/* XXX REALLY need metaconfig test */
-/* linux and Solaris2 use:
- int semctl (int semid, int semnum, int cmd, union semun arg)
- instead of:
- int semctl (int semid, int semnum, int cmd, struct semid_ds *arg);
- Solaris and Linux (pre-glibc) use
- union semun {
- int val;
- struct semid_ds *buf;
- ushort *array;
- };
- but Solaris doesn't declare it in a header file (we declared it
- explicitly earlier). Linux/glibc declares a *different* union semun
- so we just refer to "union semun" here.
-
-*/
-#if defined(__linux__) || (defined(__sun__) && defined(__svr4__))
-# define SEMCTL_SEMUN
- union semun unsemds, semun;
-#endif
id = SvIVx(*++mark);
n = (optype == OP_SEMCTL) ? SvIVx(*++mark) : 0;
@@ -1461,13 +1426,9 @@ do_ipcctl(I32 optype, SV **mark, SV **sp)
else if (cmd == GETALL || cmd == SETALL)
{
struct semid_ds semds;
-#ifdef SEMCTL_SEMUN
+ union semun semun;
+
semun.buf = &semds;
- if (semctl(id, 0, IPC_STAT, semun) == -1)
-#else
- if (semctl(id, 0, IPC_STAT, &semds) == -1)
-#endif
- return -1;
getinfo = (cmd == GETALL);
infosize = semds.sem_nsems * sizeof(short);
/* "short" is technically wrong but much more portable
@@ -1511,14 +1472,12 @@ do_ipcctl(I32 optype, SV **mark, SV **sp)
break;
#endif
#ifdef HAS_SEM
- case OP_SEMCTL:
-#ifdef SEMCTL_SEMUN
- /* XXX Need metaconfig test */
- unsemds.buf = (struct semid_ds *)a;
- ret = semctl(id, n, cmd, unsemds);
-#else
- ret = semctl(id, n, cmd, (struct semid_ds *)a);
-#endif
+ case OP_SEMCTL: {
+ union semun unsemds;
+
+ unsemds.buf = (struct semid_ds *)a;
+ ret = Semctl(id, n, cmd, unsemds);
+ }
break;
#endif
#ifdef HAS_SHM