<!DOCTYPE html>
<html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-0 vector-toc-not-available vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-0 skin-theme-clientpref-os vector-sticky-header-enabled" lang="en" dir="ltr"><head>
    <meta charset="UTF-8">
    <title>Unistd.h</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" type="image/png" href="./_res_/favicon.png">
    <link rel="canonical" href="https://en.wikipedia.org/wiki/Unistd.h"> <link href="./_mw_/ext.cite.styles.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/ext.wikimediamessages.styles.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/skins.vector.icons.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/skins.vector.styles.css" rel="stylesheet" type="text/css">
    <meta name="ResourceLoaderDynamicStyles" content="">
    
    <link rel="stylesheet" type="text/css" href="./_mw_/site.styles.css">
    <link rel="stylesheet" type="text/css" href="./_mw_/noscript.css">
    <link rel="stylesheet" type="text/css" href="./_res_/footer.css">
    <link rel="stylesheet" type="text/css" href="./_res_/vector-2022.css">
  </head>
  <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Unistd_h rootpage-Unistd_h skin-vector-2022 action-view">
    <div class="mw-page-container">
      <div class="mw-page-container-inner">
        <div class="mw-content-container">
          <main id="content" class="mw-body">
            <header class="mw-body-header vector-page-titlebar">
              <h1 id="firstHeading" class="firstHeading mw-first-heading">unistd.h</h1>
            </header>
            <a id="top"></a>
            <div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
              <div id="contentSub">
                <div id="mw-content-subtitle"></div>
              </div>
              <div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<p class="mw-empty-elt">

</p>
<style data-mw-deduplicate="TemplateStyles:r1305433154">
/* start https://en.wikipedia.org/ */


.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}


/* end   https://en.wikipedia.org/ */
</style>
<style data-mw-deduplicate="TemplateStyles:r1333133064">
/* start https://en.wikipedia.org/ */


.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:": "}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:"\a0 · ";font-weight:bold}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist dd dd:first-child::before,.mw-parser-output .hlist dd dt:first-child::before,.mw-parser-output .hlist dd li:first-child::before,.mw-parser-output .hlist dt dd:first-child::before,.mw-parser-output .hlist dt dt:first-child::before,.mw-parser-output .hlist dt li:first-child::before,.mw-parser-output .hlist li dd:first-child::before,.mw-parser-output .hlist li dt:first-child::before,.mw-parser-output .hlist li li:first-child::before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child::after,.mw-parser-output .hlist dd dt:last-child::after,.mw-parser-output .hlist dd li:last-child::after,.mw-parser-output .hlist dt dd:last-child::after,.mw-parser-output .hlist dt dt:last-child::after,.mw-parser-output .hlist dt li:last-child::after,.mw-parser-output .hlist li dd:last-child::after,.mw-parser-output .hlist li dt:last-child::after,.mw-parser-output .hlist li li:last-child::after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:" ("counter(listitem)"\a0 "}


/* end   https://en.wikipedia.org/ */
</style><style data-mw-deduplicate="TemplateStyles:r1246091330">
/* start https://en.wikipedia.org/ */


