Source-Changes-HG archive

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

[src/trunk]: src/external/cddl/osnet/dist/lib/libdtrace/common Use /dev/ksyms...



details:   https://anonhg.NetBSD.org/src/rev/a6082611b809
branches:  trunk
changeset: 1007244:a6082611b809
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Feb 12 01:10:08 2020 +0000

description:
Use /dev/ksyms, not /netbsd, for the running kernel's symbols.

diffstat:

 external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h   |   2 -
 external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c |   5 +--
 external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c   |  20 +++------------
 3 files changed, 6 insertions(+), 21 deletions(-)

diffs (76 lines):

diff -r 639d34dd3cdf -r a6082611b809 external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h   Wed Feb 12 01:09:48 2020 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h   Wed Feb 12 01:10:08 2020 +0000
@@ -750,8 +750,6 @@
 #endif
 
 #ifdef __NetBSD__
-extern const char *dt_bootfile(char *, size_t);
-
 #define longlong_t long long
 #define u_longlong_t unsigned long long
 #define __DECONST(a, b) __UNCONST(b)
diff -r 639d34dd3cdf -r a6082611b809 external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c Wed Feb 12 01:09:48 2020 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c Wed Feb 12 01:10:08 2020 +0000
@@ -43,6 +43,7 @@
 #endif
 #ifdef __NetBSD__
 #include <sys/sysctl.h>
+#include <paths.h>
 #endif
 
 #include <unistd.h>
@@ -1185,9 +1186,7 @@
        bool ismod;
 
        if (strcmp("netbsd", name) == 0) {
-               /* want the kernel, but it is not absolute */
-               dt_bootfile(machine, sizeof(machine));
-               snprintf(fname, sizeof(fname), "/%s", machine);
+               strlcpy(fname, _PATH_KSYMS, sizeof fname);
                ismod = false;
        } else {
 
diff -r 639d34dd3cdf -r a6082611b809 external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c   Wed Feb 12 01:09:48 2020 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c   Wed Feb 12 01:10:08 2020 +0000
@@ -1025,24 +1025,15 @@
 }
 #endif
 
-#ifndef illumos
-# ifdef __FreeBSD__
-#  define DEFKERNEL    "kernel"
-#  define BOOTFILE     "kern.bootfile"
-# endif
-# ifdef __NetBSD__
-#  define DEFKERNEL    "netbsd"
-#  define BOOTFILE     "machdep.booted_kernel"
-# endif
-
-const char *
+#ifdef __FreeBSD__
+static const char *
 dt_bootfile(char *bootfile, size_t len)
 {
        char *p;
        size_t olen = len;
 
-       if (sysctlbyname(BOOTFILE, bootfile, &len, NULL, 0) != 0)
-               strlcpy(bootfile, DEFKERNEL, olen);
+       if (sysctlbyname("kern.bootfile", bootfile, &len, NULL, 0) != 0)
+               strlcpy(bootfile, "kernel", olen);
 
        if ((p = strrchr(bootfile, '/')) != NULL)
                p++;
@@ -1050,9 +1041,6 @@
                p = bootfile;
        return p;
 }
-
-# undef DEFKERNEL
-# undef BOOTFILE
 #endif
 
 static dtrace_hdl_t *



Home | Main Index | Thread Index | Old Index