|
|
Message-ID: <87mrx0loj0.fsf@alyssa.is>
Date: Fri, 12 Jun 2026 00:07:15 +0200
From: Alyssa Ross <hi@...ssa.is>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com
Subject: Re: Why do sendmmsg and recvmmsg take unsigned int flags?
Rich Felker <dalias@...c.org> writes:
> On Thu, Jun 11, 2026 at 06:30:18PM +0200, Alyssa Ross wrote:
>> sendmmsg and recvmmsg are declared in musl as follows:
>>
>> int sendmmsg (int, struct mmsghdr *, unsigned int, unsigned int);
>> int recvmmsg (int, struct mmsghdr *, unsigned int, unsigned int, struct timespec *);
>>
>> Glibc declares the fourth parameter (flags) as int, as does FreeBSD.
>> The syscall definition in Linux is unsigned int, but I'd have expected
>> compatibility with other implementations to outweigh matching the
>> syscall.
>>
>> Was this an intentional decision? Should it stay this way?
>>
>> (I encountered this due to a test that wraps libc's sendmmsg[1])
>>
>> [1]: https://gitlab.freedesktop.org/libnice/libnice/-/blob/master/tests/instrument-send.c#L193-218
>
> I'm pretty sure this was unintentional, perhaps just matching
> documentation of the raw syscall. We should look at whether it makes
> sense to align it with other implementations.
A little bit more research: it's int on OpenBSD, bionic and uClibc-ng as
well, but unsigned int on NetBSD. macOS has a different interface
entirely. I think it probably makes sense to align with the majority
(and all the other Linux libcs I checked.)
Do you think further investigation/experimentation/discussion is needed,
or should I send a patch?
Download attachment "signature.asc" of type "application/pgp-signature" (228 bytes)
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.