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 |
---|
27 | _read_r(struct _reent *ptr, |
---|
28 | int fd, |
---|
29 | void *buf, |
---|
30 | size_t nbytes) |
---|
31 | { |
---|
32 | return __rtems_read(fd, buf, nbytes); |
---|
33 | } |
---|
34 | |
---|
35 | long |
---|
36 | _write_r(struct _reent *ptr, |
---|
37 | int fd, |
---|
38 | const void *buf, |
---|
39 | size_t nbytes |
---|
40 | ) |
---|
41 | { |
---|
42 | return __rtems_write(fd, buf, nbytes); |
---|
43 | } |
---|
44 | |
---|
45 | int |
---|
46 | _open_r(struct _reent *ptr, |
---|
47 | const char *buf, |
---|
48 | int flags, |
---|
49 | int mode) |
---|
50 | { |
---|
51 | return __rtems_open(buf, flags, mode); |
---|
52 | } |
---|
53 | |
---|
54 | int |
---|
55 | _close_r(struct _reent *ptr, |
---|
56 | int fd) |
---|
57 | { |
---|
58 | return __rtems_close(fd); |
---|
59 | } |
---|
60 | |
---|
61 | off_t |
---|
62 | _lseek_r(struct _reent *ptr, |
---|
63 | int fd, |
---|
64 | off_t offset, |
---|
65 | int whence) |
---|
66 | { |
---|
67 | return __rtems_lseek(fd, offset, whence); |
---|
68 | } |
---|
69 | |
---|
70 | int |
---|
71 | _fstat_r(struct _reent *ptr, |
---|
72 | int fd, |
---|
73 | struct stat *buf) |
---|
74 | { |
---|
75 | return __rtems_fstat(fd, buf); |
---|
76 | } |
---|
77 | |
---|
78 | pid_t _getpid_r(struct _reent *ptr) |
---|
79 | { |
---|
80 | pid_t __getpid(); |
---|
81 | return __getpid(); |
---|
82 | } |
---|
83 | |
---|
84 | int _kill_r( struct _reent *ptr, pid_t pid, int sig ) |
---|
85 | { |
---|
86 | int __kill(); |
---|
87 | return __kill(pid, sig); |
---|
88 | } |
---|
89 | #endif |
---|