|
Message-ID: <Z2HHBKaFQW2tlujk@voyager> Date: Tue, 17 Dec 2024 19:46:28 +0100 From: Markus Wichmann <nullplan@....net> To: musl@...ts.openwall.com Subject: struct mq_attr wrong on x32? Hi all, just something I saw in the code just now. I didn't test it, but I think struct mq_attr is wrong for x32. The kernel defines the structure like this: struct mq_attr { __kernel_long_t mq_flags; /* message queue flags */ __kernel_long_t mq_maxmsg; /* maximum number of messages */ __kernel_long_t mq_msgsize; /* maximum message size */ __kernel_long_t mq_curmsgs; /* number of messages currently queued */ __kernel_long_t __reserved[4]; /* ignored for input, zeroed for output */ }; The type __kernel_long_t is defined as long on all architectures except x32, where it is defined as long long. musl defines the same structure with the type long on all architectures. POSIX requires these fields to be typed as long, so the only choice we have is to define mq_attr as struct mq_attr { long mq_flags; long __r0; long mq_maxmsg; long __r1; long mq_msgsize; long __r2; long mq_curmsgs; long __r3; long long __reserved[4]; /* sets correct structure alignment and size */ }; on x32 only. Yeah, I know, it is ugly. We could put this in a bits/ header, but it would have the same content on all architectures except one, so that would be ugly as well. Auditing them would turn into a find-the-differences puzzle. Oh well. Thoughts? Ciao, Markus
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.