This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Use statfs64() in shm_open() and posix_getpt().
- From: Rich Felker <dalias at libc dot org>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: Mike Frysinger <vapier at gentoo dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>, GNU C Library <libc-alpha at sourceware dot org>, Andreas Schwab <schwab at linux-m68k dot org>, OndÅej BÃlka <neleai at seznam dot cz>, Peter TB Brett <peter at peter-b dot co dot uk>
- Date: Tue, 5 Aug 2014 12:14:52 -0400
- Subject: Re: [PATCH] Use statfs64() in shm_open() and posix_getpt().
- Authentication-results: sourceware.org; auth=none
- References: <1397373978-17449-1-git-send-email-peter at peter-b dot co dot uk> <2909521 dot DgPZ84h5ca at vapier> <Pine dot LNX dot 4 dot 64 dot 1408041543230 dot 17794 at digraph dot polyomino dot org dot uk> <1600529 dot JOp2K16CNC at vapier> <CA+=Sn1mAu=XiiWb2dWtowDtNb8SjDdwkCVLe2bbYhq-oxHxj6w at mail dot gmail dot com>
On Mon, Aug 04, 2014 at 06:06:58PM -0700, Andrew Pinski wrote:
> On Mon, Aug 4, 2014 at 5:49 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> > On Mon 04 Aug 2014 15:51:15 Joseph S. Myers wrote:
> >> On Sat, 2 Aug 2014, Mike Frysinger wrote:
> >> > right, posix_openpt is part of libc, but shm_open is part of librt. so
> >> > the
> >> > former should use __statfs64 to avoid the PLT while the latter should use
> >> > statfs64.
> >>
> >> No, both should use __statfs64 as statfs64 is not part of the POSIX
> >> namespace but shm_open is. As previously discussed, PLT avoidance and
> >> being namespace-clean are separate issues.
> >
> > why does that matter ? statfs64 is always exported by libc and thus is in the
> > visible ABI namespace. i don't see why glibc's internals need to be concerned
> > with conforming to POSIX at all -- they're internals. what are you trying to
> > cater to ?
>
>
> A program can define a variable called statfs64 which is used instead
> of the libc.so one when calling from librt.so.
While according to POSIX this is true (and actually statfs64 is a
really bad example since even statfs isn't POSIX), in general making
your own symbols that clash with the *64 names really can't work with
glibc at all, at least not on 32-bit systems. -D_FILE_OFFSET_BITS=64
is basically mandatory on 32-bit systems for many functions to work
since modern systems have 64-bit inode numbers and all sorts of things
fail without it.
Isn't it about time glibc added namespace-safe names for these
functions (e.g. __open64, etc.) and changed the headers to redirect to
these namespace-safe names rather than using the old ones?
Rich