From owner-freebsd-arch@FreeBSD.ORG Sun Mar 17 15:57:51 2013 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CD95BCAF; Sun, 17 Mar 2013 15:57:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 29ABD80E; Sun, 17 Mar 2013 15:57:50 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r2HFviZ8081760; Sun, 17 Mar 2013 17:57:44 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.0 kib.kiev.ua r2HFviZ8081760 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r2HFvhdt081759; Sun, 17 Mar 2013 17:57:43 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 17 Mar 2013 17:57:43 +0200 From: Konstantin Belousov To: Pawel Jakub Dawidek Subject: Re: chflags(2)'s flags argument. Message-ID: <20130317155743.GR3794@kib.kiev.ua> References: <20130317003559.GA1364@garage.freebsd.pl> <20130317064123.GM3794@kib.kiev.ua> <20130317111112.GC1364@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CFQN6Iaevez+I9dc" Content-Disposition: inline In-Reply-To: <20130317111112.GC1364@garage.freebsd.pl> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home 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 15:57:51 -0000 --CFQN6Iaevez+I9dc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 17, 2013 at 12:11:12PM +0100, Pawel Jakub Dawidek wrote: > 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 whe= re > > > 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 kn= ow. > > 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. >=20 > 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. It needs some untangling. The ABI exported by libc is what I care about when referring to the ABI. And this is the ABI which is not broken due to the reason I stated above. The interface exported by the kernel for consumption of the libc syscall wrappers is dufferent from the normal ABI on the architecture. >=20 > > Please note that API !=3D ABI, and you found a case where the API > > is broken indeed by your change. >=20 > 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: >=20 > /usr/home/pjd/p4/capkern/bin/chflags/chflags.c: In function 'main': > /usr/home/pjd/p4/capkern/bin/chflags/chflags.c:120: warning: assignment f= rom incompatible pointer type >=20 Project aims to maintain better compatibility then to claim that the changes could be 'spotted'. --CFQN6Iaevez+I9dc Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRRef3AAoJEJDCuSvBvK1BYtgP/0xDdOCWPvx1o0SOI7iLZCCK L4qeIWieXqmWKmjDmHnPehj4G/AQAXkVr3+jOvUEHEjiP1gFANy6wSIwPDW8l79n WZDmllfOSFTKGIu5khDLKDX25LaZxRtGQm1CJEbiKBVM5ofXCq/jcBvsu+X+GHTx /xqB31JSLF7Obo6cVOljLE+ZkAO17vLptUBhjuH2D6CdeIw8vX3RUvbyD68rlMgV 16H31ViOuK1WJVVl5IS97hBEtrYILtXye0hr9o9QUOywFhJNoZaqRoqMFbl3TDm4 xP/g1nXEM2ncovkwpx9T3FQVNRk9KzELTpmknyYB42P5WPQhOf2d7ieaPpdjV7be iBgT5XZsj1rXALCbUi703+NO5b5xIhFU0PW2iqA4xG9orDkcVDhmSS+ZOcWIwVPe pj/gjaNV2j/eRSdQvFpOv/epXME4zAO5q6SOs8wMMBNFmM4F5Um3mf1O4VN5o2ak SXnorZ8OJSnrmRR39l7/3cbf+wdv1zX0vOJyDsbh4maPAxJaOWI0mECmXRqSHZO6 r7Fg3GsHIWvLrroS7WDnUp83s7IBdVbTidayesv+8d+iy/VMmjQQuV6ZN9StGCsI pQu9WdBd4dpxi2gKPKLZkXQxJCEov3ijITOFuS8Z28Rcm/7SYdsnBEhHItWB/E2X FM6i1b3u9pmQ73AXfqPZ =vsac -----END PGP SIGNATURE----- --CFQN6Iaevez+I9dc--