1fpathconf(3) Library Functions Manual fpathconf(3)
2
3
4
6 fpathconf, pathconf - get configuration values for files
7
9 Standard C library (libc, -lc)
10
12 #include <unistd.h>
13
14 long fpathconf(int fd, int name);
15 long pathconf(const char *path, int name);
16
18 fpathconf() gets a value for the configuration option name for the open
19 file descriptor fd.
20
21 pathconf() gets a value for configuration option name for the filename
22 path.
23
24 The corresponding macros defined in <unistd.h> are minimum values; if
25 an application wants to take advantage of values which may change, a
26 call to fpathconf() or pathconf() can be made, which may yield more
27 liberal results.
28
29 Setting name equal to one of the following constants returns the fol‐
30 lowing configuration options:
31
32 _PC_LINK_MAX
33 The maximum number of links to the file. If fd or path refer to
34 a directory, then the value applies to the whole directory. The
35 corresponding macro is _POSIX_LINK_MAX.
36
37 _PC_MAX_CANON
38 The maximum length of a formatted input line, where fd or path
39 must refer to a terminal. The corresponding macro is
40 _POSIX_MAX_CANON.
41
42 _PC_MAX_INPUT
43 The maximum length of an input line, where fd or path must refer
44 to a terminal. The corresponding macro is _POSIX_MAX_INPUT.
45
46 _PC_NAME_MAX
47 The maximum length of a filename in the directory path or fd
48 that the process is allowed to create. The corresponding macro
49 is _POSIX_NAME_MAX.
50
51 _PC_PATH_MAX
52 The maximum length of a relative pathname when path or fd is the
53 current working directory. The corresponding macro is
54 _POSIX_PATH_MAX.
55
56 _PC_PIPE_BUF
57 The maximum number of bytes that can be written atomically to a
58 pipe of FIFO. For fpathconf(), fd should refer to a pipe or
59 FIFO. For fpathconf(), path should refer to a FIFO or a direc‐
60 tory; in the latter case, the returned value corresponds to FI‐
61 FOs created in that directory. The corresponding macro is
62 _POSIX_PIPE_BUF.
63
64 _PC_CHOWN_RESTRICTED
65 This returns a positive value if the use of chown(2) and
66 fchown(2) for changing a file's user ID is restricted to a
67 process with appropriate privileges, and changing a file's group
68 ID to a value other than the process's effective group ID or one
69 of its supplementary group IDs is restricted to a process with
70 appropriate privileges. According to POSIX.1, this variable
71 shall always be defined with a value other than -1. The corre‐
72 sponding macro is _POSIX_CHOWN_RESTRICTED.
73
74 If fd or path refers to a directory, then the return value ap‐
75 plies to all files in that directory.
76
77 _PC_NO_TRUNC
78 This returns nonzero if accessing filenames longer than
79 _POSIX_NAME_MAX generates an error. The corresponding macro is
80 _POSIX_NO_TRUNC.
81
82 _PC_VDISABLE
83 This returns nonzero if special character processing can be dis‐
84 abled, where fd or path must refer to a terminal.
85
87 The return value of these functions is one of the following:
88
89 • On error, -1 is returned and errno is set to indicate the error (for
90 example, EINVAL, indicating that name is invalid).
91
92 • If name corresponds to a maximum or minimum limit, and that limit is
93 indeterminate, -1 is returned and errno is not changed. (To distin‐
94 guish an indeterminate limit from an error, set errno to zero before
95 the call, and then check whether errno is nonzero when -1 is re‐
96 turned.)
97
98 • If name corresponds to an option, a positive value is returned if
99 the option is supported, and -1 is returned if the option is not
100 supported.
101
102 • Otherwise, the current value of the option or limit is returned.
103 This value will not be more restrictive than the corresponding value
104 that was described to the application in <unistd.h> or <limits.h>
105 when the application was compiled.
106
108 EACCES (pathconf()) Search permission is denied for one of the directo‐
109 ries in the path prefix of path.
110
111 EBADF (fpathconf()) fd is not a valid file descriptor.
112
113 EINVAL name is invalid.
114
115 EINVAL The implementation does not support an association of name with
116 the specified file.
117
118 ELOOP (pathconf()) Too many symbolic links were encountered while re‐
119 solving path.
120
121 ENAMETOOLONG
122 (pathconf()) path is too long.
123
124 ENOENT (pathconf()) A component of path does not exist, or path is an
125 empty string.
126
127 ENOTDIR
128 (pathconf()) A component used as a directory in path is not in
129 fact a directory.
130
132 For an explanation of the terms used in this section, see at‐
133 tributes(7).
134
135 ┌────────────────────────────────────────────┬───────────────┬─────────┐
136 │Interface │ Attribute │ Value │
137 ├────────────────────────────────────────────┼───────────────┼─────────┤
138 │fpathconf(), pathconf() │ Thread safety │ MT-Safe │
139 └────────────────────────────────────────────┴───────────────┴─────────┘
140
142 POSIX.1-2008.
143
145 POSIX.1-2001.
146
148 Files with name lengths longer than the value returned for name equal
149 to _PC_NAME_MAX may exist in the given directory.
150
151 Some returned values may be huge; they are not suitable for allocating
152 memory.
153
155 getconf(1), open(2), statfs(2), confstr(3), sysconf(3)
156
157
158
159Linux man-pages 6.04 2023-03-30 fpathconf(3)