incubator-nuttx/net/rpmsg
chao an 36591af615 net/rpmsg: initialize semaphore count before wait
recvmsg() will incorrectly return 0 if the count of sema before waiting is greater than 0,
This commit will reinitialize the sema count before waiting:

1181 static ssize_t rpmsg_socket_recvmsg(FAR struct socket *psock,
1182                                     FAR struct msghdr *msg, int flags)
1183 {
...
1255   ret = net_sem_timedwait(&conn->recvsem,
1256                       _SO_TIMEOUT(conn->sconn.s_rcvtimeo)); // recvsem.sem_count == 1; return 0
...
1264   if (!conn->recvdata)              // recvdata not consumed; goto else
1265     {
1266       ret = conn->recvlen;
1267     }
1268   else
1269     {
1270       conn->recvdata = NULL;
1271     }
...
1282   return ret;                        // BUGON! incorrectly return 0 to user
1283 }

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-16 17:15:42 +08:00
..
Kconfig mm/circbuf: Remove MM_CIRCBUF option from Kconfig 2022-11-08 10:18:27 -03:00
Make.defs net/socket_rpmsg: add net socket rpmsg support 2021-03-07 01:45:51 -08:00
rpmsg.h net/socket_rpmsg: add net socket rpmsg support 2021-03-07 01:45:51 -08:00
rpmsg_sockif.c net/rpmsg: initialize semaphore count before wait 2023-05-16 17:15:42 +08:00