]>
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 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1987, 1988 NeXT, Inc.
26 * 7-Jan-93 Mac Gillon (mgillon) at NeXT
27 * Integrated POSIX support
29 * 12-Aug-87 John Seamons (jks) at NeXT
34 * Indirect driver for console.
36 #include <sys/param.h>
37 #include <sys/systm.h>
39 #include <sys/ioctl.h>
43 #include <dev/ppc/cons.h>
46 struct tty
*constty
; /* current console device */
50 consopen(dev
, flag
, devtype
, pp
)
56 boolean_t funnel_state
;
59 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
62 device
= constty
->t_dev
;
65 error
= (*cdevsw
[major(device
)].d_open
)(device
, flag
, devtype
, pp
);
66 thread_funnel_set(kernel_flock
, funnel_state
);
73 consclose(dev
, flag
, mode
, pp
)
79 boolean_t funnel_state
;
82 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
84 device
= constty
->t_dev
;
87 error
= (*cdevsw
[major(device
)].d_close
)(device
, flag
, mode
, pp
);
88 thread_funnel_set(kernel_flock
, funnel_state
);
97 consread(dev
, uio
, ioflag
)
103 boolean_t funnel_state
;
106 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
108 device
= constty
->t_dev
;
111 error
= (*cdevsw
[major(device
)].d_read
)(device
, uio
, ioflag
);
112 thread_funnel_set(kernel_flock
, funnel_state
);
119 conswrite(dev
, uio
, ioflag
)
125 boolean_t funnel_state
;
128 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
130 device
= constty
->t_dev
;
133 error
= (*cdevsw
[major(device
)].d_write
)(device
, uio
, ioflag
);
134 thread_funnel_set(kernel_flock
, funnel_state
);
141 consioctl(dev
, cmd
, addr
, flag
, p
)
149 boolean_t funnel_state
;
152 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
155 device
= constty
->t_dev
;
159 * Superuser can always use this to wrest control of console
160 * output from the "virtual" console.
162 if (cmd
== TIOCCONS
&& constty
) {
163 error
= proc_suser(p
);
171 error
= (*cdevsw
[major(device
)].d_ioctl
)(device
, cmd
, addr
, flag
, p
);
173 thread_funnel_set(kernel_flock
, funnel_state
);
179 /* called with funnel held */
181 consselect(dev
, flag
, wql
, p
)
190 device
= constty
->t_dev
;
193 return ((*cdevsw
[major(device
)].d_select
)(device
, flag
, wql
, p
));
200 boolean_t funnel_state
;
203 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
205 device
= constty
->t_dev
;
208 error
= (*cdevsw
[major(device
)].d_getc
)(device
);
209 thread_funnel_set(kernel_flock
, funnel_state
);
220 boolean_t funnel_state
;
223 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
225 device
= constty
->t_dev
;
228 error
= (*cdevsw
[major(device
)].d_putc
)(device
, c
);
229 thread_funnel_set(kernel_flock
, funnel_state
);
235 * Write message to console; create an alert panel if no text-type window
236 * currently exists. Caller must call alert_done() when finished.
237 * The height and width arguments are not used; they are provided for
238 * compatibility with the 68k version of alert().
257 sprintf(smsg
, msg
, p1
, p2
, p3
, p4
, p5
, p6
, p7
, p8
);
259 /* DoAlert(title, smsg); */