From nobody Tue Jan 24 22:11:40 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P1h5S3XVZz3bfMQ; Tue, 24 Jan 2023 22:11:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P1h5S2l2Zz4P5j; Tue, 24 Jan 2023 22:11:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fulpH4kr24YFKFhpxPdRgsgEiW6ve2etrzdosiWcj/U=; b=fbvoNdt4TByErxilnMVCRxHxqFm33J6R4lvJr+yC1HJPaQuUhp+6ekbLUQSYwdHS43ZD/s Uyeipft3hmfNa3V9Vr0pARERW3Vf3qs84O92IS/ckO9J8zHO2V/MQPH0SU/qAzhBBUMrZ5 o/NMqYE+lFp0QCfAltT/UX5qjx+ZtcJkAy+jXnL3lqhsu/XSNNnORTZkEvjKa3XJRBuj8d BkK2q/TFfUed9Ve3MHUFQxrV2LJtaoGRdLhUYXcQU7NGnxH9OWOj0av/W5YmOjRjJmATse 7WsmdEJ0aFn34VPfhhqJ6NoD3V4Az6C+UyhYW0CW2+2AmtUi8DCFJmVai60TOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fulpH4kr24YFKFhpxPdRgsgEiW6ve2etrzdosiWcj/U=; b=eW7ks2hss1oEpmMUhE61RRgLr03gi6OhWzkgh8jmdKGiD5/mzYI+VGxU0YnKBYx+S0gZoq 0qWRYXeePn6XYLBDZWb31ahyQRIrtUdgUiuzm/PjQKsrPr8ADfnGbpWH1QPvsifNlFKcFw IIDf71n2egDqBvkVALMWG0kn3uDXcZpDBH8uFVScOxE391dbghRMb1+atauymwJa7c2wIl ZH8qms4si+kaDuWq1lW9WLfIcOm+Zma64Ch5foYAlarUcGlS2xTT6C5v9NeVKuBUsP28zQ zkKySSebawbM2pjZs0eBeBW4xRgbvxhtfiwaGS28cf7DhxaBHhNqXrIiQgIR+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674598300; a=rsa-sha256; cv=none; b=iljLSW0kunkdJEeI1w/eoGYcc5KBEzJLmQfHwr+QEBmcdHFNFl0VqP/1j/agPVSc/j3E76 ni86e1QfE+rXdgujhhrRlOhYejtJ7cRoVwYM9JScLZTZTwVicqXglf+0kS9mpNVszy0MtT /QH/3DXmAS6NBa0dAFoQAj6cJF4IKaGZrlC4wmHI8l1XYOPx2tVHbynm1mdntUn61Fb4ZY 8MMzk2Q65XOKtvn5+V6udj01GrDKCO0xcdushRYqsWpPOxyIMPZpFJNhYAfCUONskknjl4 Z5Z1bBswNxJfsTS9+mHQsMYffkA2HDJh4RHqo/QdBumFqWoxprZa2ROkaef4CQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P1h5S1s1hzQRj; Tue, 24 Jan 2023 22:11:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30OMBexA085042; Tue, 24 Jan 2023 22:11:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30OMBegh085041; Tue, 24 Jan 2023 22:11:40 GMT (envelope-from git) Date: Tue, 24 Jan 2023 22:11:40 GMT Message-Id: <202301242211.30OMBegh085041@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 0c1f70f8ee46 - stable/13 - kboot: implement stripped down termios List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0c1f70f8ee468ebdbb7d6bb92d706c573a58fcf3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0c1f70f8ee468ebdbb7d6bb92d706c573a58fcf3 commit 0c1f70f8ee468ebdbb7d6bb92d706c573a58fcf3 Author: Warner Losh AuthorDate: 2022-07-26 23:31:23 +0000 Commit: Warner Losh CommitDate: 2023-01-24 21:49:28 +0000 kboot: implement stripped down termios Implement a stripped down termios, obtained from various files in musl and HOST_ or host_ prepended to most things and a few unavoidable style tweaks. Only implements the bits of termios we need for the boot loader: put the terminal into raw mode, restore terminal settings and speed stuff. Sponsored by: Netflix (cherry picked from commit 963037786f76a414e91e45d4fbef5e35fc1abc84) --- stand/kboot/Makefile | 1 + stand/kboot/arch/amd64/termios_arch.h | 1 + stand/kboot/arch/powerpc64/termios_arch.h | 184 ++++++++++++++++++++++++++++++ stand/kboot/termios.c | 66 +++++++++++ stand/kboot/termios.h | 24 ++++ stand/kboot/termios_gen.h | 169 +++++++++++++++++++++++++++ 6 files changed, 445 insertions(+) diff --git a/stand/kboot/Makefile b/stand/kboot/Makefile index 3a38b8d3d0cf..986e636a8c35 100644 --- a/stand/kboot/Makefile +++ b/stand/kboot/Makefile @@ -19,6 +19,7 @@ INSTALLFLAGS= -b # Architecture-specific loader code SRCS= crt1.c conf.c vers.c main.c host_syscalls.c hostcons.c hostdisk.c kbootfdt.c gfx_fb_stub.c +SRCS+= termios.c CFLAGS.gfx_fb_stub.c += -I${SRCTOP}/contrib/pnglite -I${SRCTOP}/sys/teken diff --git a/stand/kboot/arch/amd64/termios_arch.h b/stand/kboot/arch/amd64/termios_arch.h new file mode 100644 index 000000000000..0d5ae3718498 --- /dev/null +++ b/stand/kboot/arch/amd64/termios_arch.h @@ -0,0 +1 @@ +#include "termios_gen.h" diff --git a/stand/kboot/arch/powerpc64/termios_arch.h b/stand/kboot/arch/powerpc64/termios_arch.h new file mode 100644 index 000000000000..62b801ff16da --- /dev/null +++ b/stand/kboot/arch/powerpc64/termios_arch.h @@ -0,0 +1,184 @@ +#undef HOST_NCCS +#define HOST_NCCS 19 +struct host_termios { + host_tcflag_t c_iflag; + host_tcflag_t c_oflag; + host_tcflag_t c_cflag; + host_tcflag_t c_lflag; + host_cc_t c_cc[HOST_NCCS]; + host_cc_t c_line; + host_speed_t __c_ispeed; + host_speed_t __c_ospeed; +}; + +#define HOST_VINTR 0 +#define HOST_VQUIT 1 +#define HOST_VERASE 2 +#define HOST_VKILL 3 +#define HOST_VEOF 4 +#define HOST_VMIN 5 +#define HOST_VEOL 6 +#define HOST_VTIME 7 +#define HOST_VEOL2 8 +#define HOST_VSWTC 9 +#define HOST_VWERASE 10 +#define HOST_VREPRINT 11 +#define HOST_VSUSP 12 +#define HOST_VSTART 13 +#define HOST_VSTOP 14 +#define HOST_VLNEXT 15 +#define HOST_VDISCARD 16 + +#define HOST_IGNBRK 0000001 +#define HOST_BRKINT 0000002 +#define HOST_IGNPAR 0000004 +#define HOST_PARMRK 0000010 +#define HOST_INPCK 0000020 +#define HOST_ISTRIP 0000040 +#define HOST_INLCR 0000100 +#define HOST_IGNCR 0000200 +#define HOST_ICRNL 0000400 +#define HOST_IXON 0001000 +#define HOST_IXOFF 0002000 +#define HOST_IXANY 0004000 +#define HOST_IUCLC 0010000 +#define HOST_IMAXBEL 0020000 +#define HOST_IUTF8 0040000 + +#define HOST_OPOST 0000001 +#define HOST_ONLCR 0000002 +#define HOST_OLCUC 0000004 +#define HOST_OCRNL 0000010 +#define HOST_ONOCR 0000020 +#define HOST_ONLRET 0000040 +#define HOST_OFILL 0000100 +#define HOST_OFDEL 0000200 +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE) +#define HOST_NLDLY 0001400 +#define HOST_NL0 0000000 +#define HOST_NL1 0000400 +#define HOST_NL2 0001000 +#define HOST_NL3 0001400 +#define HOST_TABDLY 0006000 +#define HOST_TAB0 0000000 +#define HOST_TAB1 0002000 +#define HOST_TAB2 0004000 +#define HOST_TAB3 0006000 +#define HOST_CRDLY 0030000 +#define HOST_CR0 0000000 +#define HOST_CR1 0010000 +#define HOST_CR2 0020000 +#define HOST_CR3 0030000 +#define HOST_FFDLY 0040000 +#define HOST_FF0 0000000 +#define HOST_FF1 0040000 +#define HOST_BSDLY 0100000 +#define HOST_BS0 0000000 +#define HOST_BS1 0100000 +#endif + +#define HOST_VTDLY 0200000 +#define HOST_VT0 0000000 +#define HOST_VT1 0200000 + +#define HOST_B0 0000000 +#define HOST_B50 0000001 +#define HOST_B75 0000002 +#define HOST_B110 0000003 +#define HOST_B134 0000004 +#define HOST_B150 0000005 +#define HOST_B200 0000006 +#define HOST_B300 0000007 +#define HOST_B600 0000010 +#define HOST_B1200 0000011 +#define HOST_B1800 0000012 +#define HOST_B2400 0000013 +#define HOST_B4800 0000014 +#define HOST_B9600 0000015 +#define HOST_B19200 0000016 +#define HOST_B38400 0000017 + +#define HOST_B57600 00020 +#define HOST_B115200 00021 +#define HOST_B230400 00022 +#define HOST_B460800 00023 +#define HOST_B500000 00024 +#define HOST_B576000 00025 +#define HOST_B921600 00026 +#define HOST_B1000000 00027 +#define HOST_B1152000 00030 +#define HOST_B1500000 00031 +#define HOST_B2000000 00032 +#define HOST_B2500000 00033 +#define HOST_B3000000 00034 +#define HOST_B3500000 00035 +#define HOST_B4000000 00036 + +#define HOST_CSIZE 00001400 +#define HOST_CS5 00000000 +#define HOST_CS6 00000400 +#define HOST_CS7 00001000 +#define HOST_CS8 00001400 +#define HOST_CSTOPB 00002000 +#define HOST_CREAD 00004000 +#define HOST_PARENB 00010000 +#define HOST_PARODD 00020000 +#define HOST_HUPCL 00040000 +#define HOST_CLOCAL 00100000 + +#define HOST_ECHOE 0x00000002 +#define HOST_ECHOK 0x00000004 +#define HOST_ECHO 0x00000008 +#define HOST_ECHONL 0x00000010 +#define HOST_ISIG 0x00000080 +#define HOST_ICANON 0x00000100 +#define HOST_IEXTEN 0x00000400 +#define HOST_TOSTOP 0x00400000 +#define HOST_NOFLSH 0x80000000 + +#define HOST_TCOOFF 0 +#define HOST_TCOON 1 +#define HOST_TCIOFF 2 +#define HOST_TCION 3 + +#define HOST_TCIFLUSH 0 +#define HOST_TCOFLUSH 1 +#define HOST_TCIOFLUSH 2 + +#define HOST_TCSANOW 0 +#define HOST_TCSADRAIN 1 +#define HOST_TCSAFLUSH 2 + +#define HOST_EXTA 0000016 +#define HOST_EXTB 0000017 +#define HOST_CBAUD 00377 +#define HOST_CBAUDEX 0000020 +#define HOST_CIBAUD 077600000 +#define HOST_CMSPAR 010000000000 +#define HOST_CRTSCTS 020000000000 + +#define HOST_XCASE 0x00004000 +#define HOST_ECHOCTL 0x00000040 +#define HOST_ECHOPRT 0x00000020 +#define HOST_ECHOKE 0x00000001 +#define HOST_FLUSHO 0x00800000 +#define HOST_PENDIN 0x20000000 +#define HOST_EXTPROC 0x10000000 + +#define HOST_XTABS 00006000 +#define HOST_TIOCSER_TEMT 1 + +#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) ) +#define _IOC_NONE 1U +#define _IOC_WRITE 4U +#define _IOC_READ 2U + +#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0) +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c)) + +#define HOST_TCGETS _IOR('t', 19, char[44]) +#define HOST_TCSETS _IOW('t', 20, char[44]) +#define HOST_TCSETSW _IOW('t', 21, char[44]) +#define HOST_TCSETSF _IOW('t', 22, char[44]) diff --git a/stand/kboot/termios.c b/stand/kboot/termios.c new file mode 100644 index 000000000000..ec62170a44c9 --- /dev/null +++ b/stand/kboot/termios.c @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2005-2020 Rich Felker, et al. + * + * SPDX-License-Identifier: MIT + * + * Note: From the musl project, stripped down and repackaged with HOST_/host_ prepended + */ + +#include +#include "termios.h" +#include "host_syscall.h" + +int +host_tcgetattr(int fd, struct host_termios *tio) +{ + if (host_ioctl(fd, HOST_TCGETS, (uintptr_t)tio)) + return -1; + return 0; +} + +int +host_tcsetattr(int fd, int act, const struct host_termios *tio) +{ + if (act < 0 || act > 2) { +// errno = EINVAL; /* XXX ?? */ + return -1; + } + return host_ioctl(fd, HOST_TCSETS+act, (uintptr_t)tio); +} + +void +host_cfmakeraw(struct host_termios *t) +{ + t->c_iflag &= ~(HOST_IGNBRK | HOST_BRKINT | HOST_PARMRK | HOST_ISTRIP | + HOST_INLCR | HOST_IGNCR | HOST_ICRNL | HOST_IXON); + t->c_oflag &= ~HOST_OPOST; + t->c_lflag &= ~(HOST_ECHO | HOST_ECHONL | HOST_ICANON | HOST_ISIG | + HOST_IEXTEN); + t->c_cflag &= ~(HOST_CSIZE | HOST_PARENB); + t->c_cflag |= HOST_CS8; + t->c_cc[HOST_VMIN] = 1; + t->c_cc[HOST_VTIME] = 0; +} + +int host_cfsetospeed(struct host_termios *tio, host_speed_t speed) +{ + if (speed & ~HOST_CBAUD) { +// errno = EINVAL; /* XXX ? */ + return -1; + } + tio->c_cflag &= ~HOST_CBAUD; + tio->c_cflag |= speed; + return 0; +} + +int host_cfsetispeed(struct host_termios *tio, host_speed_t speed) +{ + return speed ? host_cfsetospeed(tio, speed) : 0; +} + +int +host_cfsetspeed(struct host_termios *tio, host_speed_t speed) +{ + return host_cfsetospeed(tio, speed); /* weak alias in musl */ +} + diff --git a/stand/kboot/termios.h b/stand/kboot/termios.h new file mode 100644 index 000000000000..f5763292e7d5 --- /dev/null +++ b/stand/kboot/termios.h @@ -0,0 +1,24 @@ +#ifndef _TERMIOS_H +#define _TERMIOS_H + +typedef unsigned char host_cc_t; +typedef unsigned int host_speed_t; +typedef unsigned int host_tcflag_t; + +#define HOST_NCCS 32 + +#include "termios_arch.h" + +#define HOST_TCSANOW 0 +#define HOST_TCSADRAIN 1 +#define HOST_TCSAFLUSH 2 + +int host_tcgetattr (int, struct host_termios *); +int host_tcsetattr (int, int, const struct host_termios *); + +void host_cfmakeraw(struct host_termios *); +int host_cfsetispeed(struct host_termios *, host_speed_t); +int host_cfsetospeed(struct host_termios *, host_speed_t); +int host_cfsetspeed(struct host_termios *, host_speed_t); + +#endif diff --git a/stand/kboot/termios_gen.h b/stand/kboot/termios_gen.h new file mode 100644 index 000000000000..041205e6dd0a --- /dev/null +++ b/stand/kboot/termios_gen.h @@ -0,0 +1,169 @@ +struct host_termios { + host_tcflag_t c_iflag; + host_tcflag_t c_oflag; + host_tcflag_t c_cflag; + host_tcflag_t c_lflag; + host_cc_t c_line; + host_cc_t c_cc[HOST_NCCS]; + host_speed_t __c_ispeed; + host_speed_t __c_ospeed; +}; + +#define HOST_VINTR 0 +#define HOST_VQUIT 1 +#define HOST_VERASE 2 +#define HOST_VKILL 3 +#define HOST_VEOF 4 +#define HOST_VTIME 5 +#define HOST_VMIN 6 +#define HOST_VSWTC 7 +#define HOST_VSTART 8 +#define HOST_VSTOP 9 +#define HOST_VSUSP 10 +#define HOST_VEOL 11 +#define HOST_VREPRINT 12 +#define HOST_VDISCARD 13 +#define HOST_VWERASE 14 +#define HOST_VLNEXT 15 +#define HOST_VEOL2 16 + +#define HOST_IGNBRK 0000001 +#define HOST_BRKINT 0000002 +#define HOST_IGNPAR 0000004 +#define HOST_PARMRK 0000010 +#define HOST_INPCK 0000020 +#define HOST_ISTRIP 0000040 +#define HOST_INLCR 0000100 +#define HOST_IGNCR 0000200 +#define HOST_ICRNL 0000400 +#define HOST_IUCLC 0001000 +#define HOST_IXON 0002000 +#define HOST_IXANY 0004000 +#define HOST_IXOFF 0010000 +#define HOST_IMAXBEL 0020000 +#define HOST_IUTF8 0040000 + +#define HOST_OPOST 0000001 +#define HOST_OLCUC 0000002 +#define HOST_ONLCR 0000004 +#define HOST_OCRNL 0000010 +#define HOST_ONOCR 0000020 +#define HOST_ONLRET 0000040 +#define HOST_OFILL 0000100 +#define HOST_OFDEL 0000200 +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE) +#define HOST_NLDLY 0000400 +#define HOST_NL0 0000000 +#define HOST_NL1 0000400 +#define HOST_CRDLY 0003000 +#define HOST_CR0 0000000 +#define HOST_CR1 0001000 +#define HOST_CR2 0002000 +#define HOST_CR3 0003000 +#define HOST_TABDLY 0014000 +#define HOST_TAB0 0000000 +#define HOST_TAB1 0004000 +#define HOST_TAB2 0010000 +#define HOST_TAB3 0014000 +#define HOST_BSDLY 0020000 +#define HOST_BS0 0000000 +#define HOST_BS1 0020000 +#define HOST_FFDLY 0100000 +#define HOST_FF0 0000000 +#define HOST_FF1 0100000 +#endif + +#define HOST_VTDLY 0040000 +#define HOST_VT0 0000000 +#define HOST_VT1 0040000 + +#define HOST_B0 0000000 +#define HOST_B50 0000001 +#define HOST_B75 0000002 +#define HOST_B110 0000003 +#define HOST_B134 0000004 +#define HOST_B150 0000005 +#define HOST_B200 0000006 +#define HOST_B300 0000007 +#define HOST_B600 0000010 +#define HOST_B1200 0000011 +#define HOST_B1800 0000012 +#define HOST_B2400 0000013 +#define HOST_B4800 0000014 +#define HOST_B9600 0000015 +#define HOST_B19200 0000016 +#define HOST_B38400 0000017 + +#define HOST_B57600 0010001 +#define HOST_B115200 0010002 +#define HOST_B230400 0010003 +#define HOST_B460800 0010004 +#define HOST_B500000 0010005 +#define HOST_B576000 0010006 +#define HOST_B921600 0010007 +#define HOST_B1000000 0010010 +#define HOST_B1152000 0010011 +#define HOST_B1500000 0010012 +#define HOST_B2000000 0010013 +#define HOST_B2500000 0010014 +#define HOST_B3000000 0010015 +#define HOST_B3500000 0010016 +#define HOST_B4000000 0010017 + +#define HOST_CSIZE 0000060 +#define HOST_CS5 0000000 +#define HOST_CS6 0000020 +#define HOST_CS7 0000040 +#define HOST_CS8 0000060 +#define HOST_CSTOPB 0000100 +#define HOST_CREAD 0000200 +#define HOST_PARENB 0000400 +#define HOST_PARODD 0001000 +#define HOST_HUPCL 0002000 +#define HOST_CLOCAL 0004000 + +#define HOST_ISIG 0000001 +#define HOST_ICANON 0000002 +#define HOST_ECHO 0000010 +#define HOST_ECHOE 0000020 +#define HOST_ECHOK 0000040 +#define HOST_ECHONL 0000100 +#define HOST_NOFLSH 0000200 +#define HOST_TOSTOP 0000400 +#define HOST_IEXTEN 0100000 + +#define HOST_TCOOFF 0 +#define HOST_TCOON 1 +#define HOST_TCIOFF 2 +#define HOST_TCION 3 + +#define HOST_TCIFLUSH 0 +#define HOST_TCOFLUSH 1 +#define HOST_TCIOFLUSH 2 + +#define HOST_TCSANOW 0 +#define HOST_TCSADRAIN 1 +#define HOST_TCSAFLUSH 2 + +#define HOST_EXTA 0000016 +#define HOST_EXTB 0000017 +#define HOST_CBAUD 0010017 +#define HOST_CBAUDEX 0010000 +#define HOST_CIBAUD 002003600000 +#define HOST_CMSPAR 010000000000 +#define HOST_CRTSCTS 020000000000 + +#define HOST_XCASE 0000004 +#define HOST_ECHOCTL 0001000 +#define HOST_ECHOPRT 0002000 +#define HOST_ECHOKE 0004000 +#define HOST_FLUSHO 0010000 +#define HOST_PENDIN 0040000 +#define HOST_EXTPROC 0200000 + +#define HOST_XTABS 0014000 + +#define HOST_TCGETS 0x5401 +#define HOST_TCSETS 0x5402 +#define HOST_TCSETSW 0x5403 +#define HOST_TCSETSF 0x5404