]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/fpathconf.3
share/mk/: distcheck: Run 'check' after 'build'
[thirdparty/man-pages.git] / man3 / fpathconf.3
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\" and Copyright (C) 2017 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
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.
13 .\"
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.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\" Modified Wed Jul 28 11:12:26 1993 by Rik Faith (faith@cs.unc.edu)
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
41 .\"
42 .TH FPATHCONF 3 2017-07-13 "GNU" "Linux Programmer's Manual"
43 .SH NAME
44 fpathconf, pathconf \- get configuration values for files
45 .SH SYNOPSIS
46 .nf
47 .B #include <unistd.h>
48 .PP
49 .BI "long fpathconf(int " fd ", int " name );
50 .BI "long pathconf(const char *" path ", int " name );
51 .fi
52 .SH DESCRIPTION
53 .BR fpathconf ()
54 gets a value for the configuration option
55 .I name
56 for the open file descriptor
57 .IR fd .
58 .PP
59 .BR pathconf ()
60 gets a value for configuration option
61 .I name
62 for the filename
63 .IR path .
64 .PP
65 The corresponding macros defined in
66 .I <unistd.h>
67 are minimum values; if an application wants to take advantage of values
68 which may change, a call to
69 .BR fpathconf ()
70 or
71 .BR pathconf ()
72 can be made, which may yield more liberal results.
73 .PP
74 Setting
75 .I name
76 equal to one of the following constants returns the following
77 configuration options:
78 .TP
79 .B _PC_LINK_MAX
80 The maximum number of links to the file.
81 If
82 .I fd
83 or
84 .I path
85 refer to a directory, then the value applies to the whole directory.
86 The corresponding macro is
87 .BR _POSIX_LINK_MAX .
88 .TP
89 .B _PC_MAX_CANON
90 The maximum length of a formatted input line, where
91 .I fd
92 or
93 .I path
94 must refer to a terminal.
95 The corresponding macro is
96 .BR _POSIX_MAX_CANON .
97 .TP
98 .B _PC_MAX_INPUT
99 The maximum length of an input line, where
100 .I fd
101 or
102 .I path
103 must refer to a terminal.
104 The corresponding macro is
105 .BR _POSIX_MAX_INPUT .
106 .TP
107 .B _PC_NAME_MAX
108 The maximum length of a filename in the directory
109 .I path
110 or
111 .IR fd
112 that the process is allowed to create.
113 The corresponding macro is
114 .BR _POSIX_NAME_MAX .
115 .TP
116 .B _PC_PATH_MAX
117 The maximum length of a relative pathname when
118 .I path
119 or
120 .I fd
121 is the current working directory.
122 The corresponding macro is
123 .BR _POSIX_PATH_MAX .
124 .TP
125 .B _PC_PIPE_BUF
126 The maximum number of bytes that can be written atomically to a pipe of FIFO.
127 For
128 .BR fpathconf (),
129 .I fd
130 should refer to a pipe or FIFO.
131 For
132 .BR fpathconf (),
133 .I path
134 should refer to a FIFO or a directory; in the latter case,
135 the returned value corresponds to FIFOs created in that directory.
136 The corresponding macro is
137 .BR _POSIX_PIPE_BUF .
138 .TP
139 .B _PC_CHOWN_RESTRICTED
140 This returns a positive value if the use of
141 .BR chown (2)
142 and
143 .BR fchown (2)
144 for changing a file's user ID is restricted to a process
145 with appropriate privileges,
146 and changing a file's group ID to a value other than the process's
147 effective group ID or one of its supplementary group IDs
148 is restricted to a process with appropriate privileges.
149 According to POSIX.1,
150 this variable shall always be defined with a value other than \-1.
151 The corresponding macro is
152 .BR _POSIX_CHOWN_RESTRICTED .
153 .IP
154 If
155 .I fd
156 or
157 .I path
158 refers to a directory,
159 then the return value applies to all files in that directory.
160 .TP
161 .B _PC_NO_TRUNC
162 This returns nonzero if accessing filenames longer than
163 .B _POSIX_NAME_MAX
164 generates an error.
165 The corresponding macro is
166 .BR _POSIX_NO_TRUNC .
167 .TP
168 .B _PC_VDISABLE
169 This returns nonzero if special character processing can be disabled, where
170 .I fd
171 or
172 .I path
173 must refer to a terminal.
174 .SH RETURN VALUE
175 The return value of these functions is one of the following:
176 .IP * 3
177 On error, \-1 is returned and
178 .I errno
179 is set to indicate the cause of the error
180 (for example,
181 .BR EINVAL ,
182 indicating that
183 .I name
184 is invalid).
185 .IP *
186 If
187 .I name
188 corresponds to a maximum or minimum limit, and that limit is indeterminate,
189 \-1 is returned and
190 .I errno
191 is not changed.
192 (To distinguish an indeterminate limit from an error, set
193 .I errno
194 to zero before the call, and then check whether
195 .I errno
196 is nonzero when \-1 is returned.)
197 .IP *
198 If
199 .I name
200 corresponds to an option,
201 a positive value is returned if the option is supported,
202 and \-1 is returned if the option is not supported.
203 .IP *
204 Otherwise,
205 the current value of the option or limit is returned.
206 This value will not be more restrictive than
207 the corresponding value that was described to the application in
208 .I <unistd.h>
209 or
210 .I <limits.h>
211 when the application was compiled.
212 .SH ERRORS
213 .TP
214 .B EACCES
215 .RB ( pathconf ())
216 Search 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
222 is not a valid file descriptor.
223 .TP
224 .B EINVAL
225 .I name
226 is invalid.
227 .TP
228 .B EINVAL
229 The implementation does not support an association of
230 .I name
231 with the specified file.
232 .TP
233 .B ELOOP
234 .RB ( pathconf ())
235 Too many symbolic links were encountered while resolving
236 .IR path .
237 .TP
238 .B ENAMETOOLONG
239 .RB ( pathconf ())
240 .I path
241 is too long.
242 .TP
243 .B ENOENT
244 .RB ( pathconf ())
245 A component of
246 .I path
247 does not exist, or
248 .I path
249 is an empty string.
250 .TP
251 .B ENOTDIR
252 .RB ( pathconf ())
253 A component used as a directory in
254 .I path
255 is not in fact a directory.
256 .SH ATTRIBUTES
257 For an explanation of the terms used in this section, see
258 .BR attributes (7).
259 .TS
260 allbox;
261 lbw23 lb lb
262 l l l.
263 Interface Attribute Value
264 T{
265 .BR fpathconf (),
266 .BR pathconf ()
267 T} Thread safety MT-Safe
268 .TE
269 .SH CONFORMING TO
270 POSIX.1-2001, POSIX.1-2008.
271 .SH NOTES
272 Files with name lengths longer than the value returned for
273 .I name
274 equal to
275 .B _PC_NAME_MAX
276 may exist in the given directory.
277 .PP
278 Some returned values may be huge; they are not suitable for allocating
279 memory.
280 .SH SEE ALSO
281 .BR getconf (1),
282 .BR open (2),
283 .BR statfs (2),
284 .BR confstr (3),
285 .BR sysconf (3)