unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: Lukasz Majewski <lukma@denx.de>
Cc: Florian Weimer <fweimer@redhat.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	Andreas Schwab <schwab@suse.de>,
	Stepan Golosunov <stepan@golosunov.pp.ru>,
	Alistair Francis <alistair.francis@wdc.com>
Subject: Re: [PATCH 1/2] y2038: Adjust struct __stat64_t64 to be usable by redirected {f}stat{at} calls
Date: Tue, 13 Oct 2020 22:17:55 +0000	[thread overview]
Message-ID: <alpine.DEB.2.21.2010132208570.4206@digraph.polyomino.org.uk> (raw)
In-Reply-To: <20201013131603.12557-1-lukma@denx.de>

On Tue, 13 Oct 2020, Lukasz Majewski wrote:

> When glibc port with __WORDSIZE==32 and __TIMESIZE!=64 (e.g. armv7) will
> use redirected calls to {f}stat{at}64_time64 functions, it will accept
> the struct __stat64_t64 as its argument.
> 
> To avoid errors related to proper data placement after casting from
> struct __stat64_t64 to struct stat{64} it is necessary to add some missing
> padding and update type of {__}st_ino member.

When redirecting to those functions, the definitions of struct stat / 
struct stat64 should automatically change as a result of the _TIME_BITS=64 
definition so that they match the definitions of the __stat64_t64 type - 
just as _FILE_OFFSET_BITS=64 results in changes to the content of struct 
stat.

I believe the design is that __stat64_t64 has an architecture-independent 
layout that is never required to match any particular kernel layout 
because translation (typically from statx) will always occur in userspace.

Note that struct_stat_time64.h is currently an *uninstalled* header, 
despite the name of the multiple-include guard in the header, and despite 
the testing of feature test macros within the header (which only makes 
sense for installed headers); it's not a bits/ header at present.

Maybe there should be some indirection so that the installed version of 
struct_stat_time64.h defines a macro with all the contents of 
__stat64_t64, so that all the many architecture-specific 
bits/struct_stat.h headers can just use that macro to get the right 
contents when _TIME_BITS=64 rather than needing to duplicate the structure 
contents (at least twice per header, for both stat and stat64).  But I 
don't think any change to the layout of __stat64_t64 is indicated, because 
there should always be explicit conversions between different layouts.

-- 
Joseph S. Myers
joseph@codesourcery.com

  parent reply	other threads:[~2020-10-13 22:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13 13:16 [PATCH 1/2] y2038: Adjust struct __stat64_t64 to be usable by redirected {f}stat{at} calls Lukasz Majewski
2020-10-13 13:16 ` [PATCH 2/2] y2038: Remove not used __fstatat_time64 define Lukasz Majewski
2020-10-13 13:31   ` Andreas Schwab
2020-10-13 22:17 ` Joseph Myers [this message]
2020-10-14  8:47   ` [PATCH 1/2] y2038: Adjust struct __stat64_t64 to be usable by redirected {f}stat{at} calls Lukasz Majewski
2020-10-14 13:09     ` Joseph Myers

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

  List information: https://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=alpine.DEB.2.21.2010132208570.4206@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=alistair.francis@wdc.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=lukma@denx.de \
    --cc=schwab@suse.de \
    --cc=stepan@golosunov.pp.ru \
    /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).