Applied patch from Daniel Povey which should allow killall5/pidof to
avoid locking up if it encounters stopped or zombie processes
due to broken NFS mount points.
This should allow Debian bug #719273 to be closed.
Jesse Smith
5 years ago
16 | 16 | flag may not properly shut down network interfaces if the interface |
17 | 17 | does not have an IP address. |
18 | 18 | Addresses Debian bug #361935. |
19 | * Applied patch from Daniel Povey which should allow killall5/pidof to | |
20 | avoid locking up if it encounters stopped or zombie processes | |
21 | due to broken NFS mount points. | |
22 | This should allow Debian bug #719273 to be closed. | |
19 | 23 | |
20 | 24 | |
21 | 25 | sysvinit (2.91) world; urgency=low |
152 | 152 | .PP |
153 | 153 | When \fBinit\fP is requested to change the runlevel, it sends the |
154 | 154 | warning signal \s-1\fBSIGTERM\fP\s0 to all processes that are undefined |
155 | in the new runlevel. It then waits 5 seconds before forcibly | |
155 | in the new runlevel. It then waits 3 seconds before forcibly | |
156 | 156 | terminating these processes via the \s-1\fBSIGKILL\fP\s0 signal. |
157 | 157 | Note that \fBinit\fP assumes that all these processes (and their |
158 | 158 | descendants) remain in the same process group which \fBinit\fP |
177 | 177 | tell \fBinit\fP to switch to single user mode. |
178 | 178 | .IP "\fBU\fP or \fBu\fP" |
179 | 179 | tell \fBinit\fP to re-execute itself (preserving the state). No re-examining of |
180 | \fB/etc/inittab\fP file happens. Run level should be one of | |
180 | \fB/etc/inittab\fP file happens. Runlevel should be one of | |
181 | 181 | \fBSs0123456\fP |
182 | 182 | otherwise request would be silently ignored. |
183 | 183 | .PP |
2223 | 2223 | |
2224 | 2224 | /* |
2225 | 2225 | * We shouldn't be here, something failed. |
2226 | * Bitch, close the state pipe, unblock signals and return. | |
2226 | * Close the state pipe, unblock signals and return. | |
2227 | 2227 | */ |
2228 | 2228 | init_freeenv(env); |
2229 | 2229 | close(fd); |
483 | 483 | unsigned long startcode, endcode; |
484 | 484 | int pid, f; |
485 | 485 | ssize_t len; |
486 | char process_status[11]; | |
486 | 487 | |
487 | 488 | /* Open the /proc directory. */ |
488 | 489 | if (chdir("/proc") == -1) { |
566 | 567 | |
567 | 568 | /* Get session, startcode, endcode. */ |
568 | 569 | startcode = endcode = 0; |
570 | /* | |
569 | 571 | if (sscanf(q, "%*c %*d %*d %d %*d %*d %*u %*u " |
570 | 572 | "%*u %*u %*u %*u %*u %*d %*d " |
571 | 573 | "%*d %*d %*d %*d %*u %*u %*d " |
572 | 574 | "%*u %lu %lu", |
573 | 575 | &p->sid, &startcode, &endcode) != 3) { |
576 | */ | |
577 | if (sscanf(q, "%10s %*d %*d %d %*d %*d %*u %*u " | |
578 | "%*u %*u %*u %*u %*u %*d %*d " | |
579 | "%*d %*d %*d %*d %*u %*u %*d " | |
580 | "%*u %lu %lu", | |
581 | process_status, | |
582 | &p->sid, &startcode, &endcode) != 4) { | |
583 | ||
574 | 584 | p->sid = 0; |
575 | 585 | nsyslog(LOG_ERR, "can't read sid from %s\n", |
576 | 586 | path); |
585 | 595 | if (startcode == 0 && endcode == 0) |
586 | 596 | p->kernel = 1; |
587 | 597 | fclose(fp); |
598 | if ( (strchr(process_status, 'D') != NULL) || | |
599 | (strchr(process_status, 'Z') != NULL) ){ | |
600 | /* Ignore zombie processes or processes in | |
601 | disk sleep, as attempts | |
602 | to access the stats of these will | |
603 | sometimes fail. */ | |
604 | if (p->argv0) free(p->argv0); | |
605 | if (p->argv1) free(p->argv1); | |
606 | if (p->statname) free(p->statname); | |
607 | free(p); | |
608 | continue; | |
609 | } | |
588 | 610 | } else { |
589 | 611 | /* Process disappeared.. */ |
590 | 612 | if (p->argv0) free(p->argv0); |