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



> > 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.


Home | Main Index | Thread Index | Old Index