Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/wscons Implement missing ioctls for the default bell.



details:   https://anonhg.NetBSD.org/src/rev/b0207c5eae84
branches:  trunk
changeset: 354347:b0207c5eae84
user:      nat <nat%NetBSD.org@localhost>
date:      Tue Jun 13 05:49:48 2017 +0000

description:
Implement missing ioctls for the default bell.

diffstat:

 sys/dev/wscons/wsbell.c |  22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diffs (67 lines):

diff -r 149ef4ee2706 -r b0207c5eae84 sys/dev/wscons/wsbell.c
--- a/sys/dev/wscons/wsbell.c   Tue Jun 13 00:54:37 2017 +0000
+++ b/sys/dev/wscons/wsbell.c   Tue Jun 13 05:49:48 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsbell.c,v 1.7 2017/06/13 00:54:37 nat Exp $ */
+/* $NetBSD: wsbell.c,v 1.8 2017/06/13 05:49:48 nat Exp $ */
 
 /*-
  * Copyright (c) 2017 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -107,7 +107,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.7 2017/06/13 00:54:37 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.8 2017/06/13 05:49:48 nat Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "wsmux.h"
@@ -121,6 +121,7 @@
 #include <sys/kernel.h>
 #include <sys/condvar.h>
 #include <sys/mutex.h>
+#include <sys/kauth.h>
 #include <sys/kthread.h>
 #include <sys/proc.h>
 #include <sys/syslog.h>
@@ -345,6 +346,8 @@
                 int flag, struct lwp *l)
 {
        struct wskbd_bell_data *ubdp, *kbdp;
+       int error;
+
        if (sc->sc_dying == true)
                return (EIO);
 
@@ -356,16 +359,31 @@
                if ((flag & FWRITE) == 0)
                        return (EACCES);
                kbdp = &sc->sc_bell_data;
+setbell:
                ubdp = (struct wskbd_bell_data *)data;
                SETBELL(kbdp, ubdp, kbdp);
                return (0);
 
        case WSKBDIO_GETBELL:
                kbdp = &sc->sc_bell_data;
+getbell:
                ubdp = (struct wskbd_bell_data *)data;
                SETBELL(ubdp, kbdp, kbdp);
                return (0);
 
+       case WSKBDIO_SETDEFAULTBELL:
+               if ((error = kauth_authorize_device(l->l_cred,
+                   KAUTH_DEVICE_WSCONS_KEYBOARD_BELL, NULL, NULL,
+                   NULL, NULL)) != 0)
+                       return (error);
+               kbdp = &wskbd_default_bell_data;
+               goto setbell;
+
+
+       case WSKBDIO_GETDEFAULTBELL:
+               kbdp = &wskbd_default_bell_data;
+               goto getbell;
+
        case WSKBDIO_BELL:
                if ((flag & FWRITE) == 0)
                        return (EACCES);



Home | Main Index | Thread Index | Old Index