Module Name:    src
Committed By:   christos
Date:           Thu Apr 12 18:50:13 UTC 2018

Modified Files:
        src/sys/compat/common: compat_mod.c uipc_syscalls_40.c
            uipc_syscalls_50.c
        src/sys/compat/sys: sockio.h

Log Message:
provide vectors for the ifconf compat code and ifdatareq compat code.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.15 -r1.16 src/sys/compat/common/uipc_syscalls_40.c
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/common/uipc_syscalls_50.c
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/sys/sockio.h

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/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.27 src/sys/compat/common/compat_mod.c:1.28
--- src/sys/compat/common/compat_mod.c:1.27	Sun Mar 18 16:33:52 2018
+++ src/sys/compat/common/compat_mod.c	Thu Apr 12 14:50:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.27 2018/03/18 20:33:52 christos Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.28 2018/04/12 18:50:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.27 2018/03/18 20:33:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.28 2018/04/12 18:50:13 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -63,6 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: compat_mod.c
 #include <compat/sys/uvm.h>
 #include <compat/sys/cpuio.h>
 #include <compat/sys/ccdvar.h>
+#include <compat/sys/sockio.h>
 
 #if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_50)
 static struct sysctllog *compat_clog = NULL;
@@ -257,7 +258,11 @@ compat_modcmd(modcmd_t cmd, void *arg)
 #endif
 #endif
 		compat_sysctl_init();
+#ifdef COMPAT_40
+		uipc_syscalls_40_init();
+#endif
 #ifdef COMPAT_50
+		uipc_syscalls_50_init();
 		uvm_50_init();
 #endif
 #ifdef COMPAT_60
@@ -324,7 +329,11 @@ compat_modcmd(modcmd_t cmd, void *arg)
 #endif
 #endif	/* COMPAT_16 */
 		compat_sysctl_fini();
+#ifdef COMPAT_40
+		uipc_syscalls_40_fini();
+#endif
 #ifdef COMPAT_50
+		uipc_syscalls_50_fini();
 		uvm_50_fini();
 #endif
 #ifdef COMPAT_60

Index: src/sys/compat/common/uipc_syscalls_40.c
diff -u src/sys/compat/common/uipc_syscalls_40.c:1.15 src/sys/compat/common/uipc_syscalls_40.c:1.16
--- src/sys/compat/common/uipc_syscalls_40.c:1.15	Wed Nov 22 10:25:34 2017
+++ src/sys/compat/common/uipc_syscalls_40.c	Thu Apr 12 14:50:13 2018
@@ -1,9 +1,9 @@
-/*	$NetBSD: uipc_syscalls_40.c,v 1.15 2017/11/22 15:25:34 martin Exp $	*/
+/*	$NetBSD: uipc_syscalls_40.c,v 1.16 2018/04/12 18:50:13 christos Exp $	*/
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.15 2017/11/22 15:25:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.16 2018/04/12 18:50:13 christos Exp $");
 
 /*
  * System call interface to the socket abstraction.
@@ -21,7 +21,6 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscall
 #include <compat/sys/socket.h>
 #include <compat/sys/sockio.h>
 
-#ifdef COMPAT_OIFREQ
 /*
  * Return interface configuration
  * of system.  List may be used
@@ -29,8 +28,8 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscall
  * other information.
  */
 /*ARGSUSED*/
