mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: musl@lists.openwall.com
Subject: Re: [PATCH] add sched_getcpu
Date: Mon, 29 Feb 2016 22:59:10 +0300 (MSK)	[thread overview]
Message-ID: <alpine.LNX.2.20.1602292252300.14767@monopod.intra.ispras.ru> (raw)
In-Reply-To: <20160229183816.GB9349@brightrain.aerifal.cx>

On Mon, 29 Feb 2016, Rich Felker wrote:
> > (this include could also be dropped; I think it's a matter of policy whether
> > such includes are desirable or not, so please wait for comment from Rich)
> 
> Policy is to always include the header with the public declaration
> (and any feature test macros necessary to get it) so that the compiler
> checks the implementation against the public declaration.

This policy certain makes sense; I pointed that out because I've seen it
violated; at least the following files violate it by defining something
without including anything:

arch/arm/src/__aeabi_atexit.c
src/internal/procfdname.c
src/misc/gethostid.c
src/prng/__seed48.c
src/signal/restore.c
src/signal/sigrtmin.c
src/stdlib/abs.c
src/stdlib/labs.c
src/stdlib/llabs.c
src/time/__month_to_secs.c
src/time/__year_to_secs.c

(but e.g. in procfdname.c there's nothing to include because every caller
declares the prototype, and also hardcodes the buffer size -- see my recent
patch)

> > This is wrong, as it doesn't set errno on error, and does not produce -1. This
> > should be something like 'return s ? __syscall_ret(s) : c;' or maybe
> > 'return __syscall_ret(s ? s : c);'.
> 
> Why is an error even possible here? Is it just to account for ancient
> kernels that lack the syscall?

Apparently so -- afaics current kernels can only produce EFAULT, which cannot
happen in this case.

(I was wrong about the need to use __syscall_ret, but that's for another
subthread)

Alexander


  reply	other threads:[~2016-02-29 19:59 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 16:49 Nathan Zadoks
2016-02-29 16:57 ` Nathan Zadoks
2016-02-29 16:57   ` Nathan Zadoks
2016-02-29 17:00   ` Nathan Zadoks
2016-02-29 17:23     ` Alexander Monakov
2016-02-29 17:33       ` Alexander Monakov
2016-03-01 13:45         ` [PATCH] add sched_getcpu, with vDSO support Nathan Zadoks
2016-03-01 15:56           ` Nathan Zadoks
2016-03-02  5:55             ` Rich Felker
2016-03-02 16:26               ` [PATCH 0/2] add sched_getcpu, take n+1 Nathan Zadoks
2016-03-02 16:26                 ` [PATCH 1/2] add sched_getcpu Nathan Zadoks
2016-03-02 16:26                 ` [PATCH 2/2] add sched_getcpu vDSO support Nathan Zadoks
2016-03-03  3:01                 ` [PATCH 0/2] add sched_getcpu, take n+1 Rich Felker
2016-02-29 17:49       ` [PATCH] add sched_getcpu nathan
2016-02-29 17:52         ` nathan
2016-02-29 20:17           ` Alexander Monakov
2016-02-29 20:49             ` Nathan Zadoks
2016-02-29 18:38       ` Rich Felker
2016-02-29 19:59         ` Alexander Monakov [this message]
2016-02-29 20:05           ` Rich Felker
2016-02-29 20:10             ` Alexander Monakov
2016-02-29 20:17               ` Rich Felker
2016-02-29 21:09 ` Tomasz Sterna
2016-02-29 21:21   ` Nathan Zadoks
2016-02-29 21:30   ` Rich Felker
2016-03-01 20:35     ` Tomasz Sterna
2016-03-01 22:34       ` Rich Felker
2016-03-02 20:46         ` Tomasz Sterna
2016-03-02 21:19           ` Szabolcs Nagy
2016-03-02 23:26             ` Rich Felker
2016-03-04 22:21               ` Tomasz Sterna
2016-03-04 23:33                 ` Rich Felker
2016-03-05 11:40                   ` Tomasz Sterna

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=alpine.LNX.2.20.1602292252300.14767@monopod.intra.ispras.ru \
    --to=amonakov@ispras.ru \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).