NetBSD-Users archive

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

Re: sh won't trap SIGHUP while waiting for jobs



On 8/21/15 10:41 AM, Timo Buhrmester wrote:
>>> I can't get /bin/sh to trap the SIGHUP signal on amd64 NetBSD
>>> 6.1_STABLE.  Does anyone know why?
> On a first glance, this seems to be bourne-shell specific.  At least ksh and bash both behave correctly.
> 
> Looking at the source, this part is likely what causes SIGINT to work:
> (from src/bin/sh/jobs.c in the `dowait` function, note that this is -current source)
> |	do {
> |		pid = waitproc(flags & WBLOCK, job, &status);
> |		TRACE(("wait returns pid %d, status %d\n", pid, status));
> |	} while (pid == -1 && errno == EINTR && gotsig[SIGINT - 1] == 0);
> 
> Note the special case granting SIGINT to exit the loop when waitproc (i.e. waitpid(2)) comes back with EINTR, while other signals are effectively ignored.

Hello, Timo.

Thank you for your analysis.  I think you're right; that explains it!

Regards,

Lewis


Home | Main Index | Thread Index | Old Index