1 | #if !defined(RTEMS_UNIX) |
---|
2 | |
---|
3 | /* |
---|
4 | * RTEMS Fake System Calls |
---|
5 | * |
---|
6 | * This file contains "fake" versions of the system call routines |
---|
7 | * which are reference by many libc implementations. Once a routine |
---|
8 | * has been implemented in terms of RTEMS services, it should be |
---|
9 | * taken out of this file. |
---|
10 | * |
---|
11 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
12 | * On-Line Applications Research Corporation (OAR). |
---|
13 | * All rights assigned to U.S. Government, 1994. |
---|
14 | * |
---|
15 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
16 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
17 | * notice must appear in all copies of this file and its derivatives. |
---|
18 | * |
---|
19 | * $Id$ |
---|
20 | * |
---|
21 | */ |
---|
22 | |
---|
23 | #include <sys/types.h> |
---|
24 | #include <sys/stat.h> |
---|
25 | #include <assert.h> |
---|
26 | #include <errno.h> |
---|
27 | #include <string.h> |
---|
28 | #include <stdio.h> /* only for puts */ |
---|
29 | |
---|
30 | /* |
---|
31 | * fstat, stat, and isatty must lie consistently and report that everything |
---|
32 | * is a tty or stdout will not be line buffered. |
---|
33 | */ |
---|
34 | |
---|
35 | int __rtems_fstat(int _fd, struct stat* _sbuf) |
---|
36 | { |
---|
37 | if ( _fd > 2 ) { |
---|
38 | puts( "__rtems_fstat -- only stdio supported" ); |
---|
39 | assert( 0 ); |
---|
40 | } |
---|
41 | _sbuf->st_mode = S_IFCHR; |
---|
42 | #ifdef HAVE_BLKSIZE |
---|
43 | _sbuf->st_blksize = 0; |
---|
44 | #endif |
---|
45 | return 0; |
---|
46 | } |
---|
47 | |
---|
48 | int __rtems_isatty(int _fd) |
---|
49 | { |
---|
50 | return 1; |
---|
51 | } |
---|
52 | |
---|
53 | int stat( const char *path, struct stat *buf ) |
---|
54 | { |
---|
55 | if ( strncmp( "/dev/", path, 5 ) ) { |
---|
56 | return -1; |
---|
57 | } |
---|
58 | return __rtems_fstat( 0, buf ); |
---|
59 | } |
---|
60 | |
---|
61 | int link( const char *existing, const char *new ) |
---|
62 | { |
---|
63 | /* always fail */ |
---|
64 | return -1; |
---|
65 | } |
---|
66 | |
---|
67 | int unlink( const char *path ) |
---|
68 | { |
---|
69 | /* always fail */ |
---|
70 | return -1; |
---|
71 | } |
---|
72 | |
---|
73 | char *getcwd( char *_buf, size_t _size) { |
---|
74 | /* assert( FALSE ); */ |
---|
75 | errno = ENOSYS; |
---|
76 | return 0; |
---|
77 | } |
---|
78 | int fork() { |
---|
79 | puts( "fork -- not supported!!!" ); |
---|
80 | assert( 0 ); |
---|
81 | errno = ENOSYS; |
---|
82 | return -1; |
---|
83 | } |
---|
84 | int execv(const char *_path, char * const _argv[] ) { |
---|
85 | puts( "execv -- not supported!!!" ); |
---|
86 | assert( 0 ); |
---|
87 | errno = ENOSYS; |
---|
88 | return -1; |
---|
89 | } |
---|
90 | int wait() { |
---|
91 | puts( "wait -- not supported!!!" ); |
---|
92 | assert( 0 ); |
---|
93 | errno = ENOSYS; |
---|
94 | return -1; |
---|
95 | } |
---|
96 | |
---|
97 | #endif |
---|