6
6
*
7
7
* Copyright (c) 1994, Regents of the University of California
8
8
*
9
- * $Id: ipc.h,v 1.2 1996/07/20 08:35:24 scrappy Exp $
9
+ * $Id: ipc.h,v 1.3 1996/07/22 22:59:43 scrappy Exp $
10
10
*
11
11
* NOTES
12
12
* This file is very architecture-specific. This stuff should actually
30
30
* atomic test-and-set instruction). However, we have only written
31
31
* spinlock code for the architectures listed.
32
32
*/
33
- #if ( defined(PORTNAME_aix ) || \
33
+ #if defined(PORTNAME_aix ) || \
34
34
defined(PORTNAME_alpha ) || \
35
+ defined(PORTNAME_BSD44_derived ) || \
36
+ defined(PORTNAME_bsdi ) || \
35
37
defined(PORTNAME_hpux ) || \
38
+ defined(PORTNAME_i386_solaris ) || \
36
39
defined(PORTNAME_irix5 ) || \
40
+ defined(PORTNAME_linux ) || \
37
41
defined(PORTNAME_next ) || \
38
42
defined(PORTNAME_sparc ) || \
39
- defined(PORTNAME_sparc_solaris ) || \
40
- (defined(__i386__ ) && defined(__GNUC__ ))) && \
41
- !defined(PORTNAME_i386_solaris )
43
+ defined(PORTNAME_sparc_solaris )
42
44
#define HAS_TEST_AND_SET
43
45
#endif
44
46
45
47
#if defined(HAS_TEST_AND_SET )
46
48
47
- #if defined(PORTNAME_next )
48
- /*
49
- * Use Mach mutex routines since these are, in effect, test-and-set
50
- * spinlocks.
51
- */
52
- #undef NEVER /* definition in cthreads.h conflicts with parse.h */
53
- #include <mach/cthreads.h>
54
-
55
- typedef struct mutex slock_t ;
56
- #else /* next */
57
49
#if defined(PORTNAME_aix )
58
50
/*
59
51
* The AIX C library has the cs(3) builtin for compare-and-set that
60
52
* operates on ints.
61
53
*/
62
54
typedef unsigned int slock_t ;
63
55
#else /* aix */
56
+
64
57
#if defined(PORTNAME_alpha )
65
58
#include <sys/mman.h>
66
59
typedef msemaphore slock_t ;
67
60
#else /* alpha */
61
+
68
62
#if defined(PORTNAME_hpux )
69
63
/*
70
64
* The PA-RISC "semaphore" for the LDWCX instruction is 4 bytes aligned
71
65
* to a 16-byte boundary.
72
66
*/
73
67
typedef struct { int sem [4 ]; } slock_t ;
74
68
#else /* hpux */
69
+
75
70
#if defined(PORTNAME_irix5 )
76
71
#include <abi_mutex.h>
77
72
typedef abilock_t slock_t ;
78
73
#else /* irix5 */
74
+
75
+ #if defined(PORTNAME_next )
76
+ /*
77
+ * Use Mach mutex routines since these are, in effect, test-and-set
78
+ * spinlocks.
79
+ */
80
+ #undef NEVER /* definition in cthreads.h conflicts with parse.h */
81
+ #include <mach/cthreads.h>
82
+ typedef struct mutex slock_t ;
83
+ #else /* next */
84
+
79
85
/*
80
86
* On all other architectures spinlocks are a single byte.
81
87
*/
82
88
typedef unsigned char slock_t ;
89
+
90
+ #endif /* next */
83
91
#endif /* irix5 */
84
92
#endif /* hpux */
85
93
#endif /* alpha */
86
94
#endif /* aix */
87
- #endif /* next */
88
95
89
96
extern void S_LOCK (slock_t * lock );
90
97
extern void S_UNLOCK (slock_t * lock );
91
98
extern void S_INIT_LOCK (slock_t * lock );
92
99
93
- #if defined(PORTNAME_hpux ) || defined(PORTNAME_alpha ) || defined(PORTNAME_irix5 ) || defined(PORTNAME_next )
100
+ #if defined(PORTNAME_alpha ) || \
101
+ defined(PORTNAME_hpux ) || \
102
+ defined(PORTNAME_irix5 ) || \
103
+ defined(PORTNAME_next )
94
104
extern int S_LOCK_FREE (slock_t * lock );
95
- #else /* PORTNAME_hpux */
105
+ #else
96
106
#define S_LOCK_FREE (lock ) ((*lock) == 0)
97
- #endif /* PORTNAME_hpux */
107
+ #endif
98
108
99
109
#endif /* HAS_TEST_AND_SET */
100
110
@@ -108,9 +118,10 @@ extern int S_LOCK_FREE(slock_t *lock);
108
118
defined(PORTNAME_aix ) || \
109
119
defined(PORTNAME_alpha ) || \
110
120
defined(PORTNAME_hpux ) || \
121
+ defined(PORTNAME_i386_solaris ) || \
111
122
defined(PORTNAME_sparc_solaris ) || \
112
- defined(WIN32 ) || \
113
- defined(PORTNAME_ultrix4 )
123
+ defined(PORTNAME_ultrix4 ) || \
124
+ defined(WIN32 )
114
125
union semun {
115
126
int val ;
116
127
struct semid_ds * buf ;
0 commit comments