aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/tools/lldb/source/Host/netbsd/HostInfoNetBSD.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Host/netbsd/HostInfoNetBSD.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/Host/netbsd/HostInfoNetBSD.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/contrib/llvm/tools/lldb/source/Host/netbsd/HostInfoNetBSD.cpp b/contrib/llvm/tools/lldb/source/Host/netbsd/HostInfoNetBSD.cpp
index 3c1385ab562f..428183bbe2c3 100644
--- a/contrib/llvm/tools/lldb/source/Host/netbsd/HostInfoNetBSD.cpp
+++ b/contrib/llvm/tools/lldb/source/Host/netbsd/HostInfoNetBSD.cpp
@@ -21,10 +21,6 @@
using namespace lldb_private;
-uint32_t HostInfoNetBSD::GetMaxThreadNameLength() {
- return PTHREAD_MAX_NAMELEN_NP;
-}
-
bool HostInfoNetBSD::GetOSVersion(uint32_t &major, uint32_t &minor,
uint32_t &update) {
struct utsname un;
@@ -85,15 +81,15 @@ FileSpec HostInfoNetBSD::GetProgramFileSpec() {
static FileSpec g_program_filespec;
if (!g_program_filespec) {
- ssize_t len;
- static char buf[PATH_MAX];
- char name[PATH_MAX];
-
- ::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);
+ static const int name[] = {
+ CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME,
+ };
+ char path[MAXPATHLEN];
+ size_t len;
+
+ len = sizeof(path);
+ if (sysctl(name, __arraycount(name), path, &len, NULL, 0) != -1) {
+ g_program_filespec.SetFile(path, false);
}
}
return g_program_filespec;