HP-UX Reference (11i v3 07/02) - 2 System Calls (vol 5)
p
pathconf(2) pathconf(2)
8. _POSIX_CHOWN_RESTRICTED
is defined if the privilege group PRIV_GLOBAL has been
granted the
CHOWN privilege (see getprivgrp (2) and chown(2)). In all other cases,
_POSIX_CHOWN_RESTRICTED
is undefined and
pathconf() or fpathconf() returns
−1 without changing
errno. To determine if
chown() can be performed on a file, it is simplest
to attempt the
chown() operation and check the return value for failure or success.
9. _POSIX_SYNC_IO
, when defined, determines whether synchronized IO operations may be
performed for the associated file (see open(2)). If path or fildes refers to a directory, it is
unspecified whether or not the implementation supports an association of the variable name with
the specified file.
10. For file systems that are not large file enabled, the
_PC_FILESIZEBITS
return value will be
less than or equal to 32. For file systems that are large file enabled, the
_PC_FILESIZEBITS
return value will be between 33 and 63.
11. _POSIX_ASYNC_IO
, when defined, determines whether asynchronous I/O operations may be
performed for the associated file.
12.
_POSIX_PRIO_IO
, when defined, determines whether prioritized I/O is supported for the
associated file.
If the variable corresponding to name is not defined for path or fildes, the
pathconf() and fpath-
conf()
functions succeed and return a value of −1, without changing the value of errno.
Upon any other successful completion, these functions return the value of the named variable with respect
to the specified file or directory, as described above.
Otherwise, a value of −1 is returned and
errno is set to indicate the error.
ERRORS
The pathconf() and fpathconf() fail if any of the following conditions are encountered:
[EACCES] A component of the path prefix denies search permission.
[EBADF] The fildes argument is not a valid open file descriptor.
[EFAULT] path points outside the allocated address space of the process.
[EINVAL] The value of name is not valid or the implementation does not support an
association of the variable name with the specified file.
[ELOOP] Too many symbolic links were encountered in translating path.
[ENAMETOOLONG] The length of the specified path name exceeds
PATH_MAX bytes, or the
length of a component of the path name exceeds
NAME_MAX bytes while
_POSIX_NO_TRUNC is in effect.
[ENOENT] The file named by path does not exist (for example, path is null, or a com-
ponent of path does not exist).
[ENOTDIR] A component of the path prefix is not a directory.
EXAMPLES
The following example sets val to the value of
MAX_CANON for the device file being used as the standard
input. If the standard input is a terminal, this value is the maximum number of input characters that can
be entered on a single input line before typing the newline character:
if (isatty(0))
val = fpathconf(0, _PC_MAX_CANON);
The following code segment shows two calls to pathconf. The first determines whether a file name longer
than NAME_MAX bytes will be truncated to NAME_MAX bytes in the /tmp directory. If so, the second call
is made to determine the actual value of NAME_MAX so that an error can be printed if a user-supplied file
name stored in filebuf will be truncated in this directory:
extern int errno;
char *filebuf;
errno = 0; /* reset errno */
if ( pathconf("/tmp" _PC_NO_TRUNC) == -1 ) {
/* _POSIX_NO_TRUNC is not in effect for this directory */
if (strlen(filebuf) > pathconf("/tmp", PC_NAME_MAX)) {
260 Hewlett-Packard Company − 2 − HP-UX 11i Version 3: February 2007