diff options
| author | Richard M. Stallman | 1993-05-21 23:42:36 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-05-21 23:42:36 +0000 |
| commit | 4c8975adc59705c9620aa8816e0982dc47ab456b (patch) | |
| tree | cc09faf8aa9ffa249dc5705a70da7aa3b8f37c8d /src | |
| parent | 02a76f8aca37c597d988e54ac946849abefe41ce (diff) | |
| download | emacs-4c8975adc59705c9620aa8816e0982dc47ab456b.tar.gz emacs-4c8975adc59705c9620aa8816e0982dc47ab456b.zip | |
(wait_for_termination): Copy code from 18.59 (but sans BSD4_1 alternatives).
Diffstat (limited to 'src')
| -rw-r--r-- | src/sysdep.c | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index 79bac258c3b..933f599bbc9 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -314,16 +314,49 @@ wait_for_termination (pid) | |||
| 314 | status = SYS$FORCEX (&pid, 0, 0); | 314 | status = SYS$FORCEX (&pid, 0, 0); |
| 315 | break; | 315 | break; |
| 316 | #else /* not VMS */ | 316 | #else /* not VMS */ |
| 317 | 317 | #if defined (BSD) || (defined (HPUX) && !defined (HPUX_5)) | |
| 318 | /* Exit if the process has terminated. */ | 318 | /* Note that kill returns -1 even if the process is just a zombie now. |
| 319 | if (!synch_process_alive) | 319 | But inevitably a SIGCHLD interrupt should be generated |
| 320 | and child_sig will do wait3 and make the process go away. */ | ||
| 321 | /* There is some indication that there is a bug involved with | ||
| 322 | termination of subprocesses, perhaps involving a kernel bug too, | ||
| 323 | but no idea what it is. Just as a hunch we signal SIGCHLD to see | ||
| 324 | if that causes the problem to go away or get worse. */ | ||
| 325 | sigsetmask (sigmask (SIGCHLD)); | ||
| 326 | if (0 > kill (pid, 0)) | ||
| 327 | { | ||
| 328 | sigsetmask (SIGEMPTYMASK); | ||
| 329 | kill (getpid (), SIGCHLD); | ||
| 330 | break; | ||
| 331 | } | ||
| 332 | if (wait_debugging) | ||
| 333 | sleep (1); | ||
| 334 | else | ||
| 335 | sigpause (SIGEMPTYMASK); | ||
| 336 | #else /* not BSD, and not HPUX version >= 6 */ | ||
| 337 | #ifdef UNIPLUS | ||
| 338 | if (0 > kill (pid, 0)) | ||
| 320 | break; | 339 | break; |
| 321 | /* Otherwise wait 1 second or until a signal comes in. */ | 340 | wait (0); |
| 322 | signal (SIGALRM, wait_for_termination_signal); | 341 | #else /* neither BSD nor UNIPLUS: random sysV */ |
| 323 | alarm (1); | 342 | #ifdef HAVE_SYSV_SIGPAUSE |
| 324 | pause (); | 343 | sighold (SIGCHLD); |
| 325 | alarm (0); | 344 | if (0 > kill (pid, 0)) |
| 326 | signal (SIGALRM, SIG_IGN); | 345 | { |
| 346 | sigrelse (SIGCHLD); | ||
| 347 | break; | ||
| 348 | } | ||
| 349 | sigpause (SIGCHLD); | ||
| 350 | #else /* not HAVE_SYSV_SIGPAUSE */ | ||
| 351 | if (0 > kill (pid, 0)) | ||
| 352 | break; | ||
| 353 | /* Using sleep instead of pause avoids timing error. | ||
| 354 | If the inferior dies just before the sleep, | ||
| 355 | we lose just one second. */ | ||
| 356 | sleep (1); | ||
| 357 | #endif /* not HAVE_SYSV_SIGPAUSE */ | ||
| 358 | #endif /* not UNIPLUS */ | ||
| 359 | #endif /* not BSD, and not HPUX version >= 6 */ | ||
| 327 | #endif /* not VMS */ | 360 | #endif /* not VMS */ |
| 328 | #else /* not subprocesses */ | 361 | #else /* not subprocesses */ |
| 329 | #ifndef BSD4_1 | 362 | #ifndef BSD4_1 |