bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C-z fg bg sees thru scripts to affect sleep


From: Sven Mascheck
Subject: Re: C-z fg bg sees thru scripts to affect sleep
Date: 31 Oct 2001 17:30:02 +0100
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (SunOS/5.8 (sun4u))

Chet Ramey <chet@nike.ins.cwru.edu> wrote:

> When you type ^Z, all processes in the shell script's process group get
> the signal.  This includes the `sleep', which immediately terminates.

But to my best knowledge, *Linux* is the only system, where this happens ;-)

- there, sleep(3) calls nanosleep(2), but apparently it should not,
  because this returns with EINTR on SIGCONT.
- sleep(1) doesn't look at the return value of sleep(3) (unslept time),
  perhaps it should, but almost nobody does in this concern, anyway.
- One could also implement a sleep built-in, e.g. using alarm(2) instead
  of nanosleep(2).  ksh93(1) does so, btw.

I'd expect sleep(1)/(3) (when not running with realtime capabilities)
to *stop transparently* on SIGTSTP/SIGSTOP, i.e. to be more robust.
Debugging with ptrace(2) is also affected, btw.  In reality, all this
might not be *that* important.

Sven
-- 
<http://www.uni-ulm.de/~s_smasch/various/nanosleep_linux/>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]