Types of CMSG_LEN
and CMSG_SPACE
don't match libc on many platforms
#3240
Labels
CMSG_LEN
and CMSG_SPACE
don't match libc on many platforms
#3240
The
CMSG_LEN
andCMSG_SPACE
macros defined in<sys/socket.h>
on most UNIX platforms do not have well-defined types, but they generally (not always[0]) operate onsize_t
:However, the
libc
crate usesc_uint
for the functions that mimic those macros, so the values end up getting bounced back and forth betweenusize
andc_uint
with failableas
conversions.The
libc
crate would ideally usec_size
when appropriate to match the platform libc. This would be a breaking change, though most users of those functions follow aCMSG_LEN(some_slice.len() as _)
pattern that might reduce the ecosystem impact.[0] An example platform that does not use
size_t
is Solaris and its descendants, which useunsigned int
: https://github.com/illumos/illumos-gate/blob/118b2dbf1f4a745a7e35a5054a777c09bd90fff7/usr/src/uts/common/sys/socket.h#L499-L505The text was updated successfully, but these errors were encountered: