From 0426f2d05f7e1dbd11bbd78e42ca60c8de065d19 Mon Sep 17 00:00:00 2001 From: wollman Date: Thu, 8 Jul 2004 20:27:38 +0000 Subject: Eliminate some magic numbers and correct description of _PC_NO_TRUNC. Slight emendation to _PC_CHOWN_RESTRICTED, which is in a very similar boat. --- lib/libc/sys/intro.2 | 38 ++++++++++++++++++++++---------------- lib/libc/sys/pathconf.2 | 27 +++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 20 deletions(-) (limited to 'lib') diff --git a/lib/libc/sys/intro.2 b/lib/libc/sys/intro.2 index 2b88fbd..1bb900b 100644 --- a/lib/libc/sys/intro.2 +++ b/lib/libc/sys/intro.2 @@ -367,12 +367,16 @@ A path name lookup involved more than 32 .Pq Dv MAXSYMLINKS symbolic links. .It Er 63 ENAMETOOLONG Em "File name too long" . -A component of a path name exceeded 255 -.Pq Dv MAXNAMELEN +A component of a path name exceeded +.Brq Dv NAME_MAX characters, or an entire -path name exceeded 1023 -.Pq Dv MAXPATHLEN Ns -1 +path name exceeded +.Brq Dv PATH_MAX characters. +(See also the description of +.Dv _PC_NO_TRUNC +in +.Xr pathconf 2 . ) .It Er 64 EHOSTDOWN Em "Host is down" . A socket operation failed because the destination host was down. .It Er 65 EHOSTUNREACH Em "No route to host" . @@ -468,7 +472,7 @@ Each active process in the system is uniquely identified by a non-negative integer called a process ID. The range of this ID is from 0 to 99999. .It Parent process ID -A new process is created by a currently active process; (see +A new process is created by a currently active process (see .Xr fork 2 ) . The parent process ID of a process is initially the process ID of its creator. If the creating process exits, @@ -595,19 +599,20 @@ or which uniquely identifies an access path to that file or socket from a given process or any of its children. .It File Name -Names consisting of up to 255 -.Pq Dv MAXNAMELEN +Names consisting of up to +.Brq Dv NAME_MAX characters may be used to name an ordinary file, special file, or directory. .Pp -These characters may be selected from the set of all -.Tn ASCII -character -excluding 0 (NUL) and the -.Tn ASCII -code for +These characters may be arbitrary eight-bit values, +excluding NUL +.Po Tn ASCII +.No 0 Pc +and the .Ql \&/ -(slash). +character (slash, +.Tn ASCII +47). .Pp Note that it is generally unwise to use .Ql \&* , @@ -626,9 +631,10 @@ optional slash .Ql \&/ , followed by zero or more directory names separated by slashes, optionally followed by a file name. -The total length of a path name must be less than 1024 -.Pq Dv MAXPATHLEN +The total length of a path name must be less than +.Brq Dv PATH_MAX characters. +(On some systems, this limit may be infinite.) .Pp If a path name begins with a slash, the path search begins at the .Em root diff --git a/lib/libc/sys/pathconf.2 b/lib/libc/sys/pathconf.2 index e0679a0..b3d61ad 100644 --- a/lib/libc/sys/pathconf.2 +++ b/lib/libc/sys/pathconf.2 @@ -90,11 +90,24 @@ The maximum number of bytes in a pathname. .It Li _PC_PIPE_BUF The maximum number of bytes which will be written atomically to a pipe. .It Li _PC_CHOWN_RESTRICTED -Return 1 if appropriate privileges are required for the +Return 1 if appropriate privilege is required for the .Xr chown 2 system call, otherwise 0. +.St -p1003.1-2001 +requires appropriate privilege in all cases, but this behavior was optional +in prior editions of the standard. .It Li _PC_NO_TRUNC -Return 1 if file names longer than _POSIX_NAME_MAX are truncated. +Return greater than zero if attempts to use pathname components longer than +.Brq Li NAME_MAX +will result in an +.Bq Er ENAMETOOLONG +error; otherwise, such components will be truncated to +.Brq Li NAME_MAX . +.St -p1003.1-2001 +requires the error in all cases, but this behavior was optional in prior +editions of the standard, and some +.No non- Ns Tn POSIX Ns \&-compliant +filesystems do not support this behavior. .It Li _PC_VDISABLE Returns the terminal character disabling value. .It Li _PC_ASYNC_IO @@ -175,8 +188,14 @@ will fail if: .It Bq Er ENOTDIR A component of the path prefix is not a directory. .It Bq Er ENAMETOOLONG -A component of a pathname exceeded 255 characters, -or an entire path name exceeded 1023 characters. +A component of a pathname exceeded +.Brq Dv NAME_MAX +characters (but see +.Dv _PC_NO_TRUNC +above), +or an entire path name exceeded +.Brq Dv PATH_MAX +characters. .It Bq Er ENOENT The named file does not exist. .It Bq Er EACCES -- cgit v1.1