Diego Nieto Cid, le mar. 31 déc. 2024 20:48:08 +0000, a ecrit: > 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. */
That's the correct type according to posix: ./basedefs/sys_socket.h.html:<tt>socklen_t cmsg_len </tt> Data byte count, including the <b>cmsghdr</b>. <tt> > 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 ---