Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Merge the two separate sets of init/fini routines a...



details:   https://anonhg.NetBSD.org/src/rev/9f78a9615a5c
branches:  trunk
changeset: 956689:9f78a9615a5c
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed Nov 04 19:27:41 2020 +0000

description:
Merge the two separate sets of init/fini routines and unbreak the build.

XXX Still does not fix the problems noted with 32-bit arm - that will
need a lot more thought.

diffstat:

 sys/kern/sys_ptrace_common.c |  58 ++++++++++++++++---------------------------
 1 files changed, 22 insertions(+), 36 deletions(-)

diffs (93 lines):

diff -r 17d81ca7038a -r 9f78a9615a5c sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c      Wed Nov 04 19:16:34 2020 +0000
+++ b/sys/kern/sys_ptrace_common.c      Wed Nov 04 19:27:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_ptrace_common.c,v 1.90 2020/11/04 18:12:18 pgoyette Exp $  */
+/*     $NetBSD: sys_ptrace_common.c,v 1.91 2020/11/04 19:27:41 pgoyette Exp $  */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -107,7 +107,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.90 2020/11/04 18:12:18 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.91 2020/11/04 19:27:41 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -292,40 +292,6 @@
        return result;
 }
 
-int
-ptrace_common_init(void)
-{
-
-#if 0
-       mutex_init(&ptrace_mtx, MUTEX_DEFAULT, IPL_NONE);
-       cv_init(&ptrace_cv, "ptracecb");
-       ptrace_cbref = 0;
-#endif
-       ptrace_listener = kauth_listen_scope(KAUTH_SCOPE_PROCESS,
-           ptrace_listener_cb, NULL);
-       return 0;
-}
-
-int
-ptrace_common_fini(void)
-{
-
-       kauth_unlisten_scope(ptrace_listener);
-
-#if 0
-       /* Make sure no-one is executing our kauth listener */
-
-       mutex_enter(&ptrace_mtx);
-       while (ptrace_cbref != 0)
-               cv_wait(&ptrace_cv, &ptrace_mtx);
-       mutex_exit(&ptrace_mtx);
-       mutex_destroy(&ptrace_mtx);
-       cv_destroy(&ptrace_cv);
-#endif
-
-       return 0;
-}
-
 static struct proc *
 ptrace_find(struct lwp *l, int req, pid_t pid)
 {
@@ -1578,6 +1544,13 @@
 ptrace_common_init(void)
 {
 
+#if 0
+       mutex_init(&ptrace_mtx, MUTEX_DEFAULT, IPL_NONE);
+       cv_init(&ptrace_cv, "ptracecb");
+       ptrace_cbref = 0;
+#endif
+       ptrace_listener = kauth_listen_scope(KAUTH_SCOPE_PROCESS,
+           ptrace_listener_cb, NULL);
        return 0;
 }
 
@@ -1585,6 +1558,19 @@
 ptrace_common_fini(void)
 {
 
+       kauth_unlisten_scope(ptrace_listener);
+
+#if 0
+       /* Make sure no-one is executing our kauth listener */
+
+       mutex_enter(&ptrace_mtx);
+       while (ptrace_cbref != 0)
+               cv_wait(&ptrace_cv, &ptrace_mtx);
+       mutex_exit(&ptrace_mtx);
+       mutex_destroy(&ptrace_mtx);
+       cv_destroy(&ptrace_cv);
+#endif
+
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index