From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10644 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH v2] fix clock_nanosleep error case Date: Thu, 20 Oct 2016 01:47:06 -0400 Message-ID: <20161020054706.GM19318@brightrain.aerifal.cx> References: <20160917160545.4348-1-dsabogalcc@gmail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1476942445 4628 195.159.176.226 (20 Oct 2016 05:47:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 20 Oct 2016 05:47:25 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-10657-gllmg-musl=m.gmane.org@lists.openwall.com Thu Oct 20 07:47:21 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1bx6CE-0000At-HV for gllmg-musl@m.gmane.org; Thu, 20 Oct 2016 07:47:18 +0200 Original-Received: (qmail 18420 invoked by uid 550); 20 Oct 2016 05:47:18 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 18399 invoked from network); 20 Oct 2016 05:47:18 -0000 Content-Disposition: inline In-Reply-To: <20160917160545.4348-1-dsabogalcc@gmail.com> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:10644 Archived-At: On Sat, Sep 17, 2016 at 12:05:45PM -0400, Daniel Sabogal wrote: > posix requires that EINVAL be returned if the first parameter specifies > the cpu-time clock of the calling thread (CLOCK_THREAD_CPUTIME_ID). > linux returns ENOTSUP instead so we handle this. > --- > Applied Szabolcs' suggestion for remapping the return value. > clock_nanosleep is required to be a cancellation point. > --- > src/time/clock_nanosleep.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/time/clock_nanosleep.c b/src/time/clock_nanosleep.c > index ec87b9e..9e4d9f1 100644 > --- a/src/time/clock_nanosleep.c > +++ b/src/time/clock_nanosleep.c > @@ -1,8 +1,10 @@ > #include > +#include > #include "syscall.h" > #include "libc.h" > > int clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct timespec *rem) > { > - return -__syscall_cp(SYS_clock_nanosleep, clk, flags, req, rem); > + int r = -__syscall_cp(SYS_clock_nanosleep, clk, flags, req, rem); > + return clk == CLOCK_THREAD_CPUTIME_ID ? EINVAL : r; > } > -- > 2.10.0 Thanks, and sorry for the delay following up. Committed. Rich