man-pages/man3/fpathconf.3.html
2021-03-31 01:06:50 +01:00

405 lines
8.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of FPATHCONF</TITLE>
</HEAD><BODY>
<H1>FPATHCONF</H1>
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-07-13<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
fpathconf, pathconf - get configuration values for files
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/unistd.h">unistd.h</A>&gt;</B>
<B>long fpathconf(int </B><I>fd</I><B>, int </B><I>name</I><B>);</B>
<B>long pathconf(const char *</B><I>path</I><B>, int </B><I>name</I><B>);</B>
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>fpathconf</B>()
gets a value for the configuration option
<I>name</I>
for the open file descriptor
<I>fd</I>.
<P>
<B>pathconf</B>()
gets a value for configuration option
<I>name</I>
for the filename
<I>path</I>.
<P>
The corresponding macros defined in
<I>&lt;<A HREF="file:///usr/include/unistd.h">unistd.h</A>&gt;</I>
are minimum values; if an application wants to take advantage of values
which may change, a call to
<B>fpathconf</B>()
or
<B>pathconf</B>()
can be made, which may yield more liberal results.
<P>
Setting
<I>name</I>
equal to one of the following constants returns the following
configuration options:
<DL COMPACT>
<DT id="1"><B>_PC_LINK_MAX</B>
<DD>
The maximum number of links to the file.
If
<I>fd</I>
or
<I>path</I>
refer to a directory, then the value applies to the whole directory.
The corresponding macro is
<B>_POSIX_LINK_MAX</B>.
<DT id="2"><B>_PC_MAX_CANON</B>
<DD>
The maximum length of a formatted input line, where
<I>fd</I>
or
<I>path</I>
must refer to a terminal.
The corresponding macro is
<B>_POSIX_MAX_CANON</B>.
<DT id="3"><B>_PC_MAX_INPUT</B>
<DD>
The maximum length of an input line, where
<I>fd</I>
or
<I>path</I>
must refer to a terminal.
The corresponding macro is
<B>_POSIX_MAX_INPUT</B>.
<DT id="4"><B>_PC_NAME_MAX</B>
<DD>
The maximum length of a filename in the directory
<I>path</I>
or
<I>fd</I>
that the process is allowed to create.
The corresponding macro is
<B>_POSIX_NAME_MAX</B>.
<DT id="5"><B>_PC_PATH_MAX</B>
<DD>
The maximum length of a relative pathname when
<I>path</I>
or
<I>fd</I>
is the current working directory.
The corresponding macro is
<B>_POSIX_PATH_MAX</B>.
<DT id="6"><B>_PC_PIPE_BUF</B>
<DD>
The maximum number of bytes that can be written atomically to a pipe of FIFO.
For
<B>fpathconf</B>(),
<I>fd</I>
should refer to a pipe or FIFO.
For
<B>fpathconf</B>(),
<I>path</I>
should refer to a FIFO or a directory; in the latter case,
the returned value corresponds to FIFOs created in that directory.
The corresponding macro is
<B>_POSIX_PIPE_BUF</B>.
<DT id="7"><B>_PC_CHOWN_RESTRICTED</B>
<DD>
This returns a positive value if the use of
<B><A HREF="/cgi-bin/man/man2html?2+chown">chown</A></B>(2)
and
<B><A HREF="/cgi-bin/man/man2html?2+fchown">fchown</A></B>(2)
for changing a file's user ID is restricted to a process
with appropriate privileges,
and changing a file's group ID to a value other than the process's
effective group ID or one of its supplementary group IDs
is restricted to a process with appropriate privileges.
According to POSIX.1,
this variable shall always be defined with a value other than -1.
The corresponding macro is
<B>_POSIX_CHOWN_RESTRICTED</B>.
<DT id="8"><DD>
If
<I>fd</I>
or
<I>path</I>
refers to a directory,
then the return value applies to all files in that directory.
<DT id="9"><B>_PC_NO_TRUNC</B>
<DD>
This returns nonzero if accessing filenames longer than
<B>_POSIX_NAME_MAX</B>
generates an error.
The corresponding macro is
<B>_POSIX_NO_TRUNC</B>.
<DT id="10"><B>_PC_VDISABLE</B>
<DD>
This returns nonzero if special character processing can be disabled, where
<I>fd</I>
or
<I>path</I>
must refer to a terminal.
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
The return value of these functions is one of the following:
<DL COMPACT>
<DT id="11">*<DD>
On error, -1 is returned and
<I>errno</I>
is set to indicate the cause of the error
(for example,
<B>EINVAL</B>,
indicating that
<I>name</I>
is invalid).
<DT id="12">*<DD>
If
<I>name</I>
corresponds to a maximum or minimum limit, and that limit is indeterminate,
-1 is returned and
<I>errno</I>
is not changed.
(To distinguish an indeterminate limit from an error, set
<I>errno</I>
to zero before the call, and then check whether
<I>errno</I>
is nonzero when -1 is returned.)
<DT id="13">*<DD>
If
<I>name</I>
corresponds to an option,
a positive value is returned if the option is supported,
and -1 is returned if the option is not supported.
<DT id="14">*<DD>
Otherwise,
the current value of the option or limit is returned.
This value will not be more restrictive than
the corresponding value that was described to the application in
<I>&lt;<A HREF="file:///usr/include/unistd.h">unistd.h</A>&gt;</I>
or
<I>&lt;<A HREF="file:///usr/include/limits.h">limits.h</A>&gt;</I>
when the application was compiled.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
<DL COMPACT>
<DT id="15"><B>EACCES</B>
<DD>
(<B>pathconf</B>())
Search permission is denied for one of the directories in the path prefix of
<I>path</I>.
<DT id="16"><B>EBADF</B>
<DD>
(<B>fpathconf</B>())
<I>fd</I>
is not a valid file descriptor.
<DT id="17"><B>EINVAL</B>
<DD>
<I>name</I>
is invalid.
<DT id="18"><B>EINVAL</B>
<DD>
The implementation does not support an association of
<I>name</I>
with the specified file.
<DT id="19"><B>ELOOP</B>
<DD>
(<B>pathconf</B>())
Too many symbolic links were encountered while resolving
<I>path</I>.
<DT id="20"><B>ENAMETOOLONG</B>
<DD>
(<B>pathconf</B>())
<I>path</I>
is too long.
<DT id="21"><B>ENOENT</B>
<DD>
(<B>pathconf</B>())
A component of
<I>path</I>
does not exist, or
<I>path</I>
is an empty string.
<DT id="22"><B>ENOTDIR</B>
<DD>
(<B>pathconf</B>())
A component used as a directory in
<I>path</I>
is not in fact a directory.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>ATTRIBUTES</H2>
For an explanation of the terms used in this section, see
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
<TABLE BORDER>
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
<TR VALIGN=top><TD>
<B>fpathconf</B>(),
<B>pathconf</B>()
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
</TABLE>
<A NAME="lbAH">&nbsp;</A>
<H2>CONFORMING TO</H2>
POSIX.1-2001, POSIX.1-2008.
<A NAME="lbAI">&nbsp;</A>
<H2>NOTES</H2>
Files with name lengths longer than the value returned for
<I>name</I>
equal to
<B>_PC_NAME_MAX</B>
may exist in the given directory.
<P>
Some returned values may be huge; they are not suitable for allocating
memory.
<A NAME="lbAJ">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+getconf">getconf</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+statfs">statfs</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?3+confstr">confstr</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sysconf">sysconf</A></B>(3)
<A NAME="lbAK">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="23"><A HREF="#lbAB">NAME</A><DD>
<DT id="24"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="25"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="26"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="27"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="28"><A HREF="#lbAG">ATTRIBUTES</A><DD>
<DT id="29"><A HREF="#lbAH">CONFORMING TO</A><DD>
<DT id="30"><A HREF="#lbAI">NOTES</A><DD>
<DT id="31"><A HREF="#lbAJ">SEE ALSO</A><DD>
<DT id="32"><A HREF="#lbAK">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:43 GMT, March 31, 2021
</BODY>
</HTML>