Module Name:    src
Committed By:   apb
Date:           Wed Jan  4 14:31:17 UTC 2012

Modified Files:
        src/sys/compat/common: kern_time_50.c

Log Message:
Instead of calling clockctl_ioctl directly, lookup the cdevsw and
call its d_ioctl function.  This should fix an undefined reference to
`clockctlioctl' when you build a kernel that has COMPAT_50 but does not
have pseudo-device clockctl.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/compat/common/kern_time_50.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/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.21 src/sys/compat/common/kern_time_50.c:1.22
--- src/sys/compat/common/kern_time_50.c:1.21	Wed Jan  4 13:45:55 2012
+++ src/sys/compat/common/kern_time_50.c	Wed Jan  4 14:31:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.21 2012/01/04 13:45:55 apb Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.22 2012/01/04 14:31:17 apb Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.21 2012/01/04 13:45:55 apb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.22 2012/01/04 14:31:17 apb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_time_50
 #endif
 
 #include <sys/param.h>
+#include <sys/conf.h>
 #include <sys/systm.h>
 #include <sys/namei.h>
 #include <sys/filedesc.h>
@@ -625,6 +626,10 @@ compat50_clockctlioctl(dev_t dev, u_long
     struct lwp *l)
 {
 	int error = 0;
+	const struct cdevsw *cd = cdevsw_lookup(dev);
+
+	if (cd == NULL || cd->d_ioctl == NULL)
+		return ENXIO;
 
 	switch (cmd) {
 	case CLOCKCTL_OSETTIMEOFDAY: {
@@ -672,7 +677,7 @@ compat50_clockctlioctl(dev_t dev, u_long
 	}
 	case CLOCKCTL_ONTP_ADJTIME:
 		/* The ioctl number changed but the data did not change. */
-		error = clockctlioctl(dev, CLOCKCTL_NTP_ADJTIME,
+		error = (cd->d_ioctl)(dev, CLOCKCTL_NTP_ADJTIME,
 		    data, flags, l);
 		break;
 	default:

Reply via email to