]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/ppc/cons.c
015eb68782739c72aa2e81c0afebfb918727146e
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 * Copyright (c) 1987, 1988 NeXT, Inc.
34 * 7-Jan-93 Mac Gillon (mgillon) at NeXT
35 * Integrated POSIX support
37 * 12-Aug-87 John Seamons (jks) at NeXT
42 * Indirect driver for console.
44 #include <sys/param.h>
45 #include <sys/systm.h>
47 #include <sys/ioctl.h>
51 #include <dev/ppc/cons.h>
54 struct tty
*constty
; /* current console device */
58 consopen(dev
, flag
, devtype
, pp
)
64 boolean_t funnel_state
;
67 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
70 device
= constty
->t_dev
;
73 error
= (*cdevsw
[major(device
)].d_open
)(device
, flag
, devtype
, pp
);
74 thread_funnel_set(kernel_flock
, funnel_state
);
81 consclose(dev
, flag
, mode
, pp
)
87 boolean_t funnel_state
;
90 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
92 device
= constty
->t_dev
;
95 error
= (*cdevsw
[major(device
)].d_close
)(device
, flag
, mode
, pp
);
96 thread_funnel_set(kernel_flock
, funnel_state
);
105 consread(dev
, uio
, ioflag
)
111 boolean_t funnel_state
;
114 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
116 device
= constty
->t_dev
;
119 error
= (*cdevsw
[major(device
)].d_read
)(device
, uio
, ioflag
);
120 thread_funnel_set(kernel_flock
, funnel_state
);
127 conswrite(dev
, uio
, ioflag
)
133 boolean_t funnel_state
;
136 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
138 device
= constty
->t_dev
;
141 error
= (*cdevsw
[major(device
)].d_write
)(device
, uio
, ioflag
);
142 thread_funnel_set(kernel_flock
, funnel_state
);
149 consioctl(dev
, cmd
, addr
, flag
, p
)
157 boolean_t funnel_state
;
160 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
163 device
= constty
->t_dev
;
167 * Superuser can always use this to wrest control of console
168 * output from the "virtual" console.
170 if (cmd
== TIOCCONS
&& constty
) {
171 error
= proc_suser(p
);
179 error
= (*cdevsw
[major(device
)].d_ioctl
)(device
, cmd
, addr
, flag
, p
);
181 thread_funnel_set(kernel_flock
, funnel_state
);
187 /* called with funnel held */
189 consselect(dev
, flag
, wql
, p
)
198 device
= constty
->t_dev
;
201 return ((*cdevsw
[major(device
)].d_select
)(device
, flag
, wql
, p
));
208 boolean_t funnel_state
;
211 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
213 device
= constty
->t_dev
;
216 error
= (*cdevsw
[major(device
)].d_getc
)(device
);
217 thread_funnel_set(kernel_flock
, funnel_state
);
228 boolean_t funnel_state
;
231 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
233 device
= constty
->t_dev
;
236 error
= (*cdevsw
[major(device
)].d_putc
)(device
, c
);
237 thread_funnel_set(kernel_flock
, funnel_state
);
243 * Write message to console; create an alert panel if no text-type window
244 * currently exists. Caller must call alert_done() when finished.
245 * The height and width arguments are not used; they are provided for
246 * compatibility with the 68k version of alert().
265 sprintf(smsg
, msg
, p1
, p2
, p3
, p4
, p5
, p6
, p7
, p8
);
267 /* DoAlert(title, smsg); */