xref: /illumos-gate/usr/src/cmd/sendmail/include/sm/sem.h (revision 8b80e8cb6855118d46f605e91b5ed4ce83417395)
1 /*
2  * Copyright (c) 2000-2001, 2005 Sendmail, Inc. and its suppliers.
3  *      All rights reserved.
4  *
5  * By using this file, you agree to the terms and conditions set
6  * forth in the LICENSE file which can be found at the top level of
7  * the sendmail distribution.
8  *
9  *	$Id: sem.h,v 1.9 2005/02/17 22:08:58 ca Exp $
10  */
11 
12 #pragma ident	"%Z%%M%	%I%	%E% SMI"
13 
14 #ifndef SM_SEM_H
15 # define SM_SEM_H 1
16 
17 #include <sm/gen.h>
18 
19 /* key for semaphores */
20 # define SM_SEM_KEY	(41L)
21 # define SM_SEM_NO_ID	(-1)
22 # define SM_NO_SEM(id)	((id) < 0)
23 
24 # if SM_CONF_SEM > 0
25 #  include <sys/types.h>
26 #  include <sys/ipc.h>
27 #  include <sys/sem.h>
28 
29 # if SM_CONF_SEM == 2
30 union semun
31 {
32 	int		val;
33 	struct semid_ds	*buf;
34 	ushort		*array;
35 };
36 # endif /* SM_CONF_SEM == 2 */
37 
38 # ifndef SEM_A
39 #  define SEM_A	0200
40 # endif /* SEM_A */
41 # ifndef SEM_R
42 #  define SEM_R	0400
43 # endif /* SEM_R */
44 
45 # define SM_NSEM	1
46 
47 extern int sm_sem_start __P((key_t, int, int, bool));
48 extern int sm_sem_stop __P((int));
49 extern int sm_sem_acq __P((int, int, int));
50 extern int sm_sem_rel __P((int, int, int));
51 extern int sm_sem_get __P((int, int));
52 
53 # else /* SM_CONF_SEM > 0 */
54 #  define sm_sem_start(key, nsem, semflg, owner) 0
55 #  define sm_sem_stop(semid)	0
56 #  define sm_sem_acq(semid, semnum, timeout)	0
57 #  define sm_sem_rel(semid, semnum, timeout)	0
58 #  define sm_sem_get(semid, semnum)	0
59 # endif /* SM_CONF_SEM > 0 */
60 
61 #endif /* ! SM_SEM_H */
62