summaryrefslogtreecommitdiff
path: root/usr/src/man/man2/fpathconf.2
blob: 1fa0aacc937674dc9d4a3642ca1e7d8c292f1548 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
.\"
.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
.\" permission to reproduce portions of its copyrighted documentation.
.\" Original documentation from The Open Group can be obtained online at
.\" http://www.opengroup.org/bookstore/.
.\"
.\" The Institute of Electrical and Electronics Engineers and The Open
.\" Group, have given us permission to reprint portions of their
.\" documentation.
.\"
.\" In the following statement, the phrase ``this text'' refers to portions
.\" of the system documentation.
.\"
.\" Portions of this text are reprinted and reproduced in electronic form
.\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
.\" Standard for Information Technology -- Portable Operating System
.\" Interface (POSIX), The Open Group Base Specifications Issue 6,
.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
.\" Engineers, Inc and The Open Group.  In the event of any discrepancy
.\" between these versions and the original IEEE and The Open Group
.\" Standard, the original IEEE and The Open Group Standard is the referee
.\" document.  The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
.\" This notice shall appear on any product containing this material.
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\"
.\" Copyright 1989 AT&T
.\" Copyright (c) 1994, X/Open Company Limited.  All Rights Reserved.
.\" Portions Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
.\"
.TH FPATHCONF 2 "Sep 1, 2009"
.SH NAME
fpathconf, pathconf \- get configurable pathname variables
.SH SYNOPSIS
.LP
.nf
#include <unistd.h>

\fBlong\fR \fBfpathconf\fR(\fBint\fR \fIfildes\fR, \fBint\fR \fIname\fR);
.fi

