]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/fpathconf.3
man*/: ffix (un-bracket tables)
[thirdparty/man-pages.git] / man3 / fpathconf.3
CommitLineData
a1eaacb1 1'\" t
bf5a7247 2.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
bc051678 3.\" and Copyright (C) 2017 Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 4.\"
5fbde956 5.\" SPDX-License-Identifier: Linux-man-pages-copyleft
c08df37a 6.\"
fea681da 7.\" Modified Wed Jul 28 11:12:26 1993 by Rik Faith (faith@cs.unc.edu)
e2bfd6df
MK
8.\"
9.\" FIXME Probably all of the following should be documented:
10.\" _PC_SYNC_IO,
11.\" _PC_ASYNC_IO,
12.\" _PC_PRIO_IO,
13.\" _PC_SOCK_MAXBUF,
14.\" _PC_FILESIZEBITS,
15.\" _PC_REC_INCR_XFER_SIZE,
16.\" _PC_REC_MAX_XFER_SIZE,
17.\" _PC_REC_MIN_XFER_SIZE,
18.\" _PC_REC_XFER_ALIGN,
19.\" _PC_ALLOC_SIZE_MIN,
20.\" _PC_SYMLINK_MAX,
21.\" _PC_2_SYMLINKS
9f1b9726 22.\"
4c1c5274 23.TH fpathconf 3 (date) "Linux man-pages (unreleased)"
fea681da
MK
24.SH NAME
25fpathconf, pathconf \- get configuration values for files
cfba38f4
AC
26.SH LIBRARY
27Standard C library
28.RI ( libc ", " \-lc )
fea681da
MK
29.SH SYNOPSIS
30.nf
31.B #include <unistd.h>
68e4db0a 32.PP
d3b03141 33.BI "long fpathconf(int " fd ", int " name );
86138c4d 34.BI "long pathconf(const char *" path ", int " name );
fea681da
MK
35.fi
36.SH DESCRIPTION
63aa9df0 37.BR fpathconf ()
fea681da
MK
38gets a value for the configuration option
39.I name
40for the open file descriptor
d3b03141 41.IR fd .
fea681da 42.PP
63aa9df0 43.BR pathconf ()
fea681da
MK
44gets a value for configuration option
45.I name
2c5f1089 46for the filename
fea681da
MK
47.IR path .
48.PP
49The corresponding macros defined in
bd12ab88 50.I <unistd.h>
fea681da
MK
51are minimum values; if an application wants to take advantage of values
52which may change, a call to
63aa9df0 53.BR fpathconf ()
fea681da 54or
63aa9df0 55.BR pathconf ()
fea681da
MK
56can be made, which may yield more liberal results.
57.PP
58Setting
59.I name
60equal to one of the following constants returns the following
61configuration options:
62.TP
63.B _PC_LINK_MAX
5425e5c5 64The maximum number of links to the file.
c13182ef 65If
d3b03141 66.I fd
fea681da
MK
67or
68.I path
69refer to a directory, then the value applies to the whole directory.
70The corresponding macro is
71.BR _POSIX_LINK_MAX .
72.TP
73.B _PC_MAX_CANON
5425e5c5 74The maximum length of a formatted input line, where
d3b03141 75.I fd
fea681da
MK
76or
77.I path
78must refer to a terminal.
79The corresponding macro is
80.BR _POSIX_MAX_CANON .
81.TP
82.B _PC_MAX_INPUT
5425e5c5 83The maximum length of an input line, where
d3b03141 84.I fd
fea681da
MK
85or
86.I path
87must refer to a terminal.
88The corresponding macro is
89.BR _POSIX_MAX_INPUT .
90.TP
91.B _PC_NAME_MAX
5425e5c5 92The maximum length of a filename in the directory
fea681da
MK
93.I path
94or
1ae6b2c7 95.I fd
40725279 96that the process is allowed to create.
fea681da
MK
97The corresponding macro is
98.BR _POSIX_NAME_MAX .
99.TP
100.B _PC_PATH_MAX
5425e5c5 101The maximum length of a relative pathname when
fea681da
MK
102.I path
103or
d3b03141 104.I fd
c13182ef
MK
105is the current working directory.
106The corresponding macro is
fea681da
MK
107.BR _POSIX_PATH_MAX .
108.TP
109.B _PC_PIPE_BUF
6cde4271
MK
110The maximum number of bytes that can be written atomically to a pipe of FIFO.
111For
112.BR fpathconf (),
d3b03141 113.I fd
6cde4271
MK
114should refer to a pipe or FIFO.
115For
116.BR fpathconf (),
fea681da 117.I path
6cde4271
MK
118should refer to a FIFO or a directory; in the latter case,
119the returned value corresponds to FIFOs created in that directory.
1c44bd5b 120The corresponding macro is
fea681da
MK
121.BR _POSIX_PIPE_BUF .
122.TP
123.B _PC_CHOWN_RESTRICTED
3509905b 124This returns a positive value if the use of
fea681da 125.BR chown (2)
3509905b
MK
126and
127.BR fchown (2)
128for changing a file's user ID is restricted to a process
129with appropriate privileges,
130and changing a file's group ID to a value other than the process's
131effective group ID or one of its supplementary group IDs
132is restricted to a process with appropriate privileges.
133According to POSIX.1,
134this variable shall always be defined with a value other than \-1.
135The corresponding macro is
136.BR _POSIX_CHOWN_RESTRICTED .
137.IP
c13182ef 138If
d3b03141 139.I fd
fea681da
MK
140or
141.I path
3509905b
MK
142refers to a directory,
143then the return value applies to all files in that directory.
fea681da
MK
144.TP
145.B _PC_NO_TRUNC
5425e5c5 146This returns nonzero if accessing filenames longer than
fea681da 147.B _POSIX_NAME_MAX
c13182ef
MK
148generates an error.
149The corresponding macro is
fea681da
MK
150.BR _POSIX_NO_TRUNC .
151.TP
152.B _PC_VDISABLE
5425e5c5 153This returns nonzero if special character processing can be disabled, where
d3b03141 154.I fd
fea681da
MK
155or
156.I path
157must refer to a terminal.
47297adb 158.SH RETURN VALUE
081a3c71 159The return value of these functions is one of the following:
cdede5cd 160.IP \[bu] 3
081a3c71 161On error, \-1 is returned and
fea681da 162.I errno
855d489a 163is set to indicate the error
081a3c71
MK
164(for example,
165.BR EINVAL ,
166indicating that
167.I name
168is invalid).
cdede5cd 169.IP \[bu]
081a3c71
MK
170If
171.I name
172corresponds to a maximum or minimum limit, and that limit is indeterminate,
173\-1 is returned and
174.I errno
175is not changed.
176(To distinguish an indeterminate limit from an error, set
177.I errno
178to zero before the call, and then check whether
fea681da 179.I errno
081a3c71 180is nonzero when \-1 is returned.)
cdede5cd 181.IP \[bu]
081a3c71
MK
182If
183.I name
184corresponds to an option,
185a positive value is returned if the option is supported,
186and \-1 is returned if the option is not supported.
cdede5cd 187.IP \[bu]
081a3c71
MK
188Otherwise,
189the current value of the option or limit is returned.
190This value will not be more restrictive than
191the corresponding value that was described to the application in
192.I <unistd.h>
193or
194.I <limits.h>
195when the application was compiled.
09c8f2e4
MK
196.SH ERRORS
197.TP
198.B EACCES
199.RB ( pathconf ())
200Search permission is denied for one of the directories in the path prefix of
201.IR path .
202.TP
203.B EBADF
204.RB ( fpathconf ())
205.I fd
206is not a valid file descriptor.
207.TP
208.B EINVAL
209.I name
210is invalid.
211.TP
212.B EINVAL
213The implementation does not support an association of
214.I name
215with the specified file.
216.TP
217.B ELOOP
218.RB ( pathconf ())
219Too many symbolic links were encountered while resolving
220.IR path .
221.TP
222.B ENAMETOOLONG
223.RB ( pathconf ())
224.I path
225is too long.
226.TP
227.B ENOENT
228.RB ( pathconf ())
229A component of
230.I path
231does not exist, or
232.I path
233is an empty string.
234.TP
235.B ENOTDIR
236.RB ( pathconf ())
237A component used as a directory in
238.I path
239is not in fact a directory.
90f1e9c5
MS
240.SH ATTRIBUTES
241For an explanation of the terms used in this section, see
242.BR attributes (7).
243.TS
244allbox;
c466875e 245lbx lb lb
90f1e9c5
MS
246l l l.
247Interface Attribute Value
248T{
9e54434e
BR
249.na
250.nh
90f1e9c5
MS
251.BR fpathconf (),
252.BR pathconf ()
253T} Thread safety MT-Safe
254.TE
c466875e 255.sp 1
3113c7f3 256.SH STANDARDS
4131356c
AC
257POSIX.1-2008.
258.SH HISTORY
259POSIX.1-2001.
fea681da
MK
260.SH NOTES
261Files with name lengths longer than the value returned for
262.I name
263equal to
264.B _PC_NAME_MAX
265may exist in the given directory.
266.PP
267Some returned values may be huge; they are not suitable for allocating
268memory.
47297adb 269.SH SEE ALSO
fea681da
MK
270.BR getconf (1),
271.BR open (2),
272.BR statfs (2),
eff9ff0d 273.BR confstr (3),
fea681da 274.BR sysconf (3)