From f6ddb56a6039c4ff4c06a60ce9b7bfde046e7c78 Mon Sep 17 00:00:00 2001 From: Rui Paulo Date: Sat, 10 Aug 2013 23:17:09 +0000 Subject: [PATCH] Load the dtraceall module if /dev/dtrace/dtrace doesn't exist. MFC after: 3 days --- .../opensolaris/lib/libdtrace/common/dt_open.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c index 25f9956a6918..9c9b2a6e63c6 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c @@ -1086,7 +1086,17 @@ dt_vopen(int version, int flags, int *errp, 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. + */ + if (err == ENOENT && modfind("dtraceall") < 0) { + kldload("dtraceall"); /* ignore the error */ + dtfd = open("/dev/dtrace/dtrace", O_RDWR); + err = errno; + } +#endif #if defined(sun) ftfd = open("/dev/dtrace/provider/fasttrap", O_RDWR); #else