Source-Changes-HG archive

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

src: First pass at compat modules for 4.3BSD, NetBSD-0.9, and Ne...



details:   https://anonhg.NetBSD.org/src/rev/a567c9f7818c
branches:  pgoyette-compat
changeset: 318259:a567c9f7818c
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Tue Apr 17 00:02:58 2018 +0000
description:
First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43

diffstat:

 distrib/sets/lists/modules/mi        |    8 ++-
 sys/compat/common/compat_mod.c       |  116 +----------------------------------
 sys/compat/common/compat_mod.h       |   39 +++++++++++-
 sys/compat/common/files.common       |    5 +-
 sys/compat/common/kern_exit_43.c     |   26 +++++++-
 sys/compat/common/kern_info_09.c     |   40 ++++++++++-
 sys/compat/common/kern_info_43.c     |   36 ++++++++++-
 sys/compat/common/kern_resource_43.c |   28 +++++++-
 sys/compat/common/kern_sig_43.c      |   30 ++++++++-
 sys/compat/common/tty_43.c           |   20 +++++-
 sys/compat/common/uipc_syscalls_43.c |   35 +++++++++-
 sys/compat/common/vfs_syscalls_10.c  |    6 +-
 sys/compat/common/vfs_syscalls_43.c  |   25 ++++++-
 sys/compat/common/vm_43.c            |   29 ++++++++-
 sys/modules/Makefile                 |   10 +-
 sys/modules/compat_09/Makefile       |   16 ++++
 sys/modules/compat_10/Makefile       |   16 ++++
 sys/modules/compat_43/Makefile       |   15 ++++
 sys/sys/vfs_syscalls.h               |    4 +-
 19 files changed, 358 insertions(+), 146 deletions(-)

diffs (truncated from 984 to 300 lines):

diff -r 8a9aee329fee -r a567c9f7818c distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi     Mon Apr 16 09:53:02 2018 +0000
+++ b/distrib/sets/lists/modules/mi     Tue Apr 17 00:02:58 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.14 2018/03/31 09:17:35 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.15 2018/04/17 00:02:58 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -70,6 +70,10 @@
 ./@MODULEDIR@/compat/compat.kmod               base-kernel-modules     kmod
 ./@MODULEDIR@/compat_util                      base-kernel-modules     kmod
 ./@MODULEDIR@/compat_util/compat_util.kmod     base-kernel-modules     kmod
+./@MODULEDIR@/compat_09                                base-kernel-modules     kmod
+./@MODULEDIR@/compat_09/compat_09.kmod         base-kernel-modules     kmod
+./@MODULEDIR@/compat_10                                base-kernel-modules     kmod
+./@MODULEDIR@/compat_10/compat_10.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_12                                base-kernel-modules     kmod
 ./@MODULEDIR@/compat_12/compat_12.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_13                                base-kernel-modules     kmod
@@ -84,6 +88,8 @@
 ./@MODULEDIR@/compat_30/compat_30.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_40                                base-kernel-modules     kmod
 ./@MODULEDIR@/compat_40/compat_40.kmod         base-kernel-modules     kmod
+./@MODULEDIR@/compat_43                                base-kernel-modules     kmod
+./@MODULEDIR@/compat_43/compat_43.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_50                                base-kernel-modules     kmod
 ./@MODULEDIR@/compat_50/compat_50.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_60                                base-kernel-modules     kmod
