Annotation of 43BSDTahoe/man/man2/lseek.2, revision 1.1

1.1     ! root        1: .\" Copyright (c) 1980 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: .\"    @(#)lseek.2     6.3 (Berkeley) 2/24/86
        !             6: .\"
        !             7: .TH LSEEK 2 "February 24, 1986"
        !             8: .UC 4
        !             9: .SH NAME
        !            10: lseek \- move read/write pointer
        !            11: .SH SYNOPSIS
        !            12: .nf
        !            13: .ft B
        !            14: #include <sys/file.h>
        !            15: .PP
        !            16: .nf
        !            17: .ft B
        !            18: .ta 1.25i 1.6i 1.8i
        !            19: #define L_SET  0       /* set the seek pointer */
        !            20: #define L_INCR 1       /* increment the seek pointer */
        !            21: #define L_XTND 2       /* extend the file size */
        !            22: .PP
        !            23: .ft B
        !            24: pos = lseek(d, offset, whence)
        !            25: off_t pos;
        !            26: int d;
        !            27: off_t offset;
        !            28: int whence;
        !            29: .fi
        !            30: .ft R
        !            31: .SH DESCRIPTION
        !            32: The descriptor 
        !            33: .I d
        !            34: refers to a file or device open for reading and/or writing.
        !            35: .I Lseek
        !            36: sets the file pointer of
        !            37: .I d
        !            38: as follows:
        !            39: .IP
        !            40: If
        !            41: .I whence
        !            42: is L_SET, the pointer is set to
        !            43: .I offset
        !            44: bytes.
        !            45: .IP
        !            46: If
        !            47: .I whence
        !            48: is L_INCR, the pointer is set to its current location plus
        !            49: .IR offset .
        !            50: .IP
        !            51: If
        !            52: .I whence
        !            53: is L_XTND, the pointer is set to the size of the
        !            54: file plus
        !            55: .IR offset .
        !            56: .PP
        !            57: Upon successful completion, the resulting pointer location
        !            58: as measured in bytes from beginning of the file is returned.
        !            59: Some devices are incapable of seeking.  The value of the pointer
        !            60: associated with such a device is undefined.
        !            61: .SH NOTES
        !            62: Seeking far beyond the end of a file, then writing,
        !            63: creates a gap or \*(lqhole\*(rq, which occupies no
        !            64: physical space and reads as zeros.
        !            65: .SH "RETURN VALUE
        !            66: Upon successful completion,
        !            67: the current file pointer value is returned.
        !            68: Otherwise,
        !            69: a value of \-1 is returned and \fIerrno\fP is set to indicate
        !            70: the error.
        !            71: .SH "ERRORS
        !            72: .I Lseek
        !            73: will fail and the file pointer will remain unchanged if:
        !            74: .TP 15
        !            75: [EBADF]
        !            76: .I Fildes
        !            77: is not an open file descriptor.
        !            78: .TP 15
        !            79: [ESPIPE]
        !            80: .I Fildes
        !            81: is associated with a pipe or a socket.
        !            82: .TP 15
        !            83: [EINVAL]
        !            84: .I Whence
        !            85: is not a proper value.
        !            86: .SH "SEE ALSO"
        !            87: dup(2), open(2)
        !            88: .SH BUGS
        !            89: This document's use of
        !            90: .I whence
        !            91: is incorrect English, but maintained for historical reasons.

unix.superglobalmegacorp.com

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