1*61183Sbostic.\" Copyright (c) 1993 2*61183Sbostic.\" The Regents of the University of California. All rights reserved. 360277Sbostic.\" 460277Sbostic.\" %sccs.include.redist.roff% 560277Sbostic.\" 6*61183Sbostic.\" @(#)pathconf.2 8.1 (Berkeley) 06/04/93 760277Sbostic.\" 860277Sbostic.Dd 960277Sbostic.Dt PATHCONF 2 1060277Sbostic.Os BSD 4 1160277Sbostic.Sh NAME 1260277Sbostic.Nm pathconf , 1360277Sbostic.Nm fpathconf 1460277Sbostic.Nd get configurable pathname variables 1560277Sbostic.Sh SYNOPSIS 1660277Sbostic.Fd #include <unistd.h> 1760277Sbostic.Ft long 1860277Sbostic.Fn pathconf "const char *path" "int name" 1960277Sbostic.Ft long 2060277Sbostic.Fn fpathconf "int fd" "int name" 2160277Sbostic.Sh DESCRIPTION 2260277Sbostic.Pp 2360277SbosticThe 2460277Sbostic.Fn pathconf 2560277Sbosticand 2660277Sbostic.Fn fpathconf 2760277Sbosticfunctions provides a method for applications to determine the current 2860277Sbosticvalue of a configurable system limit or option variable associated 2960277Sbosticwith a pathname or file descriptor. 3060277Sbostic.Pp 3160277SbosticFor 3260277Sbostic.Nm pathconf , 3360277Sbosticthe 3460277Sbostic.Fa path 3560277Sbosticargument is the name of a file or directory. 3660277SbosticFor 3760277Sbostic.Nm fpathconf , 3860277Sbosticthe 3960277Sbostic.Fa fd 4060277Sbosticargument is an open file descriptor. 4160277SbosticThe 4260277Sbostic.Fa name 4360277Sbosticargument specifies the system variable to be queried. 4460277SbosticSymbolic constants for each name value are found in the include file 4560277Sbostic.Li <unistd.h> . 4660277Sbostic.Pp 4760277SbosticThe available values are as follows: 4860277Sbostic.Pp 4960277Sbostic.Bl -tag -width "123456" 5060277Sbostic.Pp 5160277Sbostic.It Li _PC_LINK_MAX 5260277SbosticThe maximum file link count. 5360277Sbostic.It Li _PC_MAX_CANON 5460277SbosticThe maximum number of bytes in terminal canonical input line. 5560277Sbostic.It Li _PC_MAX_INPUT 5660277SbosticThe minimum maximum number of bytes for which space is available in 5760277Sbostica terminal input queue. 5860277Sbostic.It Li _PC_NAME_MAX 5960277SbosticThe maximum number of bytes in a file name. 6060277Sbostic.It Li _PC_PATH_MAX 6160277SbosticThe maximum number of bytes in a pathname. 6260277Sbostic.It Li _PC_PIPE_BUF 6360277SbosticThe maximum number of bytes which will be written atomically to a pipe. 6460277Sbostic.It Li _PC_CHOWN_RESTRICTED 6560277SbosticReturn 1 if appropriate privileges are required for the 6660277Sbostic.Xr chown 2 6760277Sbosticsystem call, otherwise 0. 6860277Sbostic.It Li _PC_NO_TRUNC 6960277SbosticReturn 1 if file names longer than KERN_NAME_MAX are truncated. 7060277Sbostic.It Li _PC_VDISABLE 7160277SbosticReturns the terminal character disabling value. 7260277Sbostic.El 7360277Sbostic.Sh RETURN VALUES 7460277SbosticIf the call to 7560277Sbostic.Nm pathconf 7660277Sbosticor 7760277Sbostic.Nm fpathconf 7860277Sbosticis not successful, \-1 is returned and 7960277Sbostic.Va errno 8060277Sbosticis set appropriately. 8160277SbosticOtherwise, if the variable is associated with functionality that does 8260277Sbosticnot have a limit in the system, \-1 is returned and 8360277Sbostic.Va errno 8460277Sbosticis not modified. 8560277SbosticOtherwise, the current variable value is returned. 8660277Sbostic.Sh ERRORS 8760375SmckusickIf any of the following conditions occur, the 8860277Sbostic.Nm pathconf 8960375Smckusickand 9060277Sbostic.Nm fpathconf 9160375Smckusickfunctions shall return -1 and set 9260375Smckusick.Va errno 9360375Smckusickto the corresponding value. 9460277Sbostic.Bl -tag -width Er 9560277Sbostic.It Bq Er EINVAL 9660277SbosticThe value of the 9760277Sbostic.Fa name 9860277Sbosticargument is invalid. 9960375Smckusick.It Bq Er EINVAL 10060375SmckusickThe implementation does not support an association of the variable 10160375Smckusickname with the associated file. 10260375Smckusick.El 10360375Smckusick.Fn Pathconf 10460375Smckusickwill fail if: 10560375Smckusick.Bl -tag -width ENAMETOOLONGAA 10660375Smckusick.It Bq Er ENOTDIR 10760375SmckusickA component of the path prefix is not a directory. 10860375Smckusick.It Bq Er ENAMETOOLONG 10960375SmckusickA component of a pathname exceeded 255 characters, 11060375Smckusickor an entire path name exceeded 1023 characters. 11160375Smckusick.It Bq Er ENOENT 11260375SmckusickThe named file does not exist. 11360375Smckusick.It Bq Er EACCES 11460375SmckusickSearch permission is denied for a component of the path prefix. 11560375Smckusick.It Bq Er ELOOP 11660375SmckusickToo many symbolic links were encountered in translating the pathname. 11760375Smckusick.It Bq Er EIO 11860375SmckusickAn I/O error occurred while reading from or writing to the file system. 11960375Smckusick.El 12060375Smckusick.Pp 12160375Smckusick.Bl -tag -width [EFAULT] 12260375Smckusick.Fn Fpathconf 12360375Smckusickwill fail if: 12460375Smckusick.It Bq Er EBADF 12560375Smckusick.Fa fd 12660375Smckusickis not a valid open file descriptor. 12760375Smckusick.It Bq Er EIO 12860375SmckusickAn I/O error occurred while reading from or writing to the file system. 12960375Smckusick.El 13060277Sbostic.Sh SEE ALSO 13160277Sbostic.Xr sysctl 3 13260277Sbostic.Sh HISTORY 13360277SbosticThe 13460277Sbostic.Nm pathconf 13560277Sbosticand 13660277Sbostic.Nm fpathconf 13760277Sbosticfunctions first appeared in 4.4BSD. 138