1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
$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" );
}
|