Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Exit status
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===POSIX=== In [[Unix]] and other [[POSIX|POSIX-compatible systems]], the parent process can retrieve the exit status of a child process using the <code>[[Wait (system call)|wait()]]</code> family of system calls defined in [[wait.h]].<ref name="BD_syswait"/> Of these, the <code>waitid()</code><ref name="SH_waitid"/> call retrieves the full exit status, but the older <code>wait()</code> and <code>waitpid()</code><ref name="SH_wait"/> calls retrieve only the least significant 8 bits of the exit status. The <code>wait()</code> and <code>waitpid()</code> interfaces set a ''status'' value of type <code>int</code> packed as a [[bitfield]] with various types of child termination information. If the child terminated by exiting (as determined by the <code>WIFEXITED()</code> macro; the usual alternative being that it died from an uncaught [[signal (computing)|signal]]), [[Single UNIX Specification|SUS]] specifies that the low-order 8 bits of the exit status can be retrieved from the status value using the <code>WEXITSTATUS()</code> macro. In the <code>waitid()</code> system call (added with SUSv1), the child exit status and other information are no longer in a bitfield but in the structure of type <code>siginfo_t</code>.<ref name="OpenGroup"/> POSIX-compatible systems typically use a convention of zero for success and nonzero for error.<ref name="ExitStatus"/> Some conventions have developed as to the relative meanings of various error codes; for example GNU recommend that codes with the high bit set be reserved for serious errors.<ref name="glibc"/> BSD-derived OS's have defined an extensive set of preferred interpretations: Meanings for 15 status codes 64 through 78 are defined in [[sysexits.h]].<ref name="FreeBSD"/> These historically derive from [[sendmail]] and other [[message transfer agent]]s, but they have since found use in many other programs.<ref name="sysexits"/> It has been deprecated and its use is discouraged.<ref name="FreeBSD"/> The Advanced Bash-Scripting Guide has some information on the meaning of non-0 exit status codes.<ref name="SpecialMeanings"/>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)