unroff-website/www/examples/pathconf.2.html

280 lines
6.2 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<head>
<!-- This file has been generated by unroff 1.0, 03/21/96 19:25:27. -->
<!-- Do not edit! -->
<link rev="made" href="mailto:net@informatik.uni-bremen.de">
<!-- t -->
<!-- @(#)pathconf.2v 1.20 90/02/15 SMI; new for 4.1, POSIX -->
<title>Manual page for PATHCONF(2V)</title>
</head>
<body>
<h2>
pathconf, fpathconf - query file system related limits and options
<hr></h2>
<h2>SYNOPSIS</h2>
<pre>
<b>#include &lt;unistd.h&gt;
</b></pre>
<p>
<pre>
<b>long pathconf(path, name)
char *path;
int name;
</b></pre>
<p>
<pre>
<b>long fpathconf(fd, name)
int fd, name;
</b></pre>
<h2>DESCRIPTION</h2>
<p>
<b>pathconf()
</b>and
<b>fpathconf()
</b>provide a
method for the application to determine the current value of a
configurable limit or option that is associated with a file
or directory,
<p>
For
<b>pathconf()</b>,
<i>path
</i>points to the pathname of a file or
directory.<tt> </tt>
For
<b>fpathconf()</b>,
<i>fd
</i>is an open file descriptor.<tt> </tt>
<p>
The convention used throughout sections 2 and 3
is that
{LIMIT}
means that
LIMIT
is something that
can change from file to file (due to multiple file systems on the same
machine). The actual value for
LIMIT is typically
not defined in any header file since
it is not invariant. Instead, pathconf must be called to retrieve the value.<tt> </tt>
<b>pathconf()
</b>understands a list of flags that are named similarly to the value
being queried.
<p>
The following table lists the name and meaning of each conceptual limit.<tt> </tt>
<p>
<dl><dt><dd>
<pre>
Limit Meaning
------------------------------------------------------------------------
{LINK_MAX} Max links to an object.
{MAX_CANON} Max tty input line size.
{MAX_INPUT} Max packet a tty can accept at once.
{NAME_MAX} Max filename length.
{PATH_MAX} Max pathname length.
{PIPE_BUF} Pipe buffer size.
{_POSIX_CHOWN_RESTRICTED} If true only root can chown() files, other­
wise anyone may give away files.
{_POSIX_NO_TRUNC} If false filenames &gt; {NAME_MAX} are trun­
cated, otherwise an error.
{_POSIX_VDISABLE} A char to use to disable tty special chars.
</pre>
</dl>
<p>
The following table lists the name of each limit, the flag
passed to
<b>pathconf()
</b>to retrieve the value of each variable, and some notes about usage.<tt> </tt>
<p>
<dl><dt><dd>
<pre>
Limit Pathconf Flag Notes
---------------------------------------------------------
{LINK_MAX} _PC_LINK_MAX 1
{MAX_CANON} _PC_MAX_CANON 2
{MAX_INPUT} _PC_MAX_INPUT 2
{NAME_MAX} _PC_NAME_MAX 3,4
{PATH_MAX} _PC_PATH_MAX 4,5
{PIPE_BUF} _PC_PIPE_BUF 6
{_POSIX_CHOWN_RESTRICTED} _PC_CHOWN_RESTRICTED 7,8
{_POSIX_NO_TRUNC} _PC_NO_TRUNC 3,4,8
{_POSIX_VDISABLE} _PC_VDISABLE 2,8
</pre>
</dl>
<p>
<p>
The following notes apply to the entries in the preceding table.<tt> </tt>
<p>
<dl>
<dt>1
<dd>
If
<i>path
</i>or
<i>fd
</i>refers to a directory, the value returned applies to the
directory itself.<tt> </tt>
<dt>2
<dd>
The behavior is undefined if
<i>path
</i>or
<i>fd
</i>does not refer to a terminal file.<tt> </tt>
<dt>3
<dd>
If
<i>path
</i>or
<i>fd
</i>refers to a directory, the value returned applies to the
file names within the directory.<tt> </tt>
<dt>4
<dd>
The behavior is undefined if
<i>path
</i>or
<i>fd
</i>does not refer to a directory.<tt> </tt>
<dt>5
<dd>
If
<i>path
</i>or
<i>fd
</i>refers to a directory, the value returned is the maximum
length of a relative pathname when the specified directory
is the working directory.<tt> </tt>
<dt>6
<dd>
If
<i>path
</i>refers to a
FIFO,
or
<i>fd
</i>refers to a pipe of
FIFO,
the value returned applies to the referenced object itself.<tt> </tt>
If
<i>path
</i>or
<i>fd
</i>refers to a directory, the value returned applies to any
FIFOs
that exist or can be created within the directory.<tt> </tt>
If
<i>path
</i>or
<i>fd
</i>refer to any other type of file, the behavior is undefined.<tt> </tt>
<dt>7
<dd>
If
<i>path
</i>or
<i>fd
</i>refer to a directory, the value returned applies
to any files, other than directories, that
exist or can be created within the directory.<tt> </tt>
<dt>8
<dd>
The option in question is a boolean; the return value is 0 or 1.<tt> </tt>
</dl>
<h2>RETURN VALUES</h2>
<p>
On success,
<b>pathconf()
</b>and
<b>fpathconf()
</b>return
the current
variable value for the file or directory.<tt> </tt>
On failure,
they return
-1
and set
<b>errno
</b>to indicate the error.<tt> </tt>
<p>
If the variable corresponding to
<i>name
</i>has no limit for the path or file
descriptor,
<b>pathconf()
</b>and
<b>fpathconf()
</b>return -1 without changing
<b>errno</b>.<tt> </tt>
<h2>ERRORS</h2>
<p>
<b>pathconf()
</b>and
<b>fpathconf()
</b>may set
<b>errno
</b>to:
<dl>
<dt>EINVAL
<dd>
The value of name is invalid.<tt> </tt>
</dl>
<p>
For each of the following conditions,
if the condition is detected,
<b>pathconf()
</b>fails and sets
<b>errno
</b>to:
<dl>
<dt>EACCES
<dd>
Search permission is denied for a component of the path prefix.<tt> </tt>
<dt>EINVAL
<dd>
The implementation does not support an association of the
variable name with the specified file.<tt> </tt>
<dt>ENAMETOOLONG
<dd>
The length of the path argument exceeds
{PATH_MAX}.<tt> </tt>
<dt><dd><p>
A pathname component is longer than
{NAME_MAX}
while
{POSIX_NO_TRUNC}
is in effect.<tt> </tt>
<dt>ENOENT
<dd>
The named file does not exist.<tt> </tt>
<dt><dd><p>
<i>path
</i>points to an empty string.<tt> </tt>
<dt>ENOTDIR
<dd>
A component of the path prefix is not a directory.<tt> </tt>
</dl>
<p>
For each of the following conditions,
if the condition is detected,
<b>fpathconf()
</b>fails and sets
<b>errno
</b>to:
<dl>
<dt>EBADF
<dd>
The
<i>fd
</i>argument is not a valid file descriptor.<tt> </tt>
<dt>EINVAL
<dd>
The implementation does not support an association of the
variable name with the specified file.<tt> </tt>
</dl>
<p><hr>
Markup created by <em>unroff</em> 1.0,&#160;<tt> </tt>&#160;<tt> </tt>March 21, 1996.
</body>
</html>