pathconf()
QNX SDP8.0C Library ReferenceAPIDeveloper
Return the value of a configurable limit
Synopsis:
#include <unistd.h>
long pathconf( const char* path,
int name );
Arguments:
- path
- The name of the file whose limit you want to get.
- name
- The name of the configurable limit; see below.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The pathconf() function returns a value of a configurable limit indicated by name, which is associated with the filename given in path.
Configurable limits are defined in <confname.h>, and include at least the following values:
- _PC_2_SYMLINKS
- 1 if symbolic links can be created, 0 if not.
- _PC_ALLOC_SIZE_MIN
- Minimum number of bytes of storage actually allocated for any portion of a file.
- _PC_ASYNC_IO
- Defined if asynchronous I/O is supported for the file.
- _PC_CASE_PRESERVING
- 1 if the filesystem preserves the case in file names, or 0 if it doesn't. If this function indicates an error of EINVAL, you shouldn't make any assumptions about the filesystem's behavior.
- _PC_CASE_SENSITIVE
- 1 if the filesystem is sensitive to the case in file names, or 0 if it isn't. If this function indicates an error of EINVAL, you shouldn't make any assumptions about the filesystem's behavior.
- _PC_CHOWN_RESTRICTED
- If defined (not -1), indicates that the use of the chown() function is restricted to a process with root privileges, and to changing the group ID of a file to the effective group ID of the process or to one of its supplementary group IDs.
- _PC_FILESIZEBITS
- Minimum number of bits needed to represent, as a signed integer value, the maximum size of a regular file allowed in the specified directory.
- _PC_LINK_DIR
- Defined (not -1) if the filesystem permits the unlinking of a directory.
- _PC_LINK_MAX
- Maximum value of a file's link count.
- _PC_MAX_CANON
- Maximum number of bytes in a terminal's canonical input buffer (edit buffer).
- _PC_MAX_INPUT
- Maximum number of bytes in a terminal's raw input buffer.
- _PC_NAME_MAX
- Maximum number of bytes in a file name (not including the terminating null).
- _PC_NO_TRUNC
- If defined (not -1), indicates that the use of pathname components longer than the value given by _PC_NAME_MAX will generate an error.
- _PC_PATH_MAX
- Maximum number of bytes in a pathname (including the terminating null).
- _PC_PIPE_BUF
- Maximum number of bytes that can be written atomically when writing to a pipe.
- _PC_PRIO_IO
- Defined (not -1) if prioritized I/O is supported for the file.
- _PC_REC_INCR_XFER_SIZE
- Recommended increment for file transfer sizes between the _PC_REC_MIN_XFER_SIZE and _PC_REC_MAX_XFER_SIZE values.
- _PC_REC_MAX_XFER_SIZE
- Maximum recommended file transfer size.
- _PC_REC_MIN_XFER_SIZE
- Minimum recommended file transfer size.
- _PC_REC_XFER_ALIGN
- Recommended file transfer buffer alignment.
- _PC_SYMLINK_MAX
- Maximum length (in bytes) of a symbolic link name.
- _PC_SYMLOOP_MAX
- Maximum length of a symbolic link chain. This is the maximum number of symbolic links that can be reliably traversed when resolving a pathname in the absence of a loop.
- _PC_SYNC_IO
- Defined (not -1) if synchronous I/O is supported for the file.
- _PC_VDISABLE
- If defined (not -1), this is the character value which can be used to individually disable special control characters in the termios control structure.
Returns:
The requested configurable limit, or -1 if an error occurs (errno is set).
Errors:
- EACCES
- Search permission is denied for a component of path.
- EINVAL
- The name argument is invalid, or the indicated limit isn't supported.
- ELOOP
- Too many levels of symbolic links or prefixes.
- ENAMETOOLONG
- The path argument, or a component of path, is too long.
- ENOENT
- The file doesn't exist.
- ENOSYS
- The pathconf() function isn't implemented for the filesystem underlying the path specified in path.
- ENOTDIR
- A component of the path prefix isn't a directory.
Examples:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main( void )
{
long value;
value = pathconf( "/dev/con1", _PC_MAX_INPUT );
printf( "Input buffer size is %ld bytes\n",
value );
return EXIT_SUCCESS;
}
Classification:
Safety: | |
---|---|
Cancellation point | Yes |
Signal handler | Yes |
Thread | Yes |
Page updated: