From: Heesub Shin Date: Thu, 6 Apr 2017 00:59:58 +0000 (+0900) Subject: kernel/semaphore: move non-standard prototype X-Git-Tag: 1.1_Public_Release~614^2~112 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=827b3d385f6642bfb8ba8cca4c64795f03c97cd8;p=rtos%2Ftinyara.git kernel/semaphore: move non-standard prototype Move prototypes for the non-standard include/semaphore.h file to the non-standard include/tinyara/semaphore.h with the other non-standard semaphore interfaces. All credits should go to Gregory Nutt who wrote the original patch. Change-Id: I970391b2a3510279e964db3cce2345a5db91f8eb Signed-off-by: Gregory Nutt [Shin: backported d5b4d848 from NuttX] Signed-off-by: Heesub Shin --- diff --git a/lib/libc/semaphore/sem_getprotocol.c b/lib/libc/semaphore/sem_getprotocol.c index abdd515..22be7a1 100644 --- a/lib/libc/semaphore/sem_getprotocol.c +++ b/lib/libc/semaphore/sem_getprotocol.c @@ -57,9 +57,10 @@ #include #include -#include #include +#include + #ifdef CONFIG_PRIORITY_INHERITANCE /**************************************************************************** diff --git a/os/include/semaphore.h b/os/include/semaphore.h index ede02a3..d9594af 100644 --- a/os/include/semaphore.h +++ b/os/include/semaphore.h @@ -236,12 +236,6 @@ 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/os/include/tinyara/semaphore.h b/os/include/tinyara/semaphore.h index 1af82e5..3f25428 100644 --- a/os/include/tinyara/semaphore.h +++ b/os/include/tinyara/semaphore.h @@ -138,6 +138,49 @@ int sem_post_from_isr(FAR sem_t *sem); 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/os/kernel/pthread/pthread_mutexinit.c b/os/kernel/pthread/pthread_mutexinit.c index 28778e4..28e9142 100644 --- a/os/kernel/pthread/pthread_mutexinit.c +++ b/os/kernel/pthread/pthread_mutexinit.c @@ -61,6 +61,8 @@ #include #include +#include + #include "pthread/pthread.h" /**************************************************************************** diff --git a/os/kernel/semaphore/sem_setprotocol.c b/os/kernel/semaphore/sem_setprotocol.c index fce2738..127cf11 100644 --- a/os/kernel/semaphore/sem_setprotocol.c +++ b/os/kernel/semaphore/sem_setprotocol.c @@ -56,10 +56,11 @@ #include -#include #include #include +#include + #include "semaphore/semaphore.h" #ifdef CONFIG_PRIORITY_INHERITANCE diff --git a/os/syscall/syscall.csv b/os/syscall/syscall.csv index 924402b..ed2677d 100644 --- a/os/syscall/syscall.csv +++ b/os/syscall/syscall.csv @@ -113,7 +113,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","tinyara/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*"