[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add misc-utils/timeout utility
From: |
Li Zefan |
Subject: |
Re: [PATCH] Add misc-utils/timeout utility |
Date: |
Mon, 10 Mar 2008 09:26:02 +0900 |
User-agent: |
Thunderbird 2.0.0.12 (X11/20080226) |
> +/* TODO: merge with kill.c */
> +int arg_to_signum (char *arg)
> +{
> + int numsig;
> + char *ep;
> +
> + if (isdigit(*arg)) {
This check is unnecessary.
> + numsig = strtol(arg, &ep, 10);
> + if (*ep!='\0' || numsig<0 || numsig>=NSIG)
> + return -1;
> + return numsig;
> + }
> + return -1;
> +}
[..snip..]
> + } else {
> + alarm(timeout);
> +
> + /* We're just waiting for a single process here, so wait() suffices.
> + * Note the signal() calls above on linux and BSD at least,
> essentially
> + * call the lower level sigaction() with the SA_RESTART flag set,
> which
> + * ensures the following wait call will only return if the child
> exits,
> + * not on this process receiving a signal. Also we're not passing
> + * WUNTRACED | WCONTINUED to a waitpid() call and so will not get
> + * indication that the child has stopped or continued. */
> + int status;
Move this declaration above 'alarm(timeout)' ?
> + wait(&status);