]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/ppc/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>
46 #include <dev/ppc/cons.h>
49 struct tty
*constty
; /* current console device */
53 consopen(dev
, flag
, devtype
, pp
)
61 device
= constty
->t_dev
;
64 return ((*cdevsw
[major(device
)].d_open
)(device
, flag
, devtype
, pp
));
69 consclose(dev
, flag
, mode
, pp
)
77 device
= constty
->t_dev
;
80 return ((*cdevsw
[major(device
)].d_close
)(device
, flag
, mode
, pp
));
85 consread(dev
, uio
, ioflag
)
93 device
= constty
->t_dev
;
96 return ((*cdevsw
[major(device
)].d_read
)(device
, uio
, ioflag
));
101 conswrite(dev
, uio
, ioflag
)
109 device
= constty
->t_dev
;
112 return ((*cdevsw
[major(device
)].d_write
)(device
, uio
, ioflag
));
117 consioctl(dev
, cmd
, addr
, flag
, p
)
127 device
= constty
->t_dev
;
131 * Superuser can always use this to wrest control of console
132 * output from the "virtual" console.
134 if (cmd
== TIOCCONS
&& constty
) {
135 int error
= suser(p
->p_ucred
, (u_short
*) NULL
);
141 return ((*cdevsw
[major(device
)].d_ioctl
)(device
, cmd
, addr
, flag
, p
));
146 consselect(dev
, flag
, wql
, p
)
155 device
= constty
->t_dev
;
158 return ((*cdevsw
[major(device
)].d_select
)(device
, flag
, wql
, p
));
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
));
188 * Write message to console; create an alert panel if no text-type window
189 * currently exists. Caller must call alert_done() when finished.
190 * The height and width arguments are not used; they are provided for
191 * compatibility with the 68k version of alert().
210 sprintf(smsg
, msg
, p1
, p2
, p3
, p4
, p5
, p6
, p7
, p8
);
212 /* DoAlert(title, smsg); */