diff -r 8a9aee329fee -r a567c9f7818c sys/compat/common/compat_mod.c
--- a/sys/compat/common/compat_mod.c    Mon Apr 16 09:53:02 2018 +0000
+++ b/sys/compat/common/compat_mod.c    Tue Apr 17 00:02:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.c,v 1.24.14.32 2018/04/16 01:59:56 pgoyette Exp $   */
+/*     $NetBSD: compat_mod.c,v 1.24.14.33 2018/04/17 00:02:58 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,14 +34,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.32 2018/04/16 01:59:56 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.33 2018/04/17 00:02:58 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
 #include "opt_compat_43.h"
-#include "opt_ntp.h"
-#include "opt_sysv.h"
-#include "opt_lfs.h"
 #endif
 
 #include <sys/systm.h>
@@ -53,86 +50,24 @@
 #include <sys/syscallargs.h>
 #include <sys/syscallvar.h>
 #include <sys/sysctl.h>
-#include <sys/vfs_syscalls.h>
-
-#include <net/if.h>
-
-#include <uvm/uvm_extern.h>
-#include <uvm/uvm_object.h>
 
 #include <compat/common/compat_util.h>
 #include <compat/common/compat_mod.h>
-#include <compat/common/if_43.h>
-#include <compat/sys/uvm.h>
-#include <compat/sys/cpuio.h>
 
 #if defined(COMPAT_09) || defined(COMPAT_43)
 static struct sysctllog *compat_clog = NULL;
 #endif
 
-#ifdef COMPAT_70
-#include <net/route.h>
-#include <compat/net/route.h>
-#include <compat/net/route_70.h>
-#endif
-
 static const char * const compat_includes[] = {
        "compat_80", "compat_70", "compat_60", "compat_50", "compat_40",
        "compat_30", "compat_20", "compat_16", "compat_14", "compat_13",
-       "compat_12", NULL
+       "compat_12", /*"compat_10", "compat_09",*/ "compat_43", NULL
 };
 
 MODULE_WITH_ALIASES(MODULE_CLASS_EXEC, compat, NULL, &compat_includes);
 
-
 extern krwlock_t ttcompat_lock;
 
