Skip to content

Conversation

@extinguish
Copy link
Contributor

Summary

Update the sendmsg() socket API and its relative functions to use const-qualified message header parameters, aligning the implementation with the POSIX specification.

Impact

Improves API compliance with the POSIX standard, which defines sendmsg() as taking a const struct msghdr *

Testing

Verified that existing code compiles without warnings or errors after the change

To ensure consistency, in all places where the "sendmsg" function is used
either directly or indirectly, the type of the "struct msghdr *msg" parameter
needs to be modified to "const struct msghdr *msg".

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
@github-actions github-actions bot added Area: Networking Effects networking subsystem Area: OS Components OS Components issues Size: S The size of the change in this PR is small labels Jan 13, 2026
Update the can_sendmsg() signature from "struct msghdr *msg" to
"const struct msghdr *msg" to match the updated sendmsg() prototype
and resolve compilation errors due to parameter type inconsistency.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
@simbit18
Copy link
Contributor

hi @extinguish this error has occurred.

====================================================================================
Configuration/Tool: photon/adb,CONFIG_ARM_TOOLCHAIN_GNU_EABI
2026-01-13 10:23:22
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Building NuttX...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100 44130  100 44130    0     0   162k      0 --:--:-- --:--:-- --:--:--  162k

100 1646k  100 1646k    0     0  5591k      0 --:--:-- --:--:-- --:--:-- 5591k
chip/stm32_gpio.c:44:11: note: '#pragma message: CONFIG_STM32_USE_LEGACY_PINMAP will be deprecated migrate board.h see tools/stm32_pinmap_tool.py'
   44 | #  pragma message "CONFIG_STM32_USE_LEGACY_PINMAP will be deprecated migrate board.h see tools/stm32_pinmap_tool.py"
      |           ^~~~~~~
Error: libuv/src/unix/nuttx.c:225:9: error: conflicting types for 'sendmsg'; have 'ssize_t(int,  struct msghdr *, int)' {aka 'int(int,  struct msghdr *, int)'}
  225 | ssize_t sendmsg(int sockfd, struct msghdr *msg, int flags) {
      |         ^~~~~~~
In file included from /github/workspace/sources/apps/system/libuv/libuv/include/uv/unix.h:30,
                 from /github/workspace/sources/apps/system/libuv/libuv/include/uv.h:71,
                 from libuv/src/uv-common.h:35,
                 from libuv/src/unix/internal.h:25,
                 from libuv/src/unix/nuttx.c:26:
/github/workspace/sources/nuttx/include/sys/socket.h:465:9: note: previous declaration of 'sendmsg' with type 'ssize_t(int,  const struct msghdr *, int)' {aka 'int(int,  const struct msghdr *, int)'}
  465 | ssize_t sendmsg(int sockfd, FAR const struct msghdr *msg, int flags);
      |         ^~~~~~~
make[2]: *** [/github/workspace/sources/apps/Application.mk:239: nuttx.c.github.workspace.sources.apps.system.libuv.o] Error 1
make[2]: Target 'all' not remade because of errors.
make[1]: *** [Makefile:54: /github/workspace/sources/apps/system/libuv_all] Error 2
make[1]: Target 'all' not remade because of errors.
make: *** [tools/LibTargets.mk:248: /github/workspace/sources/apps/libapps.a] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 385: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
  [1/1] Normalize photon/adb
====================================================================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Networking Effects networking subsystem Area: OS Components OS Components issues Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants