public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Jonny Grant <jg@jguk.org>, GNU C Library <libc-alpha@sourceware.org>
Subject: Re: strerror_r GNU flavor
Date: Tue, 9 Nov 2021 09:35:26 -0300	[thread overview]
Message-ID: <8ef62689-64fc-1f47-a6b0-6af0c1dca8fe@linaro.org> (raw)
In-Reply-To: <e3e7eaa2-9f32-ea93-677a-8178b1d8b43b@jguk.org>



On 09/11/2021 07:33, Jonny Grant wrote:
> Hello
> 
> Is it better to depreciate the GNU flavor of strerror_r now that there is a POSIX version?
> 
> I was reading "string.h" and the man page:
> 
> https://man7.org/linux/man-pages/man3/strerror.3.html
> 
> The man page does state :-
> 
> "The XSI-compliant strerror_r() is preferred for portable
> applications.  It returns the error string in the user-supplied
> buffer buf of length buflen."
> 
> Keeping the GNU version sounds reasonable, but at least marking it depreciated?

The main problem is the GNU version is the one exported with _GNU_SOURCE.
It means to favor the XPG would require to export it as _GNU_SOURCE, which
leads to more potential breakage (since for programs that use _GNU_SOURCE
is likely to be troublesome to disable it). This is not a worthwhile change
and is definitely an *API* break.

> 
> Some other queries :-
> I noticed this page does not include the POSIX version of strerror_r
> 
> https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html

Usually the manual favor on GNU extension, but I don't think this prevent
us to document POSIX functions as well.

> 
> Also, this page function definition says "size_t n" instead of the expected "size_t buflen", should that be changed? 

The variable name is meaningless in this context.

> 
> char * strerror_r (int errnum, char *buf, size_t n)
> 
> Cheers
> Jonny
> 

  reply	other threads:[~2021-11-09 12:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 10:33 Jonny Grant
2021-11-09 12:35 ` Adhemerval Zanella [this message]
2021-11-09 22:53   ` Jonny Grant

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=8ef62689-64fc-1f47-a6b0-6af0c1dca8fe@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=jg@jguk.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).