-static const struct syscall_package compat_syscalls[] = {
-#if defined(COMPAT_43)
-       { SYS_compat_43_fstat43, 0, (sy_call_t *)compat_43_sys_fstat },
-       { SYS_compat_43_lstat43, 0, (sy_call_t *)compat_43_sys_lstat },
-       { SYS_compat_43_oaccept, 0, (sy_call_t *)compat_43_sys_accept },
-       { SYS_compat_43_ocreat, 0, (sy_call_t *)compat_43_sys_creat },
-       { SYS_compat_43_oftruncate, 0, (sy_call_t *)compat_43_sys_ftruncate },
-       { SYS_compat_43_ogetdirentries, 0, (sy_call_t *)compat_43_sys_getdirentries },
-       { SYS_compat_43_ogetdtablesize, 0, (sy_call_t *)compat_43_sys_getdtablesize },
-       { SYS_compat_43_ogethostid, 0, (sy_call_t *)compat_43_sys_gethostid },
-       { SYS_compat_43_ogethostname, 0, (sy_call_t *)compat_43_sys_gethostname },
-       { SYS_compat_43_ogetkerninfo, 0, (sy_call_t *)compat_43_sys_getkerninfo },
-       { SYS_compat_43_ogetpagesize, 0, (sy_call_t *)compat_43_sys_getpagesize },
-       { SYS_compat_43_ogetpeername, 0, (sy_call_t *)compat_43_sys_getpeername },
-       { SYS_compat_43_ogetrlimit, 0, (sy_call_t *)compat_43_sys_getrlimit },
-       { SYS_compat_43_ogetsockname, 0, (sy_call_t *)compat_43_sys_getsockname },
-       { SYS_compat_43_okillpg, 0, (sy_call_t *)compat_43_sys_killpg },
-       { SYS_compat_43_olseek, 0, (sy_call_t *)compat_43_sys_lseek },
-       { SYS_compat_43_ommap, 0, (sy_call_t *)compat_43_sys_mmap },
-       { SYS_compat_43_oquota, 0, (sy_call_t *)compat_43_sys_quota },
-       { SYS_compat_43_orecv, 0, (sy_call_t *)compat_43_sys_recv },
-       { SYS_compat_43_orecvfrom, 0, (sy_call_t *)compat_43_sys_recvfrom },
-       { SYS_compat_43_orecvmsg, 0, (sy_call_t *)compat_43_sys_recvmsg },
-       { SYS_compat_43_osend, 0, (sy_call_t *)compat_43_sys_send },
-       { SYS_compat_43_osendmsg, 0, (sy_call_t *)compat_43_sys_sendmsg },
-       { SYS_compat_43_osethostid, 0, (sy_call_t *)compat_43_sys_sethostid },
-       { SYS_compat_43_osethostname, 0, (sy_call_t *)compat_43_sys_sethostname },
-       { SYS_compat_43_osetrlimit, 0, (sy_call_t *)compat_43_sys_setrlimit },
-       { SYS_compat_43_osigblock, 0, (sy_call_t *)compat_43_sys_sigblock },
-       { SYS_compat_43_osigsetmask, 0, (sy_call_t *)compat_43_sys_sigsetmask },
-       { SYS_compat_43_osigstack, 0, (sy_call_t *)compat_43_sys_sigstack },
-       { SYS_compat_43_osigvec, 0, (sy_call_t *)compat_43_sys_sigvec },
-       { SYS_compat_43_otruncate, 0, (sy_call_t *)compat_43_sys_truncate },
-       { SYS_compat_43_owait, 0, (sy_call_t *)compat_43_sys_wait },
-       { SYS_compat_43_stat43, 0, (sy_call_t *)compat_43_sys_stat },
-#endif
-
-#if defined(COMPAT_09)
-       { SYS_compat_09_ogetdomainname, 0, (sy_call_t *)compat_09_sys_getdomainname },
-       { SYS_compat_09_osetdomainname, 0, (sy_call_t *)compat_09_sys_setdomainname },
-       { SYS_compat_09_ouname, 0, (sy_call_t *)compat_09_sys_uname },
-#endif
-
-       { 0, 0, NULL },
-};
-
 struct compat_init_fini {
        int (*init)(void);
        int (*fini)(void);
@@ -170,7 +105,6 @@
 #ifdef COMPAT_12
        { compat_12_init, compat_12_fini },
 #endif
-#if 0  /* NOT YET */
 #ifdef COMPAT_10
        { compat_10_init, compat_10_fini },
 #endif
@@ -180,7 +114,6 @@
 #ifdef COMPAT_43
        { compat_43_init, compat_43_fini },
 #endif
-#endif /* 0 NOT YET */
 };
 
 static int
@@ -207,53 +140,10 @@
                        }
                }
 
-               error = syscall_establish(NULL, compat_syscalls);
-               if (error != 0) {
-                       return error;
-               }
-#ifdef NOTYET /* XXX */
-#ifdef COMPAT_43
-/* XXX
- * XXX This would mean that compat_43 and compat_60 are mutually
- * XXX exclusive.  Rather we should save the original vector
- * XXX value, and retore it if we unload.  Note that compat_43
- * XXX should "require" compat_60 to provide a definitive order
- * XXX of initialization (ie, compat_60 first, then compat_43).
- * XXX
-               KASSERT(ttcompatvec == NULL);
-               ttcompatvec = ttcompat;
-               if_43_init();
- * XXX */
-#endif
-#endif /* XXX NOTYET */
-#ifdef COMPAT_10
-               vfs_syscalls_10_init();
-#endif
                compat_sysctl_init();
                return 0;
 
        case MODULE_CMD_FINI:
