Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Oct 2004 23:22:25 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 62719 for review
Message-ID:  <200410052322.i95NMP5p087178@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=62719

Change 62719 by peter@peter_daintree on 2004/10/05 23:21:54

	hack hack. begin CTLTYPE_LONG translation WIP.

Affected files ...

.. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_misc.c#16 edit

Differences ...

==== //depot/projects/hammer/sys/compat/freebsd32/freebsd32_misc.c#16 (text+ko) ====

@@ -1198,18 +1198,32 @@
 int
 freebsd32_sysctl(struct thread *td, struct freebsd32_sysctl_args *uap)
 {
-	int error, name[CTL_MAXNAME];
+	int error, name[CTL_MAXNAME + 2];
+	u_char buf[256];
 	size_t j, oldlen;
 
 	if (uap->namelen > CTL_MAXNAME || uap->namelen < 2)
 		return (EINVAL);
 
- 	error = copyin(uap->name, &name, uap->namelen * sizeof(int));
+	name[0] = 0;	/* Internal sysctl function */
+	name[1] = 4;	/* This is magic */
+ 	error = copyin(uap->name, &name[2], uap->namelen * sizeof(int));
  	if (error)
 		return (error);
 
 	mtx_lock(&Giant);
 
+	j = sizeof(buf);
+	error = kernel_sysctl(td, name, uap->namelen + 2, buf, &j, 0, 0, &j);
+	if (error == 0 && j >= sizeof(u_int)) {
+		int kind = *(u_int *)buf;
+		if ((kind & CTLTYPE) == CTLTYPE_LONG ||
+		    (kind & CTLTYPE) == CTLTYPE_ULONG) {
+			printf("sysctl LONG!\n");
+			/* do conversion */
+		}
+	}
+
 	if (uap->oldlenp)
 		oldlen = fuword32(uap->oldlenp);
 	else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200410052322.i95NMP5p087178>