nuttx/net/usrsock
Lingao Meng 3d20844903 arch/sim: Add AF_LOCAL support to host usrsock
The sim host usrsock backend only accepted INET/NETLINK domains and
translated socket addresses through plain struct sockaddr. That prevents
simulated applications from using POSIX AF_LOCAL sockets through the
standard socket API when CONFIG_NET_USRSOCK is used.

Add AF_LOCAL address conversion for struct sockaddr_un, allow PF_LOCAL
sockets through usrsock, handle NuttX socket type flags, and poll host
descriptors from the sim usrsock work item so nonblocking
connect/read/write readiness is reported back to NuttX. Use
sockaddr_storage for native address translation so larger address
structures are not truncated.

Testing:

  - Host: Ubuntu 22.04 x86_64.

  - Board/config: sim:nsh with CONFIG_NET_USRSOCK=y and
    CONFIG_EXAMPLES_HELLO=y.

  - make clean && make -j16.

  - Ran a temporary hello example that connected to host AF_UNIX
    SOCK_STREAM and SOCK_SEQPACKET sockets through NuttX socket(),
    connect(), write(), and read(). Both received pong and printed
    "AF_LOCAL usrsock test passed".

Assisted-by: Claude:Claude-Fable-5
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-07-23 15:34:02 +08:00
..
CMakeLists.txt net: migrate to SPDX identifier 2024-09-12 01:08:11 +08:00
Kconfig net/usrsock: Can enable TCP/UDP IP stack with Usrsock enabled 2023-09-21 01:08:11 +08:00
Make.defs net: migrate to SPDX identifier 2024-09-12 01:08:11 +08:00
usrsock.h net: make the sendmsg param type consistent with posix specification 2026-01-16 21:11:39 +08:00
usrsock_accept.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_bind.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_close.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_conn.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_connect.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_devif.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_event.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_getpeername.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_getsockname.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_getsockopt.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_ioctl.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_listen.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_poll.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_recvmsg.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_sendmsg.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_setsockopt.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_shutdown.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_socket.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock_sockif.c arch/sim: Add AF_LOCAL support to host usrsock 2026-07-23 15:34:02 +08:00