1f14ad5faSEd Schouten /*- 22321c474SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 32321c474SPedro F. Giffuni * 4f14ad5faSEd Schouten * Copyright (c) 1988, 1989, 1993, 1994 5f14ad5faSEd Schouten * The Regents of the University of California. All rights reserved. 6f14ad5faSEd Schouten * 7f14ad5faSEd Schouten * Redistribution and use in source and binary forms, with or without 8f14ad5faSEd Schouten * modification, are permitted provided that the following conditions 9f14ad5faSEd Schouten * are met: 10f14ad5faSEd Schouten * 1. Redistributions of source code must retain the above copyright 11f14ad5faSEd Schouten * notice, this list of conditions and the following disclaimer. 12f14ad5faSEd Schouten * 2. Redistributions in binary form must reproduce the above copyright 13f14ad5faSEd Schouten * notice, this list of conditions and the following disclaimer in the 14f14ad5faSEd Schouten * documentation and/or other materials provided with the distribution. 15f2556687SWarner Losh * 3. Neither the name of the University nor the names of its contributors 16f14ad5faSEd Schouten * may be used to endorse or promote products derived from this software 17f14ad5faSEd Schouten * without specific prior written permission. 18f14ad5faSEd Schouten * 19f14ad5faSEd Schouten * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20f14ad5faSEd Schouten * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21f14ad5faSEd Schouten * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22f14ad5faSEd Schouten * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23f14ad5faSEd Schouten * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24f14ad5faSEd Schouten * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25f14ad5faSEd Schouten * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26f14ad5faSEd Schouten * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27f14ad5faSEd Schouten * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28f14ad5faSEd Schouten * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29f14ad5faSEd Schouten * SUCH DAMAGE. 30f14ad5faSEd Schouten */ 31f14ad5faSEd Schouten 32f14ad5faSEd Schouten #ifndef _TERMIOS_H_ 33f14ad5faSEd Schouten #define _TERMIOS_H_ 34f14ad5faSEd Schouten 35f14ad5faSEd Schouten #include <sys/cdefs.h> 36f14ad5faSEd Schouten #include <sys/_termios.h> 37f14ad5faSEd Schouten #include <sys/_types.h> 38*7d7fad7bSKonstantin Belousov #if __BSD_VISIBLE 39*7d7fad7bSKonstantin Belousov #include <sys/_winsize.h> 40*7d7fad7bSKonstantin Belousov #endif 41f14ad5faSEd Schouten 42f14ad5faSEd Schouten #ifndef _PID_T_DECLARED 43f14ad5faSEd Schouten typedef __pid_t pid_t; 44f14ad5faSEd Schouten #define _PID_T_DECLARED 45f14ad5faSEd Schouten #endif 46f14ad5faSEd Schouten 47a07c3aebSKonstantin Belousov #if __BSD_VISIBLE 48f14ad5faSEd Schouten #define OXTABS TAB3 49f14ad5faSEd Schouten #define MDMBUF CCAR_OFLOW 50f14ad5faSEd Schouten #endif 51f14ad5faSEd Schouten 52a07c3aebSKonstantin Belousov #if __BSD_VISIBLE 53f14ad5faSEd Schouten #define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE) 54f14ad5faSEd Schouten #endif 55f14ad5faSEd Schouten 56f14ad5faSEd Schouten /* 57f14ad5faSEd Schouten * Commands passed to tcsetattr() for setting the termios structure. 58f14ad5faSEd Schouten */ 59f14ad5faSEd Schouten #define TCSANOW 0 /* make change immediate */ 60f14ad5faSEd Schouten #define TCSADRAIN 1 /* drain output, then change */ 61f14ad5faSEd Schouten #define TCSAFLUSH 2 /* drain output, flush input */ 62a07c3aebSKonstantin Belousov #if __BSD_VISIBLE 63f14ad5faSEd Schouten #define TCSASOFT 0x10 /* flag - don't alter h.w. state */ 64f14ad5faSEd Schouten #endif 65f14ad5faSEd Schouten 66f14ad5faSEd Schouten #define TCIFLUSH 1 67f14ad5faSEd Schouten #define TCOFLUSH 2 68f14ad5faSEd Schouten #define TCIOFLUSH 3 69f14ad5faSEd Schouten #define TCOOFF 1 70f14ad5faSEd Schouten #define TCOON 2 71f14ad5faSEd Schouten #define TCIOFF 3 72f14ad5faSEd Schouten #define TCION 4 73f14ad5faSEd Schouten 74f14ad5faSEd Schouten __BEGIN_DECLS 75f14ad5faSEd Schouten speed_t cfgetispeed(const struct termios *); 76f14ad5faSEd Schouten speed_t cfgetospeed(const struct termios *); 77f14ad5faSEd Schouten int cfsetispeed(struct termios *, speed_t); 78f14ad5faSEd Schouten int cfsetospeed(struct termios *, speed_t); 79f14ad5faSEd Schouten int tcgetattr(int, struct termios *); 80f14ad5faSEd Schouten int tcsetattr(int, int, const struct termios *); 81f14ad5faSEd Schouten int tcdrain(int); 82f14ad5faSEd Schouten int tcflow(int, int); 83f14ad5faSEd Schouten int tcflush(int, int); 84f14ad5faSEd Schouten int tcsendbreak(int, int); 85f14ad5faSEd Schouten 86448f5f73SJilles Tjoelker #if __POSIX_VISIBLE >= 200112 87f14ad5faSEd Schouten pid_t tcgetsid(int); 88f14ad5faSEd Schouten #endif 89f14ad5faSEd Schouten #if __BSD_VISIBLE 90f14ad5faSEd Schouten int tcsetsid(int, pid_t); 91f14ad5faSEd Schouten 92f14ad5faSEd Schouten void cfmakeraw(struct termios *); 93736fc286SEd Schouten void cfmakesane(struct termios *); 94f14ad5faSEd Schouten int cfsetspeed(struct termios *, speed_t); 95*7d7fad7bSKonstantin Belousov 96*7d7fad7bSKonstantin Belousov int tcgetwinsize(int, struct winsize *); 97*7d7fad7bSKonstantin Belousov int tcsetwinsize(int, const struct winsize *); 98f14ad5faSEd Schouten #endif 99f14ad5faSEd Schouten __END_DECLS 100f14ad5faSEd Schouten 101f14ad5faSEd Schouten #endif /* !_TERMIOS_H_ */ 102f14ad5faSEd Schouten 103a07c3aebSKonstantin Belousov #if __BSD_VISIBLE 104f14ad5faSEd Schouten #include <sys/ttycom.h> 105f14ad5faSEd Schouten #include <sys/ttydefaults.h> 106f14ad5faSEd Schouten #endif 107