fpathconf(), pathconf()

get value of configurable limit or option 

Function


SYNOPSIS

#include <unistd.h>

long fpathconf(int fildes, int name);

long pathconf(const char *pathname, int name);


DESCRIPTION

The pathconf() and fpathconf() functions provide methods for the application to determine the current value of a configurable limit or option that is associated with a file or directory.

The NuTCRACKER Platform supports the values listed below for name. These variables correspond to a compile-time constant listed in <limits.h> or <unistd.h>. For each of these, the compile-time constant is listed after the parameter name.

_PC_ALLOC_SIZE_MIN [POSIX_ALLOC_SYZE_MIN] 

Minimum number of bytes of storage actually allocated for any portion of a file.

_PC_ASYNC_IO [_POSIX_ASYNC_IO] 

A value other than -1 indicates that asynchronous input or output operations may be performed for the associated file.

_PC_CHOWN_RESTRICTED [_POSIX_CHOWN_RESTRICTED]  

A value other than -1 indicates that the use of chown() is restricted to processes with appropriate privileges. If fildes or pathname refers to a directory, then the value returned applies to any files other than directories that exist or can be created within that directory.

_PC_FILESIZEBITS [FILESIZEBITS]  

The 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_MAX [LINK_MAX]  

The maximum number of links to a single file. If fildes or pathname refers to a directory, then the value returned applies to the directory itself.

_PC_MAX_CANON [MAX_CANON]  

The maximum number of bytes in a terminal canonical input line. fildes or pathname must refer to a terminal device.

_PC_MAX_INPUT [MAX_INPUT]  

The maximum number of bytes available in the terminal input queue. fildes or pathname must refer to a terminal device.

_PC_NAME_MAX [NAME_MAX]  

The maximum number of bytes allowed in a file name, not counting the terminating null character. If fildes or pathname refers to a directory, the value applies to file names in that directory.

_PC_NO_TRUNC [_POSIX_NO_TRUNC]  

A value other than -1 indicates that path name components longer than NAME_MAX generate an error. If fildes or pathname refers to a directory, the value applies to file names in that directory.

_PC_PATH_MAX [PATH_MAX]  

The maximum number of bytes in a path name, including slashes and the terminating null character.

_PC_PIPE_BUF [PIPE_BUF]  

The maximum number of bytes that is guaranteed to be atomic when writing to a pipe. If fildes or pathname refers to a directory, the value applies to any FIFO that exists or can be created in that directory.

_PC_PRIO_IO [_POSIX_PRIO_IO]  

A value other than -1 indicates that prioritized input or output operations may be performed for the associated file.

_PC_REC_INCR_XFER [POSIX_REC_INCR_XFER_SIZE} 

Recommended increment for file transfer sizes between the {POSIX_REC_MIN_XFER_SIZE} and {POSIX_REC_MAX_XFER_SIZE} values.

_PC_REC_MAX_XFER_SIZE [POSIX_REC_MAX_XFER_SIZE} 

Maximum recommended file transfer size.

_PC_REC_MIN_XFER_SIZE [POSIX_REC_MIN_XFER_SIZE} 

Minimum recommended file transfer size.

_PC_REC_XFER_ALIGN [POSIX_INCR_XFER_ALIGN} 

Recommended file transfer buffer alignment.

_PC_SYMLINK_MAX [_POSIX_SYMLINK_MAX]  

Maximum number of bytes in a symbolic link.

_PC_SYNC_IO [_POSIX_SYNC_IO]  

A value other than -1 indicates that synchronized input or output operations may be performed for the associated file.

_PC_VDISABLE [_POSIX_VDISABLE]  

Value to assign to disable the special meaning of control characters for terminal devices. fildes or pathname must refer to a terminal device.


PARAMETERS

fildes 

Is an open file descriptor.

pathname 

Points to the path name of a file or directory.

name 

Is the symbolic constant that represents the configurable system limit or option to be returned.


RETURN VALUES

If name is an invalid value, fpathconf() and pathconf() return -1 and set errno to indicate the error, as shown below. If the variable corresponding to name has no limit for the specified file descriptor or path name, fpathconf() and pathconf() return -1 without changing errno. If pathconf() needs to use pathname to determine the value of name and an error occurs, or if fpathconf() needs to use fildes to determine the value of name and an error occurs, fpathconf() and pathconf() return -1, and set errno to indicate the error, as shown below.

Otherwise, fpathconf() and pathconf() return the current variable value for the file or directory, as described in the DESCRIPTION section. The value returned is not more restrictive than the corresponding compile-time value as found in <limits.h> or <unistd.h>.

EACCES 

The process does not have permission to access pathname.

EBADF 

fildes is not a valid file descriptor.

EINVAL 

Either name is unrecognized, or the implementation does not support an association of the variable name with pathname.

ENAMETOOLONG 

The length of the pathname exceeds PATH_MAX or a component is longer than NAME_MAX.

ENOENT 

pathname is required for the command specified and the named file does not exist.

ENOTDIR 

A component of the path prefix is not a directory.


CONFORMANCE

UNIX 98.


MULTITHREAD SAFETY LEVEL

fpathconf(): MT-Safe.

pathconf(): Async-signal-safe.


PORTING ISSUES

Refer to the Windows Concepts chapter of the PTC MKS Toolkit UNIX to Windows Porting Guide for a discussion of the implementation of devices and special devices.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
_NutConfStr(), confstr(), sysconf()


PTC MKS Toolkit 10.5 Documentation Build 40.