1.\" $NetBSD: pathconf.2,v 1.10 1999/12/02 21:42:38 kleink Exp $ 2.\" 3.\" Copyright (c) 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by the University of 17.\" California, Berkeley and its contributors. 18.\" 4. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)pathconf.2 8.1 (Berkeley) 6/4/93 35.\" 36.Dd March 21, 1999 37.Dt PATHCONF 2 38.Os 39.Sh NAME 40.Nm pathconf , 41.Nm fpathconf 42.Nd get configurable pathname variables 43.Sh LIBRARY 44.Lb libc 45.Sh SYNOPSIS 46.Fd #include <unistd.h> 47.Ft long 48.Fn pathconf "const char *path" "int name" 49.Ft long 50.Fn fpathconf "int fd" "int name" 51.Sh DESCRIPTION 52.Pp 53The 54.Fn pathconf 55and 56.Fn fpathconf 57functions provides a method for applications to determine the current 58value of a configurable system limit or option variable associated 59with a pathname or file descriptor. 60.Pp 61For 62.Nm pathconf , 63the 64.Fa path 65argument is the name of a file or directory. 66For 67.Nm fpathconf , 68the 69.Fa fd 70argument is an open file descriptor. 71The 72.Fa name 73argument specifies the system variable to be queried. 74Symbolic constants for each name value are found in the include file 75.Li <unistd.h> . 76.Pp 77The available values are as follows: 78.Pp 79.Bl -tag -width "123456" 80.Pp 81.It Li _PC_LINK_MAX 82The maximum file link count. 83.It Li _PC_MAX_CANON 84The maximum number of bytes in terminal canonical input line. 85.It Li _PC_MAX_INPUT 86The minimum maximum number of bytes for which space is available in 87a terminal input queue. 88.It Li _PC_NAME_MAX 89The maximum number of bytes in a file name. 90.It Li _PC_PATH_MAX 91The maximum number of bytes in a pathname. 92.It Li _PC_PIPE_BUF 93The maximum number of bytes which will be written atomically to a pipe. 94.It Li _PC_CHOWN_RESTRICTED 95Return 1 if appropriate privileges are required for the 96.Xr chown 2 97system call, otherwise 0. 98.It Li _PC_NO_TRUNC 99Return 1 if file names longer than KERN_NAME_MAX are truncated. 100.It Li _PC_VDISABLE 101Returns the terminal character disabling value. 102.It Li _PC_SYNC_IO 103Returns 1 of synchronized I/O is supported, otherwise 0. 104.It Li _PC_FILESIZEBITS 105If the maximum size file that could ever exist on the mounted file system is 106.Dv maxsize , 107then the returned value is 2 plus the floor of the base 2 logarithm of 108.Dv maxsize . 109.El 110.Sh RETURN VALUES 111If the call to 112.Nm pathconf 113or 114.Nm fpathconf 115is not successful, \-1 is returned and 116.Va errno 117is set appropriately. 118Otherwise, if the variable is associated with functionality that does 119not have a limit in the system, \-1 is returned and 120.Va errno 121is not modified. 122Otherwise, the current variable value is returned. 123.Sh ERRORS 124If any of the following conditions occur, the 125.Nm pathconf 126and 127.Nm fpathconf 128functions shall return -1 and set 129.Va errno 130to the corresponding value. 131.Bl -tag -width Er 132.It Bq Er EINVAL 133The value of the 134.Fa name 135argument is invalid. 136.It Bq Er EINVAL 137The implementation does not support an association of the variable 138name with the associated file. 139.El 140.Fn pathconf 141will fail if: 142.Bl -tag -width ENAMETOOLONGAA 143.It Bq Er ENOTDIR 144A component of the path prefix is not a directory. 145.It Bq Er ENAMETOOLONG 146A component of a pathname exceeded 255 characters, 147or an entire path name exceeded 1023 characters. 148.It Bq Er ENOENT 149The named file does not exist. 150.It Bq Er EACCES 151Search permission is denied for a component of the path prefix. 152.It Bq Er ELOOP 153Too many symbolic links were encountered in translating the pathname. 154.It Bq Er EIO 155An I/O error occurred while reading from or writing to the file system. 156.El 157.Pp 158.Bl -tag -width [EFAULT] 159.Fn fpathconf 160will fail if: 161.It Bq Er EBADF 162.Fa fd 163is not a valid open file descriptor. 164.It Bq Er EIO 165An I/O error occurred while reading from or writing to the file system. 166.El 167.Sh SEE ALSO 168.Xr sysctl 3 169.Sh STANDARDS 170The 171.Fn pathconf 172and 173.Fn fpathconf 174functions conform to 175.St -p1003.1-90 . 176.Sh HISTORY 177The 178.Nm pathconf 179and 180.Nm fpathconf 181functions first appeared in 182.Bx 4.4 . 183