1FPATHCONF(3)               Linux Programmer's Manual              FPATHCONF(3)
2
3
4

NAME

6       fpathconf, pathconf - get configuration values for files
7

SYNOPSIS

9       #include <unistd.h>
10
11       long fpathconf(int fd, int name);
12       long pathconf(const char *path, int name);
13

DESCRIPTION

15       fpathconf() gets a value for the configuration option name for the open
16       file descriptor fd.
17
18       pathconf() gets a value for configuration option name for the  filename
19       path.
20
21       The  corresponding  macros defined in <unistd.h> are minimum values; if
22       an application wants to take advantage of values which  may  change,  a
23       call  to  fpathconf()  or  pathconf() can be made, which may yield more
24       liberal results.
25
26       Setting name equal to one of the following constants returns  the  fol‐
27       lowing configuration options:
28
29       _PC_LINK_MAX
30              The maximum number of links to the file.  If fd or path refer to
31              a directory, then the value applies to the whole directory.  The
32              corresponding macro is _POSIX_LINK_MAX.
33
34       _PC_MAX_CANON
35              The  maximum  length of a formatted input line, where fd or path
36              must  refer  to  a  terminal.   The   corresponding   macro   is
37              _POSIX_MAX_CANON.
38
39       _PC_MAX_INPUT
40              The maximum length of an input line, where fd or path must refer
41              to a terminal.  The corresponding macro is _POSIX_MAX_INPUT.
42
43       _PC_NAME_MAX
44              The maximum length of a filename in the  directory  path  or  fd
45              that  the process is allowed to create.  The corresponding macro
46              is _POSIX_NAME_MAX.
47
48       _PC_PATH_MAX
49              The maximum length of a relative pathname when path or fd is the
50              current   working   directory.    The   corresponding  macro  is
51              _POSIX_PATH_MAX.
52
53       _PC_PIPE_BUF
54              The maximum number of bytes that can be written atomically to  a
55              pipe  of  FIFO.   For  fpathconf(), fd should refer to a pipe or
56              FIFO.  For fpathconf(), path should refer to a FIFO or a  direc‐
57              tory;  in  the  latter  case,  the returned value corresponds to
58              FIFOs created in that directory.   The  corresponding  macro  is
59              _POSIX_PIPE_BUF.
60
61       _PC_CHOWN_RESTRICTED
62              This  returns  a  positive  value  if  the  use  of chown(2) and
63              fchown(2) for changing a file's  user  ID  is  restricted  to  a
64              process with appropriate privileges, and changing a file's group
65              ID to a value other than the process's effective group ID or one
66              of  its  supplementary group IDs is restricted to a process with
67              appropriate privileges.  According  to  POSIX.1,  this  variable
68              shall  always be defined with a value other than -1.  The corre‐
69              sponding macro is _POSIX_CHOWN_RESTRICTED.
70
71              If fd or path refers to  a  directory,  then  the  return  value
72              applies to all files in that directory.
73
74       _PC_NO_TRUNC
75              This   returns   nonzero  if  accessing  filenames  longer  than
76              _POSIX_NAME_MAX generates an error.  The corresponding macro  is
77              _POSIX_NO_TRUNC.
78
79       _PC_VDISABLE
80              This returns nonzero if special character processing can be dis‐
81              abled, where fd or path must refer to a terminal.
82

RETURN VALUE

84       The return value of these functions is one of the following:
85
86       *  On error, -1 is returned and errno is set to indicate the  cause  of
87          the error (for example, EINVAL, indicating that name is invalid).
88
89       *  If name corresponds to a maximum or minimum limit, and that limit is
90          indeterminate, -1 is returned and errno is not changed.  (To distin‐
91          guish an indeterminate limit from an error, set errno to zero before
92          the call, and then  check  whether  errno  is  nonzero  when  -1  is
93          returned.)
94
95       *  If  name  corresponds  to an option, a positive value is returned if
96          the option is supported, and -1 is returned if  the  option  is  not
97          supported.
98
99       *  Otherwise,  the  current  value  of the option or limit is returned.
100          This value will not be more restrictive than the corresponding value
101          that  was  described  to the application in <unistd.h> or <limits.h>
102          when the application was compiled.
103

ERRORS

105       EACCES (pathconf()) Search permission is denied for one of the directo‐
106              ries in the path prefix of path.
107
108       EBADF  (fpathconf()) fd is not a valid file descriptor.
109
110       EINVAL name is invalid.
111
112       EINVAL The  implementation does not support an association of name with
113              the specified file.
114
115       ELOOP  (pathconf()) Too many  symbolic  links  were  encountered  while
116              resolving path.
117
118       ENAMETOOLONG
119              (pathconf()) path is too long.
120
121       ENOENT (pathconf())  A  component of path does not exist, or path is an
122              empty string.
123
124       ENOTDIR
125              (pathconf()) A component used as a directory in path is  not  in
126              fact a directory.
127

ATTRIBUTES

129       For   an   explanation   of   the  terms  used  in  this  section,  see
130       attributes(7).
131
132       ┌────────────────────────┬───────────────┬─────────┐
133Interface               Attribute     Value   
134       ├────────────────────────┼───────────────┼─────────┤
135fpathconf(), pathconf() │ Thread safety │ MT-Safe │
136       └────────────────────────┴───────────────┴─────────┘

CONFORMING TO

138       POSIX.1-2001, POSIX.1-2008.
139

NOTES

141       Files with name lengths longer than the value returned for  name  equal
142       to _PC_NAME_MAX may exist in the given directory.
143
144       Some  returned values may be huge; they are not suitable for allocating
145       memory.
146

SEE ALSO

148       getconf(1), open(2), statfs(2), confstr(3), sysconf(3)
149

COLOPHON

151       This page is part of release 4.16 of the Linux  man-pages  project.   A
152       description  of  the project, information about reporting bugs, and the
153       latest    version    of    this    page,    can     be     found     at
154       https://www.kernel.org/doc/man-pages/.
155
156
157
158GNU                               2017-07-13                      FPATHCONF(3)
Impressum