-#ifdef COMPAT_10
-               vfs_syscalls_10_fini();
-#endif
-               /* Unlink the system calls. */
-               error = syscall_disestablish(NULL, compat_syscalls);
-               if (error != 0) {
-                       return error;
-               }
-#ifdef NOTYET /* XXX */
-#ifdef COMPAT_43
-               /* Unlink ttcompatvec. */
-               if (rw_tryenter(&ttcompat_lock, RW_WRITER)) {
-                       ttcompatvec = NULL;
-                       rw_exit(&ttcompat_lock);
-               } else {
-                       error = syscall_establish(NULL, compat_syscalls);
-                       KASSERT(error == 0);
-                       return EBUSY;
-               }
-#endif
-#endif /* NOTYET XXX */
                /*
                 * Disable included components in reverse order;
                 * if any component fails to fini(), re-init those
diff -r 8a9aee329fee -r a567c9f7818c sys/compat/common/compat_mod.h
--- a/sys/compat/common/compat_mod.h    Mon Apr 16 09:53:02 2018 +0000
+++ b/sys/compat/common/compat_mod.h    Tue Apr 17 00:02:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.h,v 1.1.42.19 2018/04/16 03:41:34 pgoyette Exp $    */
+/*     $NetBSD: compat_mod.h,v 1.1.42.20 2018/04/17 00:02:58 pgoyette Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -152,4 +152,41 @@
 int vfs_syscalls_12_fini(void);
 #endif
 
+#ifdef COMPAT_10
+int compat_10_init(void);
+int compat_10_fini(void);
+void vfs_syscalls_10_init(void);
+void vfs_syscalls_10_fini(void);
+#endif
+
+#ifdef COMPAT_09
+int compat_09_init(void);
+int compat_09_fini(void);
+int kern_info_09_init(void);
+int kern_info_09_fini(void);
+#endif
+
+#ifdef COMPAT_43
+int compat_43_init(void);
+int compat_43_fini(void);
+int kern_exit_43_init(void);
+int kern_exit_43_fini(void);
+int kern_info_43_init(void);
+int kern_info_43_fini(void);
+int kern_resource_43_init(void);
+int kern_resource_43_fini(void);
+int kern_sig_43_init(void);
+int kern_sig_43_fini(void);
+int tty_43_init(void);
+int tty_43_fini(void);
+int uipc_syscalls_43_init(void);
+int uipc_syscalls_43_fini(void);
+int vfs_syscalls_43_init(void);
+int vfs_syscalls_43_fini(void);
+int vm_43_init(void);
+int vm_43_fini(void);
+int if_43_init(void);
+int if_43_fini(void);
+#endif
+
 #endif /* !_COMPAT_MOD_H_ */
diff -r 8a9aee329fee -r a567c9f7818c sys/compat/common/files.common
--- a/sys/compat/common/files.common    Mon Apr 16 09:53:02 2018 +0000
+++ b/sys/compat/common/files.common    Tue Apr 17 00:02:58 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.common,v 1.1.2.30 2018/04/03 08:29:44 pgoyette Exp $
+#      $NetBSD: files.common,v 1.1.2.31 2018/04/17 00:02:58 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -12,6 +12,7 @@
 #
 
 # Compatibility code for 4.3BSD
+file   compat/common/compat_43_mod.c           compat_43
 file   compat/common/kern_exit_43.c            compat_43
 file   compat/common/kern_info_43.c            compat_43
 file   compat/common/kern_resource_43.c        compat_43
@@ -23,9 +24,11 @@
 file   compat/common/if_43.c                   compat_43
 
 # Compatibility code for NetBSD 0.9
+file   compat/common/compat_09_mod.c           compat_09
 file   compat/common/kern_info_09.c            compat_09
 
 # Compatability code for NetBSD 1.0
+file   compat/common/compat_10_mod.c           compat_10
 file   compat/common/vfs_syscalls_10.c         compat_10
 
 # Compatibility code for NetBSD 1.2
diff -r 8a9aee329fee -r a567c9f7818c sys/compat/common/kern_exit_43.c
--- a/sys/compat/common/kern_exit_43.c  Mon Apr 16 09:53:02 2018 +0000
+++ b/sys/compat/common/kern_exit_43.c  Tue Apr 17 00:02:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exit_43.c,v 1.22 2009/11/04 21:23:02 rmind Exp $  */
+/*     $NetBSD: kern_exit_43.c,v 1.22.62.1 2018/04/17 00:02:58 pgoyette Exp $  */
 
 /*



Home | Main Index | Thread Index | Old Index