Thu Oct 22 17:36:33 2015 UTC ()
Add console-related ioctls.


(christos)
diff -r1.269 -r1.270 src/sys/kern/tty.c

cvs diff -r1.269 -r1.270 src/sys/kern/tty.c (expand / switch to unified diff)

--- src/sys/kern/tty.c 2015/10/18 15:58:23 1.269
+++ src/sys/kern/tty.c 2015/10/22 17:36:33 1.270
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tty.c,v 1.269 2015/10/18 15:58:23 christos Exp $ */ 1/* $NetBSD: tty.c,v 1.270 2015/10/22 17:36:33 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -53,27 +53,27 @@ @@ -53,27 +53,27 @@
53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 * SUCH DAMAGE. 60 * SUCH DAMAGE.
61 * 61 *
62 * @(#)tty.c 8.13 (Berkeley) 1/9/95 62 * @(#)tty.c 8.13 (Berkeley) 1/9/95
63 */ 63 */
64 64
65#include <sys/cdefs.h> 65#include <sys/cdefs.h>
66__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.269 2015/10/18 15:58:23 christos Exp $"); 66__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.270 2015/10/22 17:36:33 christos Exp $");
67 67
68#ifdef _KERNEL_OPT 68#ifdef _KERNEL_OPT
69#include "opt_compat_netbsd.h" 69#include "opt_compat_netbsd.h"
70#endif 70#endif
71 71
72#define TTY_ALLOW_PRIVATE 72#define TTY_ALLOW_PRIVATE
73 73
74#include <sys/param.h> 74#include <sys/param.h>
75#include <sys/systm.h> 75#include <sys/systm.h>
76#include <sys/ioctl.h> 76#include <sys/ioctl.h>
77#include <sys/proc.h> 77#include <sys/proc.h>
78#define TTYDEFCHARS 78#define TTYDEFCHARS
79#include <sys/tty.h> 79#include <sys/tty.h>
@@ -1385,26 +1385,37 @@ ttioctl(struct tty *tp, u_long cmd, void @@ -1385,26 +1385,37 @@ ttioctl(struct tty *tp, u_long cmd, void
1385 return EPASSTHROUGH; 1385 return EPASSTHROUGH;
1386 1386
1387 case TIOCEXT: 1387 case TIOCEXT:
1388 case TIOCPTSNAME: 1388 case TIOCPTSNAME:
1389 case TIOCGRANTPT: 1389 case TIOCGRANTPT:
1390 case TIOCPKT: 1390 case TIOCPKT:
1391 case TIOCUCNTL: 1391 case TIOCUCNTL:
1392 case TIOCREMOTE: 1392 case TIOCREMOTE:
1393 case TIOCSIG: 1393 case TIOCSIG:
1394 /* for ptys */ 1394 /* for ptys */
1395 return EPASSTHROUGH; 1395 return EPASSTHROUGH;
1396 1396
1397 default: 1397 default:
 1398 /* Pass through various console ioctls */
 1399 switch (IOCGROUP(cmd)) {
 1400 case 'c': /* syscons console */
 1401 case 'v': /* usl console, video - where one letter */
 1402 case 'K': /* usl console, keyboard - aint enough */
 1403 case 'V': /* pcvt compat */
 1404 case 'W': /* wscons console */
 1405 return EPASSTHROUGH;
 1406 default:
 1407 break;
 1408 }
1398#ifdef COMPAT_60 1409#ifdef COMPAT_60
1399 error = compat_60_ttioctl(tp, cmd, data, flag, l); 1410 error = compat_60_ttioctl(tp, cmd, data, flag, l);
1400 if (error != EPASSTHROUGH) 1411 if (error != EPASSTHROUGH)
1401 return error; 1412 return error;
1402#endif /* COMPAT_60 */ 1413#endif /* COMPAT_60 */
1403 /* We may have to load the compat module for this. */ 1414 /* We may have to load the compat module for this. */
1404 for (;;) { 1415 for (;;) {
1405 rw_enter(&ttcompat_lock, RW_READER); 1416 rw_enter(&ttcompat_lock, RW_READER);
1406 if (ttcompatvec != NULL) { 1417 if (ttcompatvec != NULL) {
1407 break; 1418 break;
1408 } 1419 }
1409 rw_exit(&ttcompat_lock); 1420 rw_exit(&ttcompat_lock);
1410 (void)module_autoload("compat", MODULE_CLASS_ANY); 1421 (void)module_autoload("compat", MODULE_CLASS_ANY);