SPAWNVEG(3)

πŸ“¦ version 93vu, in opensuse-leap 16.0

✨ SPAWNVEG(3) ✨

okay so bestie, we're talking about spawnveg from the Library Functions Manual β€” it's literally process spawn with process group and session control and it's giving main character energy for real πŸ’…


🌸 SYNOPSIS 🌸

#include <ast.h>

int spawnveg(const char* command, char** argv, char** envv, pid_t pgid);

πŸ¦‹ DESCRIPTION πŸ¦‹

so spwanveg (yes that's how it's spelled in the original, no I'm not fixing it, we respect the source 😭) combines fork(2), exec(2), setpgid(2) and setsid(2) into a single call. one call. iconic. periodt.

command, argv and envv are as in execve(2). and pgid is the vibe check for the new process group and session:

  • <0 β€” The new process becomes a session leader. is called in the child context. (yes the sentence is missing its subject in the original, we're keeping it exactly as-is, don't come for me πŸ™ˆ)
  • 0 β€” The new process is in the callers process group.
  • 1 β€” The new process becomes a process group leader.
  • >1 β€” The new process joins the process group pgid.

πŸŽ€ COMMENTS πŸŽ€

It is possible to code all process creation (except for vfork(2) hack like in csh(1)) using spawnveg. lowkey obsessed with how much this one function can do 🫢

The proc(3) routines and ksh(1) do this on systems that don't support fork(2). and this makes porting to NT and Windows a snap: a simple iffe(1) probe provides a spawnveg implementation using the NT or Windows process primitives. like, literally a snap. no cap πŸ”₯


πŸ‘‘ SEE ALSO πŸ‘‘

fork(2), exec(2), setpgid(2), setsid(2), spawnve(2)


and that's the whole page bestie, you ate that πŸ’– this was SPAWNVEG(3) from the Library Functions Manual, dated at the bottom with SPAWNVEG(3) β€” go forth and spawn responsibly 🌈✨

πŸ“¦ where this page comes from