mono6: Fix build on NetBSD
Switch from kvm(3) calls to sysctl(3) ones to detect whether a current process is debugged.
This commit is contained in:
parent
8539fe04de
commit
b443a903df
2 changed files with 30 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: distinfo,v 1.7 2020/02/12 15:25:15 ryoon Exp $
|
||||
$NetBSD: distinfo,v 1.8 2020/02/14 00:50:51 kamil Exp $
|
||||
|
||||
SHA1 (mono-6.8.0.105.tar.xz) = e39aa0ac15b3b73ecf0767462798a5acde0aed79
|
||||
RMD160 (mono-6.8.0.105.tar.xz) = 5a84c75f941d5a2a645999e13da8458fc87d3bac
|
||||
|
@ -21,6 +21,6 @@ SHA1 (patch-mono_metadata_w32mutex-unix.c) = c3d424fe4ae1079c9c664c876a087fb0134
|
|||
SHA1 (patch-mono_utils_mono-os-semaphore.h) = b850911945c95be804e9462263d558ef702831ca
|
||||
SHA1 (patch-mono_utils_mono-sigcontext.h) = b8a6f886661622e9b0d382443536bd3dc998f95f
|
||||
SHA1 (patch-mono_utils_mono-threads-posix.c) = 3111d6a47fa104d964b34fdb5f7eca8643559ea3
|
||||
SHA1 (patch-mono_utils_mono-utils-debug.c) = b813d7a3c652f120c658c3c3eeacd9c1f8b60be4
|
||||
SHA1 (patch-mono_utils_mono-utils-debug.c) = 39f099969040b3a52101b611be723b25674ea68b
|
||||
SHA1 (patch-runtime_mono-wrapper.in) = ea40d2f2e8b67de0ae42c6e608e3c085dc2b040e
|
||||
SHA1 (patch-support_minizip_ioapi.c) = 605c86916c957c31a8b3048d7703482f8f545463
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: patch-mono_utils_mono-utils-debug.c,v 1.2 2020/02/12 15:25:16 ryoon Exp $
|
||||
$NetBSD: patch-mono_utils_mono-utils-debug.c,v 1.3 2020/02/14 00:50:51 kamil Exp $
|
||||
|
||||
Learn to use kinfo_proc2 on netbsd
|
||||
|
||||
|
@ -13,15 +13,34 @@ Learn to use kinfo_proc2 on netbsd
|
|||
#endif
|
||||
#if defined (_AIX)
|
||||
#include <procinfo.h>
|
||||
@@ -78,8 +80,9 @@ mono_is_usermode_native_debugger_present
|
||||
if (!kd)
|
||||
@@ -74,14 +76,23 @@ mono_is_usermode_native_debugger_present
|
||||
|
||||
#elif defined (__NetBSD__)
|
||||
|
||||
- kvm_t * const kd = kvm_open (NULL, NULL, NULL, KVM_NO_FILES, "kvm_open");
|
||||
- if (!kd)
|
||||
+ struct kinfo_proc2 p;
|
||||
+ size_t len = sizeof(p);
|
||||
+ int name[] = {
|
||||
+ [0] = CTL_KERN,
|
||||
+ [1] = KERN_PROC2,
|
||||
+ [2] = KERN_PROC_PID,
|
||||
+ [3] = getpid(),
|
||||
+ [4] = (int)(sizeof(struct kinfo_proc2)),
|
||||
+ [5] = 1
|
||||
+ };
|
||||
+
|
||||
+ const size_t namelen = __arraycount(name);
|
||||
+
|
||||
+ if (sysctl(name, namelen, &p, &len, NULL, 0) == -1)
|
||||
return FALSE;
|
||||
int count = 0;
|
||||
- int count = 0;
|
||||
- struct kinfo_proc const * const info = kvm_getprocs (kd, KERN_PROC_PID, getpid (), &count);
|
||||
- gboolean const traced = info && count > 0 && (info->kp_proc.p_slflag & PSL_TRACED);
|
||||
+ int nproc;
|
||||
+ struct kinfo_proc2 const * const info = kvm_getproc2 (kd, KERN_PROC_PID, getpid (), sizeof(struct kinfo_proc2), &count);
|
||||
+ gboolean const traced = info && count > 0 && (info->p_flag & P_TRACED);
|
||||
kvm_close (kd);
|
||||
return traced;
|
||||
- kvm_close (kd);
|
||||
- return traced;
|
||||
+
|
||||
+ return (p.p_flag & P_TRACED) ? TRUE : FALSE;
|
||||
|
||||
#elif defined (_AIX)
|
||||
|
||||
|
|
Loading…
Reference in a new issue