Source-Changes-HG archive

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

[src/trunk]: src/sys if the LKM support is not compiled in, don't bother usin...



details:   https://anonhg.NetBSD.org/src/rev/3ad4f68645fe
branches:  trunk
changeset: 518058:3ad4f68645fe
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Fri Nov 23 22:02:39 2001 +0000

description:
if the LKM support is not compiled in, don't bother using exec_lock
at all, it's only needed in LKM case

use #if defined(LKM) || defined(_LKM) condition for netbsd32_execve.c,
to DTRT when either compiled statically into kernel with LKM support,
or compiled as a LKM

diffstat:

 sys/compat/netbsd32/netbsd32_execve.c |  14 ++++++++++++--
 sys/kern/kern_exec.c                  |  18 ++++++++++++------
 2 files changed, 24 insertions(+), 8 deletions(-)

diffs (155 lines):

diff -r efbd9315f58b -r 3ad4f68645fe sys/compat/netbsd32/netbsd32_execve.c
--- a/sys/compat/netbsd32/netbsd32_execve.c     Fri Nov 23 21:44:25 2001 +0000
+++ b/sys/compat/netbsd32/netbsd32_execve.c     Fri Nov 23 22:02:39 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_execve.c,v 1.6 2001/11/13 02:09:05 lukem Exp $        */
+/*     $NetBSD: netbsd32_execve.c,v 1.7 2001/11/23 22:02:40 jdolecek Exp $     */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_execve.c,v 1.6 2001/11/13 02:09:05 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_execve.c,v 1.7 2001/11/23 22:02:40 jdolecek Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ktrace.h"
@@ -60,7 +60,9 @@
 
 /* this is provided by kern/kern_exec.c */
 extern int exec_maxhdrsz;
+#if defined(LKM) || defined(_LKM)
 extern struct lock exec_lock;
+#endif
 
 /* 
  * Need to completly reimplement this syscall due to argument copying.
@@ -137,7 +139,9 @@
        pack.ep_vap = &attr;
        pack.ep_flags = 0;
 
+#if defined(LKM) || defined(_LKM)
        lockmgr(&exec_lock, LK_SHARED, NULL);
+#endif
 
        /* see if we can run it. */
        if ((error = check_exec(p, &pack)) != 0)
@@ -457,7 +461,9 @@
                ktremul(p);
 #endif
 
+#if defined(LKM) || defined(_LKM)
        lockmgr(&exec_lock, LK_RELEASE, NULL);
+#endif
 
        return (EJUSTRETURN);
 
@@ -477,13 +483,17 @@
        uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
 
 freehdr:
+#if defined(LKM) || defined(_LKM)
        lockmgr(&exec_lock, LK_RELEASE, NULL);
+#endif
 
        free(pack.ep_hdr, M_EXEC);
        return error;
 
 exec_abort:
+#if defined(LKM) || defined(_LKM)
        lockmgr(&exec_lock, LK_RELEASE, NULL);
+#endif
 
        /*
         * the old process doesn't exist anymore.  exit gracefully.
diff -r efbd9315f58b -r 3ad4f68645fe sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c      Fri Nov 23 21:44:25 2001 +0000
+++ b/sys/kern/kern_exec.c      Fri Nov 23 22:02:39 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exec.c,v 1.146 2001/11/12 15:25:08 lukem Exp $    */
+/*     $NetBSD: kern_exec.c,v 1.147 2001/11/23 22:02:39 jdolecek Exp $ */
 
 /*-
  * Copyright (C) 1993, 1994, 1996 Christopher G. Demetriou
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.146 2001/11/12 15:25:08 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.147 2001/11/23 22:02:39 jdolecek Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_syscall_debug.h"
@@ -154,13 +154,13 @@
 #endif
 };
 
+#ifdef LKM
 /*
  * Exec lock. Used to control access to execsw[] structures.
  * This must not be static so that netbsd32 can access it, too.
  */
 struct lock exec_lock;
  
-#ifdef LKM
 static const struct emul * emul_search(const char *);
 static void link_es(struct execsw_entry **, const struct execsw *);
 #endif /* LKM */
@@ -365,7 +365,9 @@
        pack.ep_vap = &attr;
        pack.ep_flags = 0;
 
+#ifdef LKM
        lockmgr(&exec_lock, LK_SHARED, NULL);
+#endif
 
        /* see if we can run it. */
        if ((error = check_exec(p, &pack)) != 0)
@@ -683,7 +685,9 @@
                ktremul(p);
 #endif
 
+#ifdef LKM
        lockmgr(&exec_lock, LK_RELEASE, NULL);
+#endif
 
        return (EJUSTRETURN);
 
@@ -703,13 +707,17 @@
        uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
 
  freehdr:
+#ifdef LKM
        lockmgr(&exec_lock, LK_RELEASE, NULL);
+#endif
 
        free(pack.ep_hdr, M_EXEC);
        return error;
 
  exec_abort:
+#ifdef LKM
        lockmgr(&exec_lock, LK_RELEASE, NULL);
+#endif
 
        /*
         * the old process doesn't exist anymore.  exit gracefully.
@@ -1014,7 +1022,7 @@
 /*
  * Initialize exec structures. If init_boot is true, also does necessary
  * one-time initialization (it's called from main() that way).
- * Once system is multiuser, this should be called with exec_lock hold,
+ * Once system is multiuser, this should be called with exec_lock held,
  * i.e. via exec_{add|remove}().
  */
 int
@@ -1106,8 +1114,6 @@
 #endif
 
        /* do one-time initializations */
-       lockinit(&exec_lock, PWAIT, "execlck", 0, 0);
-
        nexecs = nexecs_builtin;
        execsw = malloc(nexecs*sizeof(struct execsw *), M_EXEC, M_WAITOK);
 



Home | Main Index | Thread Index | Old Index