]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/i386/cons.c
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 * Copyright (c) 1987, 1988 NeXT, Inc.
29 * 7-Jan-93 Mac Gillon (mgillon) at NeXT
30 * Integrated POSIX support
32 * 12-Aug-87 John Seamons (jks) at NeXT
37 * Indirect driver for console.
39 #include <sys/param.h>
40 #include <sys/systm.h>
42 #include <sys/ioctl.h>
48 struct tty
*constty
; /* current console device */
52 cnopen(dev
, flag
, devtype
, pp
)
60 device
= constty
->t_dev
;
63 return ((*cdevsw
[major(device
)].d_open
)(device
, flag
, devtype
, pp
));
68 cnclose(dev
, flag
, mode
, pp
)
76 device
= constty
->t_dev
;
79 return ((*cdevsw
[major(device
)].d_close
)(device
, flag
, mode
, pp
));
84 cnread(dev
, uio
, ioflag
)
92 device
= constty
->t_dev
;
95 return ((*cdevsw
[major(device
)].d_read
)(device
, uio
, ioflag
));
100 cnwrite(dev
, uio
, ioflag
)
108 device
= constty
->t_dev
;
111 return ((*cdevsw
[major(device
)].d_write
)(device
, uio
, ioflag
));
116 cnioctl(dev
, cmd
, addr
, flag
, p
)
126 device
= constty
->t_dev
;
130 * Superuser can always use this to wrest control of console
131 * output from the "virtual" console.
133 if (cmd
== TIOCCONS
&& constty
) {
134 int error
= suser(p
->p_ucred
, (u_short
*) NULL
);
140 return ((*cdevsw
[major(device
)].d_ioctl
)(device
, cmd
, addr
, flag
, p
));
145 cnselect(dev
, flag
, wql
, p
)
154 device
= constty
->t_dev
;
157 return ((*cdevsw
[major(device
)].d_select
)(device
, flag
, wql
, p
));
160 #if 0 /* FIXME - using OSFMK console driver for the moment */
167 device
= constty
->t_dev
;
170 return ((*cdevsw
[major(device
)].d_getc
)(device
));
181 device
= constty
->t_dev
;
184 return ((*cdevsw
[major(device
)].d_putc
)(device
, c
));
191 /* FIXME: what to do here? */
197 kprintf( const char *format
, ...)
199 /* on PPC this outputs to the serial line */
200 /* nop on intel ... umeshv@apple.com */
206 * Write message to console; create an alert panel if no text-type window
207 * currently exists. Caller must call alert_done() when finished.
208 * The height and width arguments are not used; they are provided for
209 * compatibility with the 68k version of alert().
228 sprintf(smsg
, msg
, p1
, p2
, p3
, p4
, p5
, p6
, p7
, p8
);
230 /* DoAlert(title, smsg); */