From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10490 Path: news.gmane.org!.POSTED!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] fix clock_nanosleep error case Date: Sat, 17 Sep 2016 16:57:09 +0200 Message-ID: <20160917145708.GW1280@port70.net> References: <20160917143644.3654-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 1474124250 30436 195.159.176.226 (17 Sep 2016 14:57:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 17 Sep 2016 14:57:30 +0000 (UTC) User-Agent: Mutt/1.6.0 (2016-04-01) To: musl@lists.openwall.com Original-X-From: musl-return-10503-gllmg-musl=m.gmane.org@lists.openwall.com Sat Sep 17 16:57:27 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 1blH3R-0006l5-Ea for gllmg-musl@m.gmane.org; Sat, 17 Sep 2016 16:57:21 +0200 Original-Received: (qmail 21917 invoked by uid 550); 17 Sep 2016 14:57:21 -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 21899 invoked from network); 17 Sep 2016 14:57:21 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <20160917143644.3654-1-dsabogalcc@gmail.com> Xref: news.gmane.org gmane.linux.lib.musl.general:10490 Archived-At: * Daniel Sabogal [2016-09-17 10:36:43 -0400]: > 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. > --- > src/time/clock_nanosleep.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/time/clock_nanosleep.c b/src/time/clock_nanosleep.c > index ec87b9e..ea510a6 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) > { > + if (clk == CLOCK_THREAD_CPUTIME_ID) return EINVAL; > return -__syscall_cp(SYS_clock_nanosleep, clk, flags, req, rem); you elide a cancellation point here. i think you should check and remap the return value instead. > } > -- > 2.10.0