xref: /original-bsd/lib/libc/sys/pathconf.2 (revision ab6c2785)
1.\" Copyright (c) 1993 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"	@(#)pathconf.2	5.1 (Berkeley) 05/24/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.Bf -symbolic
23This interface is obsoleted by sysctl(3).
24.Ef
25.Pp
26The
27.Fn pathconf
28and
29.Fn fpathconf
30functions provides a method for applications to determine the current
31value of a configurable system limit or option variable associated
32with a pathname or file descriptor.
33.Pp
34For
35.Nm pathconf ,
36the
37.Fa path
38argument is the name of a file or directory.
39For
40.Nm fpathconf ,
41the
42.Fa fd
43argument is an open file descriptor.
44The
45.Fa name
46argument specifies the system variable to be queried.
47Symbolic constants for each name value are found in the include file
48.Li <unistd.h> .
49.Pp
50The available values are as follows:
51.Pp
52.Bl -tag -width "123456"
53.Pp
54.It Li _PC_LINK_MAX
55The maximum file link count.
56.It Li _PC_MAX_CANON
57The maximum number of bytes in terminal canonical input line.
58.It Li _PC_MAX_INPUT
59The minimum maximum number of bytes for which space is available in
60a terminal input queue.
61.It Li _PC_NAME_MAX
62The maximum number of bytes in a file name.
63.It Li _PC_PATH_MAX
64The maximum number of bytes in a pathname.
65.It Li _PC_PIPE_BUF
66The maximum number of bytes which will be written atomically to a pipe.
67.It Li _PC_CHOWN_RESTRICTED
68Return 1 if appropriate privileges are required for the
69.Xr chown 2
70system call, otherwise 0.
71.It Li _PC_NO_TRUNC
72Return 1 if file names longer than KERN_NAME_MAX are truncated.
73.It Li _PC_VDISABLE
74Returns the terminal character disabling value.
75.El
76.Sh RETURN VALUES
77If the call to
78.Nm pathconf
79or
80.Nm fpathconf
81is not successful, \-1 is returned and
82.Va errno
83is set appropriately.
84Otherwise, if the variable is associated with functionality that does
85not have a limit in the system, \-1 is returned and
86.Va errno
87is not modified.
88Otherwise, the current variable value is returned.
89.Sh ERRORS
90The
91.Nm pathconf
92function may fail and set
93.Va error
94for any of the errors specified for the library functions
95.Xr lstat 2
96or
97.Xr sysctl 3 .
98.Pp
99The
100.Nm fpathconf
101function may fail and set
102.Va error
103for any of the errors specified for the library functions
104.Xr lseek 2
105or
106.Xr sysctl 3 .
107.Pp
108In addition, the following errors may be reported:
109.Bl -tag -width Er
110.It Bq Er EINVAL
111The value of the
112.Fa name
113argument is invalid.
114.Sh SEE ALSO
115.Xr sysctl 3
116.Sh HISTORY
117The
118.Nm pathconf
119and
120.Nm fpathconf
121functions first appeared in 4.4BSD.
122