Why does ksh93 use SIGALRM internally to implement sleep? It looks a
bit byzantine, aside from the issue that the code in
src/cmd/ksh93/sh/fault.c can never work, as intended:
if(shp->savesig)
{
/* critical region, save and process later */
if(!(shp->sigflag[sig]&SH_SIGIGNORE))
shp->savesig = sig;
return;
}
if(sig==SIGALRM && shp->bltinfun==b_sleep)
{
if(trap && *trap)
{
shp->trapnote |= SH_SIGTRAP;
shp->sigflag[sig] |= SH_SIGTRAP;
#ifdef _lib_sigaction
set_trapinfo(shp,sig,info);
#endif
}
return;
}
I can imagine so many problems caused by this.
1. if(shp->savesig)/return; - if this code is *ever* executed for a
signal we loose the siginfo data for this signal.
2. if(sig==SIGALRM && shp->bltinfun==b_sleep) happens only during
builtin sleep(1), but at the same time it cannot work because this is
an asynchronous timer signal which can happen at *any* time, while
being inside b_sleep(), or not. There is no guarantee by POSIX that it
should arrive exactly then.
IMO the whole byzantine SIGALRM code should be removed.
Olga
--
, _ _ ,
{ \/`o;====- Olga Kryzhanovska -====;o`\/ }
.----'-/`-/ [email protected] \-`\-'----.
`'-..-| / http://twitter.com/fleyta \ |-..-'`
/\/\ Solaris/BSD//C/C++ programmer /\/\
`--` `--`
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers