h/tty.h

09300 /* 09301 * A clist structure is the head 09302 * of a linked list queue of characters. 09303 * The characters are stored in 4-word 09304 * blocks containing a link and several characters. 09305 * The routines getc and putc 09306 * manipulate these structures. 09307 */ 09308 struct clist 09309 { 09310 int c_cc; /* character count */ 09311 char *c_cf; /* pointer to first char */ 09312 char *c_cl; /* pointer to last char */ 09313 }; 09314 09315 /* 09316 * A tty structure is needed for 09317 * each UNIX character device that 09318 * is used for normal terminal IO. 09319 * The routines in tty.c handle the 09320 * common code associated with 09321 * these structures. 09322 * The definition and device dependent 09323 * code is in each driver. (kl.c dc.c dh.c) 09324 */ 09325 09326 struct tc { 09327 char t_intrc; /* interrupt */ 09328 char t_quitc; /* quit */ 09329 char t_startc; /* start output */ 09330 char t_stopc; /* stop output */ 09331 char t_eofc; /* end-of-file */ 09332 char t_brkc; /* input delimiter (like nl) */ 09333 }; 09334 09335 struct tty 09336 { 09337 struct clist t_rawq; /* input chars right off device */ 09338 struct clist t_canq; /* input chars after erase and kill */ 09339 struct clist t_outq; /* output list to device */ 09340 int (* t_oproc)(); /* routine to start output */ 09341 int (* t_iproc)(); /* routine to start input */ 09342 struct chan *t_chan; /* destination channel */ 09343 caddr_t t_linep; /* aux line discipline pointer */ 09344 caddr_t t_addr; /* device address */ 09345 dev_t t_dev; /* device number */ 09346 short t_flags; /* mode, settable by ioctl call */ 09347 short t_state; /* internal state, not visible externally */ 09348 short t_pgrp; /* process group name */ 09349 char t_delct; /* number of delimiters in raw q */ 09350 char t_line; /* line discipline */ 09351 char t_col; /* printing column of device */ 09352 char t_erase; /* erase character */ 09353 char t_kill; /* kill character */ 09354 char t_char; /* character temporary */ 09355 char t_ispeed; /* input speed */ 09356 char t_ospeed; /* output speed */ 09357 union { 09358 struct tc; 09359 struct clist t_ctlq; 09360 } t_un; 09361 }; 09362 09363 #define tun tp->t_un 09364 09365 /* 09366 * structure of arg for ioctl 09367 */ 09368 struct ttiocb { 09369 char ioc_ispeed; 09370 char ioc_ospeed; 09371 char ioc_erase; 09372 char ioc_kill; 09373 int ioc_flags; 09374 }; 09375 09376 #define TTIPRI 28 09377 #define TTOPRI 29 09378 09379 #define CERASE '#' /* default special characters */ 09380 #define CEOT 004 09381 #define CKILL '@' 09382 #define CQUIT 034 /* FS, cntl shift L */ 09383 #define CINTR 0177 /* DEL */ 09384 #define CSTOP 023 /* Stop output: ctl-s */ 09385 #define CSTART 021 /* Start output: ctl-q */ 09386 #define CBRK 0377 09387 09388 /* limits */ 09389 #define TTHIWAT 100 09390 #define TTLOWAT 50 09391 #define TTYHOG 256 09392 09393 /* modes */ 09394 #define TANDEM 01 09395 #define CBREAK 02 09396 #define LCASE 04 09397 #define ECHO 010 09398 #define CRMOD 020 09399 #define RAW 040 09400 #define ODDP 0100 09401 #define EVENP 0200 09402 #define NLDELAY 001400 09403 #define TBDELAY 006000 09404 #define XTABS 006000 09405 #define CRDELAY 030000 09406 #define VTDELAY 040000 09407 09408 /* Hardware bits */ 09409 #define DONE 0200 09410 #define IENABLE 0100 09411 09412 /* Internal state bits */ 09413 #define TIMEOUT 01 /* Delay timeout in progress */ 09414 #define WOPEN 02 /* Waiting for open to complete */ 09415 #define ISOPEN 04 /* Device is open */ 09416 #define FLUSH 010 /* outq has been flushed during DMA */ 09417 #define CARR_ON 020 /* Software copy of carrier-present */ 09418 #define BUSY 040 /* Output in progress */ 09419 #define ASLEEP 0100 /* Wakeup when output done */ 09420 #define XCLUDE 0200 /* exclusive-use flag against open */ 09421 #define TTSTOP 0400 /* Output stopped by ctl-s */ 09422 #define HUPCLS 01000 /* Hang up upon last close */ 09423 #define TBLOCK 02000 /* tandem queue blocked */ 09424 #define DKCMD 04000 /* datakit command channel */ 09425 #define DKMPX 010000 /* datakit user-multiplexed mode */ 09426 #define DKCALL 020000 /* datakit dial mode */ 09427 #define DKLINGR 040000 /* datakit lingering close mode */ 09428 #define CNTLQ 0100000 /* interpret t_un as clist */ 09429 09430 /* 09431 * tty ioctl commands 09432 */ 09433 #define TIOCGETD (('t'<<8)|0) 09434 #define TIOCSETD (('t'<<8)|1) 09435 #define TIOCHPCL (('t'<<8)|2) 09436 #define TIOCMODG (('t'<<8)|3) 09437 #define TIOCMODS (('t'<<8)|4) 09438 #define TIOCGETP (('t'<<8)|8) 09439 #define TIOCSETP (('t'<<8)|9) 09440 #define TIOCSETN (('t'<<8)|10) 09441 #define TIOCEXCL (('t'<<8)|13) 09442 #define TIOCNXCL (('t'<<8)|14) 09443 #define TIOCFLUSH (('t'<<8)|16) 09444 #define TIOCSETC (('t'<<8)|17) 09445 #define TIOCGETC (('t'<<8)|18) 09446 #define DIOCLSTN (('d'<<8)|1) 09447 #define DIOCNTRL (('d'<<8)|2) 09448 #define DIOCMPX (('d'<<8)|3) 09449 #define DIOCNMPX (('d'<<8)|4) 09450 #define DIOCSCALL (('d'<<8)|5) 09451 #define DIOCRCALL (('d'<<8)|6) 09452 #define DIOCPGRP (('d'<<8)|7) 09453 #define DIOCGETP (('d'<<8)|8) 09454 #define DIOCSETP (('d'<<8)|9) 09455 #define DIOCLOSE (('d'<<8)|10) 09456 #define DIOCTIME (('d'<<8)|11) 09457 #define DIOCRESET (('d'<<8)|12) 09458 #define FIOCLEX (('f'<<8)|1) 09459 #define FIONCLEX (('f'<<8)|2) 09460 #define MXLSTN (('x'<<8)|1) 09461 #define MXNBLK (('x'<<8)|2) 09462 09463 09464 09465 09466 09467 09468 09469 09470 09471 09472 09473 09474 09475 09476 09477 09478 09479 09480 09481 09482 09483 09484 09485 09486 09487 09488 09489 09490 09491 09492 09493 09494 09495 09496 09497 09498 09499