summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libc')
-rw-r--r--c/src/lib/libc/Makefile.in2
-rw-r--r--c/src/lib/libc/libio.h7
-rw-r--r--c/src/lib/libc/newlibif.c30
-rw-r--r--c/src/lib/libc/tcattr.c40
4 files changed, 78 insertions, 1 deletions
diff --git a/c/src/lib/libc/Makefile.in b/c/src/lib/libc/Makefile.in
index 9b5c9238d6..ea9f78709e 100644
--- a/c/src/lib/libc/Makefile.in
+++ b/c/src/lib/libc/Makefile.in
@@ -12,7 +12,7 @@ LIB=${ARCH}/${LIBNAME}
# C and C++ source names, if any, go here -- minus the .c or .cc
C_PIECES=__gettod __brk __times malloc syscalls \
- no_libc newlibc newlibif support unixlibc libio hosterr
+ no_libc newlibc newlibif support unixlibc libio hosterr tcattr
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libc/libio.h b/c/src/lib/libc/libio.h
index c79dfc2e33..d77480e4af 100644
--- a/c/src/lib/libc/libio.h
+++ b/c/src/lib/libc/libio.h
@@ -121,4 +121,11 @@ void rtems_register_libio_handler(int handler_flag,
#define rtems_file_descriptor_type(fd) ((fd) & 0xF000)
#define rtems_file_descriptor_type_index(fd) ((((fd) & 0xF000) >> 12) - 1)
+/*
+ * IOCTL values
+ */
+
+#define RTEMS_IO_GET_ATTRIBUTES 1
+#define RTEMS_IO_SET_ATTRIBUTES 2
+
#endif /* _RTEMS_LIBIO_H */
diff --git a/c/src/lib/libc/newlibif.c b/c/src/lib/libc/newlibif.c
index 5b59554428..aca1f369f7 100644
--- a/c/src/lib/libc/newlibif.c
+++ b/c/src/lib/libc/newlibif.c
@@ -87,4 +87,34 @@ fstat(int fd,
* getpid and kill are provided directly by rtems
*/
+/*
+ * ioctl -- IO control
+ */
+
+int
+ioctl(int fd, int request, void *argp)
+{
+ return __rtems_ioctl(fd,request,argp);
+}
+
+/*
+ * tcgetattr/tcsetattr -- get/set attributes of a device.
+ *
+ * by K.Shibuya
+ */
+
+int
+tcgetattr(int fd, struct termios *tp)
+{
+ return __rtems_ioctl(fd,RTEMS_IO_GET_ATTRIBUTES,tp);
+}
+
+int
+tcsetattr(int fd, int opt, struct termios *tp)
+{
+ if(opt != TCSANOW)
+ return -1;
+ return __rtems_ioctl(fd,RTEMS_IO_SET_ATTRIBUTES,tp);
+}
+
#endif
diff --git a/c/src/lib/libc/tcattr.c b/c/src/lib/libc/tcattr.c
new file mode 100644
index 0000000000..aaa5ff6e6e
--- /dev/null
+++ b/c/src/lib/libc/tcattr.c
@@ -0,0 +1,40 @@
+/*
+ * This file contains the RTEMS implementation of the POSIX API
+ * routines tcgetattr and tcsetattr.
+ *
+ * $Id$
+ *
+ */
+
+#include <rtems.h>
+#if defined(RTEMS_NEWLIB)
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <termios.h>
+
+#include "internal.h"
+#include "libio.h"
+
+/*
+ * tcgetattr/tcsetattr -- get/set attributes of a device.
+ *
+ * submitted by K.Shibuya
+ */
+
+int
+tcgetattr(int fd, struct termios *tp)
+{
+ return __rtems_ioctl(fd,RTEMS_IO_GET_ATTRIBUTES,tp);
+}
+
+int
+tcsetattr(int fd, int opt, struct termios *tp)
+{
+ if(opt != TCSANOW)
+ return -1;
+ return __rtems_ioctl(fd,RTEMS_IO_SET_ATTRIBUTES,tp);
+}
+
+#endif