From: george anzinger <george@mvista.com>
To: "Fleischer, Julie N" <julie.n.fleischer@intel.com>
Cc: high-res-timers-discourse@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [BUG - HRT patch] nanosleep returns 0 on failure
Date: Wed, 08 Jan 2003 12:14:51 -0800 [thread overview]
Message-ID: <3E1C86BB.3D7C3AD7@mvista.com> (raw)
In-Reply-To: <D9223EB959A5D511A98F00508B68C20C17F1C724@orsmsx108.jf.intel.com>
"Fleischer, Julie N" wrote:
>
> > george anzinger wrote:
> > If you don't mind, I will add your test code to my
> > clock_nanosleep test code so this does not creep back in.
>
> Sure. It's all GPL. The 6-1.c test case (attached below) probably has the
> best test because it does multiple values, some < 0, some >= 1000 million.
>
> One other thing I forgot to write in my previous report is that
> clock_nanosleep() appeared to behave as expected, just nanosleep() showed
> the issue of returning 0 on failure.
Yes, I found the problem. Thanks for the code and the heads
up.
-g
>
> Thanks.
> - Julie
>
> ----
> test 6-1.c
> /*
> * Copyright (c) 2002, Intel Corporation. All rights reserved.
> * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com
> * This file is licensed under the GPL license. For the full content
> * of this license, see the COPYING file at the top level of this
> * source tree.
>
> * Test that nanosleep() sets errno to EINVAL if rqtp contained a
> * nanosecond value < 0 or >= 1,000 million
> */
> #include <stdio.h>
> #include <time.h>
> #include <errno.h>
>
> #define PTS_PASS 0
> #define PTS_FAIL 1
> #define PTS_UNRESOLVED 2
>
> #define NUMTESTS 7
>
> int main(int argc, char *argv[])
> {
> struct timespec tssleepfor, tsstorage;
> int sleepnsec[NUMTESTS] = {-1, -5, -1000000000, 1000000000,
> 1000000001, 2000000000, 2000000000 };
> int i;
> int failure = 0;
>
> tssleepfor.tv_sec=0;
>
> for (i=0; i<NUMTESTS;i++) {
> tssleepfor.tv_nsec=sleepnsec[i];
> printf("sleep %d\n", sleepnsec[i]);
> if (nanosleep(&tssleepfor, &tsstorage) == -1) {
> if (EINVAL != errno) {
> printf("errno != EINVAL\n");
> failure = 1;
> }
> } else {
> printf("nanosleep() did not return -1 on
> failure\n");
> return PTS_UNRESOLVED;
> }
> }
>
> if (failure) {
> printf("At least one test FAILED\n");
> return PTS_FAIL;
> } else {
> printf("All tests PASSED\n");
> return PTS_PASS;
> }
> }
> **These views are not necessarily those of my employer.**
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
George Anzinger george@mvista.com
High-res-timers:
http://sourceforge.net/projects/high-res-timers/
Preemption patch:
http://www.kernel.org/pub/linux/kernel/people/rml
next prev parent reply other threads:[~2003-01-08 21:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-08 20:53 Fleischer, Julie N
2003-01-08 20:14 ` george anzinger [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-01-08 16:41 Fleischer, Julie N
2003-01-08 19:38 ` george anzinger
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=3E1C86BB.3D7C3AD7@mvista.com \
--to=george@mvista.com \
--cc=high-res-timers-discourse@lists.sourceforge.net \
--cc=julie.n.fleischer@intel.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®