Annotation of 43BSDTahoe/man/man2/truncate.2, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1983 Regents of the University of California.
                      2: .\" All rights reserved.  The Berkeley software License Agreement
                      3: .\" specifies the terms and conditions for redistribution.
                      4: .\"
                      5: .\"    @(#)truncate.2  6.6 (Berkeley) 3/29/86
                      6: .\"
                      7: .TH TRUNCATE 2 "March 29, 1986"
                      8: .UC 5
                      9: .SH NAME
                     10: truncate \- truncate a file to a specified length
                     11: .SH SYNOPSIS
                     12: .nf
                     13: .ft B
                     14: truncate(path, length)
                     15: char *path;
                     16: off_t length;
                     17: .PP
                     18: .ft B
                     19: ftruncate(fd, length)
                     20: int fd;
                     21: off_t length;
                     22: .fi
                     23: .SH DESCRIPTION
                     24: .I Truncate
                     25: causes the file named by
                     26: .I path
                     27: or referenced by
                     28: .I fd
                     29: to be truncated to at most
                     30: .I length
                     31: bytes in size.  If the file previously
                     32: was larger than this size, the extra data
                     33: is lost.
                     34: With
                     35: .IR ftruncate ,
                     36: the file must be open for writing.
                     37: .SH "RETURN VALUES
                     38: A value of 0 is returned if the call succeeds.  If the call
                     39: fails a \-1 is returned, and the global variable \fIerrno\fP
                     40: specifies the error.
                     41: .SH "ERRORS
                     42: .I Truncate
                     43: succeeds unless:
                     44: .TP 15
                     45: [ENOTDIR]
                     46: A component of the path prefix is not a directory.
                     47: .TP 15
                     48: [EINVAL]
                     49: The pathname contains a character with the high-order bit set.
                     50: .TP 15
                     51: [ENAMETOOLONG]
                     52: A component of a pathname exceeded 255 characters,
                     53: or an entire path name exceeded 1023 characters.
                     54: .TP 15
                     55: [ENOENT]
                     56: The named file does not exist.
                     57: .TP 15
                     58: [EACCES]
                     59: Search permission is denied for a component of the path prefix.
                     60: .TP 15
                     61: [EACCES]
                     62: The named file is not writable by the user.
                     63: .TP 15
                     64: [ELOOP]
                     65: Too many symbolic links were encountered in translating the pathname.
                     66: .TP 15
                     67: [EISDIR]
                     68: The named file is a directory.
                     69: .TP 15
                     70: [EROFS]
                     71: The named file resides on a read-only file system.
                     72: .TP 15
                     73: [ETXTBSY]
                     74: The file is a pure procedure (shared text) file that is being executed.
                     75: .TP 15
                     76: [EIO]
                     77: An I/O error occurred updating the inode.
                     78: .TP 15
                     79: [EFAULT]
                     80: .I Path
                     81: points outside the process's allocated address space.
                     82: .PP
                     83: .I Ftruncate
                     84: succeeds unless:
                     85: .TP 15
                     86: [EBADF]
                     87: The
                     88: .I fd
                     89: is not a valid descriptor.
                     90: .TP 15
                     91: [EINVAL]
                     92: The
                     93: .I fd
                     94: references a socket, not a file.
                     95: .TP 15
                     96: [EINVAL]
                     97: The
                     98: .I fd
                     99: is not open for writing.
                    100: .SH "SEE ALSO"
                    101: open(2)
                    102: .SH BUGS
                    103: These calls should be generalized to allow ranges
                    104: of bytes in a file to be discarded.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.