public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <colomar.6.4.3@gmail.com>
To: mtk.manpages@gmail.com
Cc: linux-man <linux-man@vger.kernel.org>,
	"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Subject: Re: Bug or misdocumented feature in pthread_setaffinity_np.3
Date: Mon, 7 Sep 2020 11:26:57 +0200	[thread overview]
Message-ID: <9659887c-6b11-bbd0-760b-dacfedf7e972@gmail.com> (raw)
In-Reply-To: <CAKgNAkjr1jasB7Hfjd7eeyGCGCeXmD19=nTOruGUL48Ke-Xkcg@mail.gmail.com>

Hi Michael,

On 2020-09-07 11:21, Michael Kerrisk (man-pages) wrote:
>> Or is it that those functions return an error code that corresponds to a
>> valid `errno` error number?  In that case it could be documented better
>> IMHO.
> 
> Yes, probably you are right. The thing is, when you use pthreads you
> have to know they are different from the conventional APIs. The
> pthreads(7) page hints at this:
> 
>         Most  pthreads  functions return 0 on success, and an error number
>         on failure.  Note that the pthreads functions do  not  set  errno.
> 
>> If that is the case, do those functions set `errno` and also return that
>> same `errno` value redundantly?
> 
> No, they don't use errno at all.
> 
> So, I exp[anded the text in pthreads(7), to make the point more explicit:
> 
>         Most  pthreads  functions return 0 on success, and an error number
>         on failure.  The error numbers that can be returned have the  same
>         meaning  as  the  error  numbers returned in errno by conventional
>         system calls and C library  functions.   Note  that  the  pthreads
>         functions  do  not  set errno.
> 
> Note that the various pthreads manual pages (should) all refer to
> pthreads(7) in SEE ALSO. I'm reluctant to add a note like this to
> every pthreads page, since it seems verbose, but I have also added
> this note to errno(3):
> 
>         Note  that  the  POSIX  threads  APIs  do  not set errno on error.
>         Instead, on failure they return an error number  as  the  function
>         result.   These  error numbers have the same meanings as the error
>         numbers returned in errno by other APIs.
> 
> Perhaps that suffices for you?

Yes, that is much clearer now.

Thanks,

Alex

  reply	other threads:[~2020-09-07  9:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-07  9:00 Bug or misdocumented feature in pthread_setaffinity_np.3 Alejandro Colomar
2020-09-07  9:21 ` Samuel Thibault
2020-09-07  9:21 ` Michael Kerrisk (man-pages)
2020-09-07  9:26   ` Alejandro Colomar [this message]
2020-09-07  9:24 ` Florian Weimer
2020-09-07  9:31   ` Michael Kerrisk (man-pages)

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=9659887c-6b11-bbd0-760b-dacfedf7e972@gmail.com \
    --to=colomar.6.4.3@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /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