#ifndef __SEM_LOADED #define __SEM_LOADED /**************************************************************************** ** ** - System V semaphore system calls ** ***************************************************************************** ** ** Copyright 2008 Hewlett-Packard Development Company, L.P. ** ** Confidential computer software. Valid license from HP and/or ** its subsidiaries required for possession, use, or copying. ** ** Consistent with FAR 12.211 and 12.212, Commercial Computer Software, ** Computer Software Documentation, and Technical Data for Commercial ** Items are licensed to the U.S. Government under vendor's standard ** commercial license. ** ** Neither HP nor any of its subsidiaries shall be liable for technical ** or editorial errors or omissions contained herein. The information ** in this document is provided "as is" without warranty of any kind and ** is subject to change without notice. The warranties for HP products ** are set forth in the express limited warranty statements accompanying ** such products. Nothing herein should be construed as constituting an ** additional warranty. ** ***************************************************************************** */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 64 #endif #include #if !defined __PID_T && !defined _DECC_V4_SOURCE # define __PID_T 1 typedef __pid_t pid_t; #endif #if defined _XOPEN_SOURCE || !defined _POSIX_C_SOURCE # ifndef __TIME_T # define __TIME_T 1 #ifdef __NAMESPACE_STD namespace std { #endif typedef __time_t time_t; #ifdef __NAMESPACE_STD } /* namespace std */ using std::time_t; #endif # endif #endif #if !defined __SIZE_T && !defined _DECC_V4_SOURCE # define __SIZE_T 1 #ifdef __NAMESPACE_STD namespace std { #endif typedef __size_t size_t; #ifdef __NAMESPACE_STD } /* namespace std */ using std::size_t; #endif #endif /* Flags for `semop'. */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ /* Commands for `semctl'. */ #define GETPID 11 /* get sempid */ #define GETVAL 12 /* get semval */ #define GETALL 13 /* get all semval's */ #define GETNCNT 14 /* get semncnt */ #define GETZCNT 15 /* get semzcnt */ #define SETVAL 16 /* set semval */ #define SETALL 17 /* set all semval's */ /* Data structure describing a set of semaphores. */ struct semid_ds { struct ipc_perm sem_perm; /* operation permission struct */ unsigned short int sem_nsems; /* number of semaphores in set */ __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ }; /* Anonymous structure associated with a semaphore */ typedef struct { unsigned short semval; /* Semaphore value */ __pid_t sempid; /* Process ID of last operation. */ unsigned short semncnt; /* Number of processes waiting for semval to increase */ unsigned short semzcnt; /* Number of processes waiting for semval to become 0 */ } sem_ds; /* Structure used for argument to `semop' to describe operations. */ struct sembuf { unsigned short int sem_num; /* semaphore number */ short int sem_op; /* semaphore operation */ short int sem_flg; /* operation flag */ }; /* Semaphore control operations */ int semctl(int __semid, int __semnum, int __cmd, ...); /* Get semaphore */ int semget(key_t __key, int __nsems, int __semflg); /* Operate on semaphore */ int semop(int __semid, struct sembuf *__sops, size_t __n_sops); /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __standard #endif /* __SEM_LOADED */