2 /* $OpenBSD: termios.c,v 1.2 2005/05/24 20:38:20 uwe Exp $ */
5 * Copyright (c) 1989, 1993
6 * The Regents of the University of California. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 #include "compat_linux.h"
40 linux_cfsetspeed(struct linux_termios
*t
, linux_speed_t speed
)
45 mask
= LINUX_B9600
; /* XXX default value should this be 0? */
46 for (i
= 0; i
< __arraycount(linux_speeds
); i
++) {
47 if (speed
== linux_speeds
[i
]) {
48 mask
= linux_spmasks
[i
];
52 if (i
== __arraycount(linux_speeds
))
55 t
->c_cflag
&= ~LINUX_CBAUD
;
61 linux_cfmakeraw(struct linux_termios
*t
)
64 t
->c_iflag
&= ~(LINUX_IMAXBEL
73 t
->c_oflag
&= ~LINUX_OPOST
;
74 t
->c_lflag
&= ~(LINUX_ECHO
79 t
->c_cflag
&= ~(LINUX_CSIZE
|LINUX_PARENB
);
80 t
->c_cflag
|= LINUX_CS8
;
84 linux_tcgetattr(int fd
, struct linux_termios
*t
)
87 return uioctl(fd
, LINUX_TCGETS
, t
);
90 /* This function differs slightly from tcsetattr() in libc. */
92 linux_tcsetattr(int fd
, int action
, struct linux_termios
*t
)
105 return uioctl(fd
, action
, t
);
108 void dummycall(void);
113 (void)linux_termio_to_bsd_termios
;
114 (void)bsd_termios_to_linux_termio
;
115 (void)linux_termios_to_bsd_termios
;
116 (void)bsd_termios_to_linux_termios
;