pkgsrc-WIP-changes archive

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

lldb-netbsd: Switch HostInfoNetBSD::GetProgramFileSpec() to sysctl(7)



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Mon Jan 23 22:51:32 2017 +0100
Changeset:	920bfa7dbbe90a4203c1b1e04890cf98e415e421

Modified Files:
	lldb-netbsd/distinfo
Added Files:
	lldb-netbsd/patches/patch-source_Host_netbsd_HostInfoNetBSD.cpp

Log Message:
lldb-netbsd: Switch HostInfoNetBSD::GetProgramFileSpec() to sysctl(7)

This removes dependency on /proc.

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=920bfa7dbbe90a4203c1b1e04890cf98e415e421

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 lldb-netbsd/distinfo                               |  1 +
 .../patch-source_Host_netbsd_HostInfoNetBSD.cpp    | 28 ++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 7bd9e02..661ef18 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -20,6 +20,7 @@ SHA1 (patch-source_CMakeLists.txt) = 5dacabc3f39c23bdfd432b5a4895866157b97aa0
 SHA1 (patch-source_Host_CMakeLists.txt) = b7b5fbf2354e05c33c63bf47ffa1ef58f58727ef
 SHA1 (patch-source_Host_common_Host.cpp) = 4d9b4f9ef3c2600c46e5f5d5f1f11aa59f15e87f
 SHA1 (patch-source_Host_common_NativeProcessProtocol.cpp) = 23cc7da280b2123cf0206f3d5660d2647935edbc
+SHA1 (patch-source_Host_netbsd_HostInfoNetBSD.cpp) = fd4035ec03f08ebba0c9f81e5a05939da436ec58
 SHA1 (patch-source_Host_netbsd_HostThreadNetBSD.cpp) = a1b0fbdad062309a845cfefe4469614fbbe9d20e
 SHA1 (patch-source_Host_netbsd_ProcessLauncherNetBSD.cpp) = 8f2999d3c57bb2776b048e112ec6b800fb0cea20
 SHA1 (patch-source_Host_netbsd_ThisThread.cpp) = f0d32c81bc1b8fe9aeb86519ea46ba2cb16571c2
diff --git a/lldb-netbsd/patches/patch-source_Host_netbsd_HostInfoNetBSD.cpp b/lldb-netbsd/patches/patch-source_Host_netbsd_HostInfoNetBSD.cpp
new file mode 100644
index 0000000..12f3448
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Host_netbsd_HostInfoNetBSD.cpp
@@ -0,0 +1,28 @@
+$NetBSD$
+
+--- source/Host/netbsd/HostInfoNetBSD.cpp.orig	2016-12-17 10:30:35.000000000 +0000
++++ source/Host/netbsd/HostInfoNetBSD.cpp
+@@ -85,15 +85,15 @@ FileSpec HostInfoNetBSD::GetProgramFileS
+   static FileSpec g_program_filespec;
+ 
+   if (!g_program_filespec) {
+-    ssize_t len;
+-    static char buf[PATH_MAX];
+-    char name[PATH_MAX];
++    static const int name[] = {
++        CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME,
++    };
++    char path[MAXPATHLEN];
++    size_t len;
+ 
+-    ::snprintf(name, PATH_MAX, "/proc/%d/exe", ::getpid());
+-    len = ::readlink(name, buf, PATH_MAX - 1);
+-    if (len != -1) {
+-      buf[len] = '\0';
+-      g_program_filespec.SetFile(buf, false);
++    len = sizeof(path);
++    if (sysctl(name, __arraycount(name), path, &len, NULL, 0) != -1) {
++        g_program_filespec.SetFile(path, false);
+     }
+   }
+   return g_program_filespec;


Home | Main Index | Thread Index | Old Index