.mw-parser-output .sidebar{width:22em;float:right;clear:right;margin:0.5em 0 1em 1em;background:var(--background-color-neutral-subtle,#f8f9fa);border:1px solid var(--border-color-base,#a2a9b1);padding:0.2em;text-align:center;line-height:1.4em;font-size:88%;border-collapse:collapse;display:table}body.skin-minerva .mw-parser-output .sidebar{display:table!important;float:right!important;margin:0.5em 0 1em 1em!important}.mw-parser-output .sidebar-subgroup{width:100%;margin:0;border-spacing:0}.mw-parser-output .sidebar-left{float:left;clear:left;margin:0.5em 1em 1em 0}.mw-parser-output .sidebar-none{float:none;clear:both;margin:0.5em 1em 1em 0}.mw-parser-output .sidebar-outer-title{padding:0 0.4em 0.2em;font-size:125%;line-height:1.2em;font-weight:bold}.mw-parser-output .sidebar-top-image{padding:0.4em}.mw-parser-output .sidebar-top-caption,.mw-parser-output .sidebar-pretitle-with-top-image,.mw-parser-output .sidebar-caption{padding:0.2em 0.4em 0;line-height:1.2em}.mw-parser-output .sidebar-pretitle{padding:0.4em 0.4em 0;line-height:1.2em}.mw-parser-output .sidebar-title,.mw-parser-output .sidebar-title-with-pretitle{padding:0.2em 0.8em;font-size:145%;line-height:1.2em}.mw-parser-output .sidebar-title-with-pretitle{padding:0.1em 0.4em}.mw-parser-output .sidebar-image{padding:0.2em 0.4em 0.4em}.mw-parser-output .sidebar-heading{padding:0.1em 0.4em}.mw-parser-output .sidebar-content{padding:0 0.5em 0.4em}.mw-parser-output .sidebar-content-with-subgroup{padding:0.1em 0.4em 0.2em}.mw-parser-output .sidebar-above,.mw-parser-output .sidebar-below{padding:0.3em 0.8em;font-weight:bold}.mw-parser-output .sidebar-collapse .sidebar-above,.mw-parser-output .sidebar-collapse .sidebar-below{border-top:1px solid #aaa;border-bottom:1px solid #aaa}.mw-parser-output .sidebar-navbar{text-align:right;font-size:115%;padding:0 0.4em 0.4em}.mw-parser-output .sidebar-list-title{padding:0 0.4em;text-align:left;font-weight:bold;line-height:1.6em;font-size:105%}.mw-parser-output .sidebar-list-title-c{padding:0 0.4em;text-align:center;margin:0 3.3em}@media(max-width:640px){body.mediawiki .mw-parser-output .sidebar{width:100%!important;clear:both;float:none!important;margin-left:0!important;margin-right:0!important}}body.skin--responsive .mw-parser-output .sidebar a>img{max-width:none!important}@media screen{html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-list-title,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle{background:transparent!important}html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle a{color:var(--color-progressive)!important}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-list-title,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle{background:transparent!important}html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle a{color:var(--color-progressive)!important}}@media print{body.ns-0 .mw-parser-output .sidebar{display:none!important}}


/* end   https://en.wikipedia.org/ */
</style><style data-mw-deduplicate="TemplateStyles:r1238255008">
/* start https://en.wikipedia.org/ */


.mw-parser-output .c-posix-library .sidebar-content{text-align:left}


/* end   https://en.wikipedia.org/ */
</style><table class="sidebar nomobile nowraplinks c-posix-library" role="navigation"><tbody><tr><th class="sidebar-title"><a href="C_POSIX_library" title="C POSIX library">C POSIX library</a></th></tr><tr><td class="sidebar-content">
<ul><li><code>&lt;<a href="Assert.h" title="Assert.h">assert.h</a>&gt;</code></li>
<li><code>&lt;<a href="Complex.h" class="mw-redirect" title="Complex.h">complex.h</a>&gt;</code></li>
<li><code>&lt;<a href="Ctype.h" class="mw-redirect" title="Ctype.h">ctype.h</a>&gt;</code></li>
<li><code>&lt;<a href="Dirent.h" class="mw-redirect" title="Dirent.h">dirent.h</a>&gt;</code></li>
<li><code>&lt;<a href="Dlfcn.h" class="mw-redirect" title="Dlfcn.h">dlfcn.h</a>&gt;</code></li>
<li><code>&lt;<a href="Errno.h" title="Errno.h">errno.h</a>&gt;</code></li>
<li><code>&lt;<a href="Fcntl.h" class="mw-redirect" title="Fcntl.h">fcntl.h</a>&gt;</code></li>
<li><code>&lt;<a href="Fenv.h" class="mw-redirect" title="Fenv.h">fenv.h</a>&gt;</code></li>
<li><code>&lt;<a href="Float.h" class="mw-redirect" title="Float.h">float.h</a>&gt;</code></li>
<li><code>&lt;<a href="Inttypes.h" class="mw-redirect" title="Inttypes.h">inttypes.h</a>&gt;</code></li>
<li><code>&lt;<a href="Iso646.h" class="mw-redirect" title="Iso646.h">iso646.h</a>&gt;</code></li>
<li><code>&lt;<a href="Limits.h" class="mw-redirect" title="Limits.h">limits.h</a>&gt;</code></li>
<li><code>&lt;<a href="Locale.h" class="mw-redirect" title="Locale.h">locale.h</a>&gt;</code></li>
<li><code>&lt;<a href="Math.h" class="mw-redirect" title="Math.h">math.h</a>&gt;</code></li>
<li><code>&lt;<a href="Pthread.h" class="mw-redirect" title="Pthread.h">pthread.h</a>&gt;</code></li>
<li><code>&lt;<a href="Setjmp.h" title="Setjmp.h">setjmp.h</a>&gt;</code></li>
<li><code>&lt;<a href="Signal.h" class="mw-redirect" title="Signal.h">signal.h</a>&gt;</code></li>
<li><code>&lt;<a href="Stdarg.h" title="Stdarg.h">stdarg.h</a>&gt;</code></li>
<li><code>&lt;<a href="Stdbool.h" class="mw-redirect" title="Stdbool.h">stdbool.h</a>&gt;</code></li>
<li><code>&lt;<a href="Stddef.h" class="mw-redirect" title="Stddef.h">stddef.h</a>&gt;</code></li>
<li><code>&lt;<a href="Stdint.h" class="mw-redirect" title="Stdint.h">stdint.h</a>&gt;</code></li>
<li><code>&lt;<a href="Stdio.h" class="mw-redirect" title="Stdio.h">stdio.h</a>&gt;</code></li>
<li><code>&lt;<a href="Stdlib.h" class="mw-redirect" title="Stdlib.h">stdlib.h</a>&gt;</code></li>
<li><code>&lt;<a href="String.h" class="mw-redirect" title="String.h">string.h</a>&gt;</code></li>
<li><code>&lt;<a href="Sys/stat.h" class="mw-redirect" title="Sys/stat.h">sys/stat.h</a>&gt;</code></li>
<li><code>&lt;<a href="Tgmath.h" class="mw-redirect" title="Tgmath.h">tgmath.h</a>&gt;</code></li>
<li><code>&lt;<a href="Time.h" class="mw-redirect" title="Time.h">time.h</a>&gt;</code></li>
<li><code>&lt;<a class="mw-selflink selflink">unistd.h</a>&gt;</code></li>
<li><code>&lt;<a href="Utime.h" class="mw-redirect" title="Utime.h">utime.h</a>&gt;</code></li>
<li><code>&lt;<a href="Wchar.h" class="mw-redirect" title="Wchar.h">wchar.h</a>&gt;</code></li>
<li><code>&lt;<a href="Wctype.h" class="mw-redirect" title="Wctype.h">wctype.h</a>&gt;</code></li></ul></td>
</tr><tr><td class="sidebar-navbar"><style data-mw-deduplicate="TemplateStyles:r1239400231">
/* start https://en.wikipedia.org/ */


.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}


/* end   https://en.wikipedia.org/ */
</style></td></tr></tbody></table>
<p>In the <a href="C_programming_language" class="mw-redirect" title="C programming language">C</a> and <a href="C%2B%2B" title="C++">C++</a> programming languages, <code><b>&lt;unistd.h&gt;</b></code> is the name of the <a href="Header_file" class="mw-redirect" title="Header file">header file</a> that provides access to the <a href="POSIX" title="POSIX">POSIX</a> <a href="Operating_system" title="Operating system">operating system</a> <a href="Application_programming_interface" class="mw-redirect" title="Application programming interface">API</a>.<sup id="cite_ref-unistd.h_1-0" class="reference"><a href="#cite_note-unistd.h-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> It is defined by the POSIX.1 standard, the base of the <a href="Single_Unix_Specification" class="mw-redirect" title="Single Unix Specification">Single Unix Specification</a>, and should therefore be available in any POSIX-compliant operating system and <a href="Compiler" title="Compiler">compiler</a>. For instance, this includes <a href="Unix" title="Unix">Unix</a> and <a href="Unix-like" title="Unix-like">Unix-like</a> operating systems, such as <a href="GNU_variants" title="GNU variants">GNU variants</a>, distributions of <a href="Linux" title="Linux">Linux</a> and <a href="BSD" class="mw-redirect" title="BSD">BSD</a>, and <a href="MacOS" title="MacOS">macOS</a>, and compilers such as <a href="GNU_Compiler_Collection" title="GNU Compiler Collection">GCC</a> and <a href="LLVM" title="LLVM">LLVM</a>.
</p><p>On Unix-like systems, the interface defined by <code>&lt;unistd.h&gt;</code> is typically made up largely of <a href="System_call#The_library_as_an_intermediary" title="System call">system call wrapper functions</a> such as <code><a href="Fork_(operating_system)" class="mw-redirect" title="Fork (operating system)">fork</a></code>, <code><a href="Pipeline_(Unix)" title="Pipeline (Unix)">pipe</a></code> and <a href="Input/output" title="Input/output">I/O</a> primitives (<code>read</code>, <code>write</code>, <code>close</code>, etc.).
</p><p>Unix compatibility layers such as <a href="Cygwin" title="Cygwin">Cygwin</a> and <a href="MinGW" title="MinGW">MinGW</a> also provide their own versions of <code>&lt;unistd.h&gt;</code>. In fact, those systems provide it along with the translation libraries that implement its functions in terms of win32 functions. E.g. In Cygwin, a header file can be found in <code>/usr/include</code> that sub-includes a file of the same name in <code>/usr/include/sys</code>. Not everything is defined in there but some definitions are done by references to the GNU C standard library headers (like <a href="Stddef.h" class="mw-redirect" title="Stddef.h"><style data-mw-deduplicate="TemplateStyles:r886049734">
/* start https://en.wikipedia.org/ */


'"`UNIQ--templatestyles-00000010-QINU`"'


/* end   https://en.wikipedia.org/ */
</style><span class="monospaced">&lt;stddef.h&gt;</span></a>) which provide the type <a href="Size_t" class="mw-redirect" title="Size t"><span class="monospaced">size_t</span></a> and many more. Thus, <code>&lt;unistd.h&gt;</code> is only a generically defined adaptive layer that might be based upon already existing system and compiler specific definitions. This has the general advantage of not having a possibly concurrent set of header file defined, but one that is built upon the same root which, for this reason, will raise much fewer concerns in combined usage cases.
</p>
<div class="mw-heading mw-heading2"><h2 id="Overview_of_functions">Overview of functions</h2></div>
<table class="wikitable" style="font-size:0.85em">
<tbody><tr>
<th>
</th>
<th>Function
</th>
<th>Description
</th></tr>
<tr>
<th rowspan="8">
</th></tr>
<tr>
<td><span class="anchor" id="crypt"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/crypt.3.html">crypt</a></code>
</td>
<td>password and data <a href="Encryption" title="Encryption">encryption</a>
</td></tr>
<tr>
<td><span class="anchor" id="encrypt"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/encrypt.3.html">encrypt</a></code>
</td>
<td>encrypt 64-byte messages
</td></tr>
<tr>
<td><span class="anchor" id="gethostid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/gethostid.3.html">gethostid</a></code>
</td>
<td>get the unique identifier of the current host
</td></tr>
<tr>
<td><span class="anchor" id="gethostname"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/gethostname.2.html">gethostname</a></code>
</td>
<td>get <a href="Hostname" title="Hostname">hostname</a>
</td></tr>
<tr>
<td><span class="anchor" id="getopt"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/getopt.3.html">getopt</a></code>
</td>
<td>parse <a href="Command-line_interface" title="Command-line interface"> command-line options</a>
</td></tr>
<tr>
<td><span class="anchor" id="swab"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/swab.3.html">swab</a></code>
</td>
<td>swap adjacent bytes
</td></tr>
<tr>
<td><span class="anchor" id="sysconf"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/sysconf.3.html">sysconf</a></code>
</td>
<td>get configuration at run time
</td></tr>
<tr>
<th rowspan="2">Signals
</th>
<td><span class="anchor" id="alarm"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/alarm.3p.html">alarm</a></code>
</td>
<td>schedule an alarm <a href="Signal_(IPC)" title="Signal (IPC)"> signal</a>
</td></tr>
<tr>
<td><span class="anchor" id="pause"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/pause.2.html">pause</a></code>
</td>
<td>wait for signal
</td></tr>
<tr>
<th rowspan="23">Filesystem
</th>
<td><span class="anchor" id="access"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/access.2.html">access</a></code><br><span class="anchor" id="faccessat"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/access.2.html">faccessat</a></code><br><span class="anchor" id="faccessat2"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/access.2.html">faccessat2</a></code>
</td>
<td>check user's <a href="File_system_permissions#Traditional_Unix_permissions" class="mw-redirect" title="File system permissions"> permissions</a> for a file or whether it exists
</td></tr>
<tr>
<td><span class="anchor" id="chdir"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/chdir.2.html">chdir</a></code><br><span class="anchor" id="fchdir"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/chdir.2.html">fchdir</a></code>
</td>
<td>change <a href="Working_directory" title="Working directory">working directory</a>
</td></tr>
<tr>
<td><span class="anchor" id="chown"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/fchown.2.html">chown</a></code><br><span class="anchor" id="fchown"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/fchown.2.html">fchown</a></code><br><span class="anchor" id="lchown"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/fchown.2.html">lchown</a></code><br><span class="anchor" id="fchownat"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/fchown.2.html">fchownat</a></code>
</td>
<td>change owner and group of a file
</td></tr>
<tr>
<td><span class="anchor" id="close"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/close.3p.html">close</a></code>
</td>
<td>close a <a href="File_descriptor" title="File descriptor">file descriptor</a>
</td></tr>
<tr>
<td><span class="anchor" id="dup"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/dup.2.html">dup</a></code><br><span class="anchor" id="dup2"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/dup.2.html">dup2</a></code>
</td>
<td>duplicate a file descriptor
</td></tr>
<tr>
<td><span class="anchor" id="fsync"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/fsync.2.html">fsync</a></code><br><span class="anchor" id="fdatasync"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/fsync.2.html">fdatasync</a></code>
</td>
<td>synchronize a file's in-core state with storage device
</td></tr>
<tr>
<td><span class="anchor" id="fpathconf"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/pathconf.3.html">fpathconf</a></code><br><span class="anchor" id="pathconf"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/pathconf.3.html">pathconf</a></code>
</td>
<td>get configuration values for files
</td></tr>
<tr>
<td><span class="anchor" id="ftruncate"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/truncate.2.html">ftruncate</a></code><br><span class="anchor" id="truncate"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/truncate.2.html">truncate</a></code>
</td>
<td>truncate a file to a specified length
</td></tr>
<tr>
<td><span class="anchor" id="getcwd"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/getcwd.2.html">getcwd</a></code><br><span class="anchor" id="getwd"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/getcwd.2.html">getwd</a></code><br><span class="anchor" id="get_current_dir_name"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/getcwd.2.html">get_current_dir_name</a></code><br>
</td>
<td>get current working directory
</td></tr>
<tr>
<td><span class="anchor" id="isatty"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/isatty.3.html">isatty</a></code>
</td>
<td>test whether a file descriptor refers to a <a href="Computer_terminal" title="Computer terminal"> terminal</a>
</td></tr>
<tr>
<td><span class="anchor" id="link"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/link.2.html">link</a></code><br><span class="anchor" id="linkat"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/link.2.html">linkat</a></code>
</td>
<td>make a new name for a file
</td></tr>
<tr>
<td><span class="anchor" id="lockf"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/lockf.3.html">lockf</a></code>
</td>
<td>apply, test or remove a POSIX lock on an open file
</td></tr>
<tr>
<td><span class="anchor" id="lseek"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/lseek.2.html">lseek</a></code>
</td>
<td>reposition read/write file offset
</td></tr>
<tr>
<td><span class="anchor" id="pipe"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/pipe.2.html">pipe</a></code><br><span class="anchor" id="pipe2"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/pipe.2.html">pipe2</a></code>
</td>
<td>create pipe
</td></tr>
<tr>
<td><span class="anchor" id="pread"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/pread.2.html">pread</a></code><br><span class="anchor" id="pwrite"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/pread.2.html">pwrite</a></code>
</td>
<td>read from or write to a file descriptor at a given offset
</td></tr>
<tr>
<td><span class="anchor" id="read"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/read.2.html">read</a></code>
</td>
<td>read from a file descriptor
</td></tr>
<tr>
<td><span class="anchor" id="readlink"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/readlink.2.html">readlink</a></code><br><span class="anchor" id="readlinkat"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/readlink.2.html">readlinkat</a></code>
</td>
<td>read value of a symbolic link
</td></tr>
<tr>
<td><span class="anchor" id="rmdir"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/rmdir.2.html">rmdir</a></code>
</td>
<td>delete a directory
</td></tr>
<tr>
<td><span class="anchor" id="symlink"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/symlink.2.html">symlink</a></code><br><span class="anchor" id="symlinkat"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/symlink.2.html">symlinkat</a></code>
</td>
<td>make a new name for a file
</td></tr>
<tr>
<td><span class="anchor" id="sync"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/sync.2.html">sync</a></code><br><span class="anchor" id="syncfs"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/sync.2.html">syncfs</a></code>
</td>
<td>commit filesystem caches to disk
</td></tr>
<tr>
<td><span class="anchor" id="ttyname"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/ttyname.3.html">ttyname</a></code><br><span class="anchor" id="ttyname_r"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/ttyname.3.html">ttyname_r</a></code>
</td>
<td>return name of a terminal
</td></tr>
<tr>
<td><span class="anchor" id="unlink"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/unlink.2.html">unlink</a></code><br><span class="anchor" id="unlinkat"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/unlinkat.3.html">unlinkat</a></code>
</td>
<td>delete a name and possibly the file it refers to
</td></tr>
<tr>
<td><span class="anchor" id="write"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/write.2.html">write</a></code>
</td>
<td>write to a file descriptor
</td></tr>
<tr>
<th rowspan="11">Process
</th>
<td><span class="anchor" id="_exit"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/exit.2.html">_exit</a></code>
</td>
<td>terminate the calling <a href="Process_(computing)" title="Process (computing)"> process</a>
</td></tr>
<tr>
<td><span class="anchor" id="execl"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/exec.3.html">execl</a></code><br><span class="anchor" id="execlp"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/exec.3.html">execlp</a></code><br><span class="anchor" id="execle"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/exec.3.html">execle</a></code><br><span class="anchor" id="execv"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/exec.3.html">execv</a></code><br><span class="anchor" id="execvp"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/exec.3.html">execvp</a></code><br><span class="anchor" id="execvpe"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/exec.3.html">execvpe</a></code>
</td>
<td>execute a file
</td></tr>
<tr>
<td><span class="anchor" id="fexecve"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/fexecve.3.html">fexecve</a></code>
</td>
<td>execute program specified via file descriptor
</td></tr>
<tr>
<td><span class="anchor" id="fork"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/fork.3p.html">fork</a></code>
</td>
<td>create a new process
</td></tr>
<tr>
<td><span class="anchor" id="setpgid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2.setpgid2.html">setpgid</a></code><br><span class="anchor" id="getpgid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2.setpgid2.html">getpgid</a></code><br><span class="anchor" id="setpgrp"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2.setpgid2.html">setpgrp</a></code><br><span class="anchor" id="getpgrp"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2.setpgid2.html">getpgrp</a></code><br>
</td>
<td>set/get process group
</td></tr>
<tr>
<td><span class="anchor" id="getpid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/getpid.3p.html">getpid</a></code><br><span class="anchor" id="getppid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/getppid.3p.html">getppid</a></code>
</td>
<td>get process identification
</td></tr>
<tr>
<td><span class="anchor" id="getsid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/getsid.2.html">getsid</a></code>
</td>
<td>get session ID
</td></tr>
<tr>
<td><span class="anchor" id="nice"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/nice.2.html">nice</a></code>
</td>
<td>change process priority
</td></tr>
<tr>
<td><span class="anchor" id="setsid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/setsid.2.html">setsid</a></code>
</td>
<td>creates a session and sets the process group ID
</td></tr>
<tr>
<td><span class="anchor" id="sleep"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/sleep.3.html">sleep</a></code>
</td>
<td>sleep for a specified number of seconds
</td></tr>
<tr>
<td><span class="anchor" id="tcgetpgrp"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/tcgetpgrp.3.html">tcgetpgrp</a></code><br><span class="anchor" id="tcsetpgrp"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/tcsetpgrp.3.html">tcsetpgrp</a></code>
</td>
<td>get and set terminal foreground process group
</td></tr>
<tr>
<th rowspan="8">User/Group
</th>
<td><span class="anchor" id="getgid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/getgid.2.html">getgid</a></code><br><span class="anchor" id="getegid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/getgid.2.html">getegid</a></code>
</td>
<td>get group identity
</td></tr>
<tr>
<td><span class="anchor" id="getuid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/getuid.2.html">getuid</a></code><br><span class="anchor" id="geteuid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/getuid.2.html">geteuid</a></code>
</td>
<td>get user identity
</td></tr>
<tr>
<td><span class="anchor" id="getgroups"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/getgroups.2.html">getgroups</a></code>
</td>
<td>get list of supplementary group IDs
</td></tr>
<tr>
<td><span class="anchor" id="getlogin"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/getlogin.3.html">getlogin</a></code><br><span class="anchor" id="getlogin_r"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man3/getlogin.3.html">getlogin_r</a></code>
</td>
<td>get username
</td></tr>
<tr>
<td><span class="anchor" id="seteuid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/seteuid.2.html">seteuid</a></code><br><span class="anchor" id="setegid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/setegid.2.html">setegid</a></code>
</td>
<td>set effective user or group ID
</td></tr>
<tr>
<td><span class="anchor" id="setgid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/setgid.2.html">setgid</a></code>
</td>
<td>set group identity
</td></tr>
<tr>
<td><span class="anchor" id="setreuid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/setreuid.2.html">setreuid</a></code><br><span class="anchor" id="setregid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/setreuid.2.html">setregid</a></code>
</td>
<td>set real and/or effective user or group ID
</td></tr>
<tr>
<td><span class="anchor" id="setuid"></span><code><a rel="nofollow" class="external text" href="https://www.man7.org/linux/man-pages/man2/setuid.2.html">setuid</a></code>
</td>
<td>set user identity
</td></tr>
</tbody></table>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-unistd.h-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-unistd.h_1-0">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1333433106">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./_mw_/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./_mw_/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./_mw_/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./_mw_/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#bf3c2c)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#bf3c2c)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end   https://en.wikipedia.org/ */
</style><cite class="citation book cs1"><a rel="nofollow" class="external text" href="https://man7.org/linux/man-pages/man0/unistd.h.0p.html">"unistd.h(0P)"</a>. <i>POSIX Programmer's Manual</i>. IEEE/The Open Group. 2017<span class="reference-accessdate">. Retrieved <span class="nowrap">9 February</span> 2024</span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=bookitem&amp;rft.atitle=unistd.h%280P%29&amp;rft.btitle=POSIX+Programmer%27s+Manual&amp;rft.pub=IEEE%2FThe+Open+Group&amp;rft.date=2017&amp;rft_id=https%3A%2F%2Fman7.org%2Flinux%2Fman-pages%2Fman0%2Funistd.h.0p.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AUnistd.h" class="Z3988"></span></span>
</li>
</ol></div>
<div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2></div>
<ul><li><span class="neverexpand"><code><a rel="nofollow" class="external text" href="https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/unistd.h.html">unistd.h</a></code></span>:&nbsp;standard symbolic constants and types&nbsp;–&nbsp;Base Definitions Reference, <a href="Single_Unix_Specification" class="mw-redirect" title="Single Unix Specification">The Single UNIX Specification</a>, Version 5 from <a href="The_Open_Group" title="The Open Group">The Open Group</a></li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
    This article is issued from <a class="external text" title="Last edited on 2025-12-25" href="https://en.wikipedia.org/wiki/?title=Unistd.h&amp;oldid=1329370866">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
            </div>
          </main>
        </div>
      </div>
    </div>
     <script src="./_webp_/webpHandler.js"></script>
  

</body></html>