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 put back modul...
details: https://anonhg.NetBSD.org/src/rev/541a58c3dd88
branches: trunk
changeset: 340839:541a58c3dd88
user: christos <christos%NetBSD.org@localhost>
date: Sun Oct 04 23:25:32 2015 +0000
description:
put back module filename finding code.
diffstat:
external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c | 30 +++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diffs (40 lines):
diff -r 03485ce5b3bf -r 541a58c3dd88 external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c Sun Oct 04 22:51:19 2015 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c Sun Oct 04 23:25:32 2015 +0000
@@ -1169,6 +1169,36 @@
(void) strlcpy(name, k_stat->name, sizeof(name));
(void) strlcpy(fname, k_stat->pathname, sizeof(fname));
+#elif defined(__NetBSD__)
+ int mib_osrel[2] = { CTL_KERN, KERN_OSRELEASE };
+ int mib_mach[2] = { CTL_HW, HW_MACHINE };
+ char osrel[64];
+ char machine[64];
+ size_t len;
+
+ if (strcmp("netbsd", name) == 0) {
+ /* want the kernel */
+ strncpy(fname, "/netbsd", sizeof(fname));
+ } else {
+
+ /* build stand module path from system */
+ len = sizeof(osrel);
+ if (sysctl(mib_osrel, 2, osrel, &len, NULL, 0) == -1) {
+ dt_dprintf("sysctl osrel failed: %s\n",
+ strerror(errno));
+ return;
+ }
+
+ len = sizeof(machine);
+ if (sysctl(mib_mach, 2, machine, &len, NULL, 0) == -1) {
+ dt_dprintf("sysctl machine failed: %s\n",
+ strerror(errno));
+ return;
+ }
+
+ (void) snprintf(fname, sizeof (fname),
+ "/stand/%s/%s/modules/%s/%s.kmod", machine, osrel, name, name);
+ }
#endif
if ((fd = open(fname, O_RDONLY)) == -1 || fstat64(fd, &st) == -1 ||
Home |
Main Index |
Thread Index |
Old Index