32VKern/usr/src/sys/h/tty.h
/*
* A clist structure is the head
* of a linked list queue of characters.
* The characters are stored in 4-word
* blocks containing a link and several characters.
* The routines getc and putc
* manipulate these structures.
*/
struct clist
{
int c_cc; /* character count */
char *c_cf; /* pointer to first char */
char *c_cl; /* pointer to last char */
};
/*
* A tty structure is needed for
* each UNIX character device that
* is used for normal terminal IO.
* The routines in tty.c handle the
* common code associated with
* these structures.
* The definition and device dependent
* code is in each driver. (kl.c dc.c dh.c)
*/
struct tty
{
struct clist t_rawq; /* input chars right off device */
struct clist t_canq; /* input chars after erase and kill */
struct clist t_outq; /* output list to device */
int (* t_oproc)(); /* routine to start output */
int (* t_iproc)(); /* routine to start input */
struct chan *t_chan; /* destination channel */
caddr_t t_linep; /* aux line discipline pointer */
caddr_t t_addr; /* device address */
short t_flags; /* mode, settable by ioctl call */
short t_state; /* internal state, not visible externally */
short t_pgrp; /* process group name */
char t_delct; /* number of delimiters in raw q */
char t_line; /* line discipline */
char t_col; /* printing column of device */
char t_erase; /* erase character */
char t_kill; /* kill character */
char t_char; /* character temporary */
char t_ispeed; /* input speed */
char t_ospeed; /* output speed */
};
/*
* structure of arg for ioctl
*/
struct ttiocb {
char ioc_ispeed;
char ioc_ospeed;
char ioc_erase;
char ioc_kill;
int ioc_flags;
};
#define TTIPRI 28
#define TTOPRI 29
#define CERASE '#' /* default special characters */
#define CEOT 004
#define CKILL '@'
#define CQUIT 034 /* FS, cntl shift L */
#define CINTR 0177 /* DEL */
#define CSTOP 023 /* Stop output: ctl-s */
#define CSTART 021 /* Start output: ctl-q */
/* limits */
#define TTHIWAT 100
#define TTLOWAT 50
#define TTYHOG 256
/* modes */
#define TANDEM 01
#define CBREAK 02
#define LCASE 04
#define ECHO 010
#define CRMOD 020
#define RAW 040
#define ODDP 0100
#define EVENP 0200
#define NLDELAY 001400
#define TBDELAY 006000
#define XTABS 006000
#define CRDELAY 030000
#define VTDELAY 040000
/* Hardware bits */
#define DONE 0200
#define IENABLE 0100
/* Internal state bits */
#define TIMEOUT 01 /* Delay timeout in progress */
#define WOPEN 02 /* Waiting for open to complete */
#define ISOPEN 04 /* Device is open */
#define CARR_ON 020 /* Software copy of carrier-present */
#define BUSY 040 /* Output in progress */
#define ASLEEP 0100 /* Wakeup when output done */
#define XCLUDE 0200 /* exclusive-use flag against open */
#define TTSTOP 0400 /* Output stopped by ctl-s */
#define HUPCLS 01000 /* Hang up upon last close */
#define TBLOCK 02000 /* tandem queue blocked */
/*
* tty ioctl commands
*/
#define TIOCGETD (('t'<<8)|0)
#define TIOCSETD (('t'<<8)|1)
#define TIOCHPCL (('t'<<8)|2)
#define TIOCMODG (('t'<<8)|3)
#define TIOCMODS (('t'<<8)|4)
#define TIOCGETP (('t'<<8)|8)
#define TIOCSETP (('t'<<8)|9)
#define TIOCSETN (('t'<<8)|10)
#define TIOCEXCL (('t'<<8)|13)
#define TIOCNXCL (('t'<<8)|14)
#define TIOCTSTP (('t'<<8)|16)
#define DIOCLSTN (('d'<<8)|1)
#define DIOCGETP (('d'<<8)|8)
#define DIOCSETP (('d'<<8)|9)
#define FIOCLEX (('f'<<8)|1)
#define FIONCLEX (('f'<<8)|2)
#define MXLSTN (('x'<<8)|1)
#define MXNBLK (('x'<<8)|2)