public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Kalle Olavi Niemitalo <kon@iki.fi>
To: libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH 2/2] New internal function __access_noerrno
Date: Thu, 17 Nov 2016 20:53:00 -0000	[thread overview]
Message-ID: <87r369j093.fsf@Niukka.kon.iki.fi> (raw)
In-Reply-To: <eecf08db-aca1-d824-7366-097d8a44a9ac@linaro.org> (Adhemerval Zanella's message of "Wed, 16 Nov 2016 11:44:35 -0200")

Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:

> +/* __access variant that does not set errno.  Used in very early initialization
> +   code in libc.a and ld.so.  */
> +extern __typeof (__access) __access_noerrno attribute_hidden;

Please document what __access_noerrno is supposed to return on error.
The NaCl and Linux implementations appear to return the error code,
but the stub and Hurd implementations return -1 like access does,
so I'm not sure what you intended.
In "[PATCH 1/4] Add framework for tunables", the caller
only checks whether the result is zero or nonzero.

> +__hurd_fail_noerrno (error_t err)

Your __hurd_fail_noerrno just returns (err == 0 ? 0 : -1).
All the assignments to err in the switch statement are dead.

If __access_noerrno is not required to return the error code,
then I don't think __hurd_fail_noerrno is necessary at all...

> +static int
> +hurd_fail_noerrno (error_t err)
> +{
> +  return __hurd_fail_noerrno (err);
> +}

... instead, hurd_fail_noerrno could just return -1
unconditionally, because it is not even called if err == 0.
(Perhaps then rename it, to avoid suggesting it's similar to __hurd_fail.)

> -    return __hurd_fail (EACCES);
> +    return errfunc (EACESS);

Typo here.

The t/faccessat branch at git://git.sv.gnu.org/hurd/glibc.git
changes this code path quite a lot.  Until that branch is merged
to upstream glibc, I think your function-pointer scheme is OK,
apart from the comments above.
I didn't yet try building it though.

  parent reply	other threads:[~2016-11-17 20:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10 17:04 [PATCH 1/2] Consolidate Linux access implementation Adhemerval Zanella
2016-11-10 17:04 ` [PATCH 2/2] New internal function __access_noerrno Adhemerval Zanella
2016-11-10 17:12   ` Andreas Schwab
2016-11-10 18:26     ` Adhemerval Zanella
2016-11-10 17:53   ` Siddhesh Poyarekar
2016-11-10 18:31     ` Adhemerval Zanella
2016-11-16 13:27       ` Adhemerval Zanella
2016-11-16 13:44         ` Adhemerval Zanella
2016-11-16 16:27           ` Carlos O'Donell
2016-11-16 18:29             ` Joseph Myers
2016-11-17 20:53           ` Kalle Olavi Niemitalo [this message]
2016-11-17 21:30             ` Adhemerval Zanella
2016-11-18  0:21               ` Kalle Olavi Niemitalo
2016-11-18 18:54                 ` Adhemerval Zanella
2016-11-19  3:09                   ` Siddhesh Poyarekar
2016-11-21  5:12         ` Kalle Olavi Niemitalo
2016-11-21 12:45           ` Adhemerval Zanella
2016-11-10 17:44 ` [PATCH 1/2] Consolidate Linux access implementation Siddhesh Poyarekar
2016-11-16 13:16 ` Carlos O'Donell

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=87r369j093.fsf@Niukka.kon.iki.fi \
    --to=kon@iki.fi \
    --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).