All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/3] syscalls/alarm02: Rewrite to new library
Date: Wed, 25 Jul 2018 15:48:29 +0200	[thread overview]
Message-ID: <20180725134828.GB23890@rei> (raw)
In-Reply-To: <1532431855-18452-1-git-send-email-huangjh.jy@cn.fujitsu.com>

Hi!
> +static struct tcase {
> +	char *buf;
> +	unsigned long int sec;
> +} tcases[] = {
> +	{"-1", -1},
> +	{"ULONG_MAX", ULONG_MAX},
> +	{"ULONG_MAX+1", ULONG_MAX + 1},
> +};

Looking at these values these seems to be a bit bogus, the alarm
prototype is defined with unsigned int, so the only value that makes
sense here would he UINT_MAX.

The -1 == ULONG_MAX when converted to unsigned int and ULONG_MAX + 1
would end up as 0.

Also alarm() returns the number of seconds remaining for the alarm, so
we should really do something as:

* call alarm(UINT_MAX);
* check the return value was 0
* call alarm(0);
* check that the return value was either UINT_MAX or UINT_MAX - 1

-- 
Cyril Hrubis
chrubis@suse.cz

  parent reply	other threads:[~2018-07-25 13:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-24 11:30 [LTP] [PATCH 1/3] syscalls/alarm02: Rewrite to new library Jinhui huang
2018-07-24 11:30 ` [LTP] [PATCH 2/3] syscalls/alarm03: " Jinhui huang
2018-07-25 14:20   ` Cyril Hrubis
2018-07-25 14:52     ` Cyril Hrubis
2018-07-24 11:30 ` [LTP] [PATCH 3/3] syscalls/alarm07: " Jinhui huang
2018-07-25 13:48 ` Cyril Hrubis [this message]
2018-07-26  5:32   ` [LTP] [PATCH v2 1/2] syscalls/alarm02: " Jinhui huang
2018-07-26  5:32     ` [LTP] [PATCH v2 2/2] syscalls/alarm03: " Jinhui huang
2018-08-02 15:54     ` [LTP] [PATCH v2 1/2] syscalls/alarm02: " Cyril Hrubis
2018-08-06  5:11       ` [LTP] [PATCH v3] " Jinhui huang
2018-08-07  9:16         ` Cyril Hrubis

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=20180725134828.GB23890@rei \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.