1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
4 .\" 1993 Michael Haardt, Ian Jackson.
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.
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
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
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
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):
29 .\" German translation 1 Feb 1996 Aldo Valente (aldo@dagobar.rhein.de)
31 .TH DUP 2 "21. August 1994" "Linux 1.1.46" "Linux Systemaufrufe"
33 dup, dup2 \- dupliziert einen file descriptor (Datei-Referenz)
36 .B #include <unistd.h>
38 .BI "int dup(int " oldfd );
39 .BI "int dup2(int " oldfd ", int " newfd );
43 erzeugen eine Kopie des file descriptor
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
50 für einen der Deskriptoren verändert wurde, ist es sie auch für den
53 Die close-on-exec flag (Schließen-bei-Ausführung) teilen sie sich jedoch
57 benutzt den unbenutzten Deskriptor mit der kleinsten Nummer für den neuen.
60 .RI "macht " newfd " zur Kopie von " oldfd ", wobei " newfd ,
61 falls notwendig, zuerst geschlossen wird.
64 geben den neuen descriptor zurück, oder \-1 falls ein Fehler auftrat
65 (in diesem Falle wird auch
67 entsprechend gesetzt).
72 ist kein offener file descriptor, oder
74 ist außerhalb des für Dateideskriptoren erlaubten Bereiches.
77 Der Prozess hat schon die maximale Anzahl an file deskriptoren
78 offen und versuchte einen weiteren zu öffnen.
82 zurückgegeben wird, ist unterschiedlich zu demjenigen von
83 .BR fcntl( ..., F_DUPFD ,... )
86 außerhalb des Bereiches ist. Weiterhin gibt
94 SVID, AT&T, POSIX, X/OPEN, BSD 4.3