diff --git a/include/sys/syscall_lookup.h b/include/sys/syscall_lookup.h index 949c629450..4d247350b5 100644 --- a/include/sys/syscall_lookup.h +++ b/include/sys/syscall_lookup.h @@ -71,6 +71,8 @@ SYSCALL_LOOKUP(sethostname, 2) /* Semaphores */ +SYSCALL_LOOKUP(nxsem_wait, 1) + SYSCALL_LOOKUP(sem_destroy, 1) SYSCALL_LOOKUP(sem_post, 1) SYSCALL_LOOKUP(sem_clockwait, 3) diff --git a/libs/libc/misc/lib_mutex.c b/libs/libc/misc/lib_mutex.c index c43d324d6d..a8f19c8a3d 100644 --- a/libs/libc/misc/lib_mutex.c +++ b/libs/libc/misc/lib_mutex.c @@ -27,6 +27,7 @@ #include #include #include +#include /**************************************************************************** * Pre-processor Definitions @@ -200,15 +201,13 @@ int nxmutex_lock(FAR mutex_t *mutex) { /* Take the semaphore (perhaps waiting) */ - ret = _SEM_WAIT(&mutex->sem); + ret = nxsem_wait(&mutex->sem); if (ret >= 0) { mutex->holder = _SCHED_GETTID(); break; } - - ret = _SEM_ERRVAL(ret); - if (ret != -EINTR && ret != -ECANCELED) + else if (ret != -EINTR && ret != -ECANCELED) { break; } diff --git a/syscall/syscall.csv b/syscall/syscall.csv index c0f048f11b..5f49bd08bc 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -83,6 +83,7 @@ "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_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" "pipe2","unistd.h","defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0","int","int [2]|FAR int *","int"