patacongo commented on issue #9695:
URL: https://github.com/apache/nuttx/issues/9695#issuecomment-1620753596

   > Since currently `nxmutex_` interface is used in libc it will simply not 
link in app build in case of `CONFIG_BUILD_KERNEL=y`.
   
   Nor for CONFIG_BUILD_PROTECTED=y
   
   > Seems like we need a new system call, but that is bad if sys call is done 
from inside the kernel.
   
   There are no system calls inside the kernel.  They exist only in user space 
in the PROTECTED and KERNEL builds.
   
   When you build the system calls, two libraries are generated:  (1) a "proxy" 
library that invokes the system call and (2) a "stub" library that receives the 
system call.
   
   That is, the system call proxy library is linked only into user space; the 
system call stub library is linked only into kernel space.  So you can never 
make system calls from within the kernel.
   
   nxsem_wait() would perform the system call and exist only in user space.  If 
user space code calls nxsem_wait(), it will invoke a system call.
   
   There is no such system call in the kernel space.  If kernel space code 
calls nxsem_wait(), the actual function nxsem_wait() will be called.
   
   So nxsem_wait() can be called from indirectly from nxmutex_lock() in libc OR 
directly from within the kernel.  It all works with no weird behavior.
   


-- 
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]

Reply via email to