Why do sendmmsg and recvmmsg take unsigned int flags?

Valery Ushakov <[email protected]> Fri, 12 Jun 2026 01:12:37 +0300
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
--FRutGI1TJr5dMbIA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Saw this on the musl mailing list.

We also seem to have `unsigned int flags` since day one.  Note that
`flags` is the same as in send/recv &co, where it's `int flags`.

Should we fix this?

-uwe

--FRutGI1TJr5dMbIA
Content-Type: message/rfc822
Content-Disposition: inline

Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Alyssa Ross <[email protected]>
Newsgroups: gmane.linux.lib.musl.general
Subject: Why do sendmmsg and recvmmsg take unsigned int flags?
Date: Thu, 11 Jun 2026 18:30:18 +0200
Approved: [email protected]
Message-ID: <[email protected]>
Reply-To: [email protected]
Mime-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
	micalg=pgp-sha512; protocol="application/pgp-signature"
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="27996"; mail-complaints-to="[email protected]"
To: [email protected]
Original-X-From: [email protected] Thu Jun 11 18:30:51 2026
Return-path: <[email protected]>
Envelope-to: [email protected]
Original-Received: from second.openwall.net ([193.110.157.125])
	by ciao.gmane.io with smtp (Exim 4.92)
	(envelope-from <[email protected]>)
	id 1wXiIs-00077w-DH
	for [email protected]; Thu, 11 Jun 2026 18:30:50 +0200
Original-Received: (qmail 15756 invoked by uid 550); 11 Jun 2026 16:30:38 -0000
Mailing-List: contact [email protected]; run by ezmlm
Precedence: bulk
List-Post: <mailto:[email protected]>
List-Help: <mailto:[email protected]>
List-Unsubscribe: <mailto:[email protected]>
List-Subscribe: <mailto:[email protected]>
List-ID: <musl.lists.openwall.com>
x-ms-reactions: disallow
Delivered-To: mailing list [email protected]
Original-Received: (qmail 15718 invoked from network); 11 Jun 2026 16:30:38 -0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc
	:content-type:content-type:date:date:from:from:in-reply-to
	:message-id:mime-version:reply-to:subject:subject:to:to; s=fm3;
	 t=1781195428; x=1781281828; bh=uYaD/47WGeVUh//Dx7PwGyxJKL8BWpuP
	8V7IPaQcy+w=; b=GcPhvxTbOqELenvNSSQ1jYal3xw6xZOs6cuujT5ZjRW/Pc1o
	URPeKsV2Yj8ksgnN4Hu8WkWpwuOdI0PkpMrs46V2lBD9eh3Q2I2y/xzBaLRi1DER
	9JK+Mfx1T7Ab++VbjcJewz2S4Dv7C5k9VABs1fI5EslT03TdWx2AHOdODOHyrYH/
	BVcb4D0l0xThtxfy34rKOKWaan3kk2BDaac6aDI0lzF7rj7brlDmu3tS0XXrgds3
	aQfJE1XEHf7IV1AegBnivfp/QL9JB/OHh5dGTtMqJUnloAc/FKzkuK6OSQNCMNT/
	FZs/IxhYuhMWJ+C+PzGQGtNq1805t3NLtrsTXg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
	messagingengine.com; h=cc:content-type:content-type:date:date
	:feedback-id:feedback-id:from:from:in-reply-to:message-id
	:mime-version:reply-to:subject:subject:to:to:x-me-proxy
	:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1781195428; x=
	1781281828; bh=uYaD/47WGeVUh//Dx7PwGyxJKL8BWpuP8V7IPaQcy+w=; b=W
	HxdlsvE0IlqhV/95XDg+1CugtE3MUbr9Js7WwZx+k0NHllGJRzcylkkPyE5pW1e2
	5w+hJMDrAqDqW+AKc/KnDPUK6P8qcSJ4uNEtDaMi3+eke6bQS3Zzw6EyK9ZbBViy
	AidocTq+INSOXs4KWbQzrRoZVFe1pD5DM9thKjVCApZfBEZm/QenRTsPD1KzZlsr
	qSmgOjjQzxANV375EyV7u/ilb5q41ER7jo/uDqtRteL3H742yjenZek3ydGylU+P
	KCopk7cHTVCF1rqNjUmYvJyycy2ZyJdRFbWcEs6LET1YBQ/UAIX2EHSi85glaw4G
	/zOwrMBBrS2v/fg0fdb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8OQI4nebwJSOFRH64OEK0MKLqieTUnqQ>
    <xmx:pOIqaglWd9ienoWMGUGIbJxc4W5HU87OEqnsfMSCnAo8-2Ucs2pxqg>
    <xmx:pOIqasKkEkKtXh0tmrDrj3bKVUrJ9Jw_9ZYvYhgfgycakrRdTO7wuw>
    <xmx:pOIqahZ8zQ_YixwnDGmz49meFCITEFY91fhbZjdicSoEbwIzNyjdew>
    <xmx:pOIqauV-1QVLaeYZymf8d-Qx4gROGViqmPlimHOn_7YLdIRDI4PMXIOb>
Feedback-ID: i12284293:Fastmail
Xref: news.gmane.io gmane.linux.lib.musl.general:23187
Archived-At: <http://permalink.gmane.org/gmane.linux.lib.musl.general/23187>

--=-=-=
Content-Type: text/plain

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

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRV/neXydHjZma5XLJbRZGEIw/wogUCairimgAKCRBbRZGEIw/w
oumzAP9iC6dJQE2nLMrYt0TSepgXsyYHPLgCTRLjX9Ydeix1lwD7BO/OmdaQf29G
LU0qBgZzzTvbCi4KJ53iMpGxE9dIFQE=
=Bqxz
-----END PGP SIGNATURE-----
--=-=-=--


--FRutGI1TJr5dMbIA--