File: dup.2

package info (click to toggle)
manpages-de 0.4-8
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,808 kB
  • ctags: 4
  • sloc: sh: 7,666; makefile: 60
file content (100 lines) | stat: -rw-r--r-- 3,186 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
.\"                               1993 Michael Haardt, Ian Jackson.
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\" 
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.  The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\" 
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Modified Wed Jul 21 22:45:39 1993 by Rik Faith (faith@cs.unc.edu)
.\" Modified 21 Aug 1994 by Michael Chastain (mec@shell.portal.com):
.\"   Fixed typoes.
.\" German translation 1 Feb 1996 Aldo Valente (aldo@dagobar.rhein.de)
.\" 
.TH DUP 2 "21 August 1994" "Linux 1.1.46" "Linux Systemaufrufe"
.SH BEZEICHNUNG
dup, dup2 \- dupliziert einen file descriptor (Datei-Referenz)
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.sp
.BI "int dup(int " oldfd );
.BI "int dup2(int " oldfd ", int " newfd );
.fi
.SH BESCHREIBUNG
.BR dup " und " dup2
erzeugen eine Kopie des file descriptor
.IR oldfd .

Die alten und neuen Deskriptoren knnen wahlfrei benutzt werden.  
Sie teilen sich Locks, Dateipositionszeiger (File Position Pointers)
und Flags; falls beispielsweise die Dateiposition durch
.B lseek 
fr einen der Deskriptoren verndert wurde, ist es sie auch fr den 
anderen.  

Die close-on-exec flag (schliessen-bei-ausfhrung) teilen sie sich jedoch
nicht.  

.B dup
benutzt den unbenutzten Deskriptor mit der kleinsten Nummer fr den neuen. 

.B dup2
.RI "macht " newfd " zur Kopie von " oldfd ", wobei " newfd
 ,falls notwendig, zuerst geschlossen wird.
.SH "WIEDERGABEWERT"
.BR dup " und " dup2
geben den neuen descriptor zurck, oder \-1 falls ein Fehler auftrat 
(in diesem Falle wird auch
.I errno
entsprechend gesetzt). 
.SH FEHLER
.TP
.B EBADF
.I oldfd
ist kein offener file descriptor, oder 
.I newfd
ist auerhalb des fr Dateideskriptoren erlaubten Bereiches.
.TP
.B EMFILE
Der Prozess hat schon die maximale Anzahl an file deskriptoren
offen und versuchte einen weiteren zu ffnen.  
.SH WARNUNG
Der Fehler, der von 
.B dup2
zurckgegeben wird, ist unterschiedlich zu demjenigen von
.BR fcntl( ..., F_DUPFD ,... )
wenn
.I newfd
auerhalb des Bereiches ist. Weiterhin gibt 
.B dup2
auf einigen Systemen
.B EINVAL
wie
.BR F_DUPFD 
zurck.
.SH "KONFORM ZU"
SVID, AT&T, POSIX, X/OPEN, BSD 4.3
.SH "SIEHE AUCH"
.BR fcntl (2),
.BR open (2),
.BR close (2).