2 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright (c) 1980, 1991 Regents of the University of California.
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. All advertising materials mentioning features or use of this software
15 .\" must display the following acknowledgement:
16 .\" This product includes software developed by the University of
17 .\" California, Berkeley and its contributors.
18 .\" 4. Neither the name of the University nor the names of its contributors
19 .\" may be used to endorse or promote products derived from this software
20 .\" without specific prior written permission.
22 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .\" @(#)lseek.2 6.5 (Berkeley) 3/10/91
36 .\" Modified Fri Jul 23 22:17:00 1993 by Rik Faith <faith@cs.unc.edu>
37 .\" Modified 10 June 1995 by Andries Brouwer <aeb@cwi.nl>
38 .\" Modified Thu Oct 31 15:18:33 1996 by Eric S. Raymond <esr@thyrsus.com>
39 .\" Modified Sat Jan 17 13:00:32 MET 1998 by Michael Haardt <michael@cantor.informatik.rwth-aachen.de>
40 .\" Translated Tue Nov 27 11:31:29 MET 2001 by Peter Gerbrandt <pgerbrandt@bfs.de>
42 .TH LSEEK 2 "17. Januar 1998" "Linux" "Systemaufrufe"
44 lseek \- read/write Datei offset verändern
47 .B #include <sys/types.h>
49 .B #include <unistd.h>
51 .BI "off_t lseek(int " filedes ", off_t " offset ", int " whence );
55 setzt den Offset des Dateideskriptors
61 der sich wie folgt zusammensetzt:
64 Der neue Offset wird auf
69 Der neue Offset ist die aktuelle Position plus
74 Der neue Offset ist die Datei Größe plus
80 erlaubt es, den Offset einer Datei hinter ihr end-of-file zu setzen. Wenn
81 später Daten geschrieben werden, ergeben Lesezugriffe auf
82 die Lücke zwischen der eigentlichen Datei und den neuen Daten einen
83 Rückgabewert von Null (bis tatsächlich Daten in die Lücke geschrieben werden).
87 die neue Position in Bytes vom Anfang der Datei aus.
88 Anderenfalls wird (off_t)\-1 zurückgegeben und der Fehler in
95 ist kein geöffneter Datei Zeiger.
99 beschreibt eine Pipe, einen Socket oder ein FIFO.
103 hat einen falschen Wert.
107 Manche Geräte unterstützen kein Vor- und Zurückspulen und POSIX spezifiziert nicht,
108 welche es unterstützen müssen.
110 Einschränkung unter Linux:
111 Wendet man \fBlseek\fP auf ein tty\-Device an, gibt es \fBESPIPE\fP zurück.
112 Andere Systeme liefern die Anzahl der
113 geschriebenen Bytes und verwenden SEEK_SET als Zähler.
114 Manche Devices wie \fB/dev/null\fP verursachen den Fehler \fBESPIPE\fP
115 nicht, aber liefern einen Zeiger zurück, dessen Wert nicht definiert ist.
118 Wenn alter Code konvertiert wird, ersetzen Sie die Werte von
120 durch die folgenden Makros:
134 SVR1-3 liefert \fBlong\fP statt \fBoff_t\fP, BSD liefert \fBint\fP.
136 Beachten Sie, dass Datei-Deskriptoren, die mit
140 erstellt wurden, den aktuellen Positions-Zeiger gemeinsam nutzen.
143 bei solchen Dateien verwendet wird, kann es zu unerwarteten
144 Race-Bedingungen kommen.