-int
-compat_ifconf(u_long cmd, void *data)
+static int
+compat_ifconf(struct lwp *l, u_long cmd, void *data)
 {
 	struct oifconf *ifc = data;
 	struct ifnet *ifp;
@@ -42,6 +41,14 @@ compat_ifconf(u_long cmd, void *data)
 	int bound;
 	struct psref psref;
 
+	switch (cmd) {
+	case OSIOCGIFCONF:
+	case OOSIOCGIFCONF:
+		break;
+	default:
+		return ENOSYS;
+	}
+
 	if (docopy) {
 		space = ifc->ifc_len;
 		ifrp = ifc->ifc_req;
@@ -150,4 +157,15 @@ release_exit:
 	curlwp_bindx(bound);
 	return error;
 }
-#endif
+
+void
+uipc_syscalls_40_init(void)
+{
+	vec_compat_ifconf = compat_ifconf;
+}
+
+void
+uipc_syscalls_40_fini(void)
+{
+	vec_compat_ifconf = (void *)enosys;
+}

Index: src/sys/compat/common/uipc_syscalls_50.c
diff -u src/sys/compat/common/uipc_syscalls_50.c:1.3 src/sys/compat/common/uipc_syscalls_50.c:1.4
--- src/sys/compat/common/uipc_syscalls_50.c:1.3	Wed Jan 19 05:21:16 2011
+++ src/sys/compat/common/uipc_syscalls_50.c	Thu Apr 12 14:50:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls_50.c,v 1.3 2011/01/19 10:21:16 tsutsui Exp $	*/
+/*	$NetBSD: uipc_syscalls_50.c,v 1.4 2018/04/12 18:50:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.3 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.4 2018/04/12 18:50:13 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -55,9 +55,8 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscall
 #include <compat/sys/socket.h>
 #include <compat/sys/sockio.h>
 
-#ifdef COMPAT_OIFDATA
 /*ARGSUSED*/
-int
+static int
 compat_ifdatareq(struct lwp *l, u_long cmd, void *data)
 {
 	struct oifdatareq *ifdr = data;
@@ -92,7 +91,18 @@ compat_ifdatareq(struct lwp *l, u_long c
 		return 0;
 
 	default:
-		return EINVAL;
+		return ENOSYS;
 	}
 }
-#endif
+
+void
+uipc_syscalls_50_init(void)
+{
+	vec_compat_ifdatareq = compat_ifdatareq;
+}
+
+void
+uipc_syscalls_50_fini(void)
+{
+	vec_compat_ifdatareq = (void *)enosys;
+}

Index: src/sys/compat/sys/sockio.h
diff -u src/sys/compat/sys/sockio.h:1.10 src/sys/compat/sys/sockio.h:1.11
--- src/sys/compat/sys/sockio.h:1.10	Sun Nov 14 10:36:47 2010
+++ src/sys/compat/sys/sockio.h	Thu Apr 12 14:50:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sockio.h,v 1.10 2010/11/14 15:36:47 uebayasi Exp $	*/
+/*	$NetBSD: sockio.h,v 1.11 2018/04/12 18:50:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993, 1994
@@ -56,8 +56,10 @@
 
 #endif /* _KERNEL_OPT */
 
+#define OIFNAMSIZ	16
+
 struct oifreq {
-	char	ifr_name[IFNAMSIZ];		/* if name, e.g. "en0" */
+	char	ifr_name[OIFNAMSIZ];		/* if name, e.g. "en0" */
 	union {
 		struct	sockaddr ifru_addr;
 		struct	sockaddr ifru_dstaddr;
@@ -114,7 +116,7 @@ struct oif_data {
 };
 
 struct oifdatareq {
-	char	ifdr_name[IFNAMSIZ];		/* if name, e.g. "en0" */
+	char	ifdr_name[OIFNAMSIZ];		/* if name, e.g. "en0" */
 	struct	oif_data ifdr_data;
 };
 
@@ -178,10 +180,19 @@ struct oifdatareq {
 		(ni)->ifi_lastchange.tv_nsec = \
 		    (oi)->ifi_lastchange.tv_usec * 1000; \
 	} while (/*CONSTCOND*/0)
+
 #ifdef _KERNEL
+
 __BEGIN_DECLS
-int compat_ifconf(u_long, void *);
-int compat_ifdatareq(struct lwp *, u_long, void *);
+extern int (*vec_compat_ifconf)(struct lwp *, u_long, void *);
+extern int (*vec_compat_ifdatareq)(struct lwp *, u_long, void *);
+
+void uipc_syscalls_40_init(void);
+void uipc_syscalls_40_fini(void);
+void uipc_syscalls_50_init(void);
+void uipc_syscalls_50_fini(void);
 __END_DECLS
+
 #endif
+
 #endif /* _COMPAT_SYS_SOCKIO_H_ */

Reply via email to