xref: /freebsd/contrib/ntp/include/ntp_tty.h (revision 40a8ac8f62b535d30349faf28cf47106b7041b83)
1 /*
2  * ntp_tty.h - header file for serial lines handling
3  */
4 
5 #ifndef NTP_TTY_H
6 #define NTP_TTY_H
7 
8 #if defined(HAVE_BSD_TTYS)
9 #include <sgtty.h>
10 #define TTY	struct sgttyb
11 #endif /* HAVE_BSD_TTYS */
12 
13 #if defined(HAVE_SYSV_TTYS)
14 #include <termio.h>
15 #define TTY	struct termio
16 #ifndef tcsetattr
17 #define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)
18 #endif
19 #ifndef TCSANOW
20 #define TCSANOW	TCSETA
21 #endif
22 #ifndef TCIFLUSH
23 #define TCIFLUSH 0
24 #endif
25 #ifndef TCOFLUSH
26 #define TCOFLUSH 1
27 #endif
28 #ifndef TCIOFLUSH
29 #define TCIOFLUSH 2
30 #endif
31 #ifndef tcflush
32 #define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
33 #endif
34 #endif /* HAVE_SYSV_TTYS */
35 
36 #if defined(HAVE_TERMIOS)
37 # ifdef TERMIOS_NEEDS__SVID3
38 #  define _SVID3
39 # endif
40 # include <termios.h>
41 # ifdef TERMIOS_NEEDS__SVID3
42 #  undef _SVID3
43 # endif
44 #define TTY	struct termios
45 #endif
46 
47 #if defined(HAVE_SYS_MODEM_H)
48 #include <sys/modem.h>
49 #endif
50 
51 #if !defined(SYSV_TTYS) && !defined(STREAM) & !defined(BSD_TTYS)
52 #define BSD_TTYS
53 #endif /* SYSV_TTYS STREAM BSD_TTYS */
54 
55 #endif /* NTP_TTY_H */
56