public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: Roland McGrath <roland@hack.frob.com>
To: "Carlos O'Donell" <carlos@redhat.com>
Cc: GNU C Library <libc-alpha@sourceware.org>,    libc-ports@sourceware.org
Subject: Re: [RFC] Copy as much as you can during a 32-bit stat before returning EOVERFLOW?
Date: Tue, 26 Feb 2013 21:00:00 -0000	[thread overview]
Message-ID: <20130226210002.C598C2C07E@topped-with-meat.com> (raw)
In-Reply-To: Carlos O'Donell's message of  Tuesday, 26 February 2013 14:55:33 -0500 <512D1335.1020704@redhat.com>

The argument in favor of this API change seems quite thin.  An old
program will have to be modified to accept EOVERFLOW failures, so why
not modify it to use *64 interfaces or -D_FILE_OFFSET_BITS=64 instead?
It may seem at first blush that the change would be simpler in complex
programs.  But, in fact, to be robust when using older libcs a program
would have to do something very special to distinguish a library call
(new-style) that delivered some truncated values from one (old-style)
that delivered some or all uninitialized fields.

Performance concerns aside, the real cost of this is making the API more
arcane.  It's a straightforward rule today that calls that fail leave
any result parameters in an undefined state and programs must not assume
anything about those bits of memory after a failing call.  There are
some exceptions such as nanosleep's EINTR case, but those are very few
and are well-specified in POSIX.

Old programs wanting something like you suggest can easily get it from a
wrapper function something_stat supplied in some separate library
(either an actual library or an informal one like gnulib) that calls
stat64 and converts to the old format with the EOVERFLOW semantics you
describe.

I don't see any defensible rationale for putting such a change into
libc.


Thanks,
Roland

  parent reply	other threads:[~2013-02-26 21:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-26 19:55 Carlos O'Donell
2013-02-26 20:37 ` Paul Eggert
2013-02-26 22:59   ` Joseph S. Myers
2013-02-26 21:00 ` Roland McGrath [this message]
2013-02-26 23:05   ` Joseph S. Myers
2013-02-27 19:26   ` Carlos O'Donell
2013-02-26 23:49 ` Rich Felker
2013-02-26 23:58   ` Roland McGrath

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=20130226210002.C598C2C07E@topped-with-meat.com \
    --to=roland@hack.frob.com \
    --cc=carlos@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=libc-ports@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).