1 #ifndef _SEMAPHORE_H 2 #define _SEMAPHORE_H 3 #ifdef __cplusplus 4 extern "C" { 5 #endif 6 7 #include <features.h> 8 9 #define __NEED_time_t 10 #define __NEED_struct_timespec 11 #include <bits/alltypes.h> 12 13 #include <time.h> 14 #include <fcntl.h> 15 #include "los_sem_pri.h" 16 17 #define SEM_FAILED ((sem_t *)0) 18 19 typedef struct posix_sem { 20 LosSemCB* sem; 21 } sem_t; 22 23 int sem_close(sem_t *); 24 int sem_destroy(sem_t *); 25 int sem_getvalue(sem_t *__restrict, int *__restrict); 26 int sem_init(sem_t *, int, unsigned); 27 sem_t *sem_open(const char *, int, ...); 28 int sem_post(sem_t *); 29 int sem_timedwait(sem_t *__restrict, const struct timespec *__restrict); 30 int sem_trywait(sem_t *); 31 int sem_unlink(const char *); 32 int sem_wait(sem_t *); 33 34 #if _REDIR_TIME64 35 __REDIR(sem_timedwait, __sem_timedwait_time64); 36 #endif 37 38 #ifdef __cplusplus 39 } 40 #endif 41 #endif 42