sys_wait.h(0P)

πŸ’– sys_wait.h(0P) πŸ’–

okay bestie, welcome to the POSIX Programmer's Manual β€” this lil page is literally titled sys_wait.h(0P) and it's all about the header that handles waiting. iykyk, it's the one your shell is silently screaming into every time a child process does something.


✨ PROLOG ✨

so like, real talk first 🫢 β€” this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may be different (so pls go check the corresponding Linux manual page for the deets on Linux behavior), or honestly? the interface might not even be implemented on Linux at all. no cap. πŸ’€


🌸 NAME 🌸

sys/wait.h β€” declarations for waiting. that's it. that's the vibe. it declares the stuff you need so you can sit there and wait for your children (processes, bestie, processes πŸ™ˆ).


πŸŽ€ SYNOPSIS πŸŽ€

#include <sys/wait.h>

πŸ’… DESCRIPTION πŸ’…

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

  • WCONTINUED β€” report the status of a continued child process ✨
  • WNOHANG β€” do not hang if there's no status available; just return immediately, she's busy πŸ’…
  • WUNTRACED β€” report the status of a stopped child process

and the <sys/wait.h> header shall define these macros for analyzing process status values (the little decoder ring of process feelings πŸ”):

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

and 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 psst, the WCONTINUED and WNOHANG constants that we described above for waitpid()? yeah, those can also be used with waitid(). two-for-one deal, we love to see it πŸ”₯


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 β€” main character enum energy fr fr πŸ‘‘

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>.

heads up: including 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. (yes, all of them, we're not skipping anything bestie πŸ’–)

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

and just so you know: the following sections are informative. (translation: they're the chill ones, not the rule-making ones 🌈)


🌷 APPLICATION USAGE 🌷

None. literally nothing. empty. a void. she said nothing and meant it 🫢


πŸ¦‹ RATIONALE πŸ¦‹

None. also nothing. iconic silence honestly ✨


🌈 FUTURE DIRECTIONS 🌈

None. no future plans, just vibes 🧚


πŸ’œ SEE ALSO πŸ’œ

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

and the System Interfaces volume of POSIX.1‐2017, wait(), waitid() β€” go read those, they're the whole point bestie πŸ“š


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 .


okay that's the whole page, bestie, we ate and left no crumbs πŸ’…βœ¨

this masterpiece was served to you by IEEE/The Open Group, dated 2017, under the name sys_wait.h(0P). periodt. πŸŽ€πŸ’–πŸŒΈ
πŸ“¦ where this page comes from