#ifndef __SEMAPHORE_LOADED #define __SEMAPHORE_LOADED /**************************************************************************** ** ** - POSIX semaphore system calls ** */ /* ************************************************************************* */ /* * * */ /* * HPE CONFIDENTIAL. This software is confidential proprietary software * */ /* * licensed by Hewlett Packard Enterprise Development, LP, and is not * */ /* * authorized to be used, duplicated or disclosed to anyone without the * */ /* * prior written permission of HPE. * */ /* * Copyright 2020 Hewlett Packard Enterprise Development, LP * */ /* * * */ /* * VMS SOFTWARE, INC. CONFIDENTIAL. This software is confidential * */ /* * proprietary software licensed by VMS Software, Inc., and is not * */ /* * authorized to be used, duplicated or disclosed to anyone without * */ /* * the prior written permission of VMS Software, Inc. * */ /* * Copyright 2020 VMS Software, Inc. * */ /* * * */ /* ************************************************************************* */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 64 #endif #include #include #include /* Constants definition */ #define SEM_FAILED ((sem_t *)-1) #define PSEM_MAX_PATHNAME 256 #define PSEM_MAX_SECNAME 256 #define SEM_VALUE_MAX INT_MAX /* Data structure describing a semaphores. */ typedef struct { unsigned int __unused1; /* padding */ char signature[24]; /* used internally */ int sem_named_flag; /* 1 = named semaphore */ int wait_count; /* used for unnamed semaphroes */ unsigned int sem_value; /* semaphore value (used only in case of unnamed semaphore) */ void *sem_internal_ptr; /* pointer to the internal semaphore struct (used only in case of named semaphores) */ unsigned int __unused2; /* padding */ }sem_t; /* Open a named semaphore */ sem_t *sem_open (const char *name, int oflag, ...); /* Remove the name of the semaphore */ int sem_unlink (const char *name); /* close the semaphore opened through sem_open */ int sem_close (sem_t *sem); /* Initialize the specified semaphore */ int sem_init (sem_t *sem, int pshared, unsigned value); /* Remove the semaphore */ int sem_destroy (sem_t *sem); /* Lock the semaphore (blocking) */ int sem_wait (sem_t *sem); /* Lock the specified semaphore (non-blocking) */ int sem_trywait (sem_t *sem); /* Wait for semaphore (blocking with timeout) */ int sem_timedwait (sem_t *sem, struct timespec * abs_timeout); /* Unlock the specified semaphore */ int sem_post (sem_t *sem); /* Get the semaphore value */ int sem_getvalue (sem_t *sem, int *sval); /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __standard #endif /* __SEMAPHORE_LOADED */