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