Source-Changes-D archive

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

Re: CVS commit: src/sys/compat/netbsd32



On 2016/11/16 18:33, Michael van Elst wrote:
So I suggest to make the compat32 code handle CLOCK_NTP_ADJTIME even
when compiled with !NTP but just return ENOTTY.

N.B. clockctlioctl returns EINVAL for unrecognized ioctl commands,
it should also return ENOTTY.

I wrote a patch. Besides your suggestions, I protected NTP stuff in
compat50 codes by NTP macro. Is it ok with you?

Thanks,
Rin
--- src/sys/compat/netbsd32/netbsd32_ioctl.c.orig	2016-11-17 21:10:05.784020949 +0900
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	2016-11-17 21:17:42.250121516 +0900
@@ -1324,8 +1324,8 @@
 	case CLOCKCTL_CLOCK_SETTIME32:
 		IOCTL_STRUCT_CONV_TO(CLOCKCTL_CLOCK_SETTIME,
 		    clockctl_clock_settime);
-#ifdef NTP
 	case CLOCKCTL_NTP_ADJTIME32:
+#ifdef NTP
 		{
 			size = IOCPARM_LEN(CLOCKCTL_NTP_ADJTIME);
 			if (size > sizeof(stkbuf))
@@ -1346,7 +1346,10 @@
 
 			break;
 		}
-#endif
+#else
+		error = ENOTTY;
+		break;
+#endif /* NTP */
 
 	case KIOCGSYMBOL32:
 		IOCTL_STRUCT_CONV_TO(KIOCGSYMBOL, ksyms_gsymbol);
--- src/sys/dev/clockctl.c.orig	2016-11-17 21:17:52.116138355 +0900
+++ src/sys/dev/clockctl.c	2016-11-17 21:25:27.068388985 +0900
@@ -266,7 +266,7 @@
 #ifdef COMPAT_50
 		error = compat50_clockctlioctl(dev, cmd, data, flags, l);
 #else
-		error = EINVAL;
+		error = ENOTTY;
 #endif
 	}
 
@@ -328,13 +328,16 @@
 		error = clock_settime1(l->l_proc, args->clock_id, &tp, true);
 		break;
 	}
-	case CLOCKCTL_ONTP_ADJTIME:
+#ifdef NTP
+	case CLOCKCTL_ONTP_ADJTIME: {
 		/* The ioctl number changed but the data did not change. */
 		error = (cd->d_ioctl)(dev, CLOCKCTL_NTP_ADJTIME,
 		    data, flags, l);
 		break;
+	}
+#endif
 	default:
-		error = EINVAL;
+		error = ENOTTY;
 	}
 
 	return (error);


Home | Main Index | Thread Index | Old Index