da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.ie \\$3 .ft \\$1
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.nr ;G \\n(.f
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.ft \\n(;G \}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.de EX \" start example
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.ta 1i 2i 3i 4i 5i 6i
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.de EE \" end example
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.TH SPAWNVEG 3
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinspawnveg \- process spawn with process group and session control
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.SH SYNOPSIS
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.L "#include <ast.h>"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.L "int spawnveg(const char* command, char** argv, char** envv, pid_t pgid);"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.SH DESCRIPTION
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.L spwanveg
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR fork (2),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR exec (2),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR setpgid (2)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR setsid (2)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chininto a single call.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LR command ,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR execve (2).
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chincontrols the new process group and session:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe new process becomes a session leader.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinis called in the child context.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe new process is in the callers process group.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe new process becomes a process group leader.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe new process joins the process group
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.SH COMMENTS
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinIt is possible to code all process creation (except for
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR vfork (2)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinhack like in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR csh (1))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.LR spawnveg .
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR proc (3)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinroutines and
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR ksh (1)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chindo this on systems that don't support
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR fork (2).
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThis makes porting to NT and Windows a snap: a simple
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR iffe (1)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinprobe provides a
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.L spawnveg
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinimplementation using the NT or Windows process primitives.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.SH "SEE ALSO"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinfork(2), exec(2), setpgid(2), setsid(2), spawnve(2)