Module Name: src
Committed By: pgoyette
Date: Wed Nov 4 19:27:41 UTC 2020
Modified Files:
src/sys/kern: sys_ptrace_common.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/kern/sys_ptrace_common.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.90 src/sys/kern/sys_ptrace_common.c:1.91
--- src/sys/kern/sys_ptrace_common.c:1.90 Wed Nov 4 18:12:18 2020
+++ src/sys/kern/sys_ptrace_common.c Wed Nov 4 19:27:41 2020
@@ -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 @@ ptrace_listener_cb(kauth_cred_t cred, ka
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 @@ static 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;
}
@@ -1585,6 +1558,19 @@ static 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;
}