diff options
| author | Kamil Rytarowski <n54@gmx.com> | 2017-01-28 20:04:53 +0000 |
|---|---|---|
| committer | Kamil Rytarowski <n54@gmx.com> | 2017-01-28 20:04:53 +0000 |
| commit | 3caaaa94c6a2aea5d0cda2550a9d83a3145ed5fd (patch) | |
| tree | 1d2db89fe7df9fa7ebc301e21863966566e3fe35 /lldb/source/Host/netbsd/HostInfoNetBSD.cpp | |
| parent | a89218d603cfab0930fbdb802c148bee36cab989 (diff) | |
| download | bcm5719-llvm-3caaaa94c6a2aea5d0cda2550a9d83a3145ed5fd.tar.gz bcm5719-llvm-3caaaa94c6a2aea5d0cda2550a9d83a3145ed5fd.zip | |
Switch HostInfoNetBSD::GetProgramFileSpec to sysctl(7)
Summary:
Remove dependency on the proc (/proc) filesystem, which is optional.
KERN_PROC_PATHNAME is available in NetBSD-current and will land NetBSD 8.0.
Older stable versions of NetBSD will not be supported.
Sponsored by <The NetBSD Foundation>
Reviewers: emaste, joerg, labath, clayborg
Reviewed By: clayborg
Subscribers: #lldb
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D29089
llvm-svn: 293392
Diffstat (limited to 'lldb/source/Host/netbsd/HostInfoNetBSD.cpp')
| -rw-r--r-- | lldb/source/Host/netbsd/HostInfoNetBSD.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lldb/source/Host/netbsd/HostInfoNetBSD.cpp b/lldb/source/Host/netbsd/HostInfoNetBSD.cpp index 3c1385ab562..f28c8d16250 100644 --- a/lldb/source/Host/netbsd/HostInfoNetBSD.cpp +++ b/lldb/source/Host/netbsd/HostInfoNetBSD.cpp @@ -85,15 +85,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; |

