1FPATHCONF(3P)              POSIX Programmer's Manual             FPATHCONF(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       fpathconf, pathconf - get configurable pathname variables
13

SYNOPSIS

15       #include <unistd.h>
16
17       long fpathconf(int fildes, int name);
18       long pathconf(const char *path, int name);
19
20

DESCRIPTION

22       The fpathconf() and pathconf() functions shall  determine  the  current
23       value  of  a configurable limit or option (variable) that is associated
24       with a file or directory.
25
26       For pathconf(), the path argument points to the pathname of a  file  or
27       directory.
28
29       For fpathconf(), the fildes argument is an open file descriptor.
30
31       The  name  argument  represents  the variable to be queried relative to
32       that file or directory. Implementations shall support all of the  vari‐
33       ables  listed  in the following table and may support others. The vari‐
34       ables in the following table come from <limits.h> or <unistd.h> and the
35       symbolic constants, defined in <unistd.h>, are the corresponding values
36       used for name.
37
38          Variable                    Value of name           Requirements
39          {FILESIZEBITS}              _PC_FILESIZEBITS        3,4
40          {LINK_MAX}                  _PC_LINK_MAX            1
41          {MAX_CANON}                 _PC_MAX_CANON           2
42          {MAX_INPUT}                 _PC_MAX_INPUT           2
43          {NAME_MAX}                  _PC_NAME_MAX            3,4
44          {PATH_MAX}                  _PC_PATH_MAX            4,5
45          {PIPE_BUF}                  _PC_PIPE_BUF            6
46          {POSIX_ALLOC_SIZE_MIN}      _PC_ALLOC_SIZE_MIN
47          {POSIX_REC_INCR_XFER_SIZE}  _PC_REC_INCR_XFER_SIZE
48          {POSIX_REC_MAX_XFER_SIZE}   _PC_REC_MAX_XFER_SIZE
49          {POSIX_REC_MIN_XFER_SIZE}   _PC_REC_MIN_XFER_SIZE
50          {POSIX_REC_XFER_ALIGN}      _PC_REC_XFER_ALIGN
51          {SYMLINK_MAX}               _PC_SYMLINK_MAX         4,9
52          _POSIX_CHOWN_RESTRICTED     _PC_CHOWN_RESTRICTED    7
53          _POSIX_NO_TRUNC             _PC_NO_TRUNC            3,4
54          _POSIX_VDISABLE             _PC_VDISABLE            2
55          _POSIX_ASYNC_IO             _PC_ASYNC_IO            8
56          _POSIX_PRIO_IO              _PC_PRIO_IO             8
57          _POSIX_SYNC_IO              _PC_SYNC_IO             8
58
59   Requirements
60        1. If path or fildes refers to a directory, the value  returned  shall
61           apply to the directory itself.
62
63        2. If path or fildes does not refer to a terminal file, it is unspeci‐
64           fied whether an implementation supports an association of the vari‐
65           able name with the specified file.
66
67        3. If  path  or fildes refers to a directory, the value returned shall
68           apply to filenames within the directory.
69
70        4. If path or fildes does not refer to a directory, it is  unspecified
71           whether  an  implementation supports an association of the variable
72           name with the specified file.
73
74        5. If path or fildes refers to a directory, the value  returned  shall
75           be  the  maximum  length  of a relative pathname when the specified
76           directory is the working directory.
77
78        6. If path refers to a FIFO, or fildes refers to a pipe or  FIFO,  the
79           value  returned  shall  apply  to the referenced object. If path or
80           fildes refers to a directory, the value returned shall apply to any
81           FIFO that exists or can be created within the directory. If path or
82           fildes refers to any other type of file, it is unspecified  whether
83           an implementation supports an association of the variable name with
84           the specified file.
85
86        7. If path or fildes refers to a directory, the value  returned  shall
87           apply  to  any  files, other than directories, that exist or can be
88           created within the directory.
89
90        8. If path or fildes refers to a directory, it is unspecified  whether
91           an implementation supports an association of the variable name with
92           the specified file.
93
94        9. If path or fildes refers to a directory, the value  returned  shall
95           be  the  maximum  length of the string that a symbolic link in that
96           directory can contain.
97

RETURN VALUE

99       If name is an invalid value,  both  pathconf()  and  fpathconf()  shall
100       return -1 and set errno to indicate the error.
101
102       If the variable corresponding to name has no limit for the path or file
103       descriptor, both pathconf() and fpathconf()  shall  return  -1  without
104       changing  errno.  If  the implementation needs to use path to determine
105       the value of name and the implementation does not support the  associa‐
106       tion of name with the file specified by path, or if the process did not
107       have appropriate privileges to query the file  specified  by  path,  or
108       path  does not exist, pathconf() shall return -1 and set errno to indi‐
109       cate the error.
110
111       If the implementation needs to use fildes to  determine  the  value  of
112       name  and  the  implementation does not support the association of name
113       with the file specified by fildes, or if  fildes  is  an  invalid  file
114       descriptor,  fpathconf()  shall return -1 and set errno to indicate the
115       error.
116
117       Otherwise, pathconf() or fpathconf() shall return the current  variable
118       value  for  the  file  or  directory  without changing errno. The value
119       returned shall not be more restrictive  than  the  corresponding  value
120       available  to the application when it was compiled with the implementa‐
121       tion's <limits.h> or <unistd.h>.
122

