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