Annotation of 43BSDReno/lib/libc/sys/truncate.2, revision 1.1

1.1     ! root        1: .\" Copyright (c) 1983 The Regents of the University of California.
        !             2: .\" All rights reserved.
        !             3: .\"
        !             4: .\" Redistribution and use in source and binary forms are permitted provided
        !             5: .\" that: (1) source distributions retain this entire copyright notice and
        !             6: .\" comment, and (2) distributions including binaries display the following
        !             7: .\" acknowledgement:  ``This product includes software developed by the
        !             8: .\" University of California, Berkeley and its contributors'' in the
        !             9: .\" documentation or other materials provided with the distribution and in
        !            10: .\" all advertising materials mentioning features or use of this software.
        !            11: .\" Neither the name of the University nor the names of its contributors may
        !            12: .\" be used to endorse or promote products derived from this software without
        !            13: .\" specific prior written permission.
        !            14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            17: .\"
        !            18: .\"    @(#)truncate.2  6.8 (Berkeley) 6/23/90
        !            19: .\"
        !            20: .TH TRUNCATE 2 "June 23, 1990"
        !            21: .UC 5
        !            22: .SH NAME
        !            23: truncate \- truncate a file to a specified length
        !            24: .SH SYNOPSIS
        !            25: .nf
        !            26: .ft B
        !            27: truncate(path, length)
        !            28: char *path;
        !            29: off_t length;
        !            30: .PP
        !            31: .ft B
        !            32: ftruncate(fd, length)
        !            33: int fd;
        !            34: off_t length;
        !            35: .fi
        !            36: .SH DESCRIPTION
        !            37: .I Truncate
        !            38: causes the file named by
        !            39: .I path
        !            40: or referenced by
        !            41: .I fd
        !            42: to be truncated to at most
        !            43: .I length
        !            44: bytes in size.  If the file previously
        !            45: was larger than this size, the extra data
        !            46: is lost.
        !            47: With
        !            48: .IR ftruncate ,
        !            49: the file must be open for writing.
        !            50: .SH "RETURN VALUES
        !            51: A value of 0 is returned if the call succeeds.  If the call
        !            52: fails a \-1 is returned, and the global variable \fIerrno\fP
        !            53: specifies the error.
        !            54: .SH "ERRORS
        !            55: .I Truncate
        !            56: succeeds unless:
        !            57: .TP 15
        !            58: [ENOTDIR]
        !            59: A component of the path prefix is not a directory.
        !            60: .TP 15
        !            61: [EINVAL]
        !            62: The pathname contains a character with the high-order bit set.
        !            63: .TP 15
        !            64: [ENAMETOOLONG]
        !            65: A component of a pathname exceeded 255 characters,
        !            66: or an entire path name exceeded 1023 characters.
        !            67: .TP 15
        !            68: [ENOENT]
        !            69: The named file does not exist.
        !            70: .TP 15
        !            71: [EACCES]
        !            72: Search permission is denied for a component of the path prefix.
        !            73: .TP 15
        !            74: [EACCES]
        !            75: The named file is not writable by the user.
        !            76: .TP 15
        !            77: [ELOOP]
        !            78: Too many symbolic links were encountered in translating the pathname.
        !            79: .TP 15
        !            80: [EISDIR]
        !            81: The named file is a directory.
        !            82: .TP 15
        !            83: [EROFS]
        !            84: The named file resides on a read-only file system.
        !            85: .TP 15
        !            86: [ETXTBSY]
        !            87: The file is a pure procedure (shared text) file that is being executed.
        !            88: .TP 15
        !            89: [EIO]
        !            90: An I/O error occurred updating the inode.
        !            91: .TP 15
        !            92: [EFAULT]
        !            93: .I Path
        !            94: points outside the process's allocated address space.
        !            95: .PP
        !            96: .I Ftruncate
        !            97: succeeds unless:
        !            98: .TP 15
        !            99: [EBADF]
        !           100: The
        !           101: .I fd
        !           102: is not a valid descriptor.
        !           103: .TP 15
        !           104: [EINVAL]
        !           105: The
        !           106: .I fd
        !           107: references a socket, not a file.
        !           108: .TP 15
        !           109: [EINVAL]
        !           110: The
        !           111: .I fd
        !           112: is not open for writing.
        !           113: .SH "SEE ALSO"
        !           114: open(2)
        !           115: .SH BUGS
        !           116: These calls should be generalized to allow ranges
        !           117: 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.