xref: /titanic_51/usr/src/lib/libbc/libc/sys/common/ioctl.c (revision 5d54f3d8999eac1762fe0a8c7177d20f1f201fae)
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 /*
23*5d54f3d8Smuffin  * Copyright 1995 Sun Microsystems, Inc.  All rights reserved.
24*5d54f3d8Smuffin  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*
307c478bd9Sstevel@tonic-gate  * Do not include sys/conf.h- it isn't in the compatibility include dirs.
317c478bd9Sstevel@tonic-gate  */
327c478bd9Sstevel@tonic-gate #ifdef	THIS_IS_AVAIL
337c478bd9Sstevel@tonic-gate #include <sys/conf.h>
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate #include <stdio.h>
367c478bd9Sstevel@tonic-gate #include <signal.h>
377c478bd9Sstevel@tonic-gate #include <sys/types.h>
387c478bd9Sstevel@tonic-gate #include <sys/ioccom.h>
397c478bd9Sstevel@tonic-gate #include <sys/stropts.h>
407c478bd9Sstevel@tonic-gate #include <sys/des.h>
417c478bd9Sstevel@tonic-gate #include <sys/fcntl.h>
427c478bd9Sstevel@tonic-gate #include <sys/filio.h>
437c478bd9Sstevel@tonic-gate #include <sys/termios.h>
447c478bd9Sstevel@tonic-gate #include <sys/termio.h>
457c478bd9Sstevel@tonic-gate #include <sys/ttold.h>
467c478bd9Sstevel@tonic-gate #include <sys/ttycom.h>
477c478bd9Sstevel@tonic-gate #include <sys/msio.h>
487c478bd9Sstevel@tonic-gate #include <sys/errno.h>
497c478bd9Sstevel@tonic-gate #include <nettli/tihdr.h>
507c478bd9Sstevel@tonic-gate #include <nettli/timod.h>
517c478bd9Sstevel@tonic-gate #include <nettli/tiuser.h>
527c478bd9Sstevel@tonic-gate #include <sun/dkio.h>
537c478bd9Sstevel@tonic-gate #include <scsi/impl/uscsi.h>
547c478bd9Sstevel@tonic-gate #include "cdioctl.h"
557c478bd9Sstevel@tonic-gate #include "s5dkio.h"
567c478bd9Sstevel@tonic-gate #include "s5fdio.h"
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /*
597c478bd9Sstevel@tonic-gate  * parameter for windows ioctls
607c478bd9Sstevel@tonic-gate  */
617c478bd9Sstevel@tonic-gate struct winclip {
627c478bd9Sstevel@tonic-gate         int     wc_blockbytes;          /* size of wc_block */
637c478bd9Sstevel@tonic-gate         int     wc_clipid;              /* Current clip id of clipping */
647c478bd9Sstevel@tonic-gate         short   wc_screenrect[4];       /* Screen relatived (used when paint) */
657c478bd9Sstevel@tonic-gate         char    *wc_block;              /* Block where RectList is copied. */
667c478bd9Sstevel@tonic-gate };
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /*
697c478bd9Sstevel@tonic-gate  * Ioctl control packet
707c478bd9Sstevel@tonic-gate  */
717c478bd9Sstevel@tonic-gate struct s5termios {
727c478bd9Sstevel@tonic-gate 	tcflag_t	c_iflag;	/* input modes */
737c478bd9Sstevel@tonic-gate 	tcflag_t	c_oflag;	/* output modes */
747c478bd9Sstevel@tonic-gate 	tcflag_t	c_cflag;	/* control modes */
757c478bd9Sstevel@tonic-gate 	tcflag_t	c_lflag;	/* line discipline modes */
767c478bd9Sstevel@tonic-gate 	cc_t		c_cc[19];	/* control chars */
777c478bd9Sstevel@tonic-gate };
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate #define N_ENOMSG	35
807c478bd9Sstevel@tonic-gate #define N_I_FIND	('S'<<8)|013
817c478bd9Sstevel@tonic-gate #define N_I_PUSH	('S'<<8)|02
82*5d54f3d8Smuffin #define WINGETEXPOSEDRL	_IOWR('g',31,struct winclip)
83*5d54f3d8Smuffin #define WINGETDAMAGEDRL _IOWR('g',32,struct winclip)
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate struct n_sgttyb {
867c478bd9Sstevel@tonic-gate 	char    sg_ispeed;              /* input speed */
877c478bd9Sstevel@tonic-gate 	char    sg_ospeed;              /* output speed */
887c478bd9Sstevel@tonic-gate 	char    sg_erase;               /* erase character */
897c478bd9Sstevel@tonic-gate 	char    sg_kill;                /* kill character */
907c478bd9Sstevel@tonic-gate 	int     sg_flags;               /* mode flags */
917c478bd9Sstevel@tonic-gate };
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate static int handle_dkio_partitions(int, int, int);
947c478bd9Sstevel@tonic-gate static int tcget(int, int, int);
957c478bd9Sstevel@tonic-gate static int tcset(int, int, int);
967c478bd9Sstevel@tonic-gate static int _bc_ioctl(int, int, int);
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate int
997c478bd9Sstevel@tonic-gate ioctl(int des, int request, int arg)
1007c478bd9Sstevel@tonic-gate {
1017c478bd9Sstevel@tonic-gate 	int ret;
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate 	if ((ret = _bc_ioctl(des, request, arg)) == -1)
1047c478bd9Sstevel@tonic-gate 		maperror();
1057c478bd9Sstevel@tonic-gate 	return (ret);
1067c478bd9Sstevel@tonic-gate }
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate int
1097c478bd9Sstevel@tonic-gate bc_ioctl(int des, int request, int arg)
1107c478bd9Sstevel@tonic-gate {
1117c478bd9Sstevel@tonic-gate 	int ret;
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate 	if ((ret = _bc_ioctl(des, request, arg)) == -1)
1147c478bd9Sstevel@tonic-gate 		maperror();
1157c478bd9Sstevel@tonic-gate 	return (ret);
1167c478bd9Sstevel@tonic-gate }
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate static int
1197c478bd9Sstevel@tonic-gate _bc_ioctl(int des, int request, int arg)
1207c478bd9Sstevel@tonic-gate {
1217c478bd9Sstevel@tonic-gate 	int ret;
1227c478bd9Sstevel@tonic-gate 	int nreq = (request >> 8) & 0xFF;
1237c478bd9Sstevel@tonic-gate 	struct n_sgttyb nsg;
1247c478bd9Sstevel@tonic-gate 	struct s5_dk_cinfo newArgs;
1257c478bd9Sstevel@tonic-gate 	struct dk_info *infoArgs;
1267c478bd9Sstevel@tonic-gate 	struct dk_conf *confArgs;
1277c478bd9Sstevel@tonic-gate 	extern int errno;
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate 	/* not all mappings for 'm' have been performed */
1307c478bd9Sstevel@tonic-gate 	switch (nreq) {
1317c478bd9Sstevel@tonic-gate 		case ((int) 't'):
1327c478bd9Sstevel@tonic-gate 			if (_ioctl(des, N_I_FIND, "ttcompat") == 0)
1337c478bd9Sstevel@tonic-gate 				if (_ioctl(des, N_I_PUSH, "ttcompat") == -1)
1347c478bd9Sstevel@tonic-gate 					perror("ioctl/I_PUSH");
1357c478bd9Sstevel@tonic-gate 			switch(request) {
1367c478bd9Sstevel@tonic-gate 				case TIOCSETD:
1377c478bd9Sstevel@tonic-gate 					     /* added for sunview */
1387c478bd9Sstevel@tonic-gate 					     return(0);
1397c478bd9Sstevel@tonic-gate 				case TIOCREMOTE: request = ('t'<<8)|30;
1407c478bd9Sstevel@tonic-gate 					     break;
1417c478bd9Sstevel@tonic-gate 				case TIOCNOTTY:
1427c478bd9Sstevel@tonic-gate 					     bc_setsid();
1437c478bd9Sstevel@tonic-gate 					     return(0);
1447c478bd9Sstevel@tonic-gate 				case TIOCGPGRP: request = ('t'<<8)|20;
1457c478bd9Sstevel@tonic-gate 					     break;
1467c478bd9Sstevel@tonic-gate 				case TIOCSPGRP:
1477c478bd9Sstevel@tonic-gate 				    {
1487c478bd9Sstevel@tonic-gate 					pid_t pgid;
1497c478bd9Sstevel@tonic-gate 					sigset_t set, oset;
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate 					request = ('t'<<8)|21;
1527c478bd9Sstevel@tonic-gate 					ret = _ioctl(des, request, arg);
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate 					/*
1557c478bd9Sstevel@tonic-gate 					 * SunOS4.x allows this to succeed
1567c478bd9Sstevel@tonic-gate 					 * even if the process group does
1577c478bd9Sstevel@tonic-gate 					 * not exist yet.  We emulate the 4.x
1587c478bd9Sstevel@tonic-gate 					 * bug by creating the process group
1597c478bd9Sstevel@tonic-gate 					 * and reissuing the ioctl().
1607c478bd9Sstevel@tonic-gate 					 * See bugid 1175044.
1617c478bd9Sstevel@tonic-gate 					 */
1627c478bd9Sstevel@tonic-gate 					if (ret != 0 && errno == EPERM &&
1637c478bd9Sstevel@tonic-gate 					    (pgid = *((pid_t *)arg)) != 0 &&
1647c478bd9Sstevel@tonic-gate 					    pgid == getpid() &&
1657c478bd9Sstevel@tonic-gate 					    setpgid(0, pgid) == 0) {
1667c478bd9Sstevel@tonic-gate 						sigemptyset(&set);
1677c478bd9Sstevel@tonic-gate 						sigaddset(&set, SIGTSTP);
1687c478bd9Sstevel@tonic-gate 						sigaddset(&set, SIGTTIN);
1697c478bd9Sstevel@tonic-gate 						sigaddset(&set, SIGTTOU);
1707c478bd9Sstevel@tonic-gate 						sigprocmask(SIG_BLOCK,
1717c478bd9Sstevel@tonic-gate 							&set, &oset);
1727c478bd9Sstevel@tonic-gate 						ret = _ioctl(des,
1737c478bd9Sstevel@tonic-gate 							request, arg);
1747c478bd9Sstevel@tonic-gate 						sigprocmask(SIG_SETMASK,
1757c478bd9Sstevel@tonic-gate 							&oset, NULL);
1767c478bd9Sstevel@tonic-gate 					}
1777c478bd9Sstevel@tonic-gate 					return(ret);
1787c478bd9Sstevel@tonic-gate 				    }
1797c478bd9Sstevel@tonic-gate 				case TIOCSTI: request = ('t'<<8)|23;
1807c478bd9Sstevel@tonic-gate 					     break;
1817c478bd9Sstevel@tonic-gate 				case TIOCSIGNAL: request = ('t'<<8)|31;
1827c478bd9Sstevel@tonic-gate 					     break;
1837c478bd9Sstevel@tonic-gate 				case TIOCCONS: request = ('t'<<8)|36;
1847c478bd9Sstevel@tonic-gate 					     break;
1857c478bd9Sstevel@tonic-gate 				case TIOCSWINSZ: request = ('T'<<8)|103;
1867c478bd9Sstevel@tonic-gate 					     break;
1877c478bd9Sstevel@tonic-gate 				case TIOCGWINSZ: request = ('T'<<8)|104;
1887c478bd9Sstevel@tonic-gate 					     break;
1897c478bd9Sstevel@tonic-gate 				case TIOCSETP:
1907c478bd9Sstevel@tonic-gate 				case TIOCSETN:
1917c478bd9Sstevel@tonic-gate 			  	    {
1927c478bd9Sstevel@tonic-gate 					struct sgttyb *sg = (struct sgttyb *)arg;
1937c478bd9Sstevel@tonic-gate 					nsg.sg_ispeed = sg->sg_ispeed;
1947c478bd9Sstevel@tonic-gate 					nsg.sg_ospeed = sg->sg_ospeed;
1957c478bd9Sstevel@tonic-gate 					nsg.sg_erase = sg->sg_erase;
1967c478bd9Sstevel@tonic-gate 					nsg.sg_kill = sg->sg_kill;
1977c478bd9Sstevel@tonic-gate 					nsg.sg_flags = (int)sg->sg_flags;
1987c478bd9Sstevel@tonic-gate 					arg = (int)&nsg;
1997c478bd9Sstevel@tonic-gate 				        request = request & 0x0FFFF;
2007c478bd9Sstevel@tonic-gate 					break;
2017c478bd9Sstevel@tonic-gate 				    }
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate 				case TIOCGETP:
2047c478bd9Sstevel@tonic-gate 				    {
2057c478bd9Sstevel@tonic-gate 					struct sgttyb *sg = (struct sgttyb *)arg;
2067c478bd9Sstevel@tonic-gate 
2077c478bd9Sstevel@tonic-gate 					ret = _ioctl(des, request&0xFFFF, &nsg);
2087c478bd9Sstevel@tonic-gate 					if (ret != -1) {
2097c478bd9Sstevel@tonic-gate 						sg->sg_ispeed = nsg.sg_ispeed;
2107c478bd9Sstevel@tonic-gate 						sg->sg_ospeed = nsg.sg_ospeed;
2117c478bd9Sstevel@tonic-gate 						sg->sg_erase = nsg.sg_erase;
2127c478bd9Sstevel@tonic-gate 						sg->sg_kill = nsg.sg_kill;
2137c478bd9Sstevel@tonic-gate 						sg->sg_flags = (short)nsg.sg_flags & 0x0FFFF;
2147c478bd9Sstevel@tonic-gate 					}
2157c478bd9Sstevel@tonic-gate 					return(ret);
2167c478bd9Sstevel@tonic-gate 				    }
2177c478bd9Sstevel@tonic-gate 				case TIOCPKT:
2187c478bd9Sstevel@tonic-gate 				case TIOCUCNTL:
2197c478bd9Sstevel@tonic-gate 				case TIOCTCNTL:
2207c478bd9Sstevel@tonic-gate 				case TIOCSSOFTCAR:
2217c478bd9Sstevel@tonic-gate 				case TIOCGSOFTCAR:
2227c478bd9Sstevel@tonic-gate 				case TIOCISPACE:
2237c478bd9Sstevel@tonic-gate 				case TIOCISIZE:
2247c478bd9Sstevel@tonic-gate 				case TIOCSSIZE:
2257c478bd9Sstevel@tonic-gate 				case TIOCGSIZE:
2267c478bd9Sstevel@tonic-gate 				    	     break;
2277c478bd9Sstevel@tonic-gate 				default:     request = request & 0x0FFFF;
2287c478bd9Sstevel@tonic-gate 				 	     break;
2297c478bd9Sstevel@tonic-gate 			}
2307c478bd9Sstevel@tonic-gate 			break;
2317c478bd9Sstevel@tonic-gate 		case ((int) 'T'):
2327c478bd9Sstevel@tonic-gate 			switch(request) {
2337c478bd9Sstevel@tonic-gate 				case TCGETS:
2347c478bd9Sstevel@tonic-gate 					request = ('T'<<8)|13;
2357c478bd9Sstevel@tonic-gate 					return(tcget(des, request, arg));
2367c478bd9Sstevel@tonic-gate 					break;
2377c478bd9Sstevel@tonic-gate 				case TCSETS:
2387c478bd9Sstevel@tonic-gate 					request = ('T'<<8)|14;
2397c478bd9Sstevel@tonic-gate 					return(tcset(des, request, arg));
2407c478bd9Sstevel@tonic-gate 					break;
2417c478bd9Sstevel@tonic-gate 				case TCSETSW:
2427c478bd9Sstevel@tonic-gate 					request = ('T'<<8)|15;
2437c478bd9Sstevel@tonic-gate 					return(tcset(des, request, arg));
2447c478bd9Sstevel@tonic-gate 					break;
2457c478bd9Sstevel@tonic-gate 				case TCSETSF:
2467c478bd9Sstevel@tonic-gate 					request = ('T'<<8)|16;
2477c478bd9Sstevel@tonic-gate 					return(tcset(des, request, arg));
2487c478bd9Sstevel@tonic-gate 					break;
2497c478bd9Sstevel@tonic-gate 				case TCGETA:
2507c478bd9Sstevel@tonic-gate 				case TCSETA:
2517c478bd9Sstevel@tonic-gate 				case TCSETAW:
2527c478bd9Sstevel@tonic-gate 				case TCSETAF:
2537c478bd9Sstevel@tonic-gate 				default:
2547c478bd9Sstevel@tonic-gate 					request = request & 0x0FFFF;
2557c478bd9Sstevel@tonic-gate 					break;
2567c478bd9Sstevel@tonic-gate 			}
2577c478bd9Sstevel@tonic-gate 			break;
2587c478bd9Sstevel@tonic-gate 		case ((int) 'S'):
2597c478bd9Sstevel@tonic-gate 			switch (request) {
2607c478bd9Sstevel@tonic-gate  				case I_PLINK: request = ('S'<<8)|026;
2617c478bd9Sstevel@tonic-gate 					      break;
2627c478bd9Sstevel@tonic-gate  				case I_PUNLINK: request = ('S'<<8)|027;
2637c478bd9Sstevel@tonic-gate 					      break;
2647c478bd9Sstevel@tonic-gate  				case I_STR: {
2657c478bd9Sstevel@tonic-gate 					struct strioctl *iarg =
2667c478bd9Sstevel@tonic-gate 					    (struct strioctl *)arg;
2677c478bd9Sstevel@tonic-gate 					int cmd = iarg->ic_cmd;
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate 					switch (cmd) {
2707c478bd9Sstevel@tonic-gate 					case TI_GETINFO: {
2717c478bd9Sstevel@tonic-gate 						/*
2727c478bd9Sstevel@tonic-gate 						 * The T_info_ack structure
2737c478bd9Sstevel@tonic-gate 						 * has one additional word
2747c478bd9Sstevel@tonic-gate 						 * added to it in 5.x.
2757c478bd9Sstevel@tonic-gate 						 * To prevent the module from
2767c478bd9Sstevel@tonic-gate 						 * overwritting user memory we
2777c478bd9Sstevel@tonic-gate 						 * use an internal buffer for
2787c478bd9Sstevel@tonic-gate 						 * the transfer and copy out
2797c478bd9Sstevel@tonic-gate 						 * the results to the caller.
2807c478bd9Sstevel@tonic-gate 						 */
2817c478bd9Sstevel@tonic-gate 						struct {
2827c478bd9Sstevel@tonic-gate 							struct T_info_ack info;
2837c478bd9Sstevel@tonic-gate 							long		pad[16];
2847c478bd9Sstevel@tonic-gate 						} args;
2857c478bd9Sstevel@tonic-gate 						char *dp = iarg->ic_dp;
2867c478bd9Sstevel@tonic-gate 
2877c478bd9Sstevel@tonic-gate 						memcpy(&args.info, iarg->ic_dp,
2887c478bd9Sstevel@tonic-gate 						    sizeof(struct T_info_ack));
2897c478bd9Sstevel@tonic-gate 						iarg->ic_dp =
2907c478bd9Sstevel@tonic-gate 						    (char *) &args.info;
2917c478bd9Sstevel@tonic-gate 						iarg->ic_cmd = (TIMOD | 140);
2927c478bd9Sstevel@tonic-gate 						ret = _ioctl(des,
2937c478bd9Sstevel@tonic-gate 						    request & 0xffff, arg);
2947c478bd9Sstevel@tonic-gate 						iarg->ic_cmd = cmd;
2957c478bd9Sstevel@tonic-gate 						iarg->ic_dp = dp;
2967c478bd9Sstevel@tonic-gate 						iarg->ic_len =
2977c478bd9Sstevel@tonic-gate 						    sizeof(struct T_info_ack);
2987c478bd9Sstevel@tonic-gate 						memcpy(iarg->ic_dp, &args.info,
2997c478bd9Sstevel@tonic-gate 						    iarg->ic_len);
3007c478bd9Sstevel@tonic-gate 						return (ret);
3017c478bd9Sstevel@tonic-gate 						break;
3027c478bd9Sstevel@tonic-gate 					}
3037c478bd9Sstevel@tonic-gate 					case TI_OPTMGMT:
3047c478bd9Sstevel@tonic-gate 						iarg->ic_cmd = (TIMOD | 141);
3057c478bd9Sstevel@tonic-gate 						break;
3067c478bd9Sstevel@tonic-gate 					case TI_BIND:
3077c478bd9Sstevel@tonic-gate 						iarg->ic_cmd = (TIMOD | 142);
3087c478bd9Sstevel@tonic-gate 						break;
3097c478bd9Sstevel@tonic-gate 					case TI_UNBIND:
3107c478bd9Sstevel@tonic-gate 						iarg->ic_cmd = (TIMOD | 143);
3117c478bd9Sstevel@tonic-gate 						break;
3127c478bd9Sstevel@tonic-gate 					}
3137c478bd9Sstevel@tonic-gate 					ret = _ioctl(des,
3147c478bd9Sstevel@tonic-gate 					    request & 0xffff, arg);
3157c478bd9Sstevel@tonic-gate 					iarg->ic_cmd = cmd;
3167c478bd9Sstevel@tonic-gate 					return ret;
3177c478bd9Sstevel@tonic-gate 				}
3187c478bd9Sstevel@tonic-gate 				default:      request = request & 0x0FFFF;
3197c478bd9Sstevel@tonic-gate 				  	      break;
3207c478bd9Sstevel@tonic-gate 			}
3217c478bd9Sstevel@tonic-gate 			break;
3227c478bd9Sstevel@tonic-gate 		case ((int) 'm'):
3237c478bd9Sstevel@tonic-gate 			switch (request) {
3247c478bd9Sstevel@tonic-gate 				case MSIOGETPARMS: request = ('m'<<8)|1;
3257c478bd9Sstevel@tonic-gate 					      break;
3267c478bd9Sstevel@tonic-gate 				case MSIOSETPARMS: request = ('m'<<8)|2;
3277c478bd9Sstevel@tonic-gate 					      break;
3287c478bd9Sstevel@tonic-gate 				default:      request = request & 0x0FFFF;
3297c478bd9Sstevel@tonic-gate 				  	      break;
3307c478bd9Sstevel@tonic-gate 			}
3317c478bd9Sstevel@tonic-gate 			break;
3327c478bd9Sstevel@tonic-gate 		case ((int) 'd'):
3337c478bd9Sstevel@tonic-gate 			switch (request) {
3347c478bd9Sstevel@tonic-gate 				case DKIOCGGEOM:
3357c478bd9Sstevel@tonic-gate 					request = S5DKIOCGGEOM;
3367c478bd9Sstevel@tonic-gate 					break;
3377c478bd9Sstevel@tonic-gate 				case DKIOCSGEOM:
3387c478bd9Sstevel@tonic-gate 					request = S5DKIOCSGEOM;
3397c478bd9Sstevel@tonic-gate 					break;
3407c478bd9Sstevel@tonic-gate 				case DKIOCSAPART:
3417c478bd9Sstevel@tonic-gate 					request = S5DKIOCSAPART;
3427c478bd9Sstevel@tonic-gate 					break;
3437c478bd9Sstevel@tonic-gate 				case DKIOCGAPART:
3447c478bd9Sstevel@tonic-gate 					request = S5DKIOCGAPART;
3457c478bd9Sstevel@tonic-gate 					break;
3467c478bd9Sstevel@tonic-gate 				case DKIOCSTYPE:
3477c478bd9Sstevel@tonic-gate 					request = S5HDKIOCSTYPE;
3487c478bd9Sstevel@tonic-gate 					break;
3497c478bd9Sstevel@tonic-gate 				case DKIOCGTYPE:
3507c478bd9Sstevel@tonic-gate 					request = S5HDKIOCGTYPE;
3517c478bd9Sstevel@tonic-gate 					break;
3527c478bd9Sstevel@tonic-gate 				case DKIOCSBAD:
3537c478bd9Sstevel@tonic-gate 					request = S5HDKIOCSBAD;
3547c478bd9Sstevel@tonic-gate 					break;
3557c478bd9Sstevel@tonic-gate 				case DKIOCGBAD:
3567c478bd9Sstevel@tonic-gate 					request = S5HDKIOCGBAD;
3577c478bd9Sstevel@tonic-gate 					break;
3587c478bd9Sstevel@tonic-gate 				case DKIOCSCMD:
3597c478bd9Sstevel@tonic-gate 					request = S5HDKIOCSCMD;
3607c478bd9Sstevel@tonic-gate 					break;
3617c478bd9Sstevel@tonic-gate 				case DKIOCGDIAG:
3627c478bd9Sstevel@tonic-gate 					request = S5HDKIOCGDIAG;
3637c478bd9Sstevel@tonic-gate 					break;
3647c478bd9Sstevel@tonic-gate 				case FDKIOGCHAR:
3657c478bd9Sstevel@tonic-gate 					request = S5FDIOGCHAR;
3667c478bd9Sstevel@tonic-gate 					break;
3677c478bd9Sstevel@tonic-gate 				case FDKIOSCHAR:
3687c478bd9Sstevel@tonic-gate 					request = S5FDIOSCHAR;
3697c478bd9Sstevel@tonic-gate 					break;
3707c478bd9Sstevel@tonic-gate 				case FDKEJECT:
3717c478bd9Sstevel@tonic-gate 					request = S5FDEJECT;
3727c478bd9Sstevel@tonic-gate 					break;
3737c478bd9Sstevel@tonic-gate 				case FDKGETCHANGE:
3747c478bd9Sstevel@tonic-gate 					request = S5FDGETCHANGE;
3757c478bd9Sstevel@tonic-gate 					break;
3767c478bd9Sstevel@tonic-gate 				case FDKGETDRIVECHAR:
3777c478bd9Sstevel@tonic-gate 					request = S5FDGETDRIVECHAR;
3787c478bd9Sstevel@tonic-gate 					break;
3797c478bd9Sstevel@tonic-gate 				case FDKSETDRIVECHAR:
3807c478bd9Sstevel@tonic-gate 					request = S5FDSETDRIVECHAR;
3817c478bd9Sstevel@tonic-gate 					break;
3827c478bd9Sstevel@tonic-gate 				case FDKGETSEARCH:
3837c478bd9Sstevel@tonic-gate 					request = S5FDGETSEARCH;
3847c478bd9Sstevel@tonic-gate 					break;
3857c478bd9Sstevel@tonic-gate 				case FDKSETSEARCH:
3867c478bd9Sstevel@tonic-gate 					request = S5FDSETSEARCH;
3877c478bd9Sstevel@tonic-gate 					break;
3887c478bd9Sstevel@tonic-gate 				case FDKIOCSCMD:
3897c478bd9Sstevel@tonic-gate 					request = S5FDIOCMD;
3907c478bd9Sstevel@tonic-gate 					break;
3917c478bd9Sstevel@tonic-gate 				case F_RAW:
3927c478bd9Sstevel@tonic-gate 					request = S5FDRAW;
3937c478bd9Sstevel@tonic-gate 					break;
3947c478bd9Sstevel@tonic-gate 				case DKIOCINFO:
3957c478bd9Sstevel@tonic-gate 					ret = _ioctl(des, S5DKIOCINFO, &newArgs);
3967c478bd9Sstevel@tonic-gate 					if (ret != -1) {
3977c478bd9Sstevel@tonic-gate 						infoArgs = (struct dk_info *)arg;
3987c478bd9Sstevel@tonic-gate 						infoArgs->dki_ctlr =
3997c478bd9Sstevel@tonic-gate 							newArgs.dki_addr;
4007c478bd9Sstevel@tonic-gate 						infoArgs->dki_unit =
4017c478bd9Sstevel@tonic-gate 							newArgs.dki_unit;
4027c478bd9Sstevel@tonic-gate 						infoArgs->dki_ctype =
4037c478bd9Sstevel@tonic-gate 							newArgs.dki_ctype;
4047c478bd9Sstevel@tonic-gate 						infoArgs->dki_flags =
4057c478bd9Sstevel@tonic-gate 							newArgs.dki_flags;
4067c478bd9Sstevel@tonic-gate 					}
4077c478bd9Sstevel@tonic-gate 					return ret;
4087c478bd9Sstevel@tonic-gate 					break;
4097c478bd9Sstevel@tonic-gate 				case DKIOCGCONF:
4107c478bd9Sstevel@tonic-gate 					ret = _ioctl(des, S5DKIOCINFO, &newArgs);
4117c478bd9Sstevel@tonic-gate 					if (ret != -1) {
4127c478bd9Sstevel@tonic-gate 						confArgs = (struct dk_conf *)arg;
4137c478bd9Sstevel@tonic-gate 						strncpy(confArgs->dkc_cname,
4147c478bd9Sstevel@tonic-gate 							newArgs.dki_cname,
4157c478bd9Sstevel@tonic-gate 							DK_DEVLEN);
4167c478bd9Sstevel@tonic-gate 						strncpy(confArgs->dkc_dname,
4177c478bd9Sstevel@tonic-gate 							newArgs.dki_dname,
4187c478bd9Sstevel@tonic-gate 							DK_DEVLEN);
4197c478bd9Sstevel@tonic-gate 						confArgs->dkc_ctype =
4207c478bd9Sstevel@tonic-gate 							(u_short)newArgs.dki_ctype;
4217c478bd9Sstevel@tonic-gate 						confArgs->dkc_flags =
4227c478bd9Sstevel@tonic-gate 							(u_short)newArgs.dki_flags;
4237c478bd9Sstevel@tonic-gate 						confArgs->dkc_cnum =
4247c478bd9Sstevel@tonic-gate 							newArgs.dki_cnum;
4257c478bd9Sstevel@tonic-gate 						confArgs->dkc_addr =
4267c478bd9Sstevel@tonic-gate 							newArgs.dki_addr;
4277c478bd9Sstevel@tonic-gate 						confArgs->dkc_space =
4287c478bd9Sstevel@tonic-gate 							(u_int)newArgs.dki_space;
4297c478bd9Sstevel@tonic-gate 						confArgs->dkc_prio =
4307c478bd9Sstevel@tonic-gate 							newArgs.dki_prio;
4317c478bd9Sstevel@tonic-gate 						confArgs->dkc_vec =
4327c478bd9Sstevel@tonic-gate 							newArgs.dki_vec;
4337c478bd9Sstevel@tonic-gate 						confArgs->dkc_unit =
4347c478bd9Sstevel@tonic-gate 							newArgs.dki_unit;
4357c478bd9Sstevel@tonic-gate 						confArgs->dkc_slave =
4367c478bd9Sstevel@tonic-gate 							newArgs.dki_slave;
4377c478bd9Sstevel@tonic-gate 					}
4387c478bd9Sstevel@tonic-gate 					return ret;
4397c478bd9Sstevel@tonic-gate 					break;
4407c478bd9Sstevel@tonic-gate 				case DKIOCWCHK:
4417c478bd9Sstevel@tonic-gate 					/*
4427c478bd9Sstevel@tonic-gate 					 * This is unsupported in SVR4. It
4437c478bd9Sstevel@tonic-gate 					 * turns on verify-after-write for
4447c478bd9Sstevel@tonic-gate 					 * the floppy. I don't think the
4457c478bd9Sstevel@tonic-gate 					 * system call should fail, however.
4467c478bd9Sstevel@tonic-gate 					 */
4477c478bd9Sstevel@tonic-gate 					return 0;
4487c478bd9Sstevel@tonic-gate 					break;
4497c478bd9Sstevel@tonic-gate 				case DKIOCGPART:
4507c478bd9Sstevel@tonic-gate 				case DKIOCSPART:
4517c478bd9Sstevel@tonic-gate 					return (handle_dkio_partitions(des,
4527c478bd9Sstevel@tonic-gate 					       request, arg));
4537c478bd9Sstevel@tonic-gate 				case DKIOCGLOG:
4547c478bd9Sstevel@tonic-gate 					/* unsupported */
4557c478bd9Sstevel@tonic-gate 					errno = EINVAL;
4567c478bd9Sstevel@tonic-gate 					return -1;
4577c478bd9Sstevel@tonic-gate 					break;
4587c478bd9Sstevel@tonic-gate 				case DESIOCBLOCK:
4597c478bd9Sstevel@tonic-gate 				case DESIOCQUICK:
4607c478bd9Sstevel@tonic-gate 					break; /* no change for these two */
4617c478bd9Sstevel@tonic-gate 				default:
4627c478bd9Sstevel@tonic-gate 					request = request & 0x0FFFF; /* try */
4637c478bd9Sstevel@tonic-gate 					break;
4647c478bd9Sstevel@tonic-gate 			}
4657c478bd9Sstevel@tonic-gate 			break;
4667c478bd9Sstevel@tonic-gate 		case ((int) 'c'):
4677c478bd9Sstevel@tonic-gate 			switch (request) {
4687c478bd9Sstevel@tonic-gate 				case CDROMPAUSE:
4697c478bd9Sstevel@tonic-gate 					request = S5CDROMPAUSE;
4707c478bd9Sstevel@tonic-gate 					break;
4717c478bd9Sstevel@tonic-gate 				case CDROMRESUME:
4727c478bd9Sstevel@tonic-gate 					request = S5CDROMRESUME;
4737c478bd9Sstevel@tonic-gate 					break;
4747c478bd9Sstevel@tonic-gate 				case CDROMPLAYMSF:
4757c478bd9Sstevel@tonic-gate 					request = S5CDROMPLAYMSF;
4767c478bd9Sstevel@tonic-gate 					break;
4777c478bd9Sstevel@tonic-gate 				case CDROMPLAYTRKIND:
4787c478bd9Sstevel@tonic-gate 					request = S5CDROMPLAYTRKIND;
4797c478bd9Sstevel@tonic-gate 					break;
4807c478bd9Sstevel@tonic-gate 				case CDROMREADTOCHDR:
4817c478bd9Sstevel@tonic-gate 					request = S5CDROMREADTOCHDR;
4827c478bd9Sstevel@tonic-gate 					break;
4837c478bd9Sstevel@tonic-gate 				case CDROMREADTOCENTRY:
4847c478bd9Sstevel@tonic-gate 					request = S5CDROMREADTOCENTRY;
4857c478bd9Sstevel@tonic-gate 					break;
4867c478bd9Sstevel@tonic-gate 				case CDROMSTOP:
4877c478bd9Sstevel@tonic-gate 					request = S5CDROMSTOP;
4887c478bd9Sstevel@tonic-gate 					break;
4897c478bd9Sstevel@tonic-gate 				case CDROMSTART:
4907c478bd9Sstevel@tonic-gate 					request = S5CDROMSTART;
4917c478bd9Sstevel@tonic-gate 					break;
4927c478bd9Sstevel@tonic-gate 				case CDROMEJECT:
4937c478bd9Sstevel@tonic-gate 					request = S5CDROMEJECT;
4947c478bd9Sstevel@tonic-gate 					break;
4957c478bd9Sstevel@tonic-gate 				case CDROMVOLCTRL:
4967c478bd9Sstevel@tonic-gate 					request = S5CDROMVOLCTRL;
4977c478bd9Sstevel@tonic-gate 					break;
4987c478bd9Sstevel@tonic-gate 				case CDROMSUBCHNL:
4997c478bd9Sstevel@tonic-gate 					request = S5CDROMSUBCHNL;
5007c478bd9Sstevel@tonic-gate 					break;
5017c478bd9Sstevel@tonic-gate 				case CDROMREADMODE1:
5027c478bd9Sstevel@tonic-gate 					request = S5CDROMREADMODE1;
5037c478bd9Sstevel@tonic-gate 					break;
5047c478bd9Sstevel@tonic-gate 				case CDROMREADMODE2:
5057c478bd9Sstevel@tonic-gate 					request = S5CDROMREADMODE2;
5067c478bd9Sstevel@tonic-gate 					break;
5077c478bd9Sstevel@tonic-gate 			}
5087c478bd9Sstevel@tonic-gate 			break;
5097c478bd9Sstevel@tonic-gate 		case ((int) 'u'):
5107c478bd9Sstevel@tonic-gate 			switch (request) {
5117c478bd9Sstevel@tonic-gate 				case USCSICMD:
5127c478bd9Sstevel@tonic-gate 				    {
5137c478bd9Sstevel@tonic-gate 					struct s5_uscsi_cmd s5_cmd;
5147c478bd9Sstevel@tonic-gate 					struct uscsi_cmd *cmd =
5157c478bd9Sstevel@tonic-gate 						(struct uscsi_cmd *) arg;
5167c478bd9Sstevel@tonic-gate 					request = S5USCSICMD;
5177c478bd9Sstevel@tonic-gate 					s5_cmd.uscsi_cdb = cmd->uscsi_cdb;
5187c478bd9Sstevel@tonic-gate 					s5_cmd.uscsi_cdblen =
5197c478bd9Sstevel@tonic-gate 						cmd->uscsi_cdblen;
5207c478bd9Sstevel@tonic-gate 					s5_cmd.uscsi_bufaddr =
5217c478bd9Sstevel@tonic-gate 						cmd->uscsi_bufaddr;
5227c478bd9Sstevel@tonic-gate 					s5_cmd.uscsi_buflen =
5237c478bd9Sstevel@tonic-gate 						cmd->uscsi_buflen;
5247c478bd9Sstevel@tonic-gate 					s5_cmd.uscsi_flags =
5257c478bd9Sstevel@tonic-gate 						cmd->uscsi_flags;
5267c478bd9Sstevel@tonic-gate 					ret = _ioctl(des, request, &s5_cmd);
5277c478bd9Sstevel@tonic-gate 					cmd->uscsi_status = s5_cmd.uscsi_status;
5287c478bd9Sstevel@tonic-gate 					return(ret);
5297c478bd9Sstevel@tonic-gate 				    }
5307c478bd9Sstevel@tonic-gate 			}
5317c478bd9Sstevel@tonic-gate 			break;
5327c478bd9Sstevel@tonic-gate 		case ((int) 'k'):
5337c478bd9Sstevel@tonic-gate 		case ((int) 'v'):
5347c478bd9Sstevel@tonic-gate 		case ((int) 'F'):
5357c478bd9Sstevel@tonic-gate 		case ((int) 'G'):
5367c478bd9Sstevel@tonic-gate 		case ((int) 'X'):
5377c478bd9Sstevel@tonic-gate 		case ((int) 'L'):
5387c478bd9Sstevel@tonic-gate 			request = request & 0x0FFFF;
5397c478bd9Sstevel@tonic-gate 			break;
5407c478bd9Sstevel@tonic-gate 		case ((int) 'f'):
5417c478bd9Sstevel@tonic-gate 			if ((request == FIOCLEX) || (request == FIONCLEX))
5427c478bd9Sstevel@tonic-gate 				return(fcntl(des, F_SETFD,
5437c478bd9Sstevel@tonic-gate 				    ((request == FIOCLEX) ? 1 : 0)));
5447c478bd9Sstevel@tonic-gate 			break;
5457c478bd9Sstevel@tonic-gate 		case ((int) 'g'):
5467c478bd9Sstevel@tonic-gate 			/* Treat the following 2 ioctls specially for
5477c478bd9Sstevel@tonic-gate 			 * sunview. */
5487c478bd9Sstevel@tonic-gate 			if (request == WINGETEXPOSEDRL ||
5497c478bd9Sstevel@tonic-gate 				request == WINGETDAMAGEDRL) {
5507c478bd9Sstevel@tonic-gate 				ret = _ioctl(des, request, arg);
5517c478bd9Sstevel@tonic-gate 				if (errno == N_ENOMSG)
5527c478bd9Sstevel@tonic-gate 					errno = EFBIG;
5537c478bd9Sstevel@tonic-gate 				return(ret);
5547c478bd9Sstevel@tonic-gate 			}
5557c478bd9Sstevel@tonic-gate 			break;
5567c478bd9Sstevel@tonic-gate 	}
5577c478bd9Sstevel@tonic-gate 	return (_ioctl(des, request, arg));
5587c478bd9Sstevel@tonic-gate }
5597c478bd9Sstevel@tonic-gate 
5607c478bd9Sstevel@tonic-gate 
5617c478bd9Sstevel@tonic-gate static int
5627c478bd9Sstevel@tonic-gate handle_dkio_partitions(int des, int request, int arg)
5637c478bd9Sstevel@tonic-gate {
5647c478bd9Sstevel@tonic-gate 	struct s5_dk_cinfo	cinfo;
5657c478bd9Sstevel@tonic-gate 	struct dk_allmap	map;
5667c478bd9Sstevel@tonic-gate 	struct dk_map		*part;
5677c478bd9Sstevel@tonic-gate 	int			ret;
5687c478bd9Sstevel@tonic-gate 	extern int		errno;
5697c478bd9Sstevel@tonic-gate 
5707c478bd9Sstevel@tonic-gate 	part = (struct dk_map *) arg;
5717c478bd9Sstevel@tonic-gate 
5727c478bd9Sstevel@tonic-gate 	ret = _ioctl(des, S5DKIOCINFO, &cinfo);
5737c478bd9Sstevel@tonic-gate 
5747c478bd9Sstevel@tonic-gate 	if ((cinfo.dki_partition < 0) || (cinfo.dki_partition >= NDKMAP)) {
5757c478bd9Sstevel@tonic-gate 		errno = EINVAL;
5767c478bd9Sstevel@tonic-gate 		return (-1);
5777c478bd9Sstevel@tonic-gate 	}
5787c478bd9Sstevel@tonic-gate 
5797c478bd9Sstevel@tonic-gate 	if (ret != -1) {
5807c478bd9Sstevel@tonic-gate 		ret = _ioctl(des, S5DKIOCGAPART, &map);
5817c478bd9Sstevel@tonic-gate 		if (ret != -1) {
5827c478bd9Sstevel@tonic-gate 			if (request == DKIOCGPART) {
5837c478bd9Sstevel@tonic-gate 				part->dkl_cylno =
5847c478bd9Sstevel@tonic-gate 				    map.dka_map[cinfo.dki_partition].dkl_cylno;
5857c478bd9Sstevel@tonic-gate 				part->dkl_nblk =
5867c478bd9Sstevel@tonic-gate 				    map.dka_map[cinfo.dki_partition].dkl_nblk;
5877c478bd9Sstevel@tonic-gate 			} else {
5887c478bd9Sstevel@tonic-gate 				map.dka_map[cinfo.dki_partition].dkl_cylno =
5897c478bd9Sstevel@tonic-gate 					part->dkl_cylno;
5907c478bd9Sstevel@tonic-gate 				map.dka_map[cinfo.dki_partition].dkl_nblk =
5917c478bd9Sstevel@tonic-gate 					part->dkl_nblk;
5927c478bd9Sstevel@tonic-gate 				ret = _ioctl(des, S5DKIOCSAPART, &map);
5937c478bd9Sstevel@tonic-gate 			}
5947c478bd9Sstevel@tonic-gate 		}
5957c478bd9Sstevel@tonic-gate 	}
5967c478bd9Sstevel@tonic-gate 	return (ret);
5977c478bd9Sstevel@tonic-gate }
5987c478bd9Sstevel@tonic-gate 
5997c478bd9Sstevel@tonic-gate static int
6007c478bd9Sstevel@tonic-gate tcset(des, request, arg)
6017c478bd9Sstevel@tonic-gate 	register int	des;
6027c478bd9Sstevel@tonic-gate 	register int	request;
6037c478bd9Sstevel@tonic-gate 	int		arg;
6047c478bd9Sstevel@tonic-gate {
6057c478bd9Sstevel@tonic-gate 	struct s5termios	s5termios;
6067c478bd9Sstevel@tonic-gate 	struct termios		*termios;
6077c478bd9Sstevel@tonic-gate 
6087c478bd9Sstevel@tonic-gate 	termios = (struct termios *)arg;
6097c478bd9Sstevel@tonic-gate 
6107c478bd9Sstevel@tonic-gate 	if (termios != NULL) {
6117c478bd9Sstevel@tonic-gate 		s5termios.c_iflag = termios->c_iflag;
6127c478bd9Sstevel@tonic-gate 		s5termios.c_oflag = termios->c_oflag;
6137c478bd9Sstevel@tonic-gate 		s5termios.c_cflag = termios->c_cflag;
6147c478bd9Sstevel@tonic-gate 		s5termios.c_lflag = termios->c_lflag;
6157c478bd9Sstevel@tonic-gate 		memcpy(s5termios.c_cc, termios->c_cc, NCCS);
6167c478bd9Sstevel@tonic-gate 		return (_ioctl(des, request, &s5termios));
6177c478bd9Sstevel@tonic-gate 	} else
6187c478bd9Sstevel@tonic-gate 		return (_ioctl(des, request, NULL));
6197c478bd9Sstevel@tonic-gate 
6207c478bd9Sstevel@tonic-gate }
6217c478bd9Sstevel@tonic-gate 
6227c478bd9Sstevel@tonic-gate static int
6237c478bd9Sstevel@tonic-gate tcget(des, request, arg)
6247c478bd9Sstevel@tonic-gate 	register int	des;
6257c478bd9Sstevel@tonic-gate 	register int	request;
6267c478bd9Sstevel@tonic-gate 	int		arg;
6277c478bd9Sstevel@tonic-gate {
6287c478bd9Sstevel@tonic-gate 	struct s5termios	s5termios;
6297c478bd9Sstevel@tonic-gate 	struct termios		*termios;
6307c478bd9Sstevel@tonic-gate 	int			ret;
6317c478bd9Sstevel@tonic-gate 
6327c478bd9Sstevel@tonic-gate 	termios = (struct termios *)arg;
6337c478bd9Sstevel@tonic-gate 
6347c478bd9Sstevel@tonic-gate 	ret = _ioctl(des, request, &s5termios);
6357c478bd9Sstevel@tonic-gate 
6367c478bd9Sstevel@tonic-gate 	if (termios != NULL) {
6377c478bd9Sstevel@tonic-gate 		termios->c_iflag = s5termios.c_iflag;
6387c478bd9Sstevel@tonic-gate 		termios->c_oflag = s5termios.c_oflag;
6397c478bd9Sstevel@tonic-gate 		termios->c_cflag = s5termios.c_cflag;
6407c478bd9Sstevel@tonic-gate 		termios->c_lflag = s5termios.c_lflag;
6417c478bd9Sstevel@tonic-gate 		memcpy(termios->c_cc, s5termios.c_cc, NCCS);
6427c478bd9Sstevel@tonic-gate 	}
6437c478bd9Sstevel@tonic-gate 
6447c478bd9Sstevel@tonic-gate 	return (ret);
6457c478bd9Sstevel@tonic-gate }
646