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