Date: Sun, 17 Mar 2013 12:11:12 +0100 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: freebsd-arch@FreeBSD.org Subject: Re: chflags(2)'s flags argument. Message-ID: <20130317111112.GC1364@garage.freebsd.pl> In-Reply-To: <20130317064123.GM3794@kib.kiev.ua> References: <20130317003559.GA1364@garage.freebsd.pl> <20130317064123.GM3794@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] 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. > > > > 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. > > > > 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. > > > > I'd like to proposed the following patch: > > > > http://people.freebsd.org/~pjd/patches/chflags_int.patch > > > > It changes type of the 'flags' argument from unsigned long to int where > > possible. > > > > 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) != 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) != 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 != 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 from incompatible pointer type -- Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlFFpNAACgkQForvXbEpPzT+8gCgzo1eg6NfXRQJU1Qo0zokDwCo bY0Anj1aQRXaww+0C5Tpaau3dLcdhfst =ww9+ -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130317111112.GC1364>
