CV-Bowen opened a new pull request, #3970:
URL: https://github.com/apache/nuttx-apps/pull/3970
## Summary
Three fixes to the rpmsg socket test programs, plus a style commit:
- Close the accepted socket in the stream server when the connection is
done. `rpsock_thread()` and `rpsock_recv_send_single()` never closed
it, so every connection leaked a socket. The datagram server's own
`close()` goes, since `rpsock_thread()` now closes its socket.
- `rpsock_unsync_test()` read the received data as `uint32_t` from an
offset that depends on how many bytes came before, which is often not
4-byte aligned and faults on cores that trap unaligned loads. Carry
the bytes of a partial word to the start of the buffer and check from
there.
- Initialize `addrlen` before `accept4()` in both stream servers.
- The first commit fixes nxstyle errors already on master in these two
files (blank line after declarations, braces after an if).
## Impact
Test programs only (`examples/rpmsgsocket`). No API or Kconfig change.
## Testing
Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu
13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU
Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
sim:rpserver + sim:rpproxy, `rpsock_server stream block rps &` on the
server, then three times `rpsock_client stream block rps server` on the
proxy (each sends and checks 4096000 bytes, word by word). Number of
open fds of `rpsock_server` (`/proc/<pid>/group/fd`) at start and after
each client:
| | start | 1 | 2 | 3 |
|---|---|---|---|---|
| master | 4 | 5 | 6 | 7 |
| this PR | 4 | 4 | 4 | 4 |
With this PR the server keeps only its listening socket:
```
FD OFLAGS TYPE POS PATH
0 2 1 0 /dev/console
1 2 1 0 /dev/console
2 2 1 0 /dev/console
3 2 9 0 rpmsg:[server:[rps]<->]
```
The unaligned access fix was not run on a core that traps unaligned
loads; on sim every client run reports
`client recv done, total 4096000, endflags, send total 4096000` with no
check failure, on master and with this PR.
Baseline: No regression in rpmsg: sim:rpserver/rpproxy and
qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping,
rpmsgfs; 15/15). qemu-armv8a was built with LIBC_ENVPATH and BINFMT_CHECKEXEC
disabled, which current master needs for nxinit to start nsh there; unrelated
to this change.
--
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]