diff --git a/include/nuttx/semaphore.h b/include/nuttx/semaphore.h index a4bec12cd25..7fef2a91c50 100644 --- a/include/nuttx/semaphore.h +++ b/include/nuttx/semaphore.h @@ -138,6 +138,49 @@ int sem_tickwait(FAR sem_t *sem, systime_t start, uint32_t delay); int sem_reset(FAR sem_t *sem, int16_t count); +/**************************************************************************** + * Function: sem_getprotocol + * + * Description: + * Return the value of the semaphore protocol attribute. + * + * Parameters: + * sem - A pointer to the semaphore whose attributes are to be + * queried. + * protocol - The user provided location in which to store the protocol + * value. + * + * Return Value: + * 0 if successful. Otherwise, -1 is returned and the errno value is set + * appropriately. + * + ****************************************************************************/ + +#ifdef CONFIG_PRIORITY_INHERITANCE +int sem_getprotocol(FAR sem_t *sem, FAR int *protocol); +#endif + +/**************************************************************************** + * Function: sem_setprotocol + * + * Description: + * Set semaphore protocol attribute. + * + * Parameters: + * sem - A pointer to the semaphore whose attributes are to be + * modified + * protocol - The new protocol to use + * + * Return Value: + * 0 if successful. Otherwise, -1 is returned and the errno value is set + * appropriately. + * + ****************************************************************************/ + +#ifdef CONFIG_PRIORITY_INHERITANCE +int sem_setprotocol(FAR sem_t *sem, int protocol); +#endif + #undef EXTERN #ifdef __cplusplus } diff --git a/include/semaphore.h b/include/semaphore.h index 41db9caa8bf..964d753bd91 100644 --- a/include/semaphore.h +++ b/include/semaphore.h @@ -153,13 +153,6 @@ int sem_close(FAR sem_t *sem); int sem_unlink(FAR const char *name); #endif -#ifdef CONFIG_PRIORITY_INHERITANCE -/* Non-standard interfaces to manage priority inheritance */ - -int sem_getprotocol(FAR sem_t *sem, FAR int *protocol); -int sem_setprotocol(FAR sem_t *sem, int protocol); -#endif - #undef EXTERN #ifdef __cplusplus } diff --git a/libc/semaphore/sem_getprotocol.c b/libc/semaphore/sem_getprotocol.c index abbc4c02dbf..4ae1606ff7b 100644 --- a/libc/semaphore/sem_getprotocol.c +++ b/libc/semaphore/sem_getprotocol.c @@ -39,9 +39,10 @@ #include -#include #include +#include + #ifdef CONFIG_PRIORITY_INHERITANCE /**************************************************************************** diff --git a/sched/pthread/pthread_mutexinit.c b/sched/pthread/pthread_mutexinit.c index 0c65fbc7ed2..fe9620da0b4 100644 --- a/sched/pthread/pthread_mutexinit.c +++ b/sched/pthread/pthread_mutexinit.c @@ -44,6 +44,8 @@ #include #include +#include + #include "pthread/pthread.h" /**************************************************************************** diff --git a/sched/semaphore/sem_setprotocol.c b/sched/semaphore/sem_setprotocol.c index c5609fdcd5f..daacca9f302 100644 --- a/sched/semaphore/sem_setprotocol.c +++ b/sched/semaphore/sem_setprotocol.c @@ -39,10 +39,11 @@ #include -#include #include #include +#include + #include "semaphore/semaphore.h" #ifdef CONFIG_PRIORITY_INHERITANCE diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 8d8307f42a9..8ecf52854fc 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -118,7 +118,7 @@ "sem_destroy","semaphore.h","","int","FAR sem_t*" "sem_open","semaphore.h","defined(CONFIG_FS_NAMED_SEMAPHORES)","FAR sem_t*","FAR const char*","int","..." "sem_post","semaphore.h","","int","FAR sem_t*" -"sem_setprotocol","semaphore.h","defined(CONFIG_PRIORITY_INHERITANCE)","int","FAR sem_t*","int" +"sem_setprotocol","nuttx/semaphore.h","defined(CONFIG_PRIORITY_INHERITANCE)","int","FAR sem_t*","int" "sem_timedwait","semaphore.h","","int","FAR sem_t*","FAR const struct timespec *" "sem_trywait","semaphore.h","","int","FAR sem_t*" "sem_unlink","semaphore.h","defined(CONFIG_FS_NAMED_SEMAPHORES)","int","FAR const char*"