From: Roland McGrath <roland@redhat.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linasvepstas@gmail.com, Chris Metcalf <cmetcalf@tilera.com>,
GLIBC Devel <libc-alpha@sourceware.org>,
linux-kernel@vger.kernel.org, libc-ports@sourceware.org,
linux-api@vger.kernel.org,
Mike Frysinger <vapier@gentoo.org>
Subject: Re: [BUG] Generic syscalls -- chmod vs. fchmodat
Date: Tue, 25 Jan 2011 18:54:00 -0000 [thread overview]
Message-ID: <20110125183437.7C6C2180999@magilla.sf.frob.com> (raw)
In-Reply-To: Arnd Bergmann's message of Tuesday, 25 January 2011 19:21:14 +0100 <201101251921.15184.arnd@arndb.de>
> On Tuesday 25 January 2011 18:45:15 Roland McGrath wrote:
> > I know of no reason to
> > think that the current treatment of the empty string was ever intended at
> > the creation of the *at interfaces.
>
> I always assumed that this was done so that the *at syscalls can replace
> both the ones that take a file descriptor (e.g. fstat) and the ones that
> take a pathname (e.g. stat), which is sensible for the non-AT_FDCWD case,
> although not documented in the man pages.
I see your point. That is, having the empty string relative to a file
descriptor work means it can replace f* calls on non-directories, whereas
the standard method of passing "." for descriptor-relative resolution can
only work on a file descriptor open on a directory. Is that what you mean?
I don't think this was part of the original intent when the calls were
added, but I suppose it makes sense.
> Treating the empty string special for AT_FDCWD is rather pointless, but
> at least consistent.
I agree about the consistency point. However, one could also call it
consistent if the empty string fails to resolve when operating on either a
directory file descriptor or AT_FDCWD but works on a non-directory file
descriptor. POSIX does not mandate that *at calls fail with ENOTDIR when
passed a non-directory file descriptor (it's a "may fail" error, not a
"shall fail" error). So that behavior would be consistent both with the
POSIX requirements as I read them, and with the desire you mentioned to let
the fblahat system call serve to implement fblah as well as blah. Then
libc would not have to wrap the *at calls with any special check to conform
to POSIX.
Thanks,
Roland
next prev parent reply other threads:[~2011-01-25 18:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-24 21:05 Linas Vepstas
2011-01-24 21:32 ` Roland McGrath
2011-01-25 12:20 ` Mike Frysinger
2011-01-25 17:45 ` Arnd Bergmann
2011-01-25 17:59 ` Roland McGrath
2011-01-25 18:34 ` Arnd Bergmann
2011-01-25 18:54 ` Roland McGrath [this message]
2011-01-25 20:31 ` Arnd Bergmann
2011-01-25 19:56 ` Mike Frysinger
2011-01-25 20:05 ` Eric Blake
2011-01-25 20:50 ` Eric Blake
2011-01-25 22:11 ` Eric Blake
2011-01-26 3:31 ` Linas Vepstas
2011-02-10 18:12 ` Andries Brouwer
2011-02-10 18:17 ` Roland McGrath
2011-02-11 9:12 ` Andreas Schwab
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=20110125183437.7C6C2180999@magilla.sf.frob.com \
--to=roland@redhat.com \
--cc=arnd@arndb.de \
--cc=cmetcalf@tilera.com \
--cc=libc-alpha@sourceware.org \
--cc=libc-ports@sourceware.org \
--cc=linasvepstas@gmail.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vapier@gentoo.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).