Skip to content

newlib: fix RTEMS socket address definitions and constants#5313

Open
physwkim wants to merge 1 commit into
rust-lang:mainfrom
physwkim:rtems-sockaddr-len
Open

newlib: fix RTEMS socket address definitions and constants#5313
physwkim wants to merge 1 commit into
rust-lang:mainfrom
physwkim:rtems-sockaddr-len

Conversation

@physwkim

@physwkim physwkim commented Jul 22, 2026

Copy link
Copy Markdown

Supersedes #5307, which could not be reopened after its branch was force-pushed.

Description

RTEMS was using the generic ARM socket address layout, which was incompatible
with its FreeBSD-derived API. This PR also updates 27 RTEMS-specific constants
to their corresponding FreeBSD values. Since RTEMS gating is being revised in
#5132, this PR will be rebased after #5132 is merged.

See the commit message for details and header permalinks.

Checklist

  • Relevant tests in libc-test/semver have been updated
  • Commit messages permalink to headers for added or changed API
  • Placeholder or unstable values like *LAST or *MAX have the standard
    doc comment
  • Tested locally (cargo test -p libc-test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

@rustbot rustbot added O-arm O-newlib O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jul 22, 2026
RTEMS was using the generic ARM socket address layout, which does not
match its FreeBSD-derived socket API. As a result, std could not parse
addresses returned by local_addr, accept, and recv_from.

Use the correct RTEMS socket address definitions and update 27 constants
to their FreeBSD values.

Header sources (newlib as built by the RTEMS 6 RSB,
gitlab.rtems.org/contrib/newlib-cygwin @ 1b3dcfdc6f1f):

https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/sys/rtems/include/sys/socket.h#L322
https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/sys/rtems/include/netinet/in.h#L98
https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/sys/rtems/include/netinet6/in6.h#L121
https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/sys/rtems/include/sys/un.h#L58
https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h#L41-53

https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/sys/rtems/include/sys/socket.h#L246
https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/sys/rtems/include/netinet/in.h#L424
https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/sys/rtems/include/netinet/tcp.h#L168
https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/sys/rtems/include/sys/poll.h#L65
https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/sys/rtems/include/sys/filio.h#L50
https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/sys/rtems/include/sys/_termios.h#L78
https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/sys/rtems/include/netdb.h#L156
https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/include/sys/_default_fcntl.h#L63
https://gitlab.rtems.org/contrib/newlib-cygwin/-/blob/1b3dcfdc6f1fd2bd3e1ef2f8b7df736c076c6042/newlib/libc/include/sys/select.h#L34
@physwkim
physwkim force-pushed the rtems-sockaddr-len branch from 99771f8 to 9d63af5 Compare July 22, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-arm O-newlib O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants