sys_wait.h(7POSIX)

🌸 sys_wait.h β€” the POSIX Programmer's Manual era πŸ’–

okay bestie, so this is sys_wait.h(7POSIX), straight out of the POSIX Programmer's Manual. it's the header that handles all your waiting drama. let's get into it 🫢


✨ PROLOG ✨

okay so first thing, real talk: this manual page is part of the POSIX Programmer's Manual. but β€” and this is important β€” the Linux implementation of this interface may differ. so if you're on Linux, go consult the corresponding Linux manual page for the details of Linux behavior. or honestly? the interface may just not be implemented on Linux at all. vibe check accordingly 😭


πŸ‘‘ NAME πŸ‘‘

sys/wait.h β€” declarations for waiting πŸ’…


🌈 SYNOPSIS 🌈

#include <sys/wait.h>

that's it. one include. slay.


πŸ’œ DESCRIPTION πŸ’œ

okay so the <sys/wait.h> header shall define the following symbolic constants for use with waitpid():

  • WCONTINUED β€” report status of a continued child process πŸ¦‹
  • WNOHANG β€” do not hang if no status is available; return immediately ⚑
  • WUNTRACED β€” report status of a stopped child process πŸ›‘

and then the header shall define these macros for analysis of process status values:

  • WEXITSTATUS β€” return exit status
  • WIFCONTINUED β€” true if child has been continued
  • WIFEXITED β€” true if child exited normally
  • WIFSIGNALED β€” true if child exited due to uncaught signal
  • WIFSTOPPED β€” true if child is currently stopped
  • WSTOPSIG β€” return signal number that caused process to stop
  • WTERMSIG β€” return signal number that caused process to terminate

then the <sys/wait.h> header shall define these symbolic constants as possible values for the options argument to waitid():

  • WEXITED β€” wait for processes that have exited
  • WNOWAIT β€” keep the process whose status is returned in infop in a waitable state πŸ‘€
  • WSTOPPED β€” status is returned for any child that has stopped upon receipt of a signal

and listen β€” the WCONTINUED and WNOHANG constants described above for waitpid() can also be used with waitid(). multi-purpose icons fr fr ✨

the type idtype_t shall be defined as an enumeration type whose possible values shall include at least the following: P_ALL P_PGID P_PID

the <sys/wait.h> header shall define the id_t and pid_t types as described in <sys/types.h>.

the <sys/wait.h> header shall define the siginfo_t type and the sigval union as described in <signal.h>.

also, inclusion of the <sys/wait.h> header may also make visible all symbols from <signal.h>. surprise bonus content πŸŽ€

the following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

pid_t  wait(int *);
int    waitid(idtype_t, id_t, siginfo_t *, int);
pid_t  waitpid(pid_t, int *, int);

and then β€” the following sections are informative. (so like, notes, not rules πŸ’…)


πŸ’… APPLICATION USAGE πŸ’…

None.

like, literally none. nothing to add. iconic minimalism.


🧚 RATIONALE 🧚

None.

again β€” none. they said what they said.


⭐ FUTURE DIRECTIONS ⭐

None.

no plans. no changes. we're staying exactly as we are, bestie. periodt.


πŸ”₯ SEE ALSO πŸ”₯

  • <signal.h>
  • <sys_resource.h>
  • <sys_types.h>

and also: the System Interfaces volume of POSIX.1‐2017, wait(), waitid() 🫢


okay so legal bit, and I'm keeping every word because rules are rules:

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .

heads up bestie: if you spot a typo in here, it's almost definitely a conversion glitch, not the original. report it at the link above instead of fighting for your life in the group chat πŸ’€

and that's the whole page!! brought to you by IEEE/The Open Group, 2017 πŸ’– the sys_wait.h(7POSIX) girly herself. go forth and wait on your children processes responsibly, bestie. no cap, you ate this. πŸŒŸπŸ‘‘πŸ¦‹