From: Amos Waterland <apw@us.ibm.com>
To: linux-kernel@vger.kernel.org
Subject: Re: 2.5 kernel regression in alarm() syscall behaviour?
Date: Mon, 14 Jul 2003 09:39:33 -0500 [thread overview]
Message-ID: <20030714143933.GA2925@kvasir.austin.ibm.com> (raw)
In-Reply-To: <1057871573.16218.3.camel@tanda.austin.ibm.com>
I think Wes' mail client mangled his testcase a bit. Here is a cleaned
up version.
Compile with:
% gcc -Wall -Werror alarm.c -o alarm
Output on 2.4 kernel is:
% ./alarm
[1058193354] alarm(0), want retval:0; got retval:0 (PASS)
...
[1058193354] alarm(9), want retval:8; got retval:8 (PASS)
0/10 tests failed
Output on 2.5 kernel is: many failures. The number of failures go down
when the system is heavily stressed.
---- Begin alarm.c ----
#include <unistd.h>
#include <stdio.h>
#include <sys/time.h>
#define MINVAL 0
#define MAXVAL 10
#define NOALARM 0
int main(int argc, char **argv)
{
int retval = 0, failed = 0, tests = MAXVAL, prev = 0, curr = 0;
struct timeval time;
if (argc > 1)
if (sscanf(argv[1], "%d", &tests) != 1)
return 1;
for (curr = MINVAL; curr < tests; curr++) {
retval = alarm(curr);
gettimeofday(&time, NULL);
printf("[%li] alarm(%d), want retval:%d; ",
time.tv_sec, curr, prev);
/* was there a previous alarm? */
if (retval == NOALARM && prev == NOALARM) {
printf("got retval:0 (PASS)");
} else if (retval == NOALARM && prev > NOALARM) {
printf("got retval:0 (FAIL)");
failed++;
} else if (retval != prev) {
printf("got retval:%d (FAIL)", retval);
failed++;
} else {
printf("got retval:%d (PASS)", retval);
}
printf("\n");
prev = curr;
}
printf("%d/%d tests failed\n", failed, tests);
return failed;
}
---- End alarm.c ----
next prev parent reply other threads:[~2003-07-14 14:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-10 21:12 Paul Wes Hofmann
2003-07-14 14:39 ` Amos Waterland [this message]
2003-07-14 9:48 Ben
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=20030714143933.GA2925@kvasir.austin.ibm.com \
--to=apw@us.ibm.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®