Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Mar 2013 08:41:23 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Pawel Jakub Dawidek <pjd@FreeBSD.org>
Cc:        freebsd-arch@FreeBSD.org
Subject:   Re: chflags(2)'s flags argument.
Message-ID:  <20130317064123.GM3794@kib.kiev.ua>
In-Reply-To: <20130317003559.GA1364@garage.freebsd.pl>
References:  <20130317003559.GA1364@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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.

Please note that API != ABI, and you found a case where the API
is broken indeed by your change.

> 
> Note that the patch doesn't touch the strtofflags(3) function, as I
> believe it would break ABI and it doesn't touch the fflagstostr(3)
> function to stay consistent with strtofflags(3).
> 
> PS. Manual page text provided by jilles.
> 
> -- 
> 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)

iQIcBAEBAgAGBQJRRWWTAAoJEJDCuSvBvK1BA5cP/jJtC46lftQIL1Ae6ePEcDCx
DrWalShTFxAkHYMVAKpu1ZWbdS3sb/r81pgomjI30+8T+pHhpcIxlZ/jcQOBmcoN
rBJ2sYif6JBECdHDv1nzpz1aWIEwA/QLVFHD+kwN4z3+38ZZC2ZJJBCP20pPI12x
EPzTOuUTkk9jpxSkfziTSU9EdVsU4lSPSKz9aGl7cqPOFVdFOXAYw/zOwYk+6gwW
J5lLSnGtRabD8Gf1ub8arJwTKISl9qF8/Gy39f6VbFgR6ni76Iuwate7IF+MLgSK
2BMjxqZl221w8zggGfHQVoqcFZKBkPQqfuF0e3F/uout4iB5siIV69+oHQuxTUmH
7GXhvJhX/4RcsFSJoygCY91uCPi6aUigmviWs74D740bgJo9Z6nc4rID5254ttRE
l6BNSef9vHGkNRcjgX8WiyEFDXmrB8/7ML2OsLcKVitsSaUh5cQuSVLW0vxdTsfF
txUK+fkAkA4Q8A6GZGILuRiB4v83nZ9AmfCSvXjXYOQ7ZmC2H96bY5W0ELIuqG0G
SCfPE7sMO+9kL+tdPql7SmKhGfIr0G1rrZJ46rS37qhjBTQvd2kgCdJbPc3aNjxu
7cldYZ7nREiAp+1/5qMJfDp18oaiiPO8kK+KLeM/6CTtwEoSHrmguDD+BmNUfg/I
0qQhXjDrP4jv2LcaYwmU
=JaSa
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130317064123.GM3794>