public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: GLIBC patches <libc-alpha@sourceware.org>
Subject: Re: [PATCH] open64: Force O_LARGEFILE on 32-bit architectures
Date: Wed, 29 Dec 2021 06:53:22 +0900	[thread overview]
Message-ID: <YcuHUmG/tkASo2Vz@antec> (raw)
In-Reply-To: <f887d702-4e97-a392-6b71-2dca68384655@linaro.org>

On Tue, Dec 28, 2021 at 04:43:05PM -0300, Adhemerval Zanella wrote:
> 
> 
> On 26/12/2021 04:20, Stafford Horne via Libc-alpha wrote:
> > When running tests on OpenRISC which has 32-bit wordsize but 64-bit
> > timesize it was found that O_LARGEFILE is not being set when calling
> > open64.  For 64-bit architectures the O_LARGEFILE flag is generally
> > implied by the kernel according to force_o_largefile.  However, for
> > 32-bit architectures this is not done.
> > 
> > For this patch I add an extra condition to the EXTRA_OPEN_FLAGS ifdef
> > logic to allow setting O_LARGEFILE on 32-bit architectures.
> > 
> > Tested on the OpenRISC the build works and timezone/tst-tzset passes
> > which was failing before.  I would expect this also would fix arc.
> 
> The O_LARGEFILE is implicit for architectures that defines ARCH_32BIT_OFF_T,
> which are usually old legacy ABIs (it is not defined for newer 32-bit ABIs).
> 
> However, Linux will also internally adds the flag for such cases
> (force_o_largefile macro), which means that passing it, even for ABIs that
> do not require it, is ok.
> 
> So I think it would be simpler to just remove EXTRA_OPEN_FLAGS and
> use O_LARGEFILE unconditionally.

Yes, I agree on this.  I thought maybe there was some reason for having the
ifdef there, like avoiding the extra instructions to set the flag.  But, I don't
think it's going to show up on any profiles.

I'll send a v2.

> > ---
> >  sysdeps/unix/sysv/linux/open64.c            | 3 +--
> >  sysdeps/unix/sysv/linux/open64_nocancel.c   | 2 +-
> >  sysdeps/unix/sysv/linux/openat64.c          | 2 +-
> >  sysdeps/unix/sysv/linux/openat64_nocancel.c | 2 +-
> >  4 files changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/sysdeps/unix/sysv/linux/open64.c b/sysdeps/unix/sysv/linux/open64.c
> > index 0904696973..5ae5e98b57 100644
> > --- a/sysdeps/unix/sysv/linux/open64.c
> > +++ b/sysdeps/unix/sysv/linux/open64.c
> > @@ -23,8 +23,7 @@
> >  #include <sysdep-cancel.h>
> >  #include <shlib-compat.h>
> >  
> > -
> > -#ifdef __OFF_T_MATCHES_OFF64_T
> > +#if defined __OFF_T_MATCHES_OFF64_T && (__WORDSIZE != 32)
> >  # define EXTRA_OPEN_FLAGS 0
> >  #else
> >  # define EXTRA_OPEN_FLAGS O_LARGEFILE
> > diff --git a/sysdeps/unix/sysv/linux/open64_nocancel.c b/sysdeps/unix/sysv/linux/open64_nocancel.c
> > index d7f35656a1..0fe41175ac 100644
> > --- a/sysdeps/unix/sysv/linux/open64_nocancel.c
> > +++ b/sysdeps/unix/sysv/linux/open64_nocancel.c
> > @@ -23,7 +23,7 @@
> >  
> >  #include <not-cancel.h>
> >  
> > -#ifdef __OFF_T_MATCHES_OFF64_T
> > +#if defined __OFF_T_MATCHES_OFF64_T && (__WORDSIZE != 32)
> >  # define EXTRA_OPEN_FLAGS 0
> >  #else
> >  # define EXTRA_OPEN_FLAGS O_LARGEFILE
> > diff --git a/sysdeps/unix/sysv/linux/openat64.c b/sysdeps/unix/sysv/linux/openat64.c
> > index dc226567c1..1019fc13ac 100644
> > --- a/sysdeps/unix/sysv/linux/openat64.c
> > +++ b/sysdeps/unix/sysv/linux/openat64.c
> > @@ -21,7 +21,7 @@
> >  
> >  #include <sysdep-cancel.h>
> >  
> > -#ifdef __OFF_T_MATCHES_OFF64_T
> > +#if defined __OFF_T_MATCHES_OFF64_T && (__WORDSIZE != 32)
> >  # define EXTRA_OPEN_FLAGS 0
> >  #else
> >  # define EXTRA_OPEN_FLAGS O_LARGEFILE
> > diff --git a/sysdeps/unix/sysv/linux/openat64_nocancel.c b/sysdeps/unix/sysv/linux/openat64_nocancel.c
> > index 51377aea45..324f719ea4 100644
> > --- a/sysdeps/unix/sysv/linux/openat64_nocancel.c
> > +++ b/sysdeps/unix/sysv/linux/openat64_nocancel.c
> > @@ -22,7 +22,7 @@
> >  #include <sysdep-cancel.h>
> >  #include <not-cancel.h>
> >  
> > -#ifdef __OFF_T_MATCHES_OFF64_T
> > +#if defined __OFF_T_MATCHES_OFF64_T && (__WORDSIZE != 32)
> >  # define EXTRA_OPEN_FLAGS 0
> >  #else
> >  # define EXTRA_OPEN_FLAGS O_LARGEFILE

      reply	other threads:[~2021-12-28 21:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-26  7:20 Stafford Horne
2021-12-28 19:43 ` Adhemerval Zanella
2021-12-28 21:53   ` Stafford Horne [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YcuHUmG/tkASo2Vz@antec \
    --to=shorne@gmail.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).