All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.
@(#)truncate.2 6.1 (Berkeley) 05/15/85
truncate(path, length) char *path; int length;ftruncate(fd, length) int fd, length;
15 [EPERM] The pathname contains a character with the high-order bit set.
15 [ENOENT] The pathname was too long.
15 [ENOTDIR] A component of the path prefix of path is not a directory.
15 [ENOENT] The named file does not exist.
15 [EACCES] A component of the path prefix denies search permission.
15 [EISDIR] The named file is a directory.
15 [EROFS] The named file resides on a read-only file system.
15 [ETXTBSY] The file is a pure procedure (shared text) file that is being executed.
15 [EFAULT] Name points outside the process's allocated address space.
Ftruncate succeeds unless:
15 [EBADF] The fd is not a valid descriptor.
15 [EINVAL] The fd references a socket, not a file.
These calls should be generalized to allow ranges of bytes in a file to be discarded.