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 Handle automat...
details: https://anonhg.NetBSD.org/src/rev/698c0e93d7e9
branches: trunk
changeset: 962550:698c0e93d7e9
user: hannken <hannken%NetBSD.org@localhost>
date: Wed Jul 24 16:57:45 2019 +0000
description:
Handle automatic module loading on device open more like FreeBSD does.
Where FreeBSD uses a module "dtraceall" that depends on all dtrace
modules we now load the basic set "dtrace sdt fbt syscall" on open.
diffstat:
external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c | 31 +++++++++++++---
1 files changed, 24 insertions(+), 7 deletions(-)
diffs (47 lines):
diff -r ac1d42a42235 -r 698c0e93d7e9 external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c Wed Jul 24 16:54:37 2019 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_open.c Wed Jul 24 16:57:45 2019 +0000
@@ -1140,19 +1140,36 @@
*/
dt_provmod_open(&provmod, &df);
-#ifdef __NetBSD__
+#if defined(__NetBSD__)
modctl_load_t cmdargs;
+ const char * const mod_list[] = {
+ "dtrace",
+ "dtrace_sdt",
+ "dtrace_fbt",
+ "dtrace_syscall"
+ };
- cmdargs.ml_filename = "dtrace";
- cmdargs.ml_flags = MODCTL_NO_PROP;
- cmdargs.ml_props = NULL;
- cmdargs.ml_propslen = 0;
+ dtfd = -1;
+ err = 0;
+ for (i = 0; i < __arraycount(mod_list); i++) {
+ cmdargs.ml_filename = mod_list[i];
+ cmdargs.ml_flags = MODCTL_NO_PROP;
+ cmdargs.ml_props = NULL;
+ cmdargs.ml_propslen = 0;
- (void)modctl(MODCTL_LOAD, &cmdargs);
+ if (modctl(MODCTL_LOAD, &cmdargs) < 0 && errno != EEXIST) {
+ err = errno;
+ break;
+ }
+ }
+ if (err == 0) {
+ dtfd = open("/dev/dtrace/dtrace", O_RDWR);
+ err = errno; /* save errno from opening dtfd */
+ }
#endif
+#if defined(__FreeBSD__)
dtfd = open("/dev/dtrace/dtrace", O_RDWR);
err = errno; /* save errno from opening dtfd */
-#if defined(__FreeBSD__)
/*
* Automatically load the 'dtraceall' module if we couldn't open the
* char device.
Home |
Main Index |
Thread Index |
Old Index