summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libc/newlibifr.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1997-08-22 19:17:09 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1997-08-22 19:17:09 +0000
commitb1459dc199ffbaf93c9da017714935d25ac157b5 (patch)
tree1cc5499e9c603de27d3f7849020bbdf88c2eca6c /c/src/lib/libc/newlibifr.c
parentFixed iop/memory leak bug reported by Dan Dickey. (diff)
downloadrtems-b1459dc199ffbaf93c9da017714935d25ac157b5.tar.bz2
Moved reentrant wrappers into their own file.
Diffstat (limited to 'c/src/lib/libc/newlibifr.c')
-rw-r--r--c/src/lib/libc/newlibifr.c89
1 files changed, 89 insertions, 0 deletions
diff --git a/c/src/lib/libc/newlibifr.c b/c/src/lib/libc/newlibifr.c
new file mode 100644
index 0000000000..1879239f9e
--- /dev/null
+++ b/c/src/lib/libc/newlibifr.c
@@ -0,0 +1,89 @@
+
+/*
+ * This file contains the glue which maps newlib system calls onto their
+ * RTEMS implementations. This formerly was in the file
+ * libgloss/rtems/iface.c which was installed as rtems.o. Merging this
+ * into the RTEMS source tree minimizes the files which must be linked
+ * to build an rtems application.
+ *
+ * $Id$
+ *
+ */
+
+#include <rtems.h>
+#if defined(RTEMS_NEWLIB)
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <reent.h>
+
+#include <termios.h>
+
+#include "internal.h"
+#include "libio.h"
+
+_ssize_t
+_read_r(struct _reent *ptr,
+ int fd,
+ void *buf,
+ size_t nbytes)
+{
+ return __rtems_read(fd, buf, nbytes);
+}
+
+long
+_write_r(struct _reent *ptr,
+ int fd,
+ const void *buf,
+ size_t nbytes
+)
+{
+ return __rtems_write(fd, buf, nbytes);
+}
+
+int
+_open_r(struct _reent *ptr,
+ const char *buf,
+ int flags,
+ int mode)
+{
+ return __rtems_open(buf, flags, mode);
+}
+
+int
+_close_r(struct _reent *ptr,
+ int fd)
+{
+ return __rtems_close(fd);
+}
+
+off_t
+_lseek_r(struct _reent *ptr,
+ int fd,
+ off_t offset,
+ int whence)
+{
+ return __rtems_lseek(fd, offset, whence);
+}
+
+int
+_fstat_r(struct _reent *ptr,
+ int fd,
+ struct stat *buf)
+{
+ return __rtems_fstat(fd, buf);
+}
+
+pid_t _getpid_r(struct _reent *ptr)
+{
+ pid_t __getpid();
+ return __getpid();
+}
+
+int _kill_r( struct _reent *ptr, pid_t pid, int sig )
+{
+ int __kill();
+ return __kill(pid, sig);
+}
+#endif