1/*-
2 * Copyright (c) 1982, 1986, 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.
--- 22 unchanged lines hidden (view full) ---
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)tty.c 8.8 (Berkeley) 1/21/94
39 * $Id: tty.c,v 1.55 1995/07/21 22:51:50 bde Exp $
40 */
41
42/*-
43 * TODO:
44 * o Fix races for sending the start char in ttyflush().
45 * o Handle inter-byte timeout for "MIN > 0, TIME > 0" in ttyselect().
46 * With luck, there will be MIN chars before select() returns().
47 * o Handle CLOCAL consistently for ptys. Perhaps disallow setting it.
--- 2001 unchanged lines hidden (view full) ---
2049
2050 selwakeup(&tp->t_rsel);
2051 if (ISSET(tp->t_state, TS_ASYNC))
2052 pgsignal(tp->t_pgrp, SIGIO, 1);
2053 wakeup((caddr_t)&tp->t_rawq);
2054}
2055
2056/*
2057 * Wake up any writers on a tty.
2058 */
2059void
2060ttwwakeup(tp)
2061 register struct tty *tp;
2062{
2063
2064 if (tp->t_outq.c_cc <= tp->t_lowat) {
2065 if (tp->t_state & TS_ASLEEP) {
2066 tp->t_state &= ~TS_ASLEEP;
2067 wakeup(&tp->t_outq);
2068 }
2069 selwakeup(&tp->t_wsel);
2070 }
2071}
2072
2073/*
2074 * Look up a code for a specified speed in a conversion table;
2075 * used by drivers to map software speed values to hardware parameters.
2076 */
2077int
2078ttspeedtab(speed, table)
2079 int speed;
2080 register struct speedtab *table;
2081{
--- 239 unchanged lines hidden ---
2 * Copyright (c) 1982, 1986, 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.
--- 22 unchanged lines hidden (view full) ---
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)tty.c 8.8 (Berkeley) 1/21/94
39 * $Id: tty.c,v 1.55 1995/07/21 22:51:50 bde Exp $
40 */
41
42/*-
43 * TODO:
44 * o Fix races for sending the start char in ttyflush().
45 * o Handle inter-byte timeout for "MIN > 0, TIME > 0" in ttyselect().
46 * With luck, there will be MIN chars before select() returns().
47 * o Handle CLOCAL consistently for ptys. Perhaps disallow setting it.
--- 2001 unchanged lines hidden (view full) ---
2049
2050 selwakeup(&tp->t_rsel);
2051 if (ISSET(tp->t_state, TS_ASYNC))
2052 pgsignal(tp->t_pgrp, SIGIO, 1);
2053 wakeup((caddr_t)&tp->t_rawq);
2054}
2055
2056/*
2057 * Wake up any writers on a tty.
2058 */
2059void
2060ttwwakeup(tp)
2061 register struct tty *tp;
2062{
2063
2064 if (tp->t_outq.c_cc <= tp->t_lowat) {
2065 if (tp->t_state & TS_ASLEEP) {
2066 tp->t_state &= ~TS_ASLEEP;
2067 wakeup(&tp->t_outq);
2068 }
2069 selwakeup(&tp->t_wsel);
2070 }
2071}
2072
2073/*
2074 * Look up a code for a specified speed in a conversion table;
2075 * used by drivers to map software speed values to hardware parameters.
2076 */
2077int
2078ttspeedtab(speed, table)
2079 int speed;
2080 register struct speedtab *table;
2081{
--- 239 unchanged lines hidden ---