mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 10:18:31 +00:00
Overhaul process spawning
This commit is contained in:
parent
99dc1281f5
commit
26e254fb4d
96 changed files with 1848 additions and 1541 deletions
|
@ -26,6 +26,10 @@
|
|||
|
||||
/**
|
||||
* Changes process group for process.
|
||||
*
|
||||
* @param pid is process id (may be zero for current process)
|
||||
* @param pgid is process group id (may be zero for current process)
|
||||
* @return 0 on success, or -1 w/ errno
|
||||
* @vforksafe
|
||||
*/
|
||||
int setpgid(int pid, int pgid) {
|
||||
|
@ -35,16 +39,14 @@ int setpgid(int pid, int pgid) {
|
|||
} else {
|
||||
me = getpid();
|
||||
if ((!pid || pid == me) && (!pgid || pgid == me)) {
|
||||
/*
|
||||
* "When a process is created with CREATE_NEW_PROCESS_GROUP
|
||||
* specified, an implicit call to SetConsoleCtrlHandler(NULL,TRUE)
|
||||
* is made on behalf of the new process; this means that the new
|
||||
* process has CTRL+C disabled. This lets shells handle CTRL+C
|
||||
* themselves, and selectively pass that signal on to
|
||||
* sub-processes. CTRL+BREAK is not disabled, and may be used to
|
||||
* interrupt the process/process group."
|
||||
* ──Quoth MSDN § CreateProcessW()
|
||||
*/
|
||||
// "When a process is created with kNtCreateNewProcessGroup
|
||||
// specified, an implicit call to SetConsoleCtrlHandler(NULL,TRUE)
|
||||
// is made on behalf of the new process; this means that the new
|
||||
// process has CTRL+C disabled. This lets shells handle CTRL+C
|
||||
// themselves, and selectively pass that signal on to
|
||||
// sub-processes. CTRL+BREAK is not disabled, and may be used to
|
||||
// interrupt the process/process group."
|
||||
// ──Quoth MSDN § CreateProcessW()
|
||||
if (SetConsoleCtrlHandler(0, 1)) {
|
||||
rc = 0;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue