Imported tab->space correction by redhat
[infodrom/manpages-de] / man2 / dup.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
4 .\"                               1993 Michael Haardt, Ian Jackson.
5 .\"
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one
14 .\" 
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\" 
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
26 .\" Modified Wed Jul 21 22:45:39 1993 by Rik Faith (faith@cs.unc.edu)
27 .\" Modified 21 Aug 1994 by Michael Chastain (mec@shell.portal.com):
28 .\"   Fixed typoes.
29 .\" German translation 1 Feb 1996 Aldo Valente (aldo@dagobar.rhein.de)
30 .\" 
31 .TH DUP 2 "21. August 1994" "Linux 1.1.46" "Linux Systemaufrufe"
32 .SH BEZEICHNUNG
33 dup, dup2 \- dupliziert einen file descriptor (Datei-Referenz)
34 .SH SYNOPSIS
35 .nf
36 .B #include <unistd.h>
37 .sp
38 .BI "int dup(int " oldfd );
39 .BI "int dup2(int " oldfd ", int " newfd );
40 .fi
41 .SH BESCHREIBUNG
42 .BR dup " und " dup2
43 erzeugen eine Kopie des file descriptor
44 .IR oldfd .
45
46 Die alten und neuen Deskriptoren können wahlfrei benutzt werden.  
47 Sie teilen sich Locks, Dateipositionszeiger (File Position Pointers)
48 und Flags; falls beispielsweise die Dateiposition durch
49 .B lseek 
50 für einen der Deskriptoren verändert wurde, ist es sie auch für den 
51 anderen.  
52
53 Die close-on-exec flag (Schließen-bei-Ausführung) teilen sie sich jedoch
54 nicht.  
55
56 .B dup
57 benutzt den unbenutzten Deskriptor mit der kleinsten Nummer für den neuen. 
58
59 .B dup2
60 .RI "macht " newfd " zur Kopie von " oldfd ", wobei " newfd ,
61 falls notwendig, zuerst geschlossen wird.
62 .SH "WIEDERGABEWERT"
63 .BR dup " und " dup2
64 geben den neuen descriptor zurück, oder \-1 falls ein Fehler auftrat 
65 (in diesem Falle wird auch
66 .I errno
67 entsprechend gesetzt). 
68 .SH FEHLER
69 .TP
70 .B EBADF
71 .I oldfd
72 ist kein offener file descriptor, oder 
73 .I newfd
74 ist außerhalb des für Dateideskriptoren erlaubten Bereiches.
75 .TP
76 .B EMFILE
77 Der Prozess hat schon die maximale Anzahl an file deskriptoren
78 offen und versuchte einen weiteren zu öffnen.  
79 .SH WARNUNG
80 Der Fehler, der von 
81 .B dup2
82 zurückgegeben wird, ist unterschiedlich zu demjenigen von
83 .BR fcntl( ..., F_DUPFD ,... )
84 wenn
85 .I newfd
86 außerhalb des Bereiches ist. Weiterhin gibt 
87 .B dup2
88 auf einigen Systemen
89 .B EINVAL
90 wie
91 .BR F_DUPFD 
92 zurück.
93 .SH "KONFORM ZU"
94 SVID, AT&T, POSIX, X/OPEN, BSD 4.3
95 .SH "SIEHE AUCH"
96 .BR fcntl (2),
97 .BR open (2),
98 .BR close (2).
99
100