guy@sun.uucp (Guy Harris) (05/04/85)
INTRO: The list of error codes is wrong and has several error codes missing. The entry for ENOSPC should read 28 ENOSPC No space left on device A *write* to an ordinary file, the creation of a directory or symbolic link, or the creation of a directory entry failed because no more disk blocks are available on the file system, or the allocation of an inode for a newly created file failed because no more inodes are available on the file system. The text after the entry for ENAMETOOLONG should read: 64 EHOSTDOWN Host is down A socket operation encountered a dead host. 65 EHOSTUNREACH No route to host A socket operation was attempted to an unreachable host. 66 ENOTEMPTY Directory not empty A directory... (same entry, different code) 67 *unused* 68 *unused* 69 EDQUOT Disc quota exceeded A *write* to an ordinary file, the creation of a directory or symbolic link, or the creation of a directory entry failed because the user's quota of disk blocks was exhausted, or the allocation of an inode for a newly created file failed because the user's quota of inodes was exhausted. ACCESS: ENOENT for "null path name"? V7 had a null string refer to the current directory "by default". 4.2BSD has explicit code to accomplish the same; System V has explict code to return ENOENT when a null path name is encountered. This item is wrong. "access" will also fail if: [EIO] An I/O error occurred while reading from or writing to the file system. ACCT: The manual page says EISDIR is returned if the file to be used for process accounting is a directory, and EACCES is returned if it is a special file. The System V manual says that EACCES is returned if the file is not a plain file; this is also the correct description for 4.2BSD. "acct" will also fail if: [ENOENT] The pathname was too long. [EIO] An I/O error occurred while reading from or writing to the file system. CHDIR: "chdir" will also fail if: [EIO] An I/O error occurred while reading from or writing to the file system. CHMOD: "chown" will also fail if: [EIO] An I/O error occurred while reading from or writing to the file system. "fchown" will also fail if: [EPERM] The effective user ID does not match the owner of the file and the effective user ID is not the super-user. [EIO] An I/O error occurred while reading from or writing to the file system. CHOWN: Under [EPERM], "chown" will even fail if the effective user ID matches the owner of the file, if the effective user ID is not super-user (System V may permit the owner to give the file away, but 4.2BSD doesn't). "chown" will also fail if: [EIO] An I/O error occurred while reading from or writing to the file system. "fchown" will also fail if: [EPERM] The effective user ID is not the super-user. [EROFS] The named file resides on a read-only file system. [EIO] An I/O error occurred while reading from or writing to the file system. CHROOT: "chroot" will also fail if: [EIO] An I/O error occurred while reading from or writing to the file system. CREAT: "creat" will also fail if: [ENOENT] A component of the path name which must exist does not exist. [ENOENT] The pathname was too long. [ENFILE] The system file table is full. [ENOSPC] The directory in which the entry for the new file is being placed cannot be extended because there is no space left on the file system containing the directory. [ENOSPC] There are no free inodes on the file system on which the file is being created. [EDQUOT] The directory in which the entry for the new file is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted. [EDQUOT] The user's quota of inodes on the file system on which the file is being created has been exhausted. [EIO] An I/O error occurred while reading from or writing to the file system. EXECVE: Under [EFAULT], it should say "*Name*, *argv*, or *envp* point...", not "*Path*, *argv*, or *envp* point..." "execve" will also fail if: [ENOENT] The pathname was too long. [EIO] An I/O error occurred while reading from or writing to the file system. FORK: "fork" will also fail if: [ENOMEM] There is insufficient swap space for the new process. FSYNC: "fsync" will also fail if: [EIO] An I/O error occurred while reading from or writing to the file system. GETHOSTNAME: It should clarify that EPERM applies only to "sethostname". GETITIMER: Under [EFAULT] and [EINVAL], it should say "The *value* parameter", not "The *value* structure". GETPGRP: The argument is "pgrp", not "prgp". GETRUSAGE: "getrusage" will also fail if: [EFAULT] The *rusage* argument is in an invalid portion of the process's allocated address space. GETSOCKOPT: Under [EFAULT], it should specify that the area pointed to by "optlen" be valid for "getsockopt". GETTIMEOFDAY: If "tzp" is NULL, the time zone information will not be returned or set. LINK: "link" will also fail if: [ENOSPC] The directory in which the entry for the new link is being placed cannot be extended because there is no space left on the file system containing the directory. [EDQUOT] The directory in which the entry for the new link is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted. [EIO] An I/O error occurred while reading from or writing to the file system. MKDIR: The description of the EIO error is incorrect: it misspells "occurred" and only says "writing to". It should read: [EIO] An I/O error occurred while reading from or writing to the file system. "mkdir" will also fail if: [ENOENT] The pathname was too long. [EACCES] A component of the path prefix denies search permission. [ENOSPC] The directory in which the entry for the new file is being placed cannot be extended because there is no space left on the file system containing the directory. [ENOSPC] The new directory cannot be created because there is no space left on the file system which will contain the directory. [ENOSPC] There are no free inodes on the file system on which the file is being created. [EDQUOT] The directory in which the entry for the new file is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted. [EDQUOT] The new directory cannot be created becaue the user's quota of disk blocks on the file system which will contain the directory has been exhausted. [EDQUOT] The user's quota of inodes on the file system on which the file is being created has been exhausted. MKNOD: "mknod" will also fail if: [ENOENT] The pathname was too long. [EACCES] A component of the path prefix denies search permission. [ENOSPC] The directory in which the entry for the new file is being placed cannot be extended because there is no space left on the file system containing the directory. [ENOSPC] There are no free inodes on the file system on which the file is being created. [EDQUOT] The directory in which the entry for the new file is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted. [EDQUOT] The user's quota of inodes on the file system on which the file is being created has been exhausted. [EIO] An I/O error occurred while reading from or writing to the file system. MOUNT: EPERM, not NODEV (sic), is returned if not super-user. ENOENT, not NODEV, is returned if *special* does not exist. EROFS isn't ever returned. EIO, not EBUSY, is returned if an I/O error occurs. "mount" will also fail if: [ENOTDIR] A component of the path prefix in *special* or *name* is not a directory. [EPERM] The pathname of *special* or *name* contains a character with the high-order bit set. [ENOENT] The pathname of *special* or *name* was too long. [ENOENT] *Special* or *name* does not exist. [EACCES] Search permission is denied for a component of the path prefix of *special* or *name*. [EFAULT] *Special* or *name* points outside the process's allocated address space. [ELOOP] Too many symbolic links were encountered in translating the pathname of *special* or *name*. [EIO] An I/O error occurred while reading from or writing to the file system. "umount" will also fail if: [ENOTDIR] A component of the path prefix is not a directory. [EPERM] The pathname contains a character with the high-order bit set. [ENOENT] The pathname was too long. [ENOENT] *Special* does not exist. [EACCES] Search permission is denied for a component of the path prefix. [EFAULT] *Special* points outside the process's allocated address space. [ELOOP] Too many symbolic links were encountered in translating the pathname. [EIO] An I/O error occurred while reading from or writing to the file system. OPEN: "open" will also fail if: [ENOENT] A component of the path name which must exist does not exist. [ENOENT] The pathname was too long. [EACCES] O_CREAT is specified, the file does not exist, and the directory in which it is to be created does not permit writing. [ENFILE] The system file table is full. [ENOSPC] The directory in which the entry for the new file is being placed cannot be extended because there is no space left on the file system containing the directory, the file does not exist, and O_CREAT is specified. [ENOSPC] There are no free inodes on the file system on which the file is being created, the file does not exist, and O_CREAT is specified. [EDQUOT] The directory in which the entry for the new file is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted, the file does not exist, and O_CREAT is specified. [EDQUOT] The user's quota of inodes on the file system on which the file is being created has been exhausted, the file does not exist, and O_CREAT is specified. [EIO] An I/O error occurred while reading from or writing to the file system. EEXIST is only returned if O_EXCL and O_CREAT are both specified and the file does not exist. PIPE: "pipe" will also fail if: [ENFILE] The system file table is full. PTRACE: EIO, not EINVAL, is returned if the request code is invalid. ESRCH, not EINVAL, is returned if the specified process does not exist. EIO, not EINVAL, is returned if the given signal number is invalid. EIO, not EFAULT, is returned if the specified address is out of bounds. READ: EINTR - should this be specified or not? "read" will also fail if: [EIO] An I/O error occurred while reading from or writing to the file system. "readv" will also fail if: [EFAULT] Part of *iov* points outside the process's allocated address space. READLINK: "readlink" will also fail if: [EIO] An I/O error occurred while reading from or writing to the file system. RENAME: should say "*From* or *to* point outside...", not "*Path* points outside..." "rename" will also fail if: [ENOENT] The pathname was too long. [ENOSPC] The directory in which the entry for the new name is being placed cannot be extended because there is no space left on the file system containing the directory. [EDQUOT] The directory in which the entry for the new name is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted. [EIO] An I/O error occurred while reading from or writing to the file system. RMDIR: "rmdir" will also fail if: [EIO] An I/O error occurred while reading from or writing to the file system. SETQUOTA: EPERM, not NODEV (sic), is returned if not super-user. ENOENT, not NODEV, is returned if *special* does not exist. EROFS isn't ever returned. "setquota" will also fail if: [ENOENT] The pathname was too long. [EFAULT] *Special* or *file* points outside the process's allocated address space. [EIO] An I/O error occurred while reading from or writing to the file system. STAT: ELOOP applies to "stat", not "fstat". "stat" and "fstat" will also fail if: [EIO] An I/O error occurred while reading from or writing to the file system. SWAPON: "swapon" will also fail if: [ENOTDIR] A component of the path prefix is not a directory. [EPERM] The pathname contains a character with the high-order bit set. [ENOENT] The pathname was too long. [ENOENT] *Special* does not exist. [EACCES] Search permission is denied for a component of the path prefix. [EFAULT] *Special* points to an invalid address. [ELOOP] Too many symbolic links were encountered in translating the pathname. [ENOTBLK] *Special* is not a block device. [ENXIO] The major device number of *special* is out of range (this indicates no device driver exists for the associated hardware). [EBUSY] The device specified by *special* has already been made available for swapping. [ENODEV] The device specified by *special* was not configured into the system as a swap device. [EIO] An I/O error occurred while reading from or writing to the file system. SYMLINK: "symlink" will also fail if: [ENOSPC] The directory in which the entry for the new symbolic link is being placed cannot be extended because there is no space left on the file system containing the directory. [ENOSPC] The new symbolic link cannot be created because there is no space left on the file system which will contain the link. [ENOSPC] There are no free inodes on the file system on which the file is being created. [EDQUOT] The directory in which the entry for the new symbolic link is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted. [EDQUOT] The new symbolic link cannot be created becaue the user's quota of disk blocks on the file system which will contain the link has been exhausted. [EDQUOT] The user's quota of inodes on the file system on which the file is being created has been exhausted. [EIO] An I/O error occurred while reading from or writing to the file system. TRUNCATE: should say "*Path* points outside...", not "*Name* points outside...". "truncate" and "ftruncate" will also fail if: [EIO] An I/O error occurred while reading from or writing to the file system. UNLINK: "unlink" will also fail if: [EIO] An I/O error occurred while reading from or writing to the file system. UTIMES: "utimes" will fail if the effective user ID is not super user, even uf times is NULL and write permission is granted. (Under System V, if times is NULL anyone with write permission on a file can set the accessed and modified times to the current time by passing a NULL pointer to "utime".) Under [EFAULT], it should say "*File* or *tvp* points outside...", not "*Tvp* points outside". "utimes" will also fail if: [EIO] An I/O error occurred while reading from or writing to the file system. WRITE: "write" will also fail if: [ENOSPC] There is no free space remaining on the file system containing the file. [EDQUOT] The user's quota of disk blocks on the file system containing the file has been exhausted. [EIO] An I/O error occurred while reading from or writing to the file system. (Don't go away, System Vers, I've got one coming up for you too...) Guy Harris
aeb@mcvax.UUCP (Andries Brouwer) (05/08/85)
In addition to the long list of corrections and additions to the section 2 man pages posted recently by Guy Harris one might remark that, contrary to what is stated for creat(2): "Creat will fail and the file will not be created or truncated if one of the following occur: ...", creat will in fact create (but not truncate) a file when the EMFILE (too many open files) error is returned. (This is on BSD4.2 and was noticed by ab@unido while playing around with hack.)
mp@allegra.UUCP (Mark Plotnick) (05/10/85)
Also, contrary to the documentation, mkdir(2) does not require you to be super-user.