pathconf(2) CLIX pathconf(2)
NAME
pathconf, fpathconf - Retrieves file implementation characteristics
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <unistd.h>
long pathconf(
char path ,
int name );
long fpathconf(
int filedes ,
int name );
PARAMETERS
path Points to the pathname of a file or directory.
filedes Specifies an open file descriptor.
name Specifies the configuration attribute to be queried. If this
attribute is not applicable to the file specified by path or
filedes, pathconf() or fpathconf() returns an error. Symbolic
values for name listed below, are defined in the <unistd.h>
header file:
_PC_LINK_MAX
The maximum number of links to the file.
_PC_MAX_CANON
The maximum number of bytes in a terminal canonical input
queue. This is applicable only to terminal devices.
_PC_MAX_INPUT
The number of bytes allowed in a terminal input queue.
This is applicable only to terminal devices.
_PC_NAME_MAX
The maximum number of bytes in a filename. This is
applicable only to a directory file.
_PC_PATH_MAX
The maximum number of bytes in a pathname. This is
applicable only to a directory file.
2/94 - Intergraph Corporation 1
pathconf(2) CLIX pathconf(2)
_PC_PIPE_BUF
The maximum number of bytes guaranteed to be written
atomically. This is applicable only to a FIFO or
directory file.
_PC_CHOWN_RESTRICTED
Returns other than -1 if the user of the chown() function
is restricted to the superuser and changing the group ID
of a file only to the effective group ID of the process
or to one of its supplementary group IDs. Returns -1 if
this restriction is not provided.
_PC_NO_TRUNC
Returns other than -1 if supplying a component name
longer than allowed by _PC_NAME_MAX will cause an error.
Returns -1 if long component names are truncated. This
is applicable only to a directory file.
_PC_VDISABLE
Returns the character value that can be used to disable
terminal special characters. This is applicable only to
a terminal device.
DESCRIPTION
The pathconf() function allows an application to determine the
characteristics of operations supported by the file system underlying the
file named by the path parameter. Read, write, or execute permission of
the named file is not required, but all directories in the path leading to
the file must be searchable.
The fpathconf() function allows an application to retrieve the same
information for an open file.
EXAMPLES
1. To obtain the maximum number of links to the file /usr/testdir:
if (linkmax = pathconf("/usr/testdir", _PC_LINK_MAX)
== -1)
perror("pathconf failed");
2. To obtain the maximum number of links to the open file descriptor for
/usr/testdir:
if (fd = open("/usr/testdir", O_RDWR) == -1)
perror("open failed");
if (linkmax = fpathconf(fd, _PC_LINK_MAX) == -1)
perror("fpathconf failed");
2 Intergraph Corporation - 2/94
pathconf(2) CLIX pathconf(2)
RETURN VALUES
If pathconf() or fpathconf() is successful, the specified value is
returned. Otherwise, a value of -1 is returned and the global variable
errno is set to indicate the error.
ERRORS
The pathconf() and fpathconf() functions fail if the following is true:
[EINVAL]
The name parameter is not valid.
[EINVAL]
The implementation of the function does not support an association
of the variable name with the specified file.
[EACCES]
Search permission is denied for a component of the path prefix.
[ENAMETOOLONG]
The length of the path parameter exceeds PATH_MAX, or a pathname
component is longer than NAME_MAX while _POSIX_NO_TRUNC is in
effect.
[ENOENT]
The named file does not exist or the path parameter points to an
empty string.
[ENOTDIR]
A component of the path prefix is not a directory.
[EBADF]
The filedes parameter is not a valid file descriptor.
RELATED INFORMATION
Files: limits.h(0), unistd.h(0)
2/94 - Intergraph Corporation 3