tmedicci commented on code in PR #10110:
URL: https://github.com/apache/nuttx/pull/10110#discussion_r1287036977


##########
arch/risc-v/src/esp32c3/esp32c3_libc_stubs.c:
##########
@@ -59,12 +60,12 @@ struct _reent;
 
 int _close_r(struct _reent *r, int fd)
 {
-  return close(fd);
+  return nx_close(fd);

Review Comment:
   > To use _NX_CLOSE, lib_malloc, lib_free etc. we will need to have 2 stubs 
structures and app vs kernel to be liked with different variants (like we are 
having two variants of libc: one for kernel and one for apps) and this will 
require the stubs code to be compiled two times with different options
   
   I thought the same, but after a quick review, I think we can continue on 
this approach: please note that 1) on flat build, the preprocessor will select 
the `close` and `malloc`-like functions and they can be used for applications 
without problems (as it was prior this patch). Considering the protected mode, 
it will use the kernel functions (as expected). Finally, we won't be able to 
use the functions from the userspace when protected mode is enabled, but this 
is expected (we should integrate them into the associated interfaces).



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