2 /* $NetBSD: sem.h,v 1.5 1994/06/29 06:45:15 cgd Exp $ */
5 * SVID compatible sem.h file
7 * Author: Daniel Boulet
18 struct ipc_perm sem_perm; /* operation permission struct */
19 struct sem *sem_base; /* pointer to first semaphore in set */
20 unsigned short sem_nsems; /* number of sems in set */
21 time_t sem_otime; /* last operation time */
22 long sem_pad1; /* SVABI/386 says I need this here */
23 time_t sem_ctime; /* last change time */
24 /* Times measured in secs since */
25 /* 00:00:00 GMT, Jan. 1, 1970 */
26 long sem_pad2; /* SVABI/386 says I need this here */
27 long sem_pad3[4]; /* SVABI/386 says I need this here */
31 * semop's sops parameter structure
34 unsigned short sem_num; /* semaphore # */
35 short sem_op; /* semaphore operation */
36 short sem_flg; /* operation flags */
38 #define SEM_UNDO 010000
41 * semctl's arg parameter structure
44 int val; /* value for SETVAL */
45 struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
46 unsigned short *array; /* array for GETALL & SETALL */
52 #define GETNCNT 3 /* Return the value of semncnt {READ} */
53 #define GETPID 4 /* Return the value of sempid {READ} */
54 #define GETVAL 5 /* Return the value of semval {READ} */
55 #define GETALL 6 /* Return semvals into arg.array {READ} */
56 #define GETZCNT 7 /* Return the value of semzcnt {READ} */
57 #define SETVAL 8 /* Set the value of semval to arg.val {ALTER} */
58 #define SETALL 9 /* Set semvals from arg.array {ALTER} */
59 #define SEM_STAT 10 /* Like IPC_STAT but treats semid as sema-index */
60 #define SEM_INFO 11 /* Like IPC_INFO but treats semid as sema-index */
65 #define SEM_A IPC_W /* alter permission */
66 #define SEM_R IPC_R /* read permission */
71 * semaphore info struct
74 int semmap, /* # of entries in semaphore map */
75 semmni, /* # of semaphore identifiers */
76 semmns, /* # of semaphores in system */
77 semmnu, /* # of undo structures in system */
78 semmsl, /* max # of semaphores per id */
79 semopm, /* max # of operations per semop call */
80 semume, /* max # of undo entries per process */
81 semusz, /* size in bytes of undo structure */
82 semvmx, /* semaphore maximum value */
83 semaem; /* adjust on exit max value */
85 extern struct seminfo seminfo;
87 /* internal "mode" bits */
88 #define SEM_ALLOC 01000 /* semaphore is allocated */
89 #define SEM_DEST 02000 /* semaphore will be destroyed on last detach */
92 * Process sem_undo vectors at proc exit.
94 void semexit(struct proc *p);
98 #include <sys/cdefs.h>
99 #include <sys/_types.h>
101 #ifndef _SIZE_T_DECLARED
102 typedef __size_t size_t;
103 #define _SIZE_T_DECLARED
106 #ifndef _PID_T_DECLARED
107 typedef __pid_t pid_t;
108 #define _PID_T_DECLARED
112 int semsys(int, ...);
113 int semctl(int, int, int, ...);
114 int semget(key_t, int, int);
115 int semop(int, struct sembuf *, size_t);
117 #endif /* !_KERNEL */
119 #endif /* !_SYS_SEM_H_ */