4.104.114.84.95
Last change
on this file since 07a3253d was
07a3253d,
checked in by Joel Sherrill <joel.sherrill@…>, on 11/23/98 at 19:07:58
|
Added base version of file system infrastructure. This includes a major
overhaul of the RTEMS system call interface. This base file system is
the "In-Memory File System" aka IMFS.
The design and implementation was done by the following people:
+ Joel Sherrill (joel@…)
+ Jennifer Averett (jennifer@…)
+ Steve "Mr Mount" Salitasc (salitasc@…)
+ Kerwin Wade (wade@…)
PROBLEMS
========
+ It is VERY likely that merging this will break the UNIX port. This
can/will be fixed.
+ There is likely some reentrancy/mutual exclusion needed.
+ Eventually, there should be a "mini-IMFS" description table to
eliminate links, symlinks, etc to save memory. All you need to
have "classic RTEMS" functionality is technically directories
and device IO. All the rest could be left out to save memory.
|
-
Property mode set to
100644
|
File size:
941 bytes
|
Line | |
---|
1 | /* |
---|
2 | * dup2() - POSIX 1003.1b 6.2.1 Duplicate an Open File Descriptor |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-1998. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * Copyright assigned to U.S. Government, 1994. |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.OARcorp.com/rtems/license.html. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #include <unistd.h> |
---|
16 | #include <fcntl.h> |
---|
17 | |
---|
18 | #include "libio_.h" |
---|
19 | |
---|
20 | int dup2( |
---|
21 | int fildes, |
---|
22 | int fildes2 |
---|
23 | ) |
---|
24 | { |
---|
25 | int status; |
---|
26 | struct stat buf; |
---|
27 | |
---|
28 | /* |
---|
29 | * If fildes is not valid, then fildes2 should not be closed. |
---|
30 | */ |
---|
31 | |
---|
32 | status = fstat( fildes, &buf ); |
---|
33 | if ( status == -1 ) |
---|
34 | return -1; |
---|
35 | |
---|
36 | /* |
---|
37 | * If fildes2 is not valid, then we should not do anything either. |
---|
38 | */ |
---|
39 | |
---|
40 | status = fstat( fildes2, &buf ); |
---|
41 | if ( status == -1 ) |
---|
42 | return -1; |
---|
43 | |
---|
44 | /* |
---|
45 | * This fcntl handles everything else. |
---|
46 | */ |
---|
47 | |
---|
48 | return fcntl( fildes, F_DUPFD, fildes2 ); |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.