17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 1989-2003 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* 28*1fa2a664SJoshua M. Clulow * Pseudo-terminal driver data structures. 297c478bd9Sstevel@tonic-gate */ 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifndef _SYS_PTYVAR_H 327c478bd9Sstevel@tonic-gate #define _SYS_PTYVAR_H 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #include <sys/tty.h> 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #ifdef __cplusplus 377c478bd9Sstevel@tonic-gate extern "C" { 387c478bd9Sstevel@tonic-gate #endif 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate struct pty { 417c478bd9Sstevel@tonic-gate int pt_flags; /* flag bits */ 427c478bd9Sstevel@tonic-gate mblk_t *pt_stuffqfirst; /* head of queue for ioctls */ 437c478bd9Sstevel@tonic-gate mblk_t *pt_stuffqlast; /* tail of queue for ioctls */ 447c478bd9Sstevel@tonic-gate int pt_stuffqlen; /* number of bytes of queued ioctls */ 457c478bd9Sstevel@tonic-gate tty_common_t pt_ttycommon; /* data common to all tty drivers */ 467c478bd9Sstevel@tonic-gate bufcall_id_t pt_wbufcid; /* id of pending write-side bufcall */ 477c478bd9Sstevel@tonic-gate struct proc *pt_selr; /* proc selecting on controller read */ 487c478bd9Sstevel@tonic-gate struct proc *pt_selw; /* proc selecting on controller write */ 497c478bd9Sstevel@tonic-gate struct proc *pt_sele; /* proc selecting on exception */ 50*1fa2a664SJoshua M. Clulow dev_t pt_sdev; /* XXX dev no for the subsidiary */ 51*1fa2a664SJoshua M. Clulow struct vnode *pt_vnode; /* XXX vnode for the subsidiary */ 527c478bd9Sstevel@tonic-gate short pt_pgrp; /* controller side process group */ 537c478bd9Sstevel@tonic-gate uchar_t pt_send; /* pending message to controller */ 547c478bd9Sstevel@tonic-gate uchar_t pt_ucntl; /* pending iocontrol for controller */ 557c478bd9Sstevel@tonic-gate kmutex_t ptc_lock; /* per pty mutex lock */ 567c478bd9Sstevel@tonic-gate kcondvar_t pt_cv_flags; /* condition variable for flag state */ 577c478bd9Sstevel@tonic-gate kcondvar_t pt_cv_readq; /* condition variable for read state */ 587c478bd9Sstevel@tonic-gate kcondvar_t pt_cv_writeq; /* condition variable for write state */ 597c478bd9Sstevel@tonic-gate }; 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate #define PF_RCOLL 0x00000001 /* > 1 process selecting for read */ 627c478bd9Sstevel@tonic-gate #define PF_WCOLL 0x00000002 /* > 1 process selecting for write */ 637c478bd9Sstevel@tonic-gate #define PF_ECOLL 0x00000004 /* > 1 process selecting for excep. */ 647c478bd9Sstevel@tonic-gate #define PF_NBIO 0x00000008 /* non-blocking I/O on controller */ 657c478bd9Sstevel@tonic-gate #define PF_ASYNC 0x00000010 /* asynchronous I/O on controller */ 667c478bd9Sstevel@tonic-gate #define PF_WOPEN 0x00000020 /* waiting for open to complete */ 677c478bd9Sstevel@tonic-gate #define PF_CARR_ON 0x00000040 /* "carrier" is on (cntlr. is open) */ 68*1fa2a664SJoshua M. Clulow #define PF_SUBSIDGONE 0x00000080 /* subsidiary was open, now closed */ 697c478bd9Sstevel@tonic-gate #define PF_PKT 0x00000100 /* packet mode */ 707c478bd9Sstevel@tonic-gate #define PF_STOPPED 0x00000200 /* user told stopped */ 717c478bd9Sstevel@tonic-gate #define PF_REMOTE 0x00000400 /* remote and flow controlled input */ 72*1fa2a664SJoshua M. Clulow #define PF_NOSTOP 0x00000800 /* subsidiary is doing XON/XOFF */ 737c478bd9Sstevel@tonic-gate #define PF_UCNTL 0x00001000 /* user control mode */ 747c478bd9Sstevel@tonic-gate #define PF_43UCNTL 0x00002000 /* real 4.3 user control mode */ 757c478bd9Sstevel@tonic-gate #define PF_IOCTL 0x00004000 /* ioctl call in progress */ 767c478bd9Sstevel@tonic-gate #define PF_WAIT 0x00008000 /* wait in close */ 777c478bd9Sstevel@tonic-gate #define PF_READ 0x00010000 /* serialise read */ 787c478bd9Sstevel@tonic-gate #define PF_WRITE 0x00020000 /* serialise write */ 797c478bd9Sstevel@tonic-gate #define PF_WREAD 0x00040000 /* want to read */ 807c478bd9Sstevel@tonic-gate #define PF_WWRITE 0x00080000 /* want to write */ 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate /* 837c478bd9Sstevel@tonic-gate * M_CTL message types. 847c478bd9Sstevel@tonic-gate */ 857c478bd9Sstevel@tonic-gate #define MC_NOCANON 0 /* module below saying it will canonicalize */ 867c478bd9Sstevel@tonic-gate #define MC_DOCANON 1 /* module below saying it won't canonicalize */ 877c478bd9Sstevel@tonic-gate #define MC_CANONQUERY 2 /* module above asking whether module below */ 887c478bd9Sstevel@tonic-gate /* canonicalizes */ 897c478bd9Sstevel@tonic-gate #define MC_SERVICEIMM 3 /* tell the ZS driver to return input */ 907c478bd9Sstevel@tonic-gate /* immediately */ 917c478bd9Sstevel@tonic-gate #define MC_SERVICEDEF 4 /* tell the ZS driver it can wait */ 927c478bd9Sstevel@tonic-gate #define MC_NOIFLAG 5 /* module below saying don't do i flags */ 937c478bd9Sstevel@tonic-gate #define MC_NOOFLAG 6 /* module below saying don't do o flags */ 947c478bd9Sstevel@tonic-gate #define MC_NOLFLAG 7 /* module below saying don't do l flags */ 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate /* 987c478bd9Sstevel@tonic-gate * Thus stuff is from the 4.1 termios.h, but we don't want to 997c478bd9Sstevel@tonic-gate * put it in the real system, so we hide it here. 1007c478bd9Sstevel@tonic-gate */ 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate /* 1037c478bd9Sstevel@tonic-gate * Sun version of winsize. 1047c478bd9Sstevel@tonic-gate */ 1057c478bd9Sstevel@tonic-gate struct ttysize { 1067c478bd9Sstevel@tonic-gate int ts_lines; /* number of lines on terminal */ 1077c478bd9Sstevel@tonic-gate int ts_cols; /* number of columns on terminal */ 1087c478bd9Sstevel@tonic-gate }; 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate #define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */ 1127c478bd9Sstevel@tonic-gate #define TIOCPKT_DATA 0x00 /* data packet */ 1137c478bd9Sstevel@tonic-gate #define TIOCPKT_FLUSHREAD 0x01 /* flush data not yet written */ 1147c478bd9Sstevel@tonic-gate /* to controller */ 1157c478bd9Sstevel@tonic-gate #define TIOCPKT_FLUSHWRITE 0x02 /* flush data read from */ 1167c478bd9Sstevel@tonic-gate /* controller but not yet */ 1177c478bd9Sstevel@tonic-gate /* processed */ 1187c478bd9Sstevel@tonic-gate #define TIOCPKT_STOP 0x04 /* stop output */ 1197c478bd9Sstevel@tonic-gate #define TIOCPKT_START 0x08 /* start output */ 1207c478bd9Sstevel@tonic-gate #define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ 1217c478bd9Sstevel@tonic-gate #define TIOCPKT_DOSTOP 0x20 /* now do ^S, ^Q */ 1227c478bd9Sstevel@tonic-gate #define TIOCPKT_IOCTL 0x40 /* "ioctl" packet */ 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate #define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */ 1257c478bd9Sstevel@tonic-gate #define TIOCTCNTL _IOW('t', 32, int) /* pty: set/clr intercept */ 1267c478bd9Sstevel@tonic-gate /* ioctl mode */ 1277c478bd9Sstevel@tonic-gate #define TIOCISPACE _IOR('t', 128, int) /* space left in input queue */ 1287c478bd9Sstevel@tonic-gate #define TIOCISIZE _IOR('t', 129, int) /* size of input queue */ 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate #define TIOCSSIZE _IOW('t', 37, struct ttysize) /* set tty size */ 1317c478bd9Sstevel@tonic-gate #define TIOCGSIZE _IOR('t', 38, struct ttysize) /* get tty size */ 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate #ifdef _KERNEL 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate /* 1367c478bd9Sstevel@tonic-gate * pty_softc, npty, ptcph, and pty_initspace are defined in tty_ptyconf.c 1377c478bd9Sstevel@tonic-gate */ 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate extern int npty; 1407c478bd9Sstevel@tonic-gate extern struct pty *pty_softc; 1417c478bd9Sstevel@tonic-gate extern struct pollhead ptcph; 1427c478bd9Sstevel@tonic-gate extern void pty_initspace(void); 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate /* 1457c478bd9Sstevel@tonic-gate * define the Berkeley style naming convention 1467c478bd9Sstevel@tonic-gate */ 1477c478bd9Sstevel@tonic-gate #define PTY_BANKS "pqrstuvwxyz" 1487c478bd9Sstevel@tonic-gate #define PTY_DIGITS "0123456789abcdef" 1497c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1527c478bd9Sstevel@tonic-gate } 1537c478bd9Sstevel@tonic-gate #endif 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate #endif /* _SYS_PTYVAR_H */ 156