/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* from S5R4 1.22 */
/*
* Indirect driver for controlling tty.
*/
syopen, /* open */
syclose, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
syread, /* read */
sywrite, /* write */
syioctl, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
sypoll, /* poll */
ddi_prop_op, /* cb_prop_op */
0, /* streamtab */
};
DEVO_REV, /* devo_rev, */
0, /* refcnt */
sy_info, /* info */
nulldev, /* identify */
nulldev, /* probe */
sy_attach, /* attach */
nodev, /* detach */
nodev, /* reset */
&sy_cb_ops, /* driver operations */
(struct bus_ops *)0, /* bus operations */
NULL, /* power */
ddi_quiesce_not_needed, /* quiesce */
};
extern int nodev(void);
extern int nulldev(void);
extern int dseekneg_flag;
extern struct mod_ops mod_driverops;
/*
* Module linkage information for the kernel.
*/
&mod_driverops, /* Type of module. This one is a pseudo driver */
"Indirect driver for tty 'sy'",
&sy_ops, /* driver ops */
};
&modldrv,
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}
int
{
}
/* ARGSUSED */
static int
{
return (-1);
}
return (DDI_SUCCESS);
}
/* ARGSUSED */
static int
{
int error;
switch (infocmd) {
case DDI_INFO_DEVT2DEVINFO:
error = DDI_FAILURE;
} else {
error = DDI_SUCCESS;
}
break;
case DDI_INFO_DEVT2INSTANCE:
*result = (void *)-1;
error = DDI_FAILURE;
} else {
*result = (void *)0;
error = DDI_SUCCESS;
}
break;
default:
error = DDI_FAILURE;
}
return (error);
}
/* ARGSUSED */
int
{
int error;
return (EINTR);
return (ENXIO);
}
/*
* Open the control terminal. The control terminal may be
* opened multiple times and it is closed in freectty().
* The multi-open, single-clone means that no cloning
* can happen via this open, hence the assertion.
*/
if (error == 0) {
/*
* XXX: This driver binds a single minor number to the
* current controlling tty of the process issueing the
* open / close. If we implement a traditional close
* for this driver then specfs will only invoke this driver
* on the last close of our one minor number - which is not
* what we want. Since we already get the open / close
* semantic that we want from makectty and freectty, we reach
* back into the common snode and decrease the open count so
* that the specfs filtering of all but the last close
* does not get in our way. To clean this up, a new cb_flag
* that causes specfs to call the driver on each close
* should be considered.
*/
}
return (error);
}
/* ARGSUSED */
int
{
return (0);
}
/* ARGSUSED */
int
{
int error;
return (EINTR);
return (ENXIO);
}
return (error);
}
/* ARGSUSED */
int
{
int error;
return (EINTR);
return (ENXIO);
}
return (error);
}
/* ARGSUSED */
int
int *rvalp)
{
int error;
/*
* we can't allow this ioctl. the reason is that it
* attempts to remove the ctty for a session. to do
* this the ctty can't be in use but we grab a hold on
* the current ctty (via tty_hold) to perform this ioctl.
* if we were to allow this ioctl to pass through we
* would deadlock with ourselves.
*/
return (EINVAL);
}
return (EINTR);
return (ENXIO);
}
return (error);
}
/* ARGSUSED */
int
{
int error;
return (EINTR);
return (ENXIO);
}
return (error);
}