fpathconf(2) fpathconf(2)
NAME
fpathconf, pathconf - get configurable pathname variables
SYNOPSIS
#include <unistd.h>
long int fpathconf(int fildes, int name);
long int pathconf(const char *path, int name);
DESCRIPTION
The fpathconf() and pathconf() functions provide a method for the
application to determine the current value of a configurable limit or
option (variable) that is associated with a file or directory.
For pathconf(), the path argument points to the pathname of a file or
directory.
For fpathconf(), the fildes argument is an open file descriptor.
The name argument represents the variable to be queried relative to
that file or directory. Implementations will support all of the vari-
ables listed in the following table and may support others. The vari-
ables in the following table come from limits.h or unistd.h and the
symbolic constants, defined in unistd.h, are the corresponding values
used for name:
______________________________________________________________
| Variable | Value of name | See Notes |
|________________________|_______________________|____________|
| FILESIZEBITS | PCFILESIZEBITS | 3, 4 |
|________________________|_______________________|____________|
| LINKMAX | PCLINKMAX | 1 |
|________________________|_______________________|____________|
| MAXCANON | PCMAXCANON | 2 |
|________________________|_______________________|____________|
| MAXINPUT | PCMAXINPUT | 2 |
|________________________|_______________________|____________|
| NAMEMAX | PCNAMEMAX | 3, 4 |
|________________________|_______________________|____________|
| PATHMAX | PCPATHMAX | 4, 5 |
|________________________|_______________________|____________|
| PIPEBUF | PCPIPEBUF | 6 |
|________________________|_______________________|____________|
| POSIXCHOWNRESTRICTED| PCCHOWNRESTRICTED | 7 |
|________________________|_______________________|____________|
| POSIXNOTRUNC | PCNOTRUNC | 3, 4 |
|________________________|_______________________|____________|
| POSIXVDISABLE | PCVDISABLE | 2 |
|________________________|_______________________|____________|
Page 1 Reliant UNIX 5.44 Printed 11/98
fpathconf(2) fpathconf(2)
Notes:
1) If path or fildes refers to a directory, the value returned
applies to the directory itself.
2) The behavior is undefined if path or fildes does not refer to a
terminal file.
3) If path or fildes refers to a directory, the value returned
applies to the filenames within the directory.
4) The behavior is undefined if path or fildes does not refer to a
directory.
5) If path or fildes refers to a directory, the value returned is the
maximum length of a relative pathname when the specified directory
is the working directory.
6) If path or fildes refers to a pipe or FIFO, the value returned
applies to the FIFO itself. If path or fildes refers to a direc-
tory, the value returned applies to any FIFOs that exist or can be
created within the directory. If path or fildes refer to any other
type of file, the behavior is undefined.
7) If path or fildes refers to a directory, the value returned
applies to any files, other than directories, that exist or can be
created within the directory.
The value of the configurable system limit or option specified by name
does not change during the lifetime of the calling process.
RETURN VALUE
If name is an invalid value, both pathconf() and fpathconf() return -1
and errno is set to indicate the error.
If the variable corresponding to name has no limit for the path or
file descriptor, both pathconf() and fpathconf() return -1 without
changing errno. If the implementation needs to use path to determine
the value of name and the implementation does not support the associa-
tion of name with the file specified by path, or if the process did
not have appropriate privileges to query the file specified by path,
or path does not exist, pathconf() returns -1 and errno is set to
indicate the error.
If the implementation needs to use fildes to determine the value of
name and the implementation does not support the association of name
with the file specified by fildes, or if fildes is an invalid file
descriptor, fpathconf() will return -1 and errno is set to indicate
the error.
Page 2 Reliant UNIX 5.44 Printed 11/98
fpathconf(2) fpathconf(2)
Otherwise pathconf() or fpathconf() returns the current variable value
for the file or directory without changing errno. The value returned
will not be more restrictive than the corresponding value available to
the application when it was compiled with the implementation's
limits.h or unistd.h.
ERRORS
The following error code descriptions are function-specific. You will
find a general description in introprm2(2) or in errno(5).
fpathconf() fails if the following is true:
EBADF fildes is not a valid file descriptor.
pathconf() fails if one or more of the following apply:
EACCES Search permission is denied for a component of the path
prefix.
ELOOP Too many symbolic links are encountered while translat-
ing path.
EMULTIHOP Components of path require hopping to multiple remote
machines and the file system type does not allow it.
ENAMETOOLONG The length of a pathname exceeds PATHMAX or a pathname
component is longer than NAMEMAX.
ENAMETOOLONG Pathname resolution of a symbolic link produced an
intermediate result whose length exceeds PATHMAX.
ENOENT path is needed for the command specified and the named
file does not exist or the path argument points to an
empty string.
ENOLINK path points to a remote machine and the link to that
machine is no longer active.
ENOSYS An attempt was made to perform an unsupported operation
(such as create, remove, link, or unlink) on an entry in
a file system.
ENOTDIR A component of the path prefix is not a directory.
Both fpathconf() and pathconf() fail if the following is true:
EINVAL name is an invalid value.
EINVAL The implementation does not support an association of
the variable name with the specified file.
Page 3 Reliant UNIX 5.44 Printed 11/98
fpathconf(2) fpathconf(2)
NOTES
The PCFILESIZEBITS option makes it possible for a process to deter-
mine how large a file can be created in a given directory. It takes
into account implementation limitations in the file system (e.g. due
to the size of file size and block count variables), and it takes into
account long term policy limitations. It does not take into account
dynamic restrictions such as the RLIMFSIZE resource limit or the
number of available file blocks, so the process must perform appropri-
ate checks.
When the current directory is on a typical large file capable file
system of 4 GB in size,
pathconf(".", PCFILESIZEBITS);
will return 36. This means that in the case of a 4-GB file system
(vxfs, ufs), a file can be written up to position 2 to the power of
36-1 = 32 GB-1 (physical block configuration max. 4 GB).
The maximum file size in a vxfs file system (Veritas) is 2 to the
power of 44 -bsize-1, and in a ufs file system is 2 to the power of 45
-bsize-1.
In general, if the maximum size file that could ever exist on the
mounted file system is maxsize then the returned value is 2 plus the
floor of the base 2 logarithm of maxsize.
SEE ALSO
sysconf(3C), limits(4), unistd(4), lfs(5).
Page 4 Reliant UNIX 5.44 Printed 11/98