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