aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzfs/os/freebsd/libzfs_compat.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libzfs/os/freebsd/libzfs_compat.c')
-rw-r--r--lib/libzfs/os/freebsd/libzfs_compat.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/libzfs/os/freebsd/libzfs_compat.c b/lib/libzfs/os/freebsd/libzfs_compat.c
index 037ba56efe1c..2de90c7ceea5 100644
--- a/lib/libzfs/os/freebsd/libzfs_compat.c
+++ b/lib/libzfs/os/freebsd/libzfs_compat.c
@@ -176,11 +176,26 @@ execvpe(const char *name, char * const argv[], char * const envp[])
return (execvPe(name, path, argv, envp));
}
+#define ERRBUFLEN 256
+
+__thread static char errbuf[ERRBUFLEN];
+
const char *
libzfs_error_init(int error)
{
+ char *msg = errbuf;
+ size_t len, msglen = ERRBUFLEN;
- return (strerror(error));
+ if (modfind("zfs") < 0) {
+ len = snprintf(msg, msglen, dgettext(TEXT_DOMAIN,
+ "Failed to load %s module: "), ZFS_KMOD);
+ msg += len;
+ msglen -= len;
+ }
+
+ (void) snprintf(msg, msglen, "%s", strerror(error));
+
+ return (errbuf);
}
int
@@ -193,10 +208,6 @@ zfs_ioctl(libzfs_handle_t *hdl, int request, zfs_cmd_t *zc)
* Verify the required ZFS_DEV device is available and optionally attempt
* to load the ZFS modules. Under normal circumstances the modules
* should already have been loaded by some external mechanism.
- *
- * Environment variables:
- * - ZFS_MODULE_LOADING="YES|yes|ON|on" - Attempt to load modules.
- * - ZFS_MODULE_TIMEOUT="<seconds>" - Seconds to wait for ZFS_DEV
*/
int
libzfs_load_module(void)