4.104.114.84.95
Line | |
---|
1 | |
---|
2 | /* |
---|
3 | * This file contains the glue which maps newlib system calls onto their |
---|
4 | * RTEMS implementations. This formerly was in the file |
---|
5 | * libgloss/rtems/iface.c which was installed as rtems.o. Merging this |
---|
6 | * into the RTEMS source tree minimizes the files which must be linked |
---|
7 | * to build an rtems application. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | * |
---|
11 | */ |
---|
12 | |
---|
13 | #include <rtems.h> |
---|
14 | #if defined(RTEMS_NEWLIB) |
---|
15 | |
---|
16 | #include <sys/types.h> |
---|
17 | #include <sys/stat.h> |
---|
18 | #include <errno.h> |
---|
19 | #include <reent.h> |
---|
20 | |
---|
21 | #include <termios.h> |
---|
22 | |
---|
23 | #include "internal.h" |
---|
24 | #include "libio.h" |
---|
25 | |
---|
26 | _ssize_t _read_r( |
---|
27 | struct _reent *ptr, |
---|
28 | int fd, |
---|
29 | void *buf, |
---|
30 | size_t nbytes |
---|
31 | ) |
---|
32 | { |
---|
33 | return __rtems_read(fd, buf, nbytes); |
---|
34 | } |
---|
35 | |
---|
36 | long _write_r( |
---|
37 | struct _reent *ptr, |
---|
38 | int fd, |
---|
39 | const void *buf, |
---|
40 | size_t nbytes |
---|
41 | ) |
---|
42 | { |
---|
43 | return __rtems_write(fd, buf, nbytes); |
---|
44 | } |
---|
45 | |
---|
46 | int _open_r( |
---|
47 | struct _reent *ptr, |
---|
48 | const char *buf, |
---|
49 | int flags, |
---|
50 | int mode |
---|
51 | ) |
---|
52 | { |
---|
53 | return __rtems_open(buf, flags, mode); |
---|
54 | } |
---|
55 | |
---|
56 | int _close_r( |
---|
57 | struct _reent *ptr, |
---|
58 | int fd |
---|
59 | ) |
---|
60 | { |
---|
61 | return __rtems_close(fd); |
---|
62 | } |
---|
63 | |
---|
64 | off_t _lseek_r( |
---|
65 | struct _reent *ptr, |
---|
66 | int fd, |
---|
67 | off_t offset, |
---|
68 | int whence |
---|
69 | ) |
---|
70 | { |
---|
71 | return __rtems_lseek(fd, offset, whence); |
---|
72 | } |
---|
73 | |
---|
74 | int _stat_r( |
---|
75 | struct _reent *ptr, |
---|
76 | const char *path, |
---|
77 | struct stat *buf |
---|
78 | ) |
---|
79 | { |
---|
80 | return stat(path, buf); |
---|
81 | } |
---|
82 | |
---|
83 | int _fstat_r( |
---|
84 | struct _reent *ptr, |
---|
85 | int fd, |
---|
86 | struct stat *buf |
---|
87 | ) |
---|
88 | { |
---|
89 | return __rtems_fstat(fd, buf); |
---|
90 | } |
---|
91 | |
---|
92 | pid_t _getpid_r(struct _reent *ptr) |
---|
93 | { |
---|
94 | pid_t __getpid(); |
---|
95 | return __getpid(); |
---|
96 | } |
---|
97 | |
---|
98 | int _kill_r( struct _reent *ptr, pid_t pid, int sig ) |
---|
99 | { |
---|
100 | int __kill(); |
---|
101 | return __kill(pid, sig); |
---|
102 | } |
---|
103 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.