Mercurial > emacs
comparison src/process.c @ 14131:7717b68abd2e
(create_process): Restore the signal state
after vfork whether it succeeds or not.
| author | Karl Heuer <kwzh@gnu.org> |
|---|---|
| date | Tue, 09 Jan 1996 23:40:33 +0000 |
| parents | 85ce7bab31dc |
| children | ee40177f6c68 |
comparison
equal
deleted
inserted
replaced
| 14130:99ab26698ab0 | 14131:7717b68abd2e |
|---|---|
| 1517 #endif /* not WINDOWSNT */ | 1517 #endif /* not WINDOWSNT */ |
| 1518 } | 1518 } |
| 1519 environ = save_environ; | 1519 environ = save_environ; |
| 1520 } | 1520 } |
| 1521 | 1521 |
| 1522 /* This runs in the Emacs process. */ | |
| 1522 if (pid < 0) | 1523 if (pid < 0) |
| 1523 { | 1524 { |
| 1524 if (forkin >= 0) | 1525 if (forkin >= 0) |
| 1525 close (forkin); | 1526 close (forkin); |
| 1526 if (forkin != forkout && forkout >= 0) | 1527 if (forkin != forkout && forkout >= 0) |
| 1527 close (forkout); | 1528 close (forkout); |
| 1528 report_file_error ("Doing vfork", Qnil); | 1529 } |
| 1529 } | 1530 else |
| 1530 | 1531 { |
| 1531 XSETFASTINT (XPROCESS (process)->pid, pid); | 1532 /* vfork succeeded. */ |
| 1533 XSETFASTINT (XPROCESS (process)->pid, pid); | |
| 1532 | 1534 |
| 1533 #ifdef WINDOWSNT | 1535 #ifdef WINDOWSNT |
| 1534 register_child (pid, inchannel); | 1536 register_child (pid, inchannel); |
| 1535 #endif /* WINDOWSNT */ | 1537 #endif /* WINDOWSNT */ |
| 1536 | 1538 |
| 1537 /* If the subfork execv fails, and it exits, | 1539 /* If the subfork execv fails, and it exits, |
| 1538 this close hangs. I don't know why. | 1540 this close hangs. I don't know why. |
| 1539 So have an interrupt jar it loose. */ | 1541 So have an interrupt jar it loose. */ |
| 1540 stop_polling (); | 1542 stop_polling (); |
| 1541 signal (SIGALRM, create_process_1); | 1543 signal (SIGALRM, create_process_1); |
| 1542 alarm (1); | 1544 alarm (1); |
| 1543 XPROCESS (process)->subtty = Qnil; | 1545 XPROCESS (process)->subtty = Qnil; |
| 1544 if (forkin >= 0) | 1546 if (forkin >= 0) |
| 1545 close (forkin); | 1547 close (forkin); |
| 1546 alarm (0); | 1548 alarm (0); |
| 1547 start_polling (); | 1549 start_polling (); |
| 1548 if (forkin != forkout && forkout >= 0) | 1550 if (forkin != forkout && forkout >= 0) |
| 1549 close (forkout); | 1551 close (forkout); |
| 1550 | 1552 |
| 1551 #ifdef HAVE_PTYS | 1553 #ifdef HAVE_PTYS |
| 1552 if (pty_flag) | 1554 if (pty_flag) |
| 1553 XPROCESS (process)->tty_name = build_string (pty_name); | 1555 XPROCESS (process)->tty_name = build_string (pty_name); |
| 1554 else | 1556 else |
| 1555 #endif | 1557 #endif |
| 1556 XPROCESS (process)->tty_name = Qnil; | 1558 XPROCESS (process)->tty_name = Qnil; |
| 1557 | 1559 } |
| 1560 | |
| 1561 /* Restore the signal state whether vfork succeeded or not. | |
| 1562 (We will signal an error, below, if it failed.) */ | |
| 1558 #ifdef POSIX_SIGNALS | 1563 #ifdef POSIX_SIGNALS |
| 1559 #ifdef HAVE_VFORK | 1564 #ifdef HAVE_VFORK |
| 1560 /* Restore the parent's signal handlers. */ | 1565 /* Restore the parent's signal handlers. */ |
| 1561 sigaction (SIGINT, &sigint_action, 0); | 1566 sigaction (SIGINT, &sigint_action, 0); |
| 1562 sigaction (SIGQUIT, &sigquit_action, 0); | 1567 sigaction (SIGQUIT, &sigquit_action, 0); |
| 1583 #endif | 1588 #endif |
| 1584 #endif /* ordinary USG */ | 1589 #endif /* ordinary USG */ |
| 1585 #endif /* not BSD4_1 */ | 1590 #endif /* not BSD4_1 */ |
| 1586 #endif /* SIGCHLD */ | 1591 #endif /* SIGCHLD */ |
| 1587 #endif /* !POSIX_SIGNALS */ | 1592 #endif /* !POSIX_SIGNALS */ |
| 1593 | |
| 1594 /* Now generate the error if vfork failed. */ | |
| 1595 if (pid < 0) | |
| 1596 report_file_error ("Doing vfork", Qnil); | |
| 1588 } | 1597 } |
| 1589 #endif /* not VMS */ | 1598 #endif /* not VMS */ |
| 1590 | 1599 |
| 1591 #ifdef HAVE_SOCKETS | 1600 #ifdef HAVE_SOCKETS |
| 1592 | 1601 |
