From owner-freebsd-arch@FreeBSD.ORG Sun Mar 17 11:09:43 2013 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4108BDB6 for ; Sun, 17 Mar 2013 11:09:43 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id 00771BEF for ; Sun, 17 Mar 2013 11:09:42 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 791031ED; Sun, 17 Mar 2013 12:06:24 +0100 (CET) Date: Sun, 17 Mar 2013 12:11:12 +0100 From: Pawel Jakub Dawidek To: Konstantin Belousov Subject: Re: chflags(2)'s flags argument. Message-ID: <20130317111112.GC1364@garage.freebsd.pl> References: <20130317003559.GA1364@garage.freebsd.pl> <20130317064123.GM3794@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gr/z0/N6AeWAPJVB" Content-Disposition: inline In-Reply-To: <20130317064123.GM3794@kib.kiev.ua> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-arch@FreeBSD.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 11:09:43 -0000 --gr/z0/N6AeWAPJVB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 17, 2013 at 08:41:23AM +0200, Konstantin Belousov wrote: > On Sun, Mar 17, 2013 at 01:35:59AM +0100, Pawel Jakub Dawidek wrote: > > Hi. > >=20 > > Currently this is a bit messy: chflags(2) and fchflags(2) take 'flags' > > argument of type unsigned long and lchflags(2) takes the same argument > > of type int. At least this is what you can see in manual page and in > > prototypes of those functions in sys/stat.h. > >=20 > > However all of those syscalls are defined in syscalls.master to take the > > 'flags' argument of type int and this is what they use in kernel. > >=20 > > I'd like to proposed the following patch: > >=20 > > http://people.freebsd.org/~pjd/patches/chflags_int.patch > >=20 > > It changes type of the 'flags' argument from unsigned long to int where > > possible. > >=20 > > I believe this change won't break ABI, as the syscalls (apart from the > > prototypes) already expect int and I hope in doesn't break API in any > > really visible and destructive way. If you think otherwise, let me know. > The patch seems to keep ABI intact for all useful purposes, at least > on all architectures the FreeBSD supports. A FreeBSD architecture where > sizeof(int) !=3D sizeof(long), uses register calling conventions. Actually I'd rephrase that. If I understand correctly, because we use register calling conventions on architectures where sizeof(int) !=3D sizeof(long), this mess is working correctly now. Remember that syscalls are defined to take int, but prototypes say unsigned long. > Please note that API !=3D ABI, and you found a case where the API > is broken indeed by your change. I know it can break API in some rare cases like in chflags(1), but it results in compilation error (at least with the compilation flags we use), so can be easly spotted and fixed, hopefully: /usr/home/pjd/p4/capkern/bin/chflags/chflags.c: In function 'main': /usr/home/pjd/p4/capkern/bin/chflags/chflags.c:120: warning: assignment fro= m incompatible pointer type --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --gr/z0/N6AeWAPJVB Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlFFpNAACgkQForvXbEpPzT+8gCgzo1eg6NfXRQJU1Qo0zokDwCo bY0Anj1aQRXaww+0C5Tpaau3dLcdhfst =ww9+ -----END PGP SIGNATURE----- --gr/z0/N6AeWAPJVB--