| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT/NEWLIB PATCH 7/8] Import tcgetattr() and tcsetattr() functions from musl
 Copied as is from official musl git mirror
git://git.musl-libc.org/musl, commit 6fcb440d.
Original file locations:
* src/termios/tcgetattr.c
* src/termios/tcsetattr.c
Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 musl-imported/src/termios/tcgetattr.c |  9 +++++++++
 musl-imported/src/termios/tcsetattr.c | 12 ++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 musl-imported/src/termios/tcgetattr.c
 create mode 100644 musl-imported/src/termios/tcsetattr.c
diff --git a/musl-imported/src/termios/tcgetattr.c 
b/musl-imported/src/termios/tcgetattr.c
new file mode 100644
index 0000000..545a0bf
--- /dev/null
+++ b/musl-imported/src/termios/tcgetattr.c
@@ -0,0 +1,9 @@
+#include <termios.h>
+#include <sys/ioctl.h>
+
+int tcgetattr(int fd, struct termios *tio)
+{
+       if (ioctl(fd, TCGETS, tio))
+               return -1;
+       return 0;
+}
diff --git a/musl-imported/src/termios/tcsetattr.c 
b/musl-imported/src/termios/tcsetattr.c
new file mode 100644
index 0000000..94df18f
--- /dev/null
+++ b/musl-imported/src/termios/tcsetattr.c
@@ -0,0 +1,12 @@
+#include <termios.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+int tcsetattr(int fd, int act, const struct termios *tio)
+{
+       if (act < 0 || act > 2) {
+               errno = EINVAL;
+               return -1;
+       }
+       return ioctl(fd, TCSETS+act, tio);
+}
-- 
2.20.1
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
 
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |