📄 how-spawn-works.txt
字号:
Spawn.cc in cygwin handles spawn, vfork and exec calls. It does this viaa mode parameter that determines its behaviour with respect to thechild.Of particular interest is the exec behaviour.In general spawn_guts (where the action happens) does the following:* Finds the actual program being run (which may include path searching).* Determines the type (.exe, shell script, perl etc) and for non binaryprograms finds the correct interpreter.* Creates a commandline (based on the type and the user parameters).* Guesses at whether the binary that will be invoked is a cygwin programor not (if (real_path.iscygexec ())) and uses that information to copythe argv table, or to translate it for win32 program usage.* passes a handle to the parent to the child (note: this handle shouldhave it's rights restricted the daemon is merged).* Start the process.* if the mode is _P_OVERLAY (we are doing an exec)wait for the child toa) if it's a cygwin process, signal us via an event.b) if it's a win32 process, exit.c) exit.If a) occurs, we 'reparent' the child which makes it look to the currentprocess's parent in the pid and process group chains.b) is where the cygwin process hangs around as a 'stub' presenting it'spid as the win32 process's pid, to allow cygwin tools to kill the win32process.once a-c has occured, execution resumes.* If the mode is _P_OVERLAY, this process exits, otherwise it'sbehaviour depends on the mode parameter. See the last block ofspawn_guts.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -