royzah commented on code in PR #20415:
URL: https://github.com/apache/nuttx/pull/20415#discussion_r4154607546
##########
include/sys/syscall_lookup.h:
##########
@@ -94,8 +94,11 @@ SYSCALL_LOOKUP(nxsem_timedwait, 2)
SYSCALL_LOOKUP(nxsem_trywait_slow, 1)
SYSCALL_LOOKUP(nxsem_wait_slow, 1)
-#ifdef CONFIG_PRIORITY_INHERITANCE
SYSCALL_LOOKUP(nxsem_set_protocol, 2)
+ SYSCALL_LOOKUP(nxsem_get_value, 2)
+
+#ifdef CONFIG_CUSTOM_SEMAPHORE_MAXVALUE
Review Comment:
libs/libc/semaphore/sem_getvalue.c, built for flat and __KERNEL__. User side
goes thru the syscall.
##########
libs/libc/semaphore/sem_getvalue.c:
##########
@@ -61,16 +61,28 @@
*
****************************************************************************/
+#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
int nxsem_get_value(FAR sem_t *sem, FAR int *sval)
{
- if (sem != NULL && sval != NULL && !NXSEM_IS_MUTEX(sem))
+ FAR sem_t *resolved;
+ int ret = -EINVAL;
+
+ if (sem == NULL || sval == NULL)
{
- *sval = atomic_read(NXSEM_COUNT(sem));
- return OK;
+ return ret;
}
- return -EINVAL;
+ resolved = nxsem_resolve(sem);
Review Comment:
Flat: nxsem_resolve() compiles to nothing. Protected: right, no shadow
there, will keep the syscall kernel build only.
##########
include/nuttx/semaphore.h:
##########
@@ -138,6 +138,21 @@ extern "C"
* Public Function Prototypes
****************************************************************************/
+#if defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__)
Review Comment:
Will do once #20412 lands, it needs its va_to_pa on riscv and x86_64. Draft
till then.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]