xiaoxiang781216 commented on code in PR #20415:
URL: https://github.com/apache/nuttx/pull/20415#discussion_r4154402293
##########
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:
this patch will impact the performance a lot in the normal path.
##########
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:
where define it
##########
include/nuttx/semaphore.h:
##########
@@ -138,6 +138,21 @@ extern "C"
* Public Function Prototypes
****************************************************************************/
+#if defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__)
Review Comment:
drop the first 9 patch from this pr
--
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]