Hi Chester, Thanks a lot for your review comments.
I reworked on the fix to solve bash sleep issue and here attached the patch. >From include/bits/signum.h, #define SIG_DFL ((__sighandler_t) 0) /* Default action. */ In the attached patch fix, signal(SIGCHLD, SIG_DFL), SIG_DFL performs the default action to ignore the interrupt signal from child which informs the kernel that there is no user signal handler for the given signal, and default action to ignore the signal to terminate the program. Though SIG_IGN ignores the given signal, faced a side effect in bash sleep like it sleep for more seconds than the actual given seconds and it affects the behaviour in both background and active shell sleep process. With the attached fix, bash sleep works as expected. Please kindly review and suggest comments. Thanks, Thiruvadi Rajaraman
Fixes sleep issue in bash loadable builtins SIG_DFL simply ignores the interrupt signal Signed-off-by: Thiruvadi Rajaraman <trajara...@mvista.com> Index: bash-4.2/lib/sh/ufuncs.c =================================================================== --- bash-4.2.orig/lib/sh/ufuncs.c +++ bash-4.2/lib/sh/ufuncs.c @@ -20,6 +20,7 @@ #include "config.h" +#include <signal.h> #include "bashtypes.h" #if defined (TIME_WITH_SYS_TIME) @@ -89,6 +90,8 @@ fsleep(sec, usec) tv.tv_sec = sec; tv.tv_usec = usec; + + signal(SIGCHLD,SIG_DFL); /* Ignores the signal */ return select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &tv); }