On Tue, Dec 31, 2024 at 08:32:47PM +0000, Diego Nieto Cid wrote: > > Adding the following line to the program: > > printf("cmsghdr: %lu\n", sizeof (struct cmsghdr)); > > shows 12 on Hurd and 16 on Linux. I think I'm closer :)
The only difference in the structure definition is the cmsg_len field type which happens to be the 4 missing bytes. --- >8 --- >8 --- Linux ===== /* Structure used for storage of ancillary data object information. */ struct cmsghdr { size_t cmsg_len; /* Length of data in cmsg_data plus length of cmsghdr structure. !! The type should be socklen_t but the definition of the kernel is incompatible with this. */ int cmsg_level; /* Originating protocol. */ int cmsg_type; /* Protocol specific type. */ #if __glibc_c99_flexarr_available __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */ #endif }; Hurd ==== /* Structure used for storage of ancillary data object information. */ struct cmsghdr { socklen_t cmsg_len; /* Length of data in cmsg_data plus length of cmsghdr structure. */ int cmsg_level; /* Originating protocol. */ int cmsg_type; /* Protocol specific type. */ #if __glibc_c99_flexarr_available __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */ #endif }; --- >8 --- >8 --- So, while CMSG_LEN aligns the cmsghdr structure, CMSG_DATA don't. I think that's the problem.