Copied as is from the 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@cs.pub.ro>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
--- /dev/null
+#include <termios.h>
+#include <sys/ioctl.h>
+
+int tcgetattr(int fd, struct termios *tio)
+{
+ if (ioctl(fd, TCGETS, tio))
+ return -1;
+ return 0;
+}
--- /dev/null
+#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);
+}