summaryrefslogtreecommitdiff
path: root/static/freebsd/man9/namei.9 3.html
diff options
context:
space:
mode:
Diffstat (limited to 'static/freebsd/man9/namei.9 3.html')
-rw-r--r--static/freebsd/man9/namei.9 3.html423
1 files changed, 0 insertions, 423 deletions
diff --git a/static/freebsd/man9/namei.9 3.html b/static/freebsd/man9/namei.9 3.html
deleted file mode 100644
index 634973b7..00000000
--- a/static/freebsd/man9/namei.9 3.html
+++ /dev/null
@@ -1,423 +0,0 @@
-<table class="head">
- <tr>
- <td class="head-ltitle">NAMEI(9)</td>
- <td class="head-vol">Kernel Developer's Manual</td>
- <td class="head-rtitle">NAMEI(9)</td>
- </tr>
-</table>
-<div class="manual-text">
-<section class="Sh">
-<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
-<p class="Pp"><code class="Nm">namei</code>, <code class="Nm">NDINIT</code>,
- <code class="Nm">NDINIT_AT</code>, <code class="Nm">NDFREE_PNBUF</code>
- &#x2014; <span class="Nd">pathname translation and lookup
- operations</span></p>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
-<p class="Pp"><code class="In">#include
- &lt;<a class="In">sys/param.h</a>&gt;</code>
- <br/>
- <code class="In">#include &lt;<a class="In">sys/fcntl.h</a>&gt;</code>
- <br/>
- <code class="In">#include &lt;<a class="In">sys/namei.h</a>&gt;</code></p>
-<p class="Pp"><var class="Ft">int</var>
- <br/>
- <code class="Fn">namei</code>(<var class="Fa" style="white-space: nowrap;">struct
- nameidata *ndp</var>);</p>
-<p class="Pp"><var class="Ft">void</var>
- <br/>
- <code class="Fn">NDINIT</code>(<var class="Fa">struct nameidata *ndp</var>,
- <var class="Fa">enum nameiop op</var>, <var class="Fa">u_int64_t
- flags</var>, <var class="Fa">enum uio_seg segflg</var>,
- <var class="Fa">const char *namep</var>);</p>
-<p class="Pp"><var class="Ft">void</var>
- <br/>
- <code class="Fn">NDINIT_AT</code>(<var class="Fa">struct nameidata *ndp</var>,
- <var class="Fa">enum nameiop op</var>, <var class="Fa">u_int64_t
- flags</var>, <var class="Fa">enum uio_seg segflg</var>,
- <var class="Fa">const char *namep</var>, <var class="Fa">int
- dirfd</var>);</p>
-<p class="Pp"><var class="Ft">void</var>
- <br/>
- <code class="Fn">NDFREE_PNBUF</code>(<var class="Fa" style="white-space: nowrap;">struct
- nameidata *ndp</var>);</p>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
-<p class="Pp">The <code class="Nm">namei</code> facility allows the client to
- perform pathname translation and lookup operations. The
- <code class="Nm">namei</code> functions will increment the reference count
- for the vnode in question. The reference count has to be decremented after
- use of the vnode, by using either <a class="Xr">vrele(9)</a> or
- <a class="Xr">vput(9)</a>, depending on whether the
- <code class="Dv">LOCKLEAF</code> flag was specified or not.</p>
-<p class="Pp" id="NDINIT">The
- <a class="permalink" href="#NDINIT"><code class="Fn">NDINIT</code></a>()
- macro is used to initialize <code class="Nm">namei</code> components. It
- takes the following arguments:</p>
-<dl class="Bl-tag">
- <dt><var class="Fa">ndp</var></dt>
- <dd>A pointer to the <var class="Vt">struct nameidata</var> to
- initialize.</dd>
- <dt id="namei"><var class="Fa">op</var></dt>
- <dd>The operation which
- <a class="permalink" href="#namei"><code class="Fn">namei</code></a>()
- will perform. The following operations are valid:
- <code class="Dv">LOOKUP</code>, <code class="Dv">CREATE</code>,
- <code class="Dv">DELETE</code>, and <code class="Dv">RENAME</code>. The
- latter three are just setup for those effects; just calling
- <code class="Fn">namei</code>() will not result in
- <a class="permalink" href="#VOP_RENAME"><code class="Fn" id="VOP_RENAME">VOP_RENAME</code></a>()
- being called.</dd>
- <dt><var class="Fa">flags</var></dt>
- <dd>Operation flags, described in the next section. Several of these can be
- effective at the same time.</dd>
- <dt><var class="Fa">segflg</var></dt>
- <dd>UIO segment indicator. This indicates if the name of the object is in
- userspace (<code class="Dv">UIO_USERSPACE</code>) or in the kernel address
- space (<code class="Dv">UIO_SYSSPACE</code>).</dd>
- <dt><var class="Fa">namep</var></dt>
- <dd>Pointer to the component's pathname buffer (the file or directory name
- that will be looked up).</dd>
-</dl>
-<p class="Pp" id="NDINIT_AT">The
- <a class="permalink" href="#NDINIT_AT"><code class="Fn">NDINIT_AT</code></a>()
- macro is similar to <code class="Fn">NDINIT</code>(), but takes one extra
- argument:</p>
-<dl class="Bl-tag">
- <dt><var class="Fa">dirfd</var></dt>
- <dd>File descriptor referencing a directory, or the special value
- <code class="Dv">AT_FDCWD</code> meaning the calling thread's current
- working directory. Lookups will be performed relative to this
- directory.</dd>
-</dl>
-<p class="Pp" id="NDFREE_PNBUF">The
- <a class="permalink" href="#NDFREE_PNBUF"><code class="Fn">NDFREE_PNBUF</code></a>()
- macro is used to free the pathname buffer. It must be called exactly once
- for each successful
- <a class="permalink" href="#namei~2"><code class="Fn" id="namei~2">namei</code></a>()
- call. It takes the following argument:</p>
-<dl class="Bl-tag">
- <dt><var class="Fa">ndp</var></dt>
- <dd>A pointer to a <var class="Vt">struct nameidata</var> that was used in a
- successful <code class="Fn">namei</code>() call.</dd>
-</dl>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="NAMEI_OPERATION_FLAGS"><a class="permalink" href="#NAMEI_OPERATION_FLAGS">NAMEI
- OPERATION FLAGS</a></h1>
-<p class="Pp">The <code class="Fn">namei</code>() function takes the following
- set of &#x201C;operation flags&#x201D; that influence its operation:</p>
-<dl class="Bl-tag">
- <dt id="NC_NOMAKEENTRY"><a class="permalink" href="#NC_NOMAKEENTRY"><code class="Dv">NC_NOMAKEENTRY</code></a></dt>
- <dd>An alias for <code class="Dv">NOCACHE</code>.</dd>
- <dt id="NC_KEEPPOSENTRY"><a class="permalink" href="#NC_KEEPPOSENTRY"><code class="Dv">NC_KEEPPOSENTRY</code></a></dt>
- <dd>Keep the positive-caching entry in cache. This flag is typically combined
- with <code class="Dv">NOCACHE</code> to not cache a new entry, but keep
- existing one, or with <code class="Dv">MAKEENTRY</code>.</dd>
- <dt id="NOCACHE"><a class="permalink" href="#NOCACHE"><code class="Dv">NOCACHE</code></a></dt>
- <dd>Avoid <code class="Fn">namei</code>() creating this entry in the namecache
- if it is not already present. Normally, <code class="Fn">namei</code>()
- will add entries to the name cache if they are not already there.</dd>
- <dt id="LOCKLEAF"><a class="permalink" href="#LOCKLEAF"><code class="Dv">LOCKLEAF</code></a></dt>
- <dd>Lock vnode on return with <code class="Dv">LK_EXCLUSIVE</code> unless
- <code class="Dv">LOCKSHARED</code> is also set.
- <a class="Xr">VOP_UNLOCK(9)</a> should be used to release the lock (or
- <a class="Xr">vput(9)</a> which is equivalent to calling
- <a class="Xr">VOP_UNLOCK(9)</a> followed by <a class="Xr">vrele(9)</a>,
- all in one).</dd>
- <dt id="LOCKPARENT"><a class="permalink" href="#LOCKPARENT"><code class="Dv">LOCKPARENT</code></a></dt>
- <dd>This flag lets the <code class="Fn">namei</code>() function return the
- parent (directory) vnode, <var class="Va">ni_dvp</var> in locked state,
- unless it is identical to <var class="Va">ni_vp</var>, in which case
- <var class="Va">ni_dvp</var> is not locked per se (but may be locked due
- to <code class="Dv">LOCKLEAF</code>). If a lock is enforced, it should be
- released using <a class="Xr">vput(9)</a> or
- <a class="Xr">VOP_UNLOCK(9)</a> and <a class="Xr">vrele(9)</a>.</dd>
- <dt id="WANTPARENT"><a class="permalink" href="#WANTPARENT"><code class="Dv">WANTPARENT</code></a></dt>
- <dd>This flag allows the <code class="Fn">namei</code>() function to return
- the parent (directory) vnode in an unlocked state. The parent vnode must
- be released separately by using <a class="Xr">vrele(9)</a>.</dd>
- <dt id="FAILIFEXISTS"><a class="permalink" href="#FAILIFEXISTS"><code class="Dv">FAILIFEXISTS</code></a></dt>
- <dd>Makes the <code class="Nm">namei</code> operation fail if the target
- exists. It requires that the <code class="Dv">LOCKPARENT</code> flag is
- set and <code class="Dv">LOCKLEAF</code> is not.</dd>
- <dt id="FOLLOW"><a class="permalink" href="#FOLLOW"><code class="Dv">FOLLOW</code></a></dt>
- <dd>With this flag, <code class="Fn">namei</code>() will follow the symbolic
- link if the last part of the path supplied is a symbolic link (i.e., it
- will return a vnode for whatever the link points at, instead for the link
- itself).</dd>
- <dt id="EMPTYPATH"><a class="permalink" href="#EMPTYPATH"><code class="Dv">EMPTYPATH</code></a></dt>
- <dd>For <code class="Nm">namei</code> call initialized with
- <code class="Fn">NDINIT_AT</code>(), allow the <var class="Fa">namep</var>
- path to be empty. In this case, the <var class="Fa">dirfd</var> file
- descriptor may reference a file of arbitrary type, not necessary a
- directory, and lookup returns the vnode for this file.</dd>
- <dt id="LOCKSHARED"><a class="permalink" href="#LOCKSHARED"><code class="Dv">LOCKSHARED</code></a></dt>
- <dd>Lock vnode on return with <code class="Dv">LK_SHARED</code>, if permitted
- by the file system that owns the vnode. The file system must explicitly
- permit this by setting <code class="Dv">MNTK_LOOKUP_SHARED</code> in
- <code class="Dv">mp-&gt;mnt_kern_flag</code> during mount and by calling
- <a class="permalink" href="#VN_LOCK_ASHARE"><code class="Fn" id="VN_LOCK_ASHARE">VN_LOCK_ASHARE</code></a>()
- when allocating the vnode. If <code class="Dv">LOCKLEAF</code> is
- specified but shared locking is not permitted, then the vnode will be
- returned with <code class="Dv">LK_EXCLUSIVE</code>.
- <a class="Xr">VOP_UNLOCK(9)</a> should be used to release the lock (or
- <a class="Xr">vput(9)</a> which is equivalent to calling
- <a class="Xr">VOP_UNLOCK(9)</a> followed by <a class="Xr">vrele(9)</a>,
- all in one).</dd>
- <dt id="NOFOLLOW"><a class="permalink" href="#NOFOLLOW"><code class="Dv">NOFOLLOW</code></a></dt>
- <dd>Do not follow symbolic links (pseudo). This flag is not looked for by the
- actual code, which looks for <code class="Dv">FOLLOW</code>.
- <code class="Dv">NOFOLLOW</code> is used to indicate to the source code
- reader that symlinks are intentionally not followed.</dd>
- <dt id="RBENEATH"><a class="permalink" href="#RBENEATH"><code class="Dv">RBENEATH</code></a></dt>
- <dd>Requires that <code class="Nm">namei</code> did not cross the
- <var class="Fa">dirfd</var> directory. The flag is used to implement
- <code class="Dv">O_RESOLVE_BENEATH</code> flag for
- <a class="Xr">openat(2)</a>.</dd>
- <dt id="NAMEILOOKUP"><a class="permalink" href="#NAMEILOOKUP"><code class="Dv">NAMEILOOKUP</code></a></dt>
- <dd>The component is embedded in a <code class="Nm">namei</code> lookup
- structure, and the
- <a class="permalink" href="#vfs_lookup_nameidata"><code class="Fn" id="vfs_lookup_nameidata">vfs_lookup_nameidata</code></a>()
- function can be used to obtain that structure. This can be useful in
- <a class="Xr">VOP_LOOKUP(9)</a> implementations which need to obtain extra
- lookup metadata.</dd>
-</dl>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="PARAMETERS_DESCRIPTORS_FLAGS"><a class="permalink" href="#PARAMETERS_DESCRIPTORS_FLAGS">PARAMETERS
- DESCRIPTORS FLAGS</a></h1>
-<p class="Pp">These flags are used for several purposes. Some of them affects
- the global <code class="Nm">namei</code> operation, some provide information
- for processing of the specific path element, for instance, by the
- <code class="Dv">VOP_LOOKUP</code> implementation of the involved
- filesystem.</p>
-<dl class="Bl-tag">
- <dt id="RDONLY"><a class="permalink" href="#RDONLY"><code class="Dv">RDONLY</code></a></dt>
- <dd>Specifies that the lookup should act as if the final node is located on
- read-only mount. The flag is typically used by file servers, e.g. NFS, to
- handle read-only exports.</dd>
- <dt id="ISRESTARTED"><a class="permalink" href="#ISRESTARTED"><code class="Dv">ISRESTARTED</code></a></dt>
- <dd>The <code class="Nm">namei</code> was restarted with
- <a class="permalink" href="#NDRESTART"><code class="Fn" id="NDRESTART">NDRESTART</code></a>().
- This is used internally for double-root lookups used by ABI subsystems,
- after the lookup with native root failed. The components are reset to the
- original values, and lookup is repeated with different root, once.</dd>
- <dt id="IGNOREWHITEOUT"><a class="permalink" href="#IGNOREWHITEOUT"><code class="Dv">IGNOREWHITEOUT</code></a></dt>
- <dd>Ignore whiteouts, e.g. when checking if a directory is empty.</dd>
- <dt id="ISWHITEOUT"><a class="permalink" href="#ISWHITEOUT"><code class="Dv">ISWHITEOUT</code></a></dt>
- <dd>The result of lookup is whiteout.</dd>
- <dt id="DOWHITEOUT"><a class="permalink" href="#DOWHITEOUT"><code class="Dv">DOWHITEOUT</code></a></dt>
- <dd>Handle whiteouts, the instruction for the
- <a class="permalink" href="#VOP_LOOKUP"><code class="Fn" id="VOP_LOOKUP">VOP_LOOKUP</code></a>()
- filesystem methods.</dd>
- <dt id="WILLBEDIR"><a class="permalink" href="#WILLBEDIR"><code class="Dv">WILLBEDIR</code></a></dt>
- <dd>The lookup is done for creating a new entry that will be directory. It
- allows the trailing slash in the path string.</dd>
- <dt id="ISOPEN"><a class="permalink" href="#ISOPEN"><code class="Dv">ISOPEN</code></a></dt>
- <dd>The caller is the code that opens a file. This allows to weaken the lock
- mode of the return vnode, if the mount point indicates extended shared
- lock support.</dd>
- <dt id="NOCROSSMOUNT"><a class="permalink" href="#NOCROSSMOUNT"><code class="Dv">NOCROSSMOUNT</code></a></dt>
- <dd>Do not cross mount points during lookup.
- <p class="Pp">For &#x201C;..&#x201D; lookup leading to mount root, returns
- the root vnode of the mount instead of the covered vnode of the
- filesystem where the mount was placed.</p>
- <p class="Pp">For other lookups passing over mount, do not jump into the
- mounted filesystem. This allows to descend into the file hierarchy
- otherwise shadowed by the mount point.</p>
- </dd>
- <dt id="NOMACCHECK"><a class="permalink" href="#NOMACCHECK"><code class="Dv">NOMACCHECK</code></a></dt>
- <dd>Do not perform MAC checks during lookup.</dd>
- <dt id="AUDITVNODE1"><a class="permalink" href="#AUDITVNODE1"><code class="Dv">AUDITVNODE1</code></a></dt>
- <dd>Audit the looked up vnode information, use the first slot for audit
- information.</dd>
- <dt id="AUDITVNODE2"><a class="permalink" href="#AUDITVNODE2"><code class="Dv">AUDITVNODE2</code></a></dt>
- <dd>Same as <code class="Dv">AUDITVNODE1</code> but use the second slot.</dd>
- <dt id="NOCAPCHECK"><a class="permalink" href="#NOCAPCHECK"><code class="Dv">NOCAPCHECK</code></a></dt>
- <dd>Do not perform capability checks. If the calling process is in capability
- mode, lookup is denied outright.</dd>
- <dt id="OPENREAD"><a class="permalink" href="#OPENREAD"><code class="Dv">OPENREAD</code></a></dt>
- <dd>The lookup was for open and file will be opened for read.</dd>
- <dt id="OPENWRITE"><a class="permalink" href="#OPENWRITE"><code class="Dv">OPENWRITE</code></a></dt>
- <dd>The lookup was for open and file will be opened for write.</dd>
- <dt id="WANTIOCTLCAPS"><a class="permalink" href="#WANTIOCTLCAPS"><code class="Dv">WANTIOCTLCAPS</code></a></dt>
- <dd>Leave ioctl caps for the caller. See the description of
- <code class="Nm">namei</code> results.</dd>
- <dt id="OPENNAMED"><a class="permalink" href="#OPENNAMED"><code class="Dv">OPENNAMED</code></a></dt>
- <dd>Opening a named attribute (directory).</dd>
- <dt id="NOEXECCHECK"><a class="permalink" href="#NOEXECCHECK"><code class="Dv">NOEXECCHECK</code></a></dt>
- <dd>Do not perform check for allowed execution on the starting directory. It
- is used to implement the POSIX-required semantic for
- <a class="Xr">openat(2)</a> lookups that must use the permissions from
- time the directory was opened, and not when used for lookup.</dd>
- <dt id="MAKEENTRY"><a class="permalink" href="#MAKEENTRY"><code class="Dv">MAKEENTRY</code></a></dt>
- <dd>Looked-up entry is to be added to name cache.</dd>
- <dt id="ISSYMLINK"><a class="permalink" href="#ISSYMLINK"><code class="Dv">ISSYMLINK</code></a></dt>
- <dd>Current component is symlink, and it needs the interpretation according to
- the <code class="Dv">FOLLOW</code> or <code class="Dv">NOFOLLOW</code>
- flags.</dd>
- <dt id="ISLASTCN"><a class="permalink" href="#ISLASTCN"><code class="Dv">ISLASTCN</code></a></dt>
- <dd>This is last component of pathname. It is handled specially, many flags
- augment its processing.</dd>
- <dt id="ISDOTDOT"><a class="permalink" href="#ISDOTDOT"><code class="Dv">ISDOTDOT</code></a></dt>
- <dd>Current component name is &#x201C;..&#x201D;. Usually implies a need to
- specially handle the vnode locking for instantiation of the target vnode.
- The generic
- <a class="permalink" href="#vn_vget_ino_gen"><code class="Fn" id="vn_vget_ino_gen">vn_vget_ino_gen</code></a>()
- function and its more specialized variant
- <a class="permalink" href="#vn_vget_ino"><code class="Fn" id="vn_vget_ino">vn_vget_ino</code></a>()
- might be useful.</dd>
- <dt id="TRAILINGSLASH"><a class="permalink" href="#TRAILINGSLASH"><code class="Dv">TRAILINGSLASH</code></a></dt>
- <dd>Path ended in a slash.</dd>
- <dt id="CREATENAMED"><a class="permalink" href="#CREATENAMED"><code class="Dv">CREATENAMED</code></a></dt>
- <dd>Create a named attribute dir.</dd>
-</dl>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="ALLOCATED_ELEMENTS"><a class="permalink" href="#ALLOCATED_ELEMENTS">ALLOCATED
- ELEMENTS</a></h1>
-<p class="Pp">The <var class="Vt">nameidata</var> structure is composed of the
- following fields:</p>
-<dl class="Bl-tag">
- <dt id="ni_startdir"><var class="Va">ni_startdir</var></dt>
- <dd>In the normal case, this is either the current directory or the root. It
- is the current directory if the name passed in does not start with
- &#x2018;<code class="Li">/</code>&#x2019; and we have not gone through any
- symlinks with an absolute path, and the root otherwise.
- <p class="Pp" id="vfs_lookup">In this case, it is only used by
- <a class="permalink" href="#vfs_lookup"><code class="Fn">vfs_lookup</code></a>(),
- and should not be considered valid after a call to
- <a class="permalink" href="#namei~3"><code class="Fn" id="namei~3">namei</code></a>().</p>
- </dd>
- <dt id="ni_dvp"><var class="Va">ni_dvp</var></dt>
- <dd>Vnode pointer to directory of the object on which lookup is performed.
- This is available on successful return if
- <code class="Dv">LOCKPARENT</code> or <code class="Dv">WANTPARENT</code>
- is set. It is locked if <code class="Dv">LOCKPARENT</code> is set.</dd>
- <dt id="ni_vp"><var class="Va">ni_vp</var></dt>
- <dd>Vnode pointer to the resulting object, <code class="Dv">NULL</code>
- otherwise. The <var class="Va">v_usecount</var> field of this vnode is
- incremented. If <code class="Dv">LOCKLEAF</code> is set, it is also
- locked.</dd>
- <dt id="ni_cnd.cn_pnbuf"><var class="Va">ni_cnd.cn_pnbuf</var></dt>
- <dd>The pathname buffer contains the location of the file or directory that
- will be used by the <code class="Nm">namei</code> operations. It is
- managed by the <a class="Xr">uma(9)</a> zone allocation interface.</dd>
-</dl>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="RESULTS"><a class="permalink" href="#RESULTS">RESULTS</a></h1>
-<p class="Pp">The <var class="Vt">struct namei</var> member
- <code class="Dv">ni_resflags</code> returns the following flags giving some
- details of the successful operation:</p>
-<dl class="Bl-tag">
- <dt id="NIRES_ABS"><a class="permalink" href="#NIRES_ABS"><code class="Dv">NIRES_ABS</code></a></dt>
- <dd>The path passed was absolute.</dd>
- <dt id="NIRES_STRICTREL"><a class="permalink" href="#NIRES_STRICTREL"><code class="Dv">NIRES_STRICTREL</code></a></dt>
- <dd>Restricted lookup result. Only relative lookups were done to resolve the
- path to vnode.</dd>
- <dt id="NIRES_EMPTYPATH"><a class="permalink" href="#NIRES_EMPTYPATH"><code class="Dv">NIRES_EMPTYPATH</code></a></dt>
- <dd>The <code class="Dv">EMPTYPATH</code> flag was provided and used. In
- particular, the passed path was empty.</dd>
-</dl>
-<p class="Pp">If the <code class="Dv">WANTIOCTLCAPS</code> flag was specified,
- on return the <var class="Va">ni_filecaps</var> member of the
- <var class="Vt">struct namei</var> contains the capabilities of the file
- descriptor used as the lookup starting point
- (<var class="Va">dirfd</var>).</p>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
- VALUES</a></h1>
-<p class="Pp">If successful, <code class="Fn">namei</code>() will return 0,
- otherwise it will return an error.</p>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="FILES"><a class="permalink" href="#FILES">FILES</a></h1>
-<dl class="Bl-tag">
- <dt><span class="Pa">src/sys/kern/vfs_lookup.c</span></dt>
- <dd style="width: auto;">&#x00A0;</dd>
-</dl>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1>
-<p class="Pp">Assuming the <code class="Dv">path</code> variable contains a
- pointer to userspace path string, the following example looks up the file
- named by it, and performs required error and resource handling:</p>
-<div class="Bd Pp Li">
-<pre> char *path;
- struct nameidata nd;
- int error;
-
- NDINIT(&amp;nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE,
- path);
- if ((error = namei(&amp;nd)) != 0)
- return (error);
- NDFREE_PNBUF(&amp;nd);
- ... use nd.ni_vp vnode</pre>
-</div>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
-<p class="Pp">Errors which <code class="Fn">namei</code>() may return:</p>
-<dl class="Bl-tag">
- <dt id="ENOTDIR">[<a class="permalink" href="#ENOTDIR"><code class="Er">ENOTDIR</code></a>]</dt>
- <dd>A component of the specified pathname is not a directory when a directory
- is expected.</dd>
- <dt id="ENAMETOOLONG">[<a class="permalink" href="#ENAMETOOLONG"><code class="Er">ENAMETOOLONG</code></a>]</dt>
- <dd>A component of a pathname exceeded 255 characters, or an entire pathname
- exceeded 1023 characters.</dd>
- <dt id="ENOENT">[<a class="permalink" href="#ENOENT"><code class="Er">ENOENT</code></a>]</dt>
- <dd>A component of the specified pathname does not exist, or the pathname is
- an empty string.</dd>
- <dt id="EACCES">[<a class="permalink" href="#EACCES"><code class="Er">EACCES</code></a>]</dt>
- <dd>An attempt is made to access a file in a way forbidden by its file access
- permissions.</dd>
- <dt id="ELOOP">[<a class="permalink" href="#ELOOP"><code class="Er">ELOOP</code></a>]</dt>
- <dd>Too many symbolic links were encountered in translating the pathname.</dd>
- <dt id="EISDIR">[<a class="permalink" href="#EISDIR"><code class="Er">EISDIR</code></a>]</dt>
- <dd>An attempt is made to open a directory with write mode specified.</dd>
- <dt id="EINVAL">[<a class="permalink" href="#EINVAL"><code class="Er">EINVAL</code></a>]</dt>
- <dd>The last component of the pathname specified for a
- <code class="Dv">DELETE</code> or <code class="Dv">RENAME</code> operation
- is &#x2018;<code class="Li">.</code>&#x2019;.</dd>
- <dt id="EROFS">[<a class="permalink" href="#EROFS"><code class="Er">EROFS</code></a>]</dt>
- <dd>An attempt is made to modify a file or directory on a read-only file
- system.</dd>
-</dl>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
- ALSO</a></h1>
-<p class="Pp"><a class="Xr">uio(9)</a>, <a class="Xr">uma(9)</a>,
- <a class="Xr">VFS(9)</a>, <a class="Xr">vnode(9)</a>,
- <a class="Xr">vput(9)</a>, <a class="Xr">vref(9)</a>,
- <a class="Xr">vrele(9)</a></p>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
-<p class="Pp">This manual page was written by <span class="An">Eivind
- Eklund</span>
- &lt;<a class="Mt" href="mailto:eivind@FreeBSD.org">eivind@FreeBSD.org</a>&gt;
- and later significantly revised by <span class="An">Hiten M. Pandya</span>
- &lt;<a class="Mt" href="mailto:hmp@FreeBSD.org">hmp@FreeBSD.org</a>&gt;.</p>
-</section>
-<section class="Sh">
-<h1 class="Sh" id="BUGS"><a class="permalink" href="#BUGS">BUGS</a></h1>
-<p class="Pp">The <code class="Dv">LOCKPARENT</code> flag does not always result
- in the parent vnode being locked. This results in complications when the
- <code class="Dv">LOCKPARENT</code> is used. In order to solve this for the
- cases where both <code class="Dv">LOCKPARENT</code> and
- <code class="Dv">LOCKLEAF</code> are used, it is necessary to resort to
- recursive locking.</p>
-</section>
-</div>
-<table class="foot">
- <tr>
- <td class="foot-date">September 30, 2025</td>
- <td class="foot-os">FreeBSD 15.0</td>
- </tr>
-</table>