1147078Sgshapiro/* 2261363Sgshapiro * Copyright (c) 2000-2001, 2005, 2008 Proofpoint, Inc. and its suppliers. 3147078Sgshapiro * All rights reserved. 4147078Sgshapiro * 5147078Sgshapiro * By using this file, you agree to the terms and conditions set 6147078Sgshapiro * forth in the LICENSE file which can be found at the top level of 7147078Sgshapiro * the sendmail distribution. 8147078Sgshapiro * 9266692Sgshapiro * $Id: sem.h,v 1.11 2013-11-22 20:51:31 ca Exp $ 10147078Sgshapiro */ 11147078Sgshapiro 12147078Sgshapiro#ifndef SM_SEM_H 13147078Sgshapiro# define SM_SEM_H 1 14147078Sgshapiro 15147078Sgshapiro#include <sm/gen.h> 16147078Sgshapiro 17147078Sgshapiro/* key for semaphores */ 18147078Sgshapiro# define SM_SEM_KEY (41L) 19147078Sgshapiro# define SM_SEM_NO_ID (-1) 20147078Sgshapiro# define SM_NO_SEM(id) ((id) < 0) 21147078Sgshapiro 22147078Sgshapiro# if SM_CONF_SEM > 0 23147078Sgshapiro# include <sys/types.h> 24147078Sgshapiro# include <sys/ipc.h> 25147078Sgshapiro# include <sys/sem.h> 26147078Sgshapiro 27147078Sgshapiro# if SM_CONF_SEM == 2 28147078Sgshapirounion semun 29147078Sgshapiro{ 30147078Sgshapiro int val; 31147078Sgshapiro struct semid_ds *buf; 32147078Sgshapiro ushort *array; 33147078Sgshapiro}; 34147078Sgshapiro# endif /* SM_CONF_SEM == 2 */ 35147078Sgshapiro 36147078Sgshapiro# ifndef SEM_A 37147078Sgshapiro# define SEM_A 0200 38147078Sgshapiro# endif /* SEM_A */ 39147078Sgshapiro# ifndef SEM_R 40147078Sgshapiro# define SEM_R 0400 41147078Sgshapiro# endif /* SEM_R */ 42147078Sgshapiro 43147078Sgshapiro# define SM_NSEM 1 44147078Sgshapiro 45147078Sgshapiroextern int sm_sem_start __P((key_t, int, int, bool)); 46147078Sgshapiroextern int sm_sem_stop __P((int)); 47147078Sgshapiroextern int sm_sem_acq __P((int, int, int)); 48147078Sgshapiroextern int sm_sem_rel __P((int, int, int)); 49147078Sgshapiroextern int sm_sem_get __P((int, int)); 50203004Sgshapiroextern int sm_semsetowner __P((int, uid_t, gid_t, mode_t)); 51147078Sgshapiro 52147078Sgshapiro# else /* SM_CONF_SEM > 0 */ 53147078Sgshapiro# define sm_sem_start(key, nsem, semflg, owner) 0 54147078Sgshapiro# define sm_sem_stop(semid) 0 55147078Sgshapiro# define sm_sem_acq(semid, semnum, timeout) 0 56147078Sgshapiro# define sm_sem_rel(semid, semnum, timeout) 0 57147078Sgshapiro# define sm_sem_get(semid, semnum) 0 58147078Sgshapiro# endif /* SM_CONF_SEM > 0 */ 59147078Sgshapiro 60147078Sgshapiro#endif /* ! SM_SEM_H */ 61