On Tue, Dec 31, 2024 at 04:01:08PM +0000, Diego Nieto Cid wrote: > > Ok, I'll have a look in both OSes behaviour.
There's something wrong with our CMSG_DATA macro. It produces the wrong output (or at least different from Linux). The attached program prints: cmsg: 0x101040a90; data: 0x101040a9c; hurd=0x101040a9c, linux=0x101040aa0 data seems to be off by 4 bytes compared to linux output.
#include <stdio.h> #include <sys/socket.h> int main(int argc, char **argv) { size_t ucred = 12; printf("ucred: %lu\n", ucred); printf("CMS_LEN(ucred): %lu\n", CMSG_LEN(ucred)); size_t cmsgcred = 84; printf("cmsgcred: %lu\n", cmsgcred); printf("CMS_LEN(cmsgcred): %lu\n", CMSG_LEN(cmsgcred)); struct cmsghdr *cmsg = (struct cmsghdr *) 0x101040a90; printf("cmsg: %p; data: %p; hurd=0x101040a9c, linux=0x101040aa0\n", cmsg, CMSG_DATA(cmsg)); return 0; }