kernel/semaphore: move non-standard prototype
authorHeesub Shin <heesub.shin@samsung.com>
Thu, 6 Apr 2017 00:59:58 +0000 (09:59 +0900)
committerHeesub Shin <heesub.shin@samsung.com>
Tue, 18 Apr 2017 03:02:11 +0000 (12:02 +0900)
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 <gnutt@nuttx.org>
[Shin: backported d5b4d848 from NuttX]
Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
lib/libc/semaphore/sem_getprotocol.c
os/include/semaphore.h
os/include/tinyara/semaphore.h
os/kernel/pthread/pthread_mutexinit.c
os/kernel/semaphore/sem_setprotocol.c
os/syscall/syscall.csv

index abdd515..22be7a1 100644 (file)
 #include <tinyara/config.h>
 
 #include <sys/types.h>
-#include <semaphore.h>
 #include <assert.h>
 
+#include <tinyara/semaphore.h>
+
 #ifdef CONFIG_PRIORITY_INHERITANCE
 
 /****************************************************************************
index ede02a3..d9594af 100644 (file)
@@ -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
 }
index 1af82e5..3f25428 100644 (file)
@@ -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
 }
index 28778e4..28e9142 100644 (file)
@@ -61,6 +61,8 @@
 #include <errno.h>
 #include <debug.h>
 
+#include <tinyara/semaphore.h>
+
 #include "pthread/pthread.h"
 
 /****************************************************************************
index fce2738..127cf11 100644 (file)
 
 #include <tinyara/config.h>
 
-#include <semaphore.h>
 #include <assert.h>
 #include <errno.h>
 
+#include <tinyara/semaphore.h>
+
 #include "semaphore/semaphore.h"
 
 #ifdef CONFIG_PRIORITY_INHERITANCE
index 924402b..ed2677d 100644 (file)
 "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*"