bug-bash
[Top][All Lists]
Advanced

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

sleep & Co on Linux (was: disown, fg, jobs)


From: Sven Mascheck
Subject: sleep & Co on Linux (was: disown, fg, jobs)
Date: 21 Jun 2001 15:28:34 +0200
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (SunOS/5.8 (sun4u))

Paul Jarc <prj@po.cwru.edu> wrote:
> Dan Jacobson <jidanni@kimo.FiXcomTHiS.tw> writes:

>> Is there something funny going on here in bash 2.04?:
> No, that output looks normal.

It looks rather unexpected.
AFAIK, this only happens on Linux.

> [...] don't expect us to guess what.

I agree with you, he could have been more to the point.

The example was also misleading (not related with disown),
on Linux it's just:

$ sleep 100
^Z
[1]+ Stopped    sleep 100
$ fg
$

I.e., the sleep(1) is *terminating* on SIGCONT (it sort of died
already on SIGSTOP/TSTP).

The reason is sleep(1) using glibc sleep(3) using nanosleep(2).

This would not happen if sleep(1) used alarm(2) or looked at the return
value of sleep(3) (not common practice) - or if bash had a built-in,
doing one of both, like ksh93 (which uses alarm(2) and works fine)

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

There are too many parties involved (utilities, glibc, kernel), so i guess
this will unecessarily still "live" for a while.

Sven



reply via email to

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