From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org ([140.211.166.183]:48186 "EHLO smtp.gentoo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752794AbcHQUhr (ORCPT ); Wed, 17 Aug 2016 16:37:47 -0400 Date: Wed, 17 Aug 2016 13:37:46 -0700 From: Mike Frysinger To: Jeff Layton Cc: "Michael Kerrisk (man-pages)" , libc-alpha@sourceware.org, linux-fsdevel@vger.kernel.org, Carlos O'Donell , Yuriy Kolerov Subject: Re: [glibc PATCH] fcntl: put F_OFD_* constants under #ifdef __USE_FILE_OFFSET64 Message-ID: <20160817203746.GF21655@vapier.lan> References: <1471445251-2450-1-git-send-email-jlayton@redhat.com> <20160817184333.GC21655@vapier.lan> <1471461304.3196.101.camel@redhat.com> <1471464343.3196.125.camel@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="OzxllxdKGCiKxUZM" Content-Disposition: inline In-Reply-To: <1471464343.3196.125.camel@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --OzxllxdKGCiKxUZM Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 17 Aug 2016 16:05, Jeff Layton wrote: > The way it works now is that when you define _FILE_OFFSET_BITS=3D64 and > call fcntl(fd, F_SETLK, fl) glibc swaps in a struct flock64 for your > struct flock, and F_SETLK64 for the F_SETLK. does it ? doesn't seem like it does to me. here's glibc's fcntl.c: io/fcntl.c - generic stub that sets ENOSYS sysdeps/unix/sysv/linux/fcntl.c - just calls syscall(fcntl) sysdeps/unix/sysv/linux/generic/wordsize-32/fcntl.c - just calls syscall(f= cntl64) sysdeps/unix/sysv/linux/i386/fcntl.c - same as above the kernel is where it gets interesting: fs/compat.c: COMPAT_SYSCALL_DEFINE3(fcntl): rejects all 64-bit commands w/EINVAL passes all other calls to compat_sys_fcntl64 COMPAT_SYSCALL_DEFINE3(fcntl64): rewrites 32-bit flock struct to 64-bit flock struct passes args to sys_fcntl=20 fs/fcntl.c: SYSCALL_DEFINE3(fcntl): passes all args to do_fcntl SYSCALL_DEFINE3(fcntl64): handles 64-bit flock commands passes all others commands to do_fcntl do_fcntl: handles all commands using native sized flock struct so for a 32-bit system (e.g. i386), you must match LFS & command usage. if LFS is turned on, then using 32-bit commands w/struct flock fails. if LFS is turned off, then using 64-bit commands w/struct flock fails. -mike --OzxllxdKGCiKxUZM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXtMsaAAoJEEFjO5/oN/WB5lkP/2OqnUkjZ31Q++72GqjzWmo0 5pDjllLe3+MGIxjIDHQwUDv4EAzkHMYzfNhh85uOk5AnJgnS0FsQxRvLL6qEu0U9 KauH8IULR4mclbWey2wKISdCyJrLxeEjLmyOXEb09uhIDoysFewlW1F/H8RnpWW6 nInrmVMJeuN8ase+cFpR24Qj0QIkK1Ri1GPKyjcOwiF8vWYobJsjk7+E+SLJpJ/8 C+qe/McXitqXyNitNwVthw5rqFQ1pI9hjpeUN6cGP/PHGWLYxebUX4bqull273DZ lAqdOunqOE4O+wPYVSO+WGaWNp8sDVP9pYxFsOkzfNcCVUTxG+c6EYcEpmaU8Xw3 ag3x1yv1IDkFK1Oi0By6BEHZ8IEzLDMPbmgBTxtqnIrSveajNLxah591FIq8kmq1 a4tbMo4643RxiHNG/+8hu9s4b0p34/RacxBnjbT5/DOrq665zroiJcR/UBcvN8rS wa91MQ4o6VatheOrRAbmd2MDoYG6l2H30WmejNk5/BQrVH7QR/PQUtHkdJUyvTIJ 8fBMEnqWubhnbeONBDbcW/fMWrFW5MCrXSWIcDVLXCKGSpRDmLzpB6AyV451SUfr t68gP3uYj298c8tHLPF6ln2OuwnHrNZrdfTRTFoXTeqUBShPCI03xNKOEM4iP1L3 v4t/DyPOG9A/a6yfQKID =ms3q -----END PGP SIGNATURE----- --OzxllxdKGCiKxUZM--