Module Name:    src
Committed By:   nat
Date:           Tue Jun 13 05:49:48 UTC 2017

Modified Files:
        src/sys/dev/wscons: wsbell.c

Log Message:
Implement missing ioctls for the default bell.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/wscons/wsbell.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/wscons/wsbell.c
diff -u src/sys/dev/wscons/wsbell.c:1.7 src/sys/dev/wscons/wsbell.c:1.8
--- src/sys/dev/wscons/wsbell.c:1.7	Tue Jun 13 00:54:37 2017
+++ src/sys/dev/wscons/wsbell.c	Tue Jun 13 05:49:48 2017
@@ -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 <[email protected]>
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1
 #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 @@ wsbell_do_ioctl(struct wsbell_softc *sc,
 		 int flag, struct lwp *l)
 {
 	struct wskbd_bell_data *ubdp, *kbdp;
+	int error;
+
 	if (sc->sc_dying == true)
 		return (EIO);
 
@@ -356,16 +359,31 @@ wsbell_do_ioctl(struct wsbell_softc *sc,
 		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);

Reply via email to