| ... | ... | @@ -1554,3 +1554,186 @@ pub const rlimit = extern struct { |
| 1554 | 1554 | pub const SHUT_RD = 0; |
| 1555 | 1555 | pub const SHUT_WR = 1; |
| 1556 | 1556 | pub const SHUT_RDWR = 2; |
| 1557 | |
| 1558 | // Term |
| 1559 | pub const VEOF = 0; |
| 1560 | pub const VEOL = 1; |
| 1561 | pub const VEOL2 = 2; |
| 1562 | pub const VERASE = 3; |
| 1563 | pub const VWERASE = 4; |
| 1564 | pub const VKILL = 5; |
| 1565 | pub const VREPRINT = 6; |
| 1566 | pub const VINTR = 8; |
| 1567 | pub const VQUIT = 9; |
| 1568 | pub const VSUSP = 10; |
| 1569 | pub const VDSUSP = 11; |
| 1570 | pub const VSTART = 12; |
| 1571 | pub const VSTOP = 13; |
| 1572 | pub const VLNEXT = 14; |
| 1573 | pub const VDISCARD = 15; |
| 1574 | pub const VMIN = 16; |
| 1575 | pub const VTIME = 17; |
| 1576 | pub const VSTATUS = 18; |
| 1577 | pub const NCCS = 20; // 2 spares (7, 19) |
| 1578 | |
| 1579 | pub const IGNBRK = 0x00000001; // ignore BREAK condition |
| 1580 | pub const BRKINT = 0x00000002; // map BREAK to SIGINTR |
| 1581 | pub const IGNPAR = 0x00000004; // ignore (discard) parity errors |
| 1582 | pub const PARMRK = 0x00000008; // mark parity and framing errors |
| 1583 | pub const INPCK = 0x00000010; // enable checking of parity errors |
| 1584 | pub const ISTRIP = 0x00000020; // strip 8th bit off chars |
| 1585 | pub const INLCR = 0x00000040; // map NL into CR |
| 1586 | pub const IGNCR = 0x00000080; // ignore CR |
| 1587 | pub const ICRNL = 0x00000100; // map CR to NL (ala CRMOD) |
| 1588 | pub const IXON = 0x00000200; // enable output flow control |
| 1589 | pub const IXOFF = 0x00000400; // enable input flow control |
| 1590 | pub const IXANY = 0x00000800; // any char will restart after stop |
| 1591 | pub const IMAXBEL = 0x00002000; // ring bell on input queue full |
| 1592 | pub const IUTF8 = 0x00004000; // maintain state for UTF-8 VERASE |
| 1593 | |
| 1594 | pub const OPOST = 0x00000001; //enable following output processing |
| 1595 | pub const ONLCR = 0x00000002; // map NL to CR-NL (ala CRMOD) |
| 1596 | pub const OXTABS = 0x00000004; // expand tabs to spaces |
| 1597 | pub const ONOEOT = 0x00000008; // discard EOT's (^D) on output) |
| 1598 | |
| 1599 | pub const OCRNL = 0x00000010; // map CR to NL on output |
| 1600 | pub const ONOCR = 0x00000020; // no CR output at column 0 |
| 1601 | pub const ONLRET = 0x00000040; // NL performs CR function |
| 1602 | pub const OFILL = 0x00000080; // use fill characters for delay |
| 1603 | pub const NLDLY = 0x00000300; // \n delay |
| 1604 | pub const TABDLY = 0x00000c04; // horizontal tab delay |
| 1605 | pub const CRDLY = 0x00003000; // \r delay |
| 1606 | pub const FFDLY = 0x00004000; // form feed delay |
| 1607 | pub const BSDLY = 0x00008000; // \b delay |
| 1608 | pub const VTDLY = 0x00010000; // vertical tab delay |
| 1609 | pub const OFDEL = 0x00020000; // fill is DEL, else NUL |
| 1610 | |
| 1611 | pub const NL0 = 0x00000000; |
| 1612 | pub const NL1 = 0x00000100; |
| 1613 | pub const NL2 = 0x00000200; |
| 1614 | pub const NL3 = 0x00000300; |
| 1615 | pub const TAB0 = 0x00000000; |
| 1616 | pub const TAB1 = 0x00000400; |
| 1617 | pub const TAB2 = 0x00000800; |
| 1618 | pub const TAB3 = 0x00000004; |
| 1619 | pub const CR0 = 0x00000000; |
| 1620 | pub const CR1 = 0x00001000; |
| 1621 | pub const CR2 = 0x00002000; |
| 1622 | pub const CR3 = 0x00003000; |
| 1623 | pub const FF0 = 0x00000000; |
| 1624 | pub const FF1 = 0x00004000; |
| 1625 | pub const BS0 = 0x00000000; |
| 1626 | pub const BS1 = 0x00008000; |
| 1627 | pub const VT0 = 0x00000000; |
| 1628 | pub const VT1 = 0x00010000; |
| 1629 | |
| 1630 | pub const CIGNORE = 0x00000001; // ignore control flags |
| 1631 | pub const CSIZE = 0x00000300; // character size mask |
| 1632 | pub const CS5 = 0x00000000; // 5 bits (pseudo) |
| 1633 | pub const CS6 = 0x00000100; // 6 bits |
| 1634 | pub const CS7 = 0x00000200; // 7 bits |
| 1635 | pub const CS8 = 0x00000300; // 8 bits |
| 1636 | pub const CSTOPB = 0x0000040; // send 2 stop bits |
| 1637 | pub const CREAD = 0x00000800; // enable receiver |
| 1638 | pub const PARENB = 0x00001000; // parity enable |
| 1639 | pub const PARODD = 0x00002000; // odd parity, else even |
| 1640 | pub const HUPCL = 0x00004000; // hang up on last close |
| 1641 | pub const CLOCAL = 0x00008000; // ignore modem status lines |
| 1642 | pub const CCTS_OFLOW = 0x00010000; // CTS flow control of output |
| 1643 | pub const CRTSCTS = (CCTS_OFLOW | CRTS_IFLOW); |
| 1644 | pub const CRTS_IFLOW = 0x00020000; // RTS flow control of input |
| 1645 | pub const CDTR_IFLOW = 0x00040000; // DTR flow control of input |
| 1646 | pub const CDSR_OFLOW = 0x00080000; // DSR flow control of output |
| 1647 | pub const CCAR_OFLOW = 0x00100000; // DCD flow control of output |
| 1648 | pub const MDMBUF = 0x00100000; // old name for CCAR_OFLOW |
| 1649 | |
| 1650 | pub const ECHOKE = 0x00000001; // visual erase for line kill |
| 1651 | pub const ECHOE = 0x00000002; // visually erase chars |
| 1652 | pub const ECHOK = 0x00000004; // echo NL after line kill |
| 1653 | pub const ECHO = 0x00000008; // enable echoing |
| 1654 | pub const ECHONL = 0x00000010; // echo NL even if ECHO is off |
| 1655 | pub const ECHOPRT = 0x00000020; // visual erase mode for hardcopy |
| 1656 | pub const ECHOCTL = 0x00000040; // echo control chars as ^(Char) |
| 1657 | pub const ISIG = 0x00000080; // enable signals INTR, QUIT, [D]SUSP |
| 1658 | pub const ICANON = 0x00000100; // canonicalize input lines |
| 1659 | pub const ALTWERASE = 0x00000200; // use alternate WERASE algorithm |
| 1660 | pub const IEXTEN = 0x00000400; // enable DISCARD and LNEXT |
| 1661 | pub const EXTPROC = 0x00000800; // external processing |
| 1662 | pub const TOSTOP = 0x00400000; // stop background jobs from output |
| 1663 | pub const FLUSHO = 0x00800000; // output being flushed (state) |
| 1664 | pub const NOKERNINFO = 0x02000000; // no kernel output from VSTATUS |
| 1665 | pub const PENDIN = 0x20000000; // XXX retype pending input (state) |
| 1666 | pub const NOFLSH = 0x80000000; // don't flush after interrupt |
| 1667 | |
| 1668 | pub const TCSANOW = 0; // make change immediate |
| 1669 | pub const TCSADRAIN = 1; // drain output, then change |
| 1670 | pub const TCSAFLUSH = 2; // drain output, flush input |
| 1671 | pub const TCSASOFT = 0x10; // flag - don't alter h.w. state |
| 1672 | pub const TCSA = extern enum(c_uint) { |
| 1673 | NOW, |
| 1674 | DRAIN, |
| 1675 | FLUSH, |
| 1676 | _, |
| 1677 | }; |
| 1678 | |
| 1679 | pub const B0 = 0; |
| 1680 | pub const B50 = 50; |
| 1681 | pub const B75 = 75; |
| 1682 | pub const B110 = 110; |
| 1683 | pub const B134 = 134; |
| 1684 | pub const B150 = 150; |
| 1685 | pub const B200 = 200; |
| 1686 | pub const B300 = 300; |
| 1687 | pub const B600 = 600; |
| 1688 | pub const B1200 = 1200; |
| 1689 | pub const B1800 = 1800; |
| 1690 | pub const B2400 = 2400; |
| 1691 | pub const B4800 = 4800; |
| 1692 | pub const B9600 = 9600; |
| 1693 | pub const B19200 = 19200; |
| 1694 | pub const B38400 = 38400; |
| 1695 | pub const B7200 = 7200; |
| 1696 | pub const B14400 = 14400; |
| 1697 | pub const B28800 = 28800; |
| 1698 | pub const B57600 = 57600; |
| 1699 | pub const B76800 = 76800; |
| 1700 | pub const B115200 = 115200; |
| 1701 | pub const B230400 = 230400; |
| 1702 | pub const EXTA = 19200; |
| 1703 | pub const EXTB = 38400; |
| 1704 | |
| 1705 | pub const TCIFLUSH = 1; |
| 1706 | pub const TCOFLUSH = 2; |
| 1707 | pub const TCIOFLUSH = 3; |
| 1708 | pub const TCOOFF = 1; |
| 1709 | pub const TCOON = 2; |
| 1710 | pub const TCIOFF = 3; |
| 1711 | pub const TCION = 4; |
| 1712 | |
| 1713 | pub const cc_t = u8; |
| 1714 | pub const speed_t = u64; |
| 1715 | pub const tcflag_t = u64; |
| 1716 | |
| 1717 | pub const termios = extern struct { |
| 1718 | iflag: tcflag_t, // input flags |
| 1719 | oflag: tcflag_t, // output flags |
| 1720 | cflag: tcflag_t, // control flags |
| 1721 | lflag: tcflag_t, // local flags |
| 1722 | cc: [NCCS]cc_t, // control chars |
| 1723 | ispeed: speed_t align(8), // input speed |
| 1724 | ospeed: speed_t, // output speed |
| 1725 | }; |
| 1726 | |
| 1727 | pub const winsize = extern struct { |
| 1728 | ws_row: u16, |
| 1729 | ws_col: u16, |
| 1730 | ws_xpixel: u16, |
| 1731 | ws_ypixel: u16, |
| 1732 | }; |
| 1733 | |
| 1734 | pub const TIOCGWINSZ = ior(0x40000000, 't', 104, @sizeOf(winsize)); |
| 1735 | pub const IOCPARM_MASK = 0x1fff; |
| 1736 | |
| 1737 | fn ior(inout: u32, group: usize, num: usize, len: usize) usize { |
| 1738 | return (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)); |
| 1739 | } |