sched/semaphore: Move cancel point and errno handling to libc / user-space

This moves all the public POSIX semaphore functions into libc and with
this most of the user-space logic is also moved; namely cancel point and
errno handling.

This also removes the need for the _SEM_XX macros used to differentiate
which API is used per user-/kernel mode. Such macros are henceforth
unnecessary.
This commit is contained in:
Ville Juven
2023-11-16 16:27:06 +02:00
committed by Xiang Xiao
parent 34afef5cfb
commit c9bdadd541
20 changed files with 552 additions and 411 deletions
+6 -7
View File
@@ -81,6 +81,12 @@
"nx_pthread_exit","nuttx/pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","noreturn","pthread_addr_t"
"nx_vsyslog","nuttx/syslog/syslog.h","","int","int","FAR const IPTR char *","FAR va_list *"
"nxsched_get_stackinfo","nuttx/sched.h","","int","pid_t","FAR struct stackinfo_s *"
"nxsem_clockwait","nuttx/semaphore.h","","int","FAR sem_t *","clockid_t","FAR const struct timespec *"
"nxsem_destroy","nuttx/semaphore.h","","int","FAR sem_t *"
"nxsem_post","nuttx/semaphore.h","","int","FAR sem_t *"
"nxsem_set_protocol","nuttx/semaphore.h","defined(CONFIG_PRIORITY_INHERITANCE)","int","FAR sem_t *","int"
"nxsem_timedwait","nuttx/semaphore.h","","int","FAR sem_t *","FAR const struct timespec *"
"nxsem_trywait","nuttx/semaphore.h","","int","FAR sem_t *"
"nxsem_wait","nuttx/semaphore.h","","int","FAR sem_t *"
"open","fcntl.h","","int","FAR const char *","int","...","mode_t"
"pgalloc", "nuttx/arch.h", "defined(CONFIG_BUILD_KERNEL)", "uintptr_t", "uintptr_t", "unsigned int"
@@ -135,16 +141,9 @@
"sched_unlock","sched.h","","int"
"sched_yield","sched.h","","int"
"select","sys/select.h","","int","int","FAR fd_set *","FAR fd_set *","FAR fd_set *","FAR struct timeval *"
"sem_clockwait","semaphore.h","","int","FAR sem_t *","clockid_t","FAR const struct timespec *"
"sem_close","semaphore.h","defined(CONFIG_FS_NAMED_SEMAPHORES)","int","FAR sem_t *"
"sem_destroy","semaphore.h","","int","FAR sem_t *"
"sem_open","semaphore.h","defined(CONFIG_FS_NAMED_SEMAPHORES)","FAR sem_t *","FAR const char *","int","...","mode_t","unsigned int"
"sem_post","semaphore.h","","int","FAR sem_t *"
"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 *"
"sem_wait","semaphore.h","","int","FAR sem_t *"
"send","sys/socket.h","defined(CONFIG_NET)","ssize_t","int","FAR const void *","size_t","int"
"sendfile","sys/sendfile.h","","ssize_t","int","int","FAR off_t *","size_t"
"sendmsg","sys/socket.h","defined(CONFIG_NET)","ssize_t","int","FAR struct msghdr *","int"
1 _assert assert.h void FAR const char * int FAR const char * FAR void *
81 nx_pthread_exit nuttx/pthread.h !defined(CONFIG_DISABLE_PTHREAD) noreturn pthread_addr_t
82 nx_vsyslog nuttx/syslog/syslog.h int int FAR const IPTR char * FAR va_list *
83 nxsched_get_stackinfo nuttx/sched.h int pid_t FAR struct stackinfo_s *
84 nxsem_clockwait nuttx/semaphore.h int FAR sem_t * clockid_t FAR const struct timespec *
85 nxsem_destroy nuttx/semaphore.h int FAR sem_t *
86 nxsem_post nuttx/semaphore.h int FAR sem_t *
87 nxsem_set_protocol nuttx/semaphore.h defined(CONFIG_PRIORITY_INHERITANCE) int FAR sem_t * int
88 nxsem_timedwait nuttx/semaphore.h int FAR sem_t * FAR const struct timespec *
89 nxsem_trywait nuttx/semaphore.h int FAR sem_t *
90 nxsem_wait nuttx/semaphore.h int FAR sem_t *
91 open fcntl.h int FAR const char * int ... mode_t
92 pgalloc nuttx/arch.h defined(CONFIG_BUILD_KERNEL) uintptr_t uintptr_t unsigned int
141 sched_unlock sched.h int
142 sched_yield sched.h int
143 select sys/select.h int int FAR fd_set * FAR fd_set * FAR fd_set *
sem_clockwait semaphore.h int FAR sem_t * clockid_t FAR const struct timespec *
144 sem_close semaphore.h defined(CONFIG_FS_NAMED_SEMAPHORES) int FAR sem_t *
sem_destroy semaphore.h int FAR sem_t *
145 sem_open semaphore.h defined(CONFIG_FS_NAMED_SEMAPHORES) FAR sem_t * FAR const char * int ... mode_t
sem_post semaphore.h int FAR sem_t *
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 *
146 sem_unlink semaphore.h defined(CONFIG_FS_NAMED_SEMAPHORES) int FAR const char *
sem_wait semaphore.h int FAR sem_t *
147 send sys/socket.h defined(CONFIG_NET) ssize_t int FAR const void * size_t int
148 sendfile sys/sendfile.h ssize_t int int FAR off_t * size_t
149 sendmsg sys/socket.h defined(CONFIG_NET) ssize_t int FAR struct msghdr * int