From 272e62018a190c605efc131fdd557598a031642c Mon Sep 17 00:00:00 2001 From: zhanghongyu Date: Fri, 12 May 2023 18:10:45 +0800 Subject: [PATCH] sim/posix/sim_hostusrsock: process host network syscall with critical section if config_walltime_signal is enabled, NuttX_sim will receive a lot of signals, the socket api will break and errno will be EINTR, masking irq before calling the host socket api will avoid this problem. Signed-off-by: zhanghongyu --- arch/sim/src/sim/sim_usrsock.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/sim/src/sim/sim_usrsock.c b/arch/sim/src/sim/sim_usrsock.c index 3d5789674b..08c93cc53d 100644 --- a/arch/sim/src/sim/sim_usrsock.c +++ b/arch/sim/src/sim/sim_usrsock.c @@ -28,6 +28,7 @@ #include #include +#include #include #include "sim_hostusrsock.h" @@ -408,6 +409,7 @@ void usrsock_register(void) int usrsock_request(struct iovec *iov, unsigned int iovcnt) { struct usrsock_request_common_s *common; + uint64_t flags; int ret; /* Copy request to buffer */ @@ -424,8 +426,10 @@ int usrsock_request(struct iovec *iov, unsigned int iovcnt) if (common->reqid >= 0 && common->reqid < USRSOCK_REQUEST__MAX) { + flags = up_irq_save(); ret = g_usrsock_handler[common->reqid](&g_usrsock, g_usrsock.in, ret); + up_irq_restore(flags); if (ret < 0) { syslog(LOG_ERR, "Usrsock request %d failed: %d\n",