mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-18 17:00:49 +01:00
Obtained from: partly from ancient patches of mine via 1.1.5
Give names to the magic tty i/o sleep addresses and use them. This makes it easier to remember what the addresses are for and to keep them unique.
This commit is contained in:
parent
3ec9b35e8a
commit
abe8bea470
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9639
@ -27,7 +27,7 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cy.c,v 1.9 1995/07/21 22:51:31 bde Exp $
|
||||
* $Id: cy.c,v 1.10 1995/07/22 01:29:58 bde Exp $
|
||||
*/
|
||||
|
||||
#include "cy.h"
|
||||
@ -151,11 +151,6 @@
|
||||
#define CD1400_xIVR_CHAN_SHIFT 3
|
||||
#define CD1400_xIVR_CHAN 0x0F /* XXX reduce to pack Cyclom-8Ys */
|
||||
|
||||
/*
|
||||
* XXX temporary kludges for 2.0 (XXX TK2.0).
|
||||
*/
|
||||
#define TSA_CARR_ON(tp) ((void *)&(tp)->t_rawq)
|
||||
|
||||
#define LOTS_OF_EVENTS 64 /* helps separate urgent events from input */
|
||||
#define RB_I_HIGH_WATER (TTYHOG - 2 * RS_IBUFSIZE)
|
||||
#define RS_IBUFSIZE 256
|
||||
@ -396,7 +391,7 @@ static u_int com_events; /* input chars + weighted output completions */
|
||||
static int commajor;
|
||||
static int sio_timeout;
|
||||
static int sio_timeouts_until_log;
|
||||
#if 0 /* XXX TK2.0 */
|
||||
#if 0 /* XXX */
|
||||
static struct tty *sio_tty[NSIO];
|
||||
#else
|
||||
static struct tty sio_tty[NSIO];
|
||||
@ -622,7 +617,7 @@ sioopen(dev, flag, mode, p)
|
||||
return (ENXIO);
|
||||
if (mynor & CONTROL_MASK)
|
||||
return (0);
|
||||
#if 0 /* XXX TK2.0 */
|
||||
#if 0 /* XXX */
|
||||
tp = com->tp = sio_tty[unit] = ttymalloc(sio_tty[unit]);
|
||||
#else
|
||||
tp = com->tp = &sio_tty[unit];
|
||||
|
@ -27,7 +27,7 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cy.c,v 1.9 1995/07/21 22:51:31 bde Exp $
|
||||
* $Id: cy.c,v 1.10 1995/07/22 01:29:58 bde Exp $
|
||||
*/
|
||||
|
||||
#include "cy.h"
|
||||
@ -151,11 +151,6 @@
|
||||
#define CD1400_xIVR_CHAN_SHIFT 3
|
||||
#define CD1400_xIVR_CHAN 0x0F /* XXX reduce to pack Cyclom-8Ys */
|
||||
|
||||
/*
|
||||
* XXX temporary kludges for 2.0 (XXX TK2.0).
|
||||
*/
|
||||
#define TSA_CARR_ON(tp) ((void *)&(tp)->t_rawq)
|
||||
|
||||
#define LOTS_OF_EVENTS 64 /* helps separate urgent events from input */
|
||||
#define RB_I_HIGH_WATER (TTYHOG - 2 * RS_IBUFSIZE)
|
||||
#define RS_IBUFSIZE 256
|
||||
@ -396,7 +391,7 @@ static u_int com_events; /* input chars + weighted output completions */
|
||||
static int commajor;
|
||||
static int sio_timeout;
|
||||
static int sio_timeouts_until_log;
|
||||
#if 0 /* XXX TK2.0 */
|
||||
#if 0 /* XXX */
|
||||
static struct tty *sio_tty[NSIO];
|
||||
#else
|
||||
static struct tty sio_tty[NSIO];
|
||||
@ -622,7 +617,7 @@ sioopen(dev, flag, mode, p)
|
||||
return (ENXIO);
|
||||
if (mynor & CONTROL_MASK)
|
||||
return (0);
|
||||
#if 0 /* XXX TK2.0 */
|
||||
#if 0 /* XXX */
|
||||
tp = com->tp = sio_tty[unit] = ttymalloc(sio_tty[unit]);
|
||||
#else
|
||||
tp = com->tp = &sio_tty[unit];
|
||||
|
@ -825,7 +825,7 @@ again:
|
||||
if (!(tp->t_state & TS_CARR_ON) && !CALLOUT(dev)
|
||||
&& !(tp->t_cflag & CLOCAL) && !(flag & O_NONBLOCK)) {
|
||||
rc->rc_dcdwaits++;
|
||||
error = tsleep(&tp->t_rawq, TTIPRI | PCATCH, "rcdcd", 0);
|
||||
error = tsleep(TSA_CARR_ON(tp), TTIPRI | PCATCH, "rcdcd", 0);
|
||||
rc->rc_dcdwaits--;
|
||||
if (error != 0)
|
||||
goto out;
|
||||
@ -895,7 +895,7 @@ register struct rc_chans *rc;
|
||||
}
|
||||
rc->rc_flags &= ~RC_ACTOUT;
|
||||
wakeup((caddr_t) &rc->rc_rcb); /* wake bi */
|
||||
wakeup((caddr_t) &tp->t_rawq); /* wake dcd */
|
||||
wakeup(TSA_CARR_ON(tp));
|
||||
(void) splx(s);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* $Id: sio.c,v 1.103 1995/07/21 22:51:34 bde Exp $
|
||||
* $Id: sio.c,v 1.104 1995/07/22 01:30:02 bde Exp $
|
||||
*/
|
||||
|
||||
#include "sio.h"
|
||||
@ -66,12 +66,6 @@
|
||||
#include <i386/isa/sioreg.h>
|
||||
#include <i386/isa/ic/ns16550.h>
|
||||
|
||||
/*
|
||||
* XXX temporary kludges for 2.0 (XXX TK2.0).
|
||||
*/
|
||||
#define TSA_CARR_ON(tp) ((void *)&(tp)->t_rawq)
|
||||
#define TSA_OCOMPLETE(tp) ((void *)&(tp)->t_outq)
|
||||
|
||||
#define LOTS_OF_EVENTS 64 /* helps separate urgent events from input */
|
||||
#define RB_I_HIGH_WATER (TTYHOG - 2 * RS_IBUFSIZE)
|
||||
#define RS_IBUFSIZE 256
|
||||
@ -307,7 +301,7 @@ static u_int com_events; /* input chars + weighted output completions */
|
||||
static int commajor;
|
||||
static int sio_timeout;
|
||||
static int sio_timeouts_until_log;
|
||||
#if 0 /* XXX TK2.0 */
|
||||
#if 0 /* XXX */
|
||||
static struct tty *sio_tty[NSIO];
|
||||
#else
|
||||
static struct tty sio_tty[NSIO];
|
||||
@ -779,7 +773,7 @@ sioopen(dev, flag, mode, p)
|
||||
return (ENXIO);
|
||||
if (mynor & CONTROL_MASK)
|
||||
return (0);
|
||||
#if 0 /* XXX TK2.0 */
|
||||
#if 0 /* XXX */
|
||||
tp = com->tp = sio_tty[unit] = ttymalloc(sio_tty[unit]);
|
||||
#else
|
||||
tp = com->tp = &sio_tty[unit];
|
||||
@ -1714,7 +1708,7 @@ retry:
|
||||
enable_intr();
|
||||
while ((inb(com->line_status_port) & (LSR_TSRE | LSR_TXRDY))
|
||||
!= (LSR_TSRE | LSR_TXRDY)) {
|
||||
error = ttysleep(tp, TSA_OCOMPLETE(tp), TTIPRI | PCATCH,
|
||||
error = ttysleep(tp, TSA_OLOWAT(tp), TTIPRI | PCATCH,
|
||||
"siotx", hz / 100);
|
||||
if ( txtimeout != 0
|
||||
&& (!error || error == EAGAIN)
|
||||
|
@ -1,6 +1,6 @@
|
||||
static char _ittyid[] = "@(#)$Id: iitty.c,v 1.7 1995/07/21 20:52:21 bde Exp $";
|
||||
static char _ittyid[] = "@(#)$Id: iitty.c,v 1.8 1995/07/22 01:29:28 bde Exp $";
|
||||
/*******************************************************************************
|
||||
* II - Version 0.1 $Revision: 1.7 $ $State: Exp $
|
||||
* II - Version 0.1 $Revision: 1.8 $ $State: Exp $
|
||||
*
|
||||
* Copyright 1994 Dietmar Friede
|
||||
*******************************************************************************
|
||||
@ -10,6 +10,17 @@ static char _ittyid[] = "@(#)$Id: iitty.c,v 1.7 1995/07/21 20:52:21 bde Exp
|
||||
*
|
||||
*******************************************************************************
|
||||
* $Log: iitty.c,v $
|
||||
* Revision 1.8 1995/07/22 01:29:28 bde
|
||||
* Move the inline code for waking up writers to a new function
|
||||
* ttwwakeup(). The conditions for doing the wakeup will soon become
|
||||
* more complicated and I don't want them duplicated in all drivers.
|
||||
*
|
||||
* It's probably not worth making ttwwakeup() a macro or an inline
|
||||
* function. The cost of the function call is relatively small when
|
||||
* there is a process to wake up. There is usually a process to wake
|
||||
* up for large writes and the system call overhead dwarfs the function
|
||||
* call overhead for small writes.
|
||||
*
|
||||
* Revision 1.7 1995/07/21 20:52:21 bde
|
||||
* Obtained from: partly from ancient patches by ache and me via 1.1.5
|
||||
*
|
||||
@ -153,7 +164,7 @@ ityopen(dev_t dev, int flag, int mode, struct proc * p)
|
||||
while ((flag & O_NONBLOCK) == 0 && (tp->t_cflag & CLOCAL) == 0 &&
|
||||
(tp->t_state & TS_CARR_ON) == 0)
|
||||
{
|
||||
if (error = ttysleep(tp, (caddr_t) & tp->t_rawq, TTIPRI | PCATCH,
|
||||
if (error = ttysleep(tp, TSA_CARR_ON(tp), TTIPRI | PCATCH,
|
||||
"iidcd", 0))
|
||||
break;
|
||||
}
|
||||
|
@ -55,9 +55,11 @@
|
||||
# define t_out t_outq
|
||||
# define RB_LEN(q) ((q).c_cc)
|
||||
# define RB_GETC(q) getc(&q)
|
||||
#ifndef TSA_CARR_ON /* FreeBSD 2.x before not long after 2.0.5 */
|
||||
# define TSA_CARR_ON(tp) tp
|
||||
# define TSA_OLOWAT(q) ((caddr_t)&(q)->t_out)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <machine/cronyx.h>
|
||||
#include <i386/isa/cxreg.h>
|
||||
|
@ -27,7 +27,7 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cy.c,v 1.9 1995/07/21 22:51:31 bde Exp $
|
||||
* $Id: cy.c,v 1.10 1995/07/22 01:29:58 bde Exp $
|
||||
*/
|
||||
|
||||
#include "cy.h"
|
||||
@ -151,11 +151,6 @@
|
||||
#define CD1400_xIVR_CHAN_SHIFT 3
|
||||
#define CD1400_xIVR_CHAN 0x0F /* XXX reduce to pack Cyclom-8Ys */
|
||||
|
||||
/*
|
||||
* XXX temporary kludges for 2.0 (XXX TK2.0).
|
||||
*/
|
||||
#define TSA_CARR_ON(tp) ((void *)&(tp)->t_rawq)
|
||||
|
||||
#define LOTS_OF_EVENTS 64 /* helps separate urgent events from input */
|
||||
#define RB_I_HIGH_WATER (TTYHOG - 2 * RS_IBUFSIZE)
|
||||
#define RS_IBUFSIZE 256
|
||||
@ -396,7 +391,7 @@ static u_int com_events; /* input chars + weighted output completions */
|
||||
static int commajor;
|
||||
static int sio_timeout;
|
||||
static int sio_timeouts_until_log;
|
||||
#if 0 /* XXX TK2.0 */
|
||||
#if 0 /* XXX */
|
||||
static struct tty *sio_tty[NSIO];
|
||||
#else
|
||||
static struct tty sio_tty[NSIO];
|
||||
@ -622,7 +617,7 @@ sioopen(dev, flag, mode, p)
|
||||
return (ENXIO);
|
||||
if (mynor & CONTROL_MASK)
|
||||
return (0);
|
||||
#if 0 /* XXX TK2.0 */
|
||||
#if 0 /* XXX */
|
||||
tp = com->tp = sio_tty[unit] = ttymalloc(sio_tty[unit]);
|
||||
#else
|
||||
tp = com->tp = &sio_tty[unit];
|
||||
|
@ -825,7 +825,7 @@ again:
|
||||
if (!(tp->t_state & TS_CARR_ON) && !CALLOUT(dev)
|
||||
&& !(tp->t_cflag & CLOCAL) && !(flag & O_NONBLOCK)) {
|
||||
rc->rc_dcdwaits++;
|
||||
error = tsleep(&tp->t_rawq, TTIPRI | PCATCH, "rcdcd", 0);
|
||||
error = tsleep(TSA_CARR_ON(tp), TTIPRI | PCATCH, "rcdcd", 0);
|
||||
rc->rc_dcdwaits--;
|
||||
if (error != 0)
|
||||
goto out;
|
||||
@ -895,7 +895,7 @@ register struct rc_chans *rc;
|
||||
}
|
||||
rc->rc_flags &= ~RC_ACTOUT;
|
||||
wakeup((caddr_t) &rc->rc_rcb); /* wake bi */
|
||||
wakeup((caddr_t) &tp->t_rawq); /* wake dcd */
|
||||
wakeup(TSA_CARR_ON(tp));
|
||||
(void) splx(s);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* $Id: sio.c,v 1.103 1995/07/21 22:51:34 bde Exp $
|
||||
* $Id: sio.c,v 1.104 1995/07/22 01:30:02 bde Exp $
|
||||
*/
|
||||
|
||||
#include "sio.h"
|
||||
@ -66,12 +66,6 @@
|
||||
#include <i386/isa/sioreg.h>
|
||||
#include <i386/isa/ic/ns16550.h>
|
||||
|
||||
/*
|
||||
* XXX temporary kludges for 2.0 (XXX TK2.0).
|
||||
*/
|
||||
#define TSA_CARR_ON(tp) ((void *)&(tp)->t_rawq)
|
||||
#define TSA_OCOMPLETE(tp) ((void *)&(tp)->t_outq)
|
||||
|
||||
#define LOTS_OF_EVENTS 64 /* helps separate urgent events from input */
|
||||
#define RB_I_HIGH_WATER (TTYHOG - 2 * RS_IBUFSIZE)
|
||||
#define RS_IBUFSIZE 256
|
||||
@ -307,7 +301,7 @@ static u_int com_events; /* input chars + weighted output completions */
|
||||
static int commajor;
|
||||
static int sio_timeout;
|
||||
static int sio_timeouts_until_log;
|
||||
#if 0 /* XXX TK2.0 */
|
||||
#if 0 /* XXX */
|
||||
static struct tty *sio_tty[NSIO];
|
||||
#else
|
||||
static struct tty sio_tty[NSIO];
|
||||
@ -779,7 +773,7 @@ sioopen(dev, flag, mode, p)
|
||||
return (ENXIO);
|
||||
if (mynor & CONTROL_MASK)
|
||||
return (0);
|
||||
#if 0 /* XXX TK2.0 */
|
||||
#if 0 /* XXX */
|
||||
tp = com->tp = sio_tty[unit] = ttymalloc(sio_tty[unit]);
|
||||
#else
|
||||
tp = com->tp = &sio_tty[unit];
|
||||
@ -1714,7 +1708,7 @@ retry:
|
||||
enable_intr();
|
||||
while ((inb(com->line_status_port) & (LSR_TSRE | LSR_TXRDY))
|
||||
!= (LSR_TSRE | LSR_TXRDY)) {
|
||||
error = ttysleep(tp, TSA_OCOMPLETE(tp), TTIPRI | PCATCH,
|
||||
error = ttysleep(tp, TSA_OLOWAT(tp), TTIPRI | PCATCH,
|
||||
"siotx", hz / 100);
|
||||
if ( txtimeout != 0
|
||||
&& (!error || error == EAGAIN)
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* $Id: sio.c,v 1.103 1995/07/21 22:51:34 bde Exp $
|
||||
* $Id: sio.c,v 1.104 1995/07/22 01:30:02 bde Exp $
|
||||
*/
|
||||
|
||||
#include "sio.h"
|
||||
@ -66,12 +66,6 @@
|
||||
#include <i386/isa/sioreg.h>
|
||||
#include <i386/isa/ic/ns16550.h>
|
||||
|
||||
/*
|
||||
* XXX temporary kludges for 2.0 (XXX TK2.0).
|
||||
*/
|
||||
#define TSA_CARR_ON(tp) ((void *)&(tp)->t_rawq)
|
||||
#define TSA_OCOMPLETE(tp) ((void *)&(tp)->t_outq)
|
||||
|
||||
#define LOTS_OF_EVENTS 64 /* helps separate urgent events from input */
|
||||
#define RB_I_HIGH_WATER (TTYHOG - 2 * RS_IBUFSIZE)
|
||||
#define RS_IBUFSIZE 256
|
||||
@ -307,7 +301,7 @@ static u_int com_events; /* input chars + weighted output completions */
|
||||
static int commajor;
|
||||
static int sio_timeout;
|
||||
static int sio_timeouts_until_log;
|
||||
#if 0 /* XXX TK2.0 */
|
||||
#if 0 /* XXX */
|
||||
static struct tty *sio_tty[NSIO];
|
||||
#else
|
||||
static struct tty sio_tty[NSIO];
|
||||
@ -779,7 +773,7 @@ sioopen(dev, flag, mode, p)
|
||||
return (ENXIO);
|
||||
if (mynor & CONTROL_MASK)
|
||||
return (0);
|
||||
#if 0 /* XXX TK2.0 */
|
||||
#if 0 /* XXX */
|
||||
tp = com->tp = sio_tty[unit] = ttymalloc(sio_tty[unit]);
|
||||
#else
|
||||
tp = com->tp = &sio_tty[unit];
|
||||
@ -1714,7 +1708,7 @@ retry:
|
||||
enable_intr();
|
||||
while ((inb(com->line_status_port) & (LSR_TSRE | LSR_TXRDY))
|
||||
!= (LSR_TSRE | LSR_TXRDY)) {
|
||||
error = ttysleep(tp, TSA_OCOMPLETE(tp), TTIPRI | PCATCH,
|
||||
error = ttysleep(tp, TSA_OLOWAT(tp), TTIPRI | PCATCH,
|
||||
"siotx", hz / 100);
|
||||
if ( txtimeout != 0
|
||||
&& (!error || error == EAGAIN)
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)tty.c 8.8 (Berkeley) 1/21/94
|
||||
* $Id: tty.c,v 1.55 1995/07/21 22:51:50 bde Exp $
|
||||
* $Id: tty.c,v 1.56 1995/07/22 01:30:31 bde Exp $
|
||||
*/
|
||||
|
||||
/*-
|
||||
@ -961,7 +961,7 @@ ttioctl(tp, cmd, data, flag)
|
||||
if (error)
|
||||
return (error);
|
||||
tp->t_timeout = *(int *)data * hz;
|
||||
wakeup((caddr_t)&tp->t_outq);
|
||||
wakeup(TSA_OLOWAT(tp));
|
||||
break;
|
||||
case TIOCGDRAINWAIT:
|
||||
*(int *)data = tp->t_timeout / hz;
|
||||
@ -1077,7 +1077,7 @@ ttywait(tp)
|
||||
if ((tp->t_outq.c_cc || ISSET(tp->t_state, TS_BUSY)) &&
|
||||
(ISSET(tp->t_state, TS_CARR_ON) || ISSET(tp->t_cflag, CLOCAL))) {
|
||||
SET(tp->t_state, TS_ASLEEP);
|
||||
error = ttysleep(tp, &tp->t_outq, TTOPRI | PCATCH,
|
||||
error = ttysleep(tp, TSA_OLOWAT(tp), TTOPRI | PCATCH,
|
||||
"ttywai", tp->t_timeout);
|
||||
if (error == EWOULDBLOCK)
|
||||
error = EIO;
|
||||
@ -1133,7 +1133,7 @@ ttyflush(tp, rw)
|
||||
}
|
||||
if (rw & FWRITE) {
|
||||
FLUSHQ(&tp->t_outq);
|
||||
wakeup((caddr_t)&tp->t_outq);
|
||||
wakeup(TSA_OLOWAT(tp));
|
||||
selwakeup(&tp->t_wsel);
|
||||
}
|
||||
if ((rw & FREAD) &&
|
||||
@ -1514,7 +1514,7 @@ sleep:
|
||||
splx(s);
|
||||
return (0); /* EOF */
|
||||
}
|
||||
error = ttysleep(tp, &tp->t_rawq, TTIPRI | PCATCH,
|
||||
error = ttysleep(tp, TSA_CARR_ON(tp), TTIPRI | PCATCH,
|
||||
carrier ?
|
||||
"ttyin" : "ttyhup", (int)slp);
|
||||
splx(s);
|
||||
@ -1670,7 +1670,7 @@ ttycheckoutq(tp, wait)
|
||||
timeout((void (*)__P((void *)))wakeup,
|
||||
(void *)&tp->t_outq, hz);
|
||||
SET(tp->t_state, TS_ASLEEP);
|
||||
(void) tsleep((caddr_t)&tp->t_outq, PZERO - 1, "ttoutq", 0);
|
||||
(void) tsleep(TSA_OLOWAT(tp), PZERO - 1, "ttoutq", 0);
|
||||
}
|
||||
splx(s);
|
||||
return (1);
|
||||
@ -1707,8 +1707,7 @@ loop:
|
||||
error = EWOULDBLOCK;
|
||||
goto out;
|
||||
} else {
|
||||
/* Sleep awaiting carrier. */
|
||||
error = ttysleep(tp, &tp->t_rawq, TTIPRI | PCATCH,
|
||||
error = ttysleep(tp, TSA_CARR_ON(tp), TTIPRI | PCATCH,
|
||||
"ttydcd", 0);
|
||||
splx(s);
|
||||
if (error)
|
||||
@ -1863,7 +1862,8 @@ ovhiwat:
|
||||
return (uio->uio_resid == cnt ? EWOULDBLOCK : 0);
|
||||
}
|
||||
SET(tp->t_state, TS_ASLEEP);
|
||||
error = ttysleep(tp, &tp->t_outq, TTOPRI | PCATCH, "ttywri", tp->t_timeout);
|
||||
error = ttysleep(tp, TSA_OLOWAT(tp), TTOPRI | PCATCH, "ttywri",
|
||||
tp->t_timeout);
|
||||
splx(s);
|
||||
if (error == EWOULDBLOCK)
|
||||
error = EIO;
|
||||
@ -2050,7 +2050,7 @@ ttwakeup(tp)
|
||||
selwakeup(&tp->t_rsel);
|
||||
if (ISSET(tp->t_state, TS_ASYNC))
|
||||
pgsignal(tp->t_pgrp, SIGIO, 1);
|
||||
wakeup((caddr_t)&tp->t_rawq);
|
||||
wakeup(TSA_CARR_ON(tp));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2064,7 +2064,7 @@ ttwwakeup(tp)
|
||||
if (tp->t_outq.c_cc <= tp->t_lowat) {
|
||||
if (tp->t_state & TS_ASLEEP) {
|
||||
tp->t_state &= ~TS_ASLEEP;
|
||||
wakeup(&tp->t_outq);
|
||||
wakeup(TSA_OLOWAT(tp));
|
||||
}
|
||||
selwakeup(&tp->t_wsel);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)tty_pty.c 8.2 (Berkeley) 9/23/93
|
||||
* $Id: tty_pty.c,v 1.13 1995/07/21 20:52:40 bde Exp $
|
||||
* $Id: tty_pty.c,v 1.14 1995/07/22 01:30:32 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -136,7 +136,7 @@ ptsopen(dev, flag, devtype, p)
|
||||
while ((tp->t_state & TS_CARR_ON) == 0) {
|
||||
if (flag&FNONBLOCK)
|
||||
break;
|
||||
error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH,
|
||||
error = ttysleep(tp, TSA_CARR_ON(tp), TTIPRI | PCATCH,
|
||||
"ptsopn", 0);
|
||||
if (error)
|
||||
return (error);
|
||||
@ -191,7 +191,7 @@ again:
|
||||
if (tp->t_canq.c_cc == 0) {
|
||||
if (flag & IO_NDELAY)
|
||||
return (EWOULDBLOCK);
|
||||
error = ttysleep(tp, &tp->t_canq, TTIPRI | PCATCH,
|
||||
error = ttysleep(tp, TSA_PTS_READ(tp), TTIPRI | PCATCH,
|
||||
"ptsin", 0);
|
||||
if (error)
|
||||
return (error);
|
||||
@ -260,11 +260,11 @@ ptcwakeup(tp, flag)
|
||||
|
||||
if (flag & FREAD) {
|
||||
selwakeup(&pti->pt_selr);
|
||||
wakeup((caddr_t)&tp->t_outq.c_cf);
|
||||
wakeup(TSA_PTC_READ(tp));
|
||||
}
|
||||
if (flag & FWRITE) {
|
||||
selwakeup(&pti->pt_selw);
|
||||
wakeup((caddr_t)&tp->t_rawq.c_cl);
|
||||
wakeup(TSA_PTC_WRITE(tp));
|
||||
}
|
||||
}
|
||||
|
||||
@ -361,7 +361,7 @@ ptcread(dev, uio, flag)
|
||||
return (0); /* EOF */
|
||||
if (flag & IO_NDELAY)
|
||||
return (EWOULDBLOCK);
|
||||
error = tsleep(&tp->t_outq.c_cf, TTIPRI | PCATCH, "ptcin", 0);
|
||||
error = tsleep(TSA_PTC_READ(tp), TTIPRI | PCATCH, "ptcin", 0);
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
@ -494,7 +494,7 @@ again:
|
||||
}
|
||||
(void) putc(0, &tp->t_canq);
|
||||
ttwakeup(tp);
|
||||
wakeup((caddr_t)&tp->t_canq);
|
||||
wakeup(TSA_PTS_READ(tp));
|
||||
return (0);
|
||||
}
|
||||
while (uio->uio_resid > 0) {
|
||||
@ -511,7 +511,7 @@ again:
|
||||
while (cc > 0) {
|
||||
if ((tp->t_rawq.c_cc + tp->t_canq.c_cc) >= TTYHOG - 2 &&
|
||||
(tp->t_canq.c_cc > 0 || !(tp->t_iflag&ICANON))) {
|
||||
wakeup((caddr_t)&tp->t_rawq);
|
||||
wakeup(TSA_CARR_ON(tp));
|
||||
goto block;
|
||||
}
|
||||
(*linesw[tp->t_line].l_rint)(*cp++, tp);
|
||||
@ -535,7 +535,7 @@ block:
|
||||
return (EWOULDBLOCK);
|
||||
return (0);
|
||||
}
|
||||
error = tsleep(&tp->t_rawq.c_cl, TTOPRI | PCATCH, "ptcout", 0);
|
||||
error = tsleep(TSA_PTC_WRITE(tp), TTOPRI | PCATCH, "ptcout", 0);
|
||||
if (error) {
|
||||
/* adjust for data copied in but not written */
|
||||
uio->uio_resid += cc;
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)tty.h 8.6 (Berkeley) 1/21/94
|
||||
* $Id: tty.h,v 1.22 1995/07/21 22:52:01 bde Exp $
|
||||
* $Id: tty.h,v 1.23 1995/07/22 01:30:45 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_TTY_H_
|
||||
@ -199,6 +199,13 @@ struct speedtab {
|
||||
#define isbackground(p, tp) \
|
||||
(isctty((p), (tp)) && (p)->p_pgrp != (tp)->t_pgrp)
|
||||
|
||||
/* Unique sleep addresses. */
|
||||
#define TSA_CARR_ON(tp) ((void *)&(tp)->t_rawq) /* XXX overloaded */
|
||||
#define TSA_OLOWAT(tp) ((void *)&(tp)->t_outq) /* XXX overloaded */
|
||||
#define TSA_PTC_READ(tp) ((void *)&(tp)->t_outq.c_cf)
|
||||
#define TSA_PTC_WRITE(tp) ((void *)&(tp)->t_rawq.c_cl)
|
||||
#define TSA_PTS_READ(tp) ((void *)&(tp)->t_canq)
|
||||
|
||||
#ifdef KERNEL
|
||||
extern struct tty *constty; /* Temporary virtual console. */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user