.LP
.nf
\fBlong\fR \fBpathconf\fR(\fBconst char *\fR\fIpath\fR, \fBint\fR \fIname\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBfpathconf()\fR and \fBpathconf()\fR functions determine the current
value of a configurable limit or option ( variable ) that is associated with a
file or directory.
.sp
.LP
For \fBpathconf()\fR, the \fIpath\fR argument points to the pathname of a file
or directory.
.sp
.LP
For \fBfpathconf()\fR, the \fIfildes\fR argument is an open file descriptor.
.sp
.LP
The \fIname\fR argument represents the variable to be queried relative to that
file or directory. The variables in the following table come from
<\fBlimits.h\fR> or <\fBunistd.h\fR> and the symbolic constants, defined in
<\fBunistd.h\fR>, are the corresponding values used for \fIname:\fR
.sp

.sp
.TS
box;
c | c | c
l | l | l .
Variable	Value of \fIname\fR	Notes
_
{\fBACL_ENABLED\fR}	\fB_PC_ACL_ENABLED\fR	10
_
{\fBFILESIZEBITS\fR}	\fB_PC_FILESIZEBITS\fR	3,4
_
{\fBLINK_MAX\fR}	\fB_PC_LINK_MAX\fR	1
_
{\fBMAX_CANON\fR}	\fB_PC_MAX_CANON\fR	2
_
{\fBMAX_INPUT\fR}	\fB_PC_MAX_INPUT\fR	2
_
{\fBMIN_HOLE_SIZE\fR}	\fB_PC_MIN_HOLE_SIZE\fR	11
_
{\fBNAME_MAX\fR}	\fB_PC_NAME_MAX\fR	3, 4
_
{\fBPATH_MAX\fR}	\fB_PC_PATH_MAX\fR	4,5
_
{\fBPIPE_BUF\fR}	\fB_PC_PIPE_BUF\fR	6
_
{\fBPOSIX_ALLOC_SIZE_MIN\fR}	\fB_PC_ALLOC_SIZE_MIN\fR	
_
{\fBPOSIX_REC_INCR_XFER_SIZE\fR}	\fB_PC_REC_INCR_XFER_SIZE\fR	
_
{\fBPOSIX_REC_MAX_XFER_SIZE\fR}	\fB_PC_REC_MAX_XFER_SIZE\fR	
_
{\fBPOSIX_REC_MIN_XFER_SIZE\fR}	\fB_PC_REC_MIN_XFER_SIZE\fR	
_
{\fBPOSIX_REC_XFER_ALIGN\fR}	\fB_PC_REC_XFER_ALIGN\fR	
_
{\fBSYMLINK_MAX\fR}	\fB_PC_SYMLINK_MAX\fR	4, 9
_
{\fBXATTR_ENABLED\fR}	\fB_PC_XATTR_ENABLED\fR	1
_
{\fBSATTR_ENABLED\fR}	\fB_PC_SATTR_ENABLED\fR	
_
{\fBXATTR_EXISTS\fR}	\fB_PC_XATTR_EXISTS\fR	1
_
{\fBSATTR_EXISTS\fR}	\fB_PC_SATTR_EXISTS\fR	
_
{\fBACCESS_FILTERING\fR}	\fB_PC_ACCESS_FILTERING\fR	12
_
\fB_POSIX_CHOWN_RESTRICTED\fR	\fB_PC_CHOWN_RESTRICTED\fR	7
_
\fB_POSIX_NO_TRUNC\fR	\fB_PC_NO_TRUNC\fR	3, 4
_
\fB_POSIX_VDISABLE\fR	\fB_PC_VDISABLE\fR	2
_
\fB_POSIX_ASYNC_IO\fR	\fB_PC_ASYNC_IO\fR	8
_
\fB_POSIX_PRIO_IO\fR	\fB_PC_PRIO_IO\fR	8
_
\fB_POSIX_SYNC_IO\fR	\fB_PC_SYNC_IO\fR	8
_
\fB_POSIX_TIMESTAMP_RESOLUTION\fR	\fB_PC_TIMESTAMP_RESOLUTION\fR	1
.TE

.sp
.LP
\fBNotes:\fR
.RS +4
.TP
1.
If \fIpath\fR or \fIfildes\fR refers to a directory, the value returned
applies to the directory itself.
.RE
.RS +4
.TP
2.
If \fIpath\fR or \fIfildes\fR does not refer to a terminal file, it is
unspecified whether an implementation supports an association of the variable
name with the specified file.
.RE
.RS +4
.TP
3.
If \fIpath\fR or \fIfildes\fR refers to a directory, the value returned
applies to filenames within the directory.
.RE
.RS +4
.TP
4.
If \fIpath\fR or \fIfildes\fR does not refer to a directory, it is
unspecified whether an implementation supports an association of the variable
name with the specified file.
.RE
.RS +4
.TP
5.
If \fIpath\fR or \fIfildes\fR refers to a directory, the value returned is
the maximum length of a relative pathname when the specified directory is the
working directory.
.RE
.RS +4
.TP
6.
If \fIpath\fR refers to a FIFO, or \fIfildes\fR refers to a pipe or FIFO,
the value returned applies to the referenced object. If \fIpath\fR or
\fIfildes\fR refers to a directory, the value returned applies to any FIFO that
exists or can be created within the directory. If \fIpath\fR or \fIfildes\fR
refers to any other type of file, it is unspecified whether an implementation
supports an association of the variable name with the specified file.
.RE
.RS +4
.TP
7.
If \fIpath\fR or \fIfildes\fR refers to a directory, the value returned
applies to any files, other than directories, that exist or can be created
within the directory.
.RE
.RS +4
.TP
8.
If \fIpath\fR or \fIfildes\fR refers to a directory, it is unspecified
whether an implementation supports an association of the variable name with the
specified file.
.RE
.RS +4
.TP
9.
If \fIpath\fR or \fIfildes\fR refers to a directory, the value returned is
the maximum length of the string that a symbolic link in that directory can
contain.
.RE
.RS +4
.TP
10.
If \fIpath\fR or \fIfildes\fR refers to a file or directory in a file
system that supports ACLs, the value returned is the bitwise inclusive OR of
the following flags associated with ACL types supported by the file system;
otherwise 0 is returned.
.sp
.ne 2
.na
\fB\fB_ACL_ACE_ENABLED\fR\fR
.ad
.RS 23n
The file system supports ACE ACLs.
.RE

.sp
.ne 2
.na
\fB\fB_ACL_ACLENT_ENABLED\fR\fR
.ad
.RS 23n
The file system supports UFS aclent ACLs.
.RE

.RE
.RS +4
.TP
11.
If a filesystem supports the reporting of holes (see \fBlseek\fR(2),
\fBpathconf()\fR and \fBfpathconf()\fR return a positive number that represents
the minimum hole size returned in bytes. The offsets of holes returned will be
aligned to this same value. A special value of 1 is returned if the filesystem
does not specify the minimum hole size but still reports holes.
.RE
.RS +4
.TP
12.
If \fIpath\fR or \fIfildes\fR refers to a directory and the file system in
which the directory resides supports access filtering, a non-zero value is
returned. Otherwise, 0 is returned.
.RE
.SH RETURN VALUES
.sp
.LP
If \fIname\fR is an invalid value, both \fBpathconf()\fR and \fBfpathconf()\fR
return \fB\(mi1\fR and \fBerrno\fR is set to indicate the error.
.sp
.LP
If the variable corresponding to \fIname\fR has no limit for the \fIpath\fR or
file descriptor, both \fBpathconf()\fR and \fBfpathconf()\fR return \fB\(mi1\fR
without changing \fBerrno\fR. If \fBpathconf()\fR needs to use \fIpath\fR to
determine the value of \fIname\fR and \fBpathconf()\fR does not support the
association of \fIname\fR with the file specified by \fIpath\fR, or if the
process did not have appropriate privileges to query the file specified by
\fIpath\fR, or \fIpath\fR does not exist, \fBpathconf()\fR returns \fB\(mi1\fR
and \fBerrno\fR is set to indicate the error.
.sp
.LP
If \fBfpathconf()\fR needs to use \fIfildes\fR to determine the value of
\fIname\fR and \fBfpathconf()\fR does not support the association of \fIname\fR
with the file specified by \fIfildes\fR, or if \fIfildes\fR is an invalid file
descriptor, \fBfpathconf()\fR returns \fB\(mi1\fR and \fBerrno\fR is set to
indicate the error.
.sp
.LP
Otherwise \fBpathconf()\fR or \fBfpathconf()\fR returns the current variable
value for the file or directory without changing \fBerrno\fR. The value
returned will not be more restrictive than the corresponding value available to
the application when it was compiled with <\fBlimits.h\fR> or <\fBunistd.h\fR>.
.SH ERRORS
.sp
.LP
The \fBpathconf()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
The value of \fIname\fR is not valid.
.RE

.sp
.ne 2
.na
\fB\fBELOOP\fR\fR
.ad
.RS 10n
A loop exists in symbolic links encountered during resolution of the \fIpath\fR
argument.
.RE

.sp
.LP
The \fBfpathconf()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
The value of \fIname\fR is not valid.
.RE

.sp
.LP
The \fBpathconf()\fR function may fail if:
.sp
.ne 2
.na
\fB\fBEACCES\fR\fR
.ad
.RS 16n
Search permission is denied for a component of the path prefix.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 16n
An association of the variable \fIname\fR with the specified file is not
supported.
.RE

.sp
.ne 2
.na
\fB\fBENAMETOOLONG\fR\fR
.ad
.RS 16n
The length of the \fIpath\fR argument exceeds {\fBPATH_MAX\fR} or a pathname
component is longer than {\fBNAME_MAX\fR}.
.RE

.sp
.ne 2
.na
\fB\fBENAMETOOLONG\fR\fR
.ad
.RS 16n
As a result of encountering a symbolic link in resolution of the \fIpath\fR
argument, the length of the substituted pathname string exceeded
{\fBPATH_MAX\fR}.
.RE

.sp
.ne 2
.na
\fB\fBENOENT\fR\fR
.ad
.RS 16n
A component of \fIpath\fR does not name an existing file or \fIpath\fR is an
empty string.
.RE

.sp
.ne 2
.na
\fB\fBENOTDIR\fR\fR
.ad
.RS 16n
A component of the path prefix is not a directory.
.RE

.sp
.LP
The \fBfpathconf()\fR function may fail if:
.sp
.ne 2
.na
\fB\fBEBADF\fR\fR
.ad
.RS 10n
The \fIfildes\fR argument is not a valid file descriptor.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
An association of the variable \fIname\fR with the specified file is not
supported.
.RE

.SH USAGE
.sp
.LP
The {\fBSYMLINK_MAX\fR} variable applies only to the \fBfpathconf()\fR
function.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
_
MT-Level	Async-Signal-Safe
_
Standard	See \fBstandards\fR(5).
.TE

.SH SEE ALSO
.sp
.LP
\fBlseek\fR(2), \fBconfstr\fR(3C), \fBlimits.h\fR(3HEAD), \fBsysconf\fR(3C),
\fBattributes\fR(5), \fBstandards\fR(5)