Imported tab->space correction by redhat
[infodrom/manpages-de] / man2 / lseek.2
1 .\" t
2 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright (c) 1980, 1991 Regents of the University of California.
4 .\" All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
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.
21 .\"
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
32 .\" SUCH DAMAGE.
33 .\"
34 .\"     @(#)lseek.2     6.5 (Berkeley) 3/10/91
35 .\"
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>
41 .\"
42 .TH LSEEK 2 "17. Januar 1998" "Linux" "Systemaufrufe"
43 .SH BEZEICHNUNG
44 lseek \- read/write Datei offset verändern
45 .SH "ÜBERSICHT"
46 .nf
47 .B #include <sys/types.h>
48 .br
49 .B #include <unistd.h>
50 .sp
51 .BI "off_t lseek(int " filedes ", off_t " offset ", int " whence );
52 .SH BESCHREIBUNG
53 Die Funktion
54 .B lseek
55 setzt den Offset des Dateideskriptors
56 .I filedes
57 auf
58 .IR offset ,
59 gemäß des Wertes von
60 .IR whence ,
61 der sich wie folgt zusammensetzt:
62 .TP
63 .B SEEK_SET
64 Der neue Offset wird auf
65 .I offset
66 Bytes gesetzt.
67 .TP
68 .B SEEK_CUR
69 Der neue Offset ist die aktuelle Position plus
70 .I offset
71 Bytes.
72 .TP
73 .B SEEK_END
74 Der neue Offset ist die Datei Größe plus
75 .I offset
76 Bytes.
77 .PP
78 Die Funktion
79 .B lseek
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).
84 .SH "RÜCKGABEWERT"
85 Bei Erfolg liefert
86 .B lseek
87 die neue Position in Bytes vom Anfang der Datei aus.
88 Anderenfalls wird (off_t)\-1 zurückgegeben und der Fehler in
89 .I errno
90 gesetzt.
91 .SH FEHLER
92 .TP
93 .B EBADF
94 .I Filedes
95 ist kein geöffneter Datei Zeiger.
96 .TP
97 .B ESPIPE
98 .I Filedes
99 beschreibt eine Pipe, einen Socket oder ein FIFO.
100 .TP
101 .B EINVAL
102 .I Whence
103 hat einen falschen Wert.
104 .SH "KONFORM ZU"
105 SVr4, POSIX, BSD 4.3
106 .SH EINSCHRÄNKUNGEN
107 Manche Geräte unterstützen kein Vor- und Zurückspulen und POSIX spezifiziert nicht,
108 welche es unterstützen müssen.
109
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.
116 .SH ANMERKUNGEN
117
118 Wenn alter Code konvertiert wird, ersetzen Sie die Werte von
119 .I whence
120 durch die folgenden Makros:
121 .PP
122 .TS
123 c c
124 l l.
125 old     new
126 0       SEEK_SET
127 1       SEEK_CUR
128 2       SEEK_END
129 L_SET   SEEK_SET
130 L_INCR  SEEK_CUR
131 L_XTND  SEEK_END
132 .TE
133 .PP
134 SVR1-3 liefert \fBlong\fP statt \fBoff_t\fP, BSD liefert \fBint\fP.
135
136 Beachten Sie, dass Datei-Deskriptoren, die mit
137 .BR dup (2)
138 oder
139 .BR fork (2)
140 erstellt wurden, den aktuellen Positions-Zeiger gemeinsam nutzen.
141 Wenn
142 .B lseek
143 bei solchen Dateien verwendet wird, kann es zu unerwarteten
144 Race-Bedingungen kommen.
145 .SH "SIEHE AUCH"
146 .BR dup (2),
147 .BR fork (2),
148 .BR open (2),
149 .BR fseek (3).