Chapter Contents |
Previous |
Next |
fpathconf |
Portability: | POSIX.1 conforming |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
EXAMPLE | |
RELATED FUNCTIONS |
SYNOPSIS |
#include <unistd.h> long fpathconf(int filedes, int configvar);
DESCRIPTION |
fpathconf
determines the value of a configuration variable that is
associated with a file descriptor.
filedes
is the file descriptor.
configvar
is the configuration variable.
configvar
can be one of the following symbols that are defined in
<unistd.h>
. The values that
fpathconf
returns are listed with each symbol.
_PC_LINK_MAX
filedes
references
a directory, and
fpathconf
returns the maximum number of links possible for the directory.
_PC_MAX_CANON
filedes
refers to a character special file for a terminal.
_PC_MAX_INPUT
filedes
refers to a character special file for a terminal.
_PC_NAME_MAX
NULL
for filenames stored as strings. This limit
is for names that do not specify any directories.
_PC_PATH_MAX
NULL
for pathnames stored as
strings.
_PC_PIPE_BUF
fpathconf
returns the value for the file itself. For directories,
fpathconf
returns the value for
FIFO special files that exist or can be created under the specified directory.
For other kinds of files, an
errno
of
EINVAL
is stored.
_PC_CHOWN_RESTRICTED
chown
is restricted. For directories,
fpathconf
returns the value for files, but not
necessarily for subdirectories.
_PC_NO_TRUNC
_PC_VDISABLE
filedes
must refer to a character
special file for the terminal.
RETURN VALUE |
If successful,
fpathconf
returns the value defined above for the particular value
of
configvar
. If not successful,
fpathconf
returns
-1
.
EXAMPLE |
The following code fragment illustrates
the use of
fpathconf
:
#include <sys/types.h> #include <stdio.h> #include <unistd.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> . . . long result; char fn[]="temp.file"; int fd; . . . puts("What is the NAME_MAX limit for the current directory?"); if ((result = fpathconf(fd,_PC_NAME_MAX)) == -1) if(errno == 0) puts("There is no limit."); else perror("fpathconf() error"); else printf("NAME_MAX is %d\n", result); . . .
RELATED FUNCTIONS |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.