summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libc/newlibif.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1997-01-29 00:29:25 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1997-01-29 00:29:25 +0000
commitdcec5a4d60405c206b1fab8630534e917fdf9857 (patch)
tree53dd9f4fbaffd74fbb5e8311ec6a2efe83eb84ea /c/src/lib/libc/newlibif.c
parentAll RTEMS system call implementation renamed to be __rtems_*. (diff)
downloadrtems-dcec5a4d60405c206b1fab8630534e917fdf9857.tar.bz2
Merged newlib's libgloss support for rtems into this directory. This
should simplify the build process.
Diffstat (limited to 'c/src/lib/libc/newlibif.c')
-rw-r--r--c/src/lib/libc/newlibif.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/c/src/lib/libc/newlibif.c b/c/src/lib/libc/newlibif.c
new file mode 100644
index 0000000000..5b59554428
--- /dev/null
+++ b/c/src/lib/libc/newlibif.c
@@ -0,0 +1,90 @@
+
+/*
+ * 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 "internal.h"
+#include "libio.h"
+
+int
+read(int fd,
+ char *buf,
+ int nbytes)
+{
+ return __rtems_read(fd, buf, nbytes);
+}
+
+int
+write(int fd,
+ char *buf,
+ int nbytes)
+{
+ return __rtems_write(fd, buf, nbytes);
+}
+
+int
+open(char *buf,
+ int flags,
+ int mode)
+{
+ return __rtems_open(buf, flags, mode);
+}
+
+int
+close(int fd)
+{
+ return __rtems_close(fd);
+}
+
+/*
+ * isatty -- returns 1 if connected to a terminal device,
+ * returns 0 if not.
+ */
+int
+isatty(int fd)
+{
+ return __rtems_isatty(fd);
+}
+
+/*
+ * lseek -- move read/write pointer. Since a serial port
+ * is non-seekable, we return an error.
+ */
+off_t
+lseek(int fd,
+ off_t offset,
+ int whence)
+{
+ return __rtems_lseek(fd, offset, whence);
+}
+
+/*
+ * fstat -- get status of a file. Since we have no file
+ * system, we just return an error.
+ */
+int
+fstat(int fd,
+ struct stat *buf)
+{
+ return __rtems_fstat(fd, buf);
+}
+
+/*
+ * getpid and kill are provided directly by rtems
+ */
+
+#endif