ERRORS

124       The pathconf() function shall fail if:
125
126       EINVAL The value of name is not valid.
127
128       ELOOP  A loop exists in symbolic links encountered during resolution of
129              the path argument.
130
131
132       The pathconf() function may fail if:
133
134       EACCES Search permission is denied for a component of the path prefix.
135
136       EINVAL The  implementation does not support an association of the vari‐
137              able name with the specified file.
138
139       ELOOP  More than {SYMLOOP_MAX} symbolic links were  encountered  during
140              resolution of the path argument.
141
142       ENAMETOOLONG
143              The length of the path argument exceeds {PATH_MAX} or a pathname
144              component is longer than {NAME_MAX}.
145
146       ENAMETOOLONG
147              As a result of encountering a symbolic link in resolution of the
148              path  argument,  the  length  of the substituted pathname string
149              exceeded {PATH_MAX}.
150
151       ENOENT A component of path does not name an existing file or path is an
152              empty string.
153
154       ENOTDIR
155              A component of the path prefix is not a directory.
156
157
158       The fpathconf() function shall fail if:
159
160       EINVAL The value of name is not valid.
161
162
163       The fpathconf() function may fail if:
164
165       EBADF  The fildes argument is not a valid file descriptor.
166
167       EINVAL The  implementation does not support an association of the vari‐
168              able name with the specified file.
169
170
171       The following sections are informative.
172

EXAMPLES

174       None.
175

APPLICATION USAGE

177       None.
178

RATIONALE

180       The pathconf() function was proposed immediately  after  the  sysconf()
181       function  when it was realized that some configurable values may differ
182       across file system, directory, or device boundaries.
183
184       For example, {NAME_MAX} frequently changes between System  V  and  BSD-
185       based  file  systems;  System  V  uses a maximum of 14, BSD 255.  On an
186       implementation that provides both types of file systems, an application
187       would  be  forced to limit all pathname components to 14 bytes, as this
188       would be the value specified in <limits.h> on such a system.
189
190       Therefore, various useful values can be queried on any pathname or file
191       descriptor, assuming that the appropriate permissions are in place.
192
193       The  value  returned  for the variable {PATH_MAX} indicates the longest
194       relative pathname that could be given if the specified directory is the
195       process' current working directory. A process may not always be able to
196       generate a name that long and use it if a subdirectory in the  pathname
197       crosses into a more restrictive file system.
198
199       The  value  returned  for  the  variable  _POSIX_CHOWN_RESTRICTED  also
200       applies to directories that do not have file systems mounted  on  them.
201       The  value may change when crossing a mount point, so applications that
202       need to know should check for each directory. (An even easier check  is
203       to try the chown() function and look for an error in case it happens.)
204
205       Unlike  the  values  returned by sysconf(), the pathname-oriented vari‐
206       ables are potentially more volatile and are not  guaranteed  to  remain
207       constant  throughout the process' lifetime. For example, in between two
208       calls to  pathconf(),  the  file  system  in  question  may  have  been
209       unmounted and remounted with different characteristics.
210
211       Also note that most of the errors are optional. If one of the variables
212       always has the same value on an implementation, the implementation need
213       not  look at path or fildes to return that value and is, therefore, not
214       required to detect any of the errors except  the  meaning  of  [EINVAL]
215       that indicates that the value of name is not valid for that variable.
216
217       If  the value of any of the limits is unspecified (logically infinite),
218       they will not be defined in <limits.h> and the  pathconf()  and  fpath‐
219       conf()  functions return -1 without changing errno. This can be distin‐
220       guished from the case of giving an unrecognized name  argument  because
221       errno is set to [EINVAL] in this case.
222
223       Since  -1  is  a  valid return value for the pathconf() and fpathconf()
224       functions, applications should set errno to zero  before  calling  them
225       and check errno only if the return value is -1.
226
227       For  the case of {SYMLINK_MAX}, since both pathconf() and open() follow
228       symbolic links, there is no way that path or fildes could  refer  to  a
229       symbolic link.
230

FUTURE DIRECTIONS

232       None.
233

SEE ALSO

235       confstr(),     sysconf(),    the    Base    Definitions    volume    of
236       IEEE Std 1003.1-2001, <limits.h>, <unistd.h>, the Shell  and  Utilities
237       volume of IEEE Std 1003.1-2001
238
240       Portions  of  this text are reprinted and reproduced in electronic form
241       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
242       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
243       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
244       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
245       event of any discrepancy between this version and the original IEEE and
246       The  Open Group Standard, the original IEEE and The Open Group Standard
247       is the referee document. The original Standard can be  obtained  online
248       at http://www.opengroup.org/unix/online.html .
249
250
251
252IEEE/The Open Group                  2003                        FPATHCONF(3P)
Impressum