blob: 21d87380842b813ac3008f497d24ae29dc118027 [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Safe wrappers around functions found in libc “unistd.h” header"><meta name="keywords" content="rust, rustlang, rust-lang, unistd"><title>nix::unistd - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../../normalize.css"><link rel="stylesheet" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../../ayu.css" disabled><link rel="stylesheet" href="../../dark.css" disabled><link rel="stylesheet" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script defer src="../../main.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../../nix/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../nix/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Module unistd</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../index.html">nix</a>::<wbr><a class="mod" href="#">unistd</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/nix/unistd.rs.html#1-3383">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Safe wrappers around functions found in libc “unistd.h” header</p>
</div></details><h2 id="modules" class="small-section-header"><a href="#modules">Modules</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="alarm/index.html" title="nix::unistd::alarm mod">alarm</a></div><div class="item-right docblock-short">Alarm signal scheduling.</div></div></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.AccessFlags.html" title="nix::unistd::AccessFlags struct">AccessFlags</a></div><div class="item-right docblock-short">Options for access()</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Pid.html" title="nix::unistd::Pid struct">Pid</a></div><div class="item-right docblock-short">Process identifier</div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.ForkResult.html" title="nix::unistd::ForkResult enum">ForkResult</a></div><div class="item-right docblock-short">Represents the successful result of calling <code>fork</code></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.LinkatFlags.html" title="nix::unistd::LinkatFlags enum">LinkatFlags</a></div><div class="item-right docblock-short">Flags for <code>linkat</code> function.</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.UnlinkatFlags.html" title="nix::unistd::UnlinkatFlags enum">UnlinkatFlags</a></div><div class="item-right docblock-short">Flags for <code>unlinkat</code> function.</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Whence.html" title="nix::unistd::Whence enum">Whence</a></div><div class="item-right docblock-short">Directive that tells <a href="./fn.lseek.html"><code>lseek</code></a> and <a href="./fn.lseek64.html"><code>lseek64</code></a> what the offset is relative to.</div></div></div><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.access.html" title="nix::unistd::access fn">access</a></div><div class="item-right docblock-short">Checks the file named by <code>path</code> for accessibility according to the flags given by <code>amode</code>
See <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/access.html">access(2)</a></div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.chdir.html" title="nix::unistd::chdir fn">chdir</a></div><div class="item-right docblock-short">Change the current working directory of the calling process (see
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/chdir.html">chdir(2)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.chroot.html" title="nix::unistd::chroot fn">chroot</a></div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.close.html" title="nix::unistd::close fn">close</a></div><div class="item-right docblock-short">Close a raw file descriptor</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.daemon.html" title="nix::unistd::daemon fn">daemon</a></div><div class="item-right docblock-short">Daemonize this process by detaching from the controlling terminal (see
<a href="https://man7.org/linux/man-pages/man3/daemon.3.html">daemon(3)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.dup.html" title="nix::unistd::dup fn">dup</a></div><div class="item-right docblock-short">Create a copy of the specified file descriptor (see
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html">dup(2)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.dup2.html" title="nix::unistd::dup2 fn">dup2</a></div><div class="item-right docblock-short">Create a copy of the specified file descriptor using the specified fd (see
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html">dup(2)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.dup3.html" title="nix::unistd::dup3 fn">dup3</a></div><div class="item-right docblock-short">Create a new copy of the specified file descriptor using the specified fd
and flags (see <a href="https://man7.org/linux/man-pages/man2/dup.2.html">dup(2)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.eaccess.html" title="nix::unistd::eaccess fn">eaccess</a></div><div class="item-right docblock-short">Checks the file named by <code>path</code> for accessibility according to the flags given
by <code>mode</code> using effective UID, effective GID and supplementary group lists.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.execv.html" title="nix::unistd::execv fn">execv</a></div><div class="item-right docblock-short">Replace the current process image with a new one (see
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html">exec(3)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.execve.html" title="nix::unistd::execve fn">execve</a></div><div class="item-right docblock-short">Replace the current process image with a new one (see
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html">execve(2)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.execveat.html" title="nix::unistd::execveat fn">execveat</a></div><div class="item-right docblock-short">Execute program relative to a directory file descriptor (see
<a href="https://man7.org/linux/man-pages/man2/execveat.2.html">execveat(2)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.execvp.html" title="nix::unistd::execvp fn">execvp</a></div><div class="item-right docblock-short">Replace the current process image with a new one and replicate shell <code>PATH</code>
searching behavior (see
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html">exec(3)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.execvpe.html" title="nix::unistd::execvpe fn">execvpe</a></div><div class="item-right docblock-short">Replace the current process image with a new one and replicate shell <code>PATH</code>
searching behavior (see
<a href="https://man7.org/linux/man-pages/man3/exec.3.html"><code>execvpe(3)</code></a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.faccessat.html" title="nix::unistd::faccessat fn">faccessat</a></div><div class="item-right docblock-short">Checks the file named by <code>path</code> for accessibility according to the flags given by <code>mode</code></div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.fchdir.html" title="nix::unistd::fchdir fn">fchdir</a></div><div class="item-right docblock-short">Change the current working directory of the process to the one
given as an open file descriptor (see
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html">fchdir(2)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.fdatasync.html" title="nix::unistd::fdatasync fn">fdatasync</a></div><div class="item-right docblock-short">Synchronize the data of a file</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.fexecve.html" title="nix::unistd::fexecve fn">fexecve</a></div><div class="item-right docblock-short">Replace the current process image with a new one (see
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/fexecve.html">fexecve(2)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.fork.html" title="nix::unistd::fork fn">fork</a><sup title="unsafe function"></sup></div><div class="item-right docblock-short">Create a new child process duplicating the parent process (<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/fork.html">see
fork(2)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.fsync.html" title="nix::unistd::fsync fn">fsync</a></div><div class="item-right docblock-short">Synchronize changes to a file</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.ftruncate.html" title="nix::unistd::ftruncate fn">ftruncate</a></div><div class="item-right docblock-short">Truncate a file to a specified length</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.getcwd.html" title="nix::unistd::getcwd fn">getcwd</a></div><div class="item-right docblock-short">Returns the current directory as a <code>PathBuf</code></div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.getpgid.html" title="nix::unistd::getpgid fn">getpgid</a></div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.getpgrp.html" title="nix::unistd::getpgrp fn">getpgrp</a></div><div class="item-right docblock-short">Get the group id of the calling process (see
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgrp.html">getpgrp(3)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.getpid.html" title="nix::unistd::getpid fn">getpid</a></div><div class="item-right docblock-short">Get the pid of this process (see
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpid.html">getpid(2)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.getppid.html" title="nix::unistd::getppid fn">getppid</a></div><div class="item-right docblock-short">Get the pid of this processes’ parent (see
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/getppid.html">getpid(2)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.getsid.html" title="nix::unistd::getsid fn">getsid</a></div><div class="item-right docblock-short">Get the process group ID of a session leader
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsid.html">getsid(2)</a>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.gettid.html" title="nix::unistd::gettid fn">gettid</a></div><div class="item-right docblock-short">Get the caller’s thread ID (see
<a href="https://man7.org/linux/man-pages/man2/gettid.2.html">gettid(2)</a>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.isatty.html" title="nix::unistd::isatty fn">isatty</a></div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.linkat.html" title="nix::unistd::linkat fn">linkat</a></div><div class="item-right docblock-short">Link one file to another file</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.lseek.html" title="nix::unistd::lseek fn">lseek</a></div><div class="item-right docblock-short">Move the read/write file offset.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.lseek64.html" title="nix::unistd::lseek64 fn">lseek64</a></div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.mkdir.html" title="nix::unistd::mkdir fn">mkdir</a></div><div class="item-right docblock-short">Creates new directory <code>path</code> with access rights <code>mode</code>. (see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html">mkdir(2)</a>)</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.mkfifo.html" title="nix::unistd::mkfifo fn">mkfifo</a></div><div class="item-right docblock-short">Creates new fifo special file (named pipe) with path <code>path</code> and access rights <code>mode</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.mkfifoat.html" title="nix::unistd::mkfifoat fn">mkfifoat</a></div><div class="item-right docblock-short">Creates new fifo special file (named pipe) with path <code>path</code> and access rights <code>mode</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.mkstemp.html" title="nix::unistd::mkstemp fn">mkstemp</a></div><div class="item-right docblock-short">Creates a regular file which persists even after process termination</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.pause.html" title="nix::unistd::pause fn">pause</a></div><div class="item-right docblock-short">Suspend the thread until a signal is received.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.pipe.html" title="nix::unistd::pipe fn">pipe</a></div><div class="item-right docblock-short">Create an interprocess channel.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.pipe2.html" title="nix::unistd::pipe2 fn">pipe2</a></div><div class="item-right docblock-short">Like <code>pipe</code>, but allows setting certain file descriptor flags.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.pivot_root.html" title="nix::unistd::pivot_root fn">pivot_root</a></div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.read.html" title="nix::unistd::read fn">read</a></div><div class="item-right docblock-short">Read from a raw file descriptor.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.setpgid.html" title="nix::unistd::setpgid fn">setpgid</a></div><div class="item-right docblock-short">Set a process group ID (see
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/setpgid.html">setpgid(2)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.setsid.html" title="nix::unistd::setsid fn">setsid</a></div><div class="item-right docblock-short">Create new session and set process group id (see
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsid.html">setsid(2)</a>).</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.sleep.html" title="nix::unistd::sleep fn">sleep</a></div><div class="item-right docblock-short">Suspend execution for an interval of time</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.symlinkat.html" title="nix::unistd::symlinkat fn">symlinkat</a></div><div class="item-right docblock-short">Creates a symbolic link at <code>path2</code> which points to <code>path1</code>.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.sync.html" title="nix::unistd::sync fn">sync</a></div><div class="item-right docblock-short">Commit filesystem caches to disk</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.syncfs.html" title="nix::unistd::syncfs fn">syncfs</a></div><div class="item-right docblock-short">Commit filesystem caches containing file referred to by the open file
descriptor <code>fd</code> to disk</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.truncate.html" title="nix::unistd::truncate fn">truncate</a></div><div class="item-right docblock-short">Truncate a file to a specified length</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.unlink.html" title="nix::unistd::unlink fn">unlink</a></div><div class="item-right docblock-short">Remove a directory entry</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.unlinkat.html" title="nix::unistd::unlinkat fn">unlinkat</a></div><div class="item-right docblock-short">Remove a directory entry</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.write.html" title="nix::unistd::write fn">write</a></div><div class="item-right docblock-short">Write to a raw file descriptor.</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="nix" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>