1.\" Copyright (c) 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.roff% 5.\" 6.\" @(#)pathconf.2 8.1 (Berkeley) 06/04/93 7.\" 8.Dd 9.Dt PATHCONF 2 10.Os BSD 4 11.Sh NAME 12.Nm pathconf , 13.Nm fpathconf 14.Nd get configurable pathname variables 15.Sh SYNOPSIS 16.Fd #include <unistd.h> 17.Ft long 18.Fn pathconf "const char *path" "int name" 19.Ft long 20.Fn fpathconf "int fd" "int name" 21.Sh DESCRIPTION 22.Pp 23The 24.Fn pathconf 25and 26.Fn fpathconf 27functions provides a method for applications to determine the current 28value of a configurable system limit or option variable associated 29with a pathname or file descriptor. 30.Pp 31For 32.Nm pathconf , 33the 34.Fa path 35argument is the name of a file or directory. 36For 37.Nm fpathconf , 38the 39.Fa fd 40argument is an open file descriptor. 41The 42.Fa name 43argument specifies the system variable to be queried. 44Symbolic constants for each name value are found in the include file 45.Li <unistd.h> . 46.Pp 47The available values are as follows: 48.Pp 49.Bl -tag -width "123456" 50.Pp 51.It Li _PC_LINK_MAX 52The maximum file link count. 53.It Li _PC_MAX_CANON 54The maximum number of bytes in terminal canonical input line. 55.It Li _PC_MAX_INPUT 56The minimum maximum number of bytes for which space is available in 57a terminal input queue. 58.It Li _PC_NAME_MAX 59The maximum number of bytes in a file name. 60.It Li _PC_PATH_MAX 61The maximum number of bytes in a pathname. 62.It Li _PC_PIPE_BUF 63The maximum number of bytes which will be written atomically to a pipe. 64.It Li _PC_CHOWN_RESTRICTED 65Return 1 if appropriate privileges are required for the 66.Xr chown 2 67system call, otherwise 0. 68.It Li _PC_NO_TRUNC 69Return 1 if file names longer than KERN_NAME_MAX are truncated. 70.It Li _PC_VDISABLE 71Returns the terminal character disabling value. 72.El 73.Sh RETURN VALUES 74If the call to 75.Nm pathconf 76or 77.Nm fpathconf 78is not successful, \-1 is returned and 79.Va errno 80is set appropriately. 81Otherwise, if the variable is associated with functionality that does 82not have a limit in the system, \-1 is returned and 83.Va errno 84is not modified. 85Otherwise, the current variable value is returned. 86.Sh ERRORS 87If any of the following conditions occur, the 88.Nm pathconf 89and 90.Nm fpathconf 91functions shall return -1 and set 92.Va errno 93to the corresponding value. 94.Bl -tag -width Er 95.It Bq Er EINVAL 96The value of the 97.Fa name 98argument is invalid. 99.It Bq Er EINVAL 100The implementation does not support an association of the variable 101name with the associated file. 102.El 103.Fn Pathconf 104will fail if: 105.Bl -tag -width ENAMETOOLONGAA 106.It Bq Er ENOTDIR 107A component of the path prefix is not a directory. 108.It Bq Er ENAMETOOLONG 109A component of a pathname exceeded 255 characters, 110or an entire path name exceeded 1023 characters. 111.It Bq Er ENOENT 112The named file does not exist. 113.It Bq Er EACCES 114Search permission is denied for a component of the path prefix. 115.It Bq Er ELOOP 116Too many symbolic links were encountered in translating the pathname. 117.It Bq Er EIO 118An I/O error occurred while reading from or writing to the file system. 119.El 120.Pp 121.Bl -tag -width [EFAULT] 122.Fn Fpathconf 123will fail if: 124.It Bq Er EBADF 125.Fa fd 126is not a valid open file descriptor. 127.It Bq Er EIO 128An I/O error occurred while reading from or writing to the file system. 129.El 130.Sh SEE ALSO 131.Xr sysctl 3 132.Sh HISTORY 133The 134.Nm pathconf 135and 136.Nm fpathconf 137functions first appeared in 4.4BSD. 138