sem.h revision e9af4bc0b1cc30cea75d6ad4aa2fde97d985e9be
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/*
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Copyright (c) 2000-2001, 2005, 2008 Sendmail, Inc. and its suppliers.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * All rights reserved.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * By using this file, you agree to the terms and conditions set
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * forth in the LICENSE file which can be found at the top level of
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * the sendmail distribution.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * $Id: sem.h,v 1.10 2008/05/30 16:26:39 ca Exp $
9512fe850e98fdd448c638ca63fdd92a8a510255ahl */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#ifndef SM_SEM_H
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# define SM_SEM_H 1
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#include <sm/gen.h>
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/* key for semaphores */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# define SM_SEM_KEY (41L)
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# define SM_SEM_NO_ID (-1)
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# define SM_NO_SEM(id) ((id) < 0)
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# if SM_CONF_SEM > 0
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# include <sys/types.h>
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# include <sys/ipc.h>
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# include <sys/sem.h>
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# if SM_CONF_SEM == 2
9512fe850e98fdd448c638ca63fdd92a8a510255ahlunion semun
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl int val;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl struct semid_ds *buf;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl ushort *array;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl};
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# endif /* SM_CONF_SEM == 2 */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# ifndef SEM_A
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# define SEM_A 0200
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# endif /* SEM_A */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# ifndef SEM_R
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# define SEM_R 0400
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# endif /* SEM_R */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
# define SM_NSEM 1
extern int sm_sem_start __P((key_t, int, int, bool));
extern int sm_sem_stop __P((int));
extern int sm_sem_acq __P((int, int, int));
extern int sm_sem_rel __P((int, int, int));
extern int sm_sem_get __P((int, int));
extern int sm_semsetowner __P((int, uid_t, gid_t, mode_t));
# else /* SM_CONF_SEM > 0 */
# define sm_sem_start(key, nsem, semflg, owner) 0
# define sm_sem_stop(semid) 0
# define sm_sem_acq(semid, semnum, timeout) 0
# define sm_sem_rel(semid, semnum, timeout) 0
# define sm_sem_get(semid, semnum) 0
# endif /* SM_CONF_SEM > 0 */
#endif /* ! SM_SEM_H */