58 lines
1.2 KiB
Text
58 lines
1.2 KiB
Text
$NetBSD: patch-ab,v 1.4 2012/10/20 22:14:05 joerg Exp $
|
|
|
|
--- sem.c.orig 1994-10-04 16:44:53.000000000 +0000
|
|
+++ sem.c
|
|
@@ -27,13 +27,16 @@
|
|
* semaphores */
|
|
|
|
#include <stdio.h>
|
|
+#include <unistd.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/ipc.h>
|
|
#include <sys/sem.h>
|
|
#include <errno.h>
|
|
+#include <sys/param.h>
|
|
|
|
-#if defined(SYS5) || defined(ultrix) || defined(_AIX)
|
|
+#if defined(SYS5) || defined(ultrix) || defined(_AIX) \
|
|
+ || (defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 104110000))
|
|
union semun {
|
|
int val;
|
|
struct semid_ds *buf;
|
|
@@ -60,7 +63,6 @@ sem_set( sem_id, semn, val )
|
|
int val;
|
|
{
|
|
union semun arg;
|
|
- extern int errno;
|
|
|
|
arg.val = val;
|
|
|
|
@@ -94,7 +96,7 @@ new_sems( nsems )
|
|
return sem;
|
|
}
|
|
|
|
-static
|
|
+static void
|
|
do_sem( sem_id, pbuf, err )
|
|
int sem_id;
|
|
struct sembuf *pbuf;
|
|
@@ -148,10 +150,17 @@ void
|
|
remove_sems( sem_id )
|
|
int sem_id;
|
|
{
|
|
+#if defined(__NetBSD__) && defined(__NetBSD_Version__) \
|
|
+ && (__NetBSD_Version__ < 104110000)
|
|
+ union semun dummy;
|
|
+#else
|
|
+#define dummy NULL
|
|
+#endif
|
|
+
|
|
if( sem_id == -1 )
|
|
return;
|
|
|
|
- if( semctl( sem_id, 0, IPC_RMID, NULL ) == -1 ){
|
|
+ if( semctl( sem_id, 0, IPC_RMID, dummy ) == -1 ){
|
|
report_proc();
|
|
perror( "internal error, failed to remove semaphore" );
|
|
}
|