pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/lang/mono6 mono6: Fix build on NetBSD



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a3c2fd96e9b3
branches:  trunk
changeset: 423265:a3c2fd96e9b3
user:      kamil <kamil%pkgsrc.org@localhost>
date:      Fri Feb 14 00:50:51 2020 +0000

description:
mono6: Fix build on NetBSD

Switch from kvm(3) calls to sysctl(3) ones to detect whether a current
process is debugged.

diffstat:

 lang/mono6/distinfo                                    |   4 +-
 lang/mono6/patches/patch-mono_utils_mono-utils-debug.c |  37 +++++++++++++----
 2 files changed, 30 insertions(+), 11 deletions(-)

diffs (69 lines):

diff -r dd36e92f4b93 -r a3c2fd96e9b3 lang/mono6/distinfo
--- a/lang/mono6/distinfo       Thu Feb 13 23:13:52 2020 +0000
+++ b/lang/mono6/distinfo       Fri Feb 14 00:50:51 2020 +0000
@@ -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_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
diff -r dd36e92f4b93 -r a3c2fd96e9b3 lang/mono6/patches/patch-mono_utils_mono-utils-debug.c
--- a/lang/mono6/patches/patch-mono_utils_mono-utils-debug.c    Thu Feb 13 23:13:52 2020 +0000
+++ b/lang/mono6/patches/patch-mono_utils_mono-utils-debug.c    Fri Feb 14 00:50:51 2020 +0000
@@ -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 @@
  #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)
+ 



Home | Main Index | Thread Index | Old Index