summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcth <none@none>2005-08-06 19:19:22 -0700
committercth <none@none>2005-08-06 19:19:22 -0700
commit5c3113005025c7746cee7871e37f22045f093f96 (patch)
treef9df80b7eb361e305f32fcceceae0460a5fea44d
parent43a291055ab3951f6372241323fd4e2486098fff (diff)
downloadillumos-gate-5c3113005025c7746cee7871e37f22045f093f96.tar.gz
6302583 modload with absolute paths does not work in snv_20
-rw-r--r--usr/src/uts/common/krtld/kobj.c19
-rw-r--r--usr/src/uts/common/krtld/kobj_stubs.c7
-rw-r--r--usr/src/uts/common/krtld/mapfile1
-rw-r--r--usr/src/uts/common/os/modctl.c9
-rw-r--r--usr/src/uts/common/sys/kobj.h1
-rw-r--r--usr/src/uts/sparc/krtld/mapfile1
6 files changed, 30 insertions, 8 deletions
diff --git a/usr/src/uts/common/krtld/kobj.c b/usr/src/uts/common/krtld/kobj.c
index 4b764fd337..6df0916ea0 100644
--- a/usr/src/uts/common/krtld/kobj.c
+++ b/usr/src/uts/common/krtld/kobj.c
@@ -3195,6 +3195,25 @@ kobj_boot_mod_lookup(const char *modname)
}
/*
+ * Determine if the module exists.
+ */
+int
+kobj_path_exists(char *name, int use_path)
+{
+ struct _buf *file;
+
+ file = kobj_open_path(name, use_path, 1);
+#ifdef MODDIR_SUFFIX
+ if (file == (struct _buf *)-1)
+ file = kobj_open_path(name, use_path, 0);
+#endif /* MODDIR_SUFFIX */
+ if (file == (struct _buf *)-1)
+ return (0);
+ kobj_close_file(file);
+ return (1);
+}
+
+/*
* fullname is dynamically allocated to be able to hold the
* maximum size string that can be constructed from name.
* path is exactly like the shell PATH variable.
diff --git a/usr/src/uts/common/krtld/kobj_stubs.c b/usr/src/uts/common/krtld/kobj_stubs.c
index f3b381b097..7bc82c5139 100644
--- a/usr/src/uts/common/krtld/kobj_stubs.c
+++ b/usr/src/uts/common/krtld/kobj_stubs.c
@@ -55,6 +55,13 @@ kobj_unload_module(struct modctl *modp)
{}
/*ARGSUSED*/
+int
+kobj_path_exists(char *name, int use_path)
+{
+ return (0);
+}
+
+/*ARGSUSED*/
struct _buf *
kobj_open_path(char *name, int use_path, int use_moddir_suffix)
{
diff --git a/usr/src/uts/common/krtld/mapfile b/usr/src/uts/common/krtld/mapfile
index 9428e54c5b..398c6dcf32 100644
--- a/usr/src/uts/common/krtld/mapfile
+++ b/usr/src/uts/common/krtld/mapfile
@@ -49,6 +49,7 @@
kobj_notify_remove;
kobj_open;
kobj_open_file;
+ kobj_path_exists;
kobj_open_path;
kobj_read;
kobj_read_file;
diff --git a/usr/src/uts/common/os/modctl.c b/usr/src/uts/common/os/modctl.c
index 84aa333ce7..752ca7840c 100644
--- a/usr/src/uts/common/os/modctl.c
+++ b/usr/src/uts/common/os/modctl.c
@@ -2262,23 +2262,16 @@ mod_hold_installed_mod(char *name, int usepath, int *r)
{
struct modctl *modp;
int retval;
- struct _buf *file;
/*
* Verify that that module in question actually exists on disk
* before allocation of module structure by mod_hold_by_name.
*/
if (modrootloaded && swaploaded) {
- file = kobj_open_path(name, usepath, 1);
-#ifdef MODDIR_SUFFIX
- if (file == (struct _buf *)-1)
- file = kobj_open_path(name, usepath, 0);
-#endif /* MODDIR_SUFFIX */
- if (file == (struct _buf *)-1) {
+ if (!kobj_path_exists(name, usepath)) {
*r = ENOENT;
return (NULL);
}
- kobj_close_file(file);
}
/*
diff --git a/usr/src/uts/common/sys/kobj.h b/usr/src/uts/common/sys/kobj.h
index cb1063c4e9..4051cef88e 100644
--- a/usr/src/uts/common/sys/kobj.h
+++ b/usr/src/uts/common/sys/kobj.h
@@ -189,6 +189,7 @@ extern char *kobj_getsymname(uintptr_t, ulong_t *);
extern char *kobj_searchsym(struct module *, uintptr_t, ulong_t *);
extern intptr_t kobj_open(char *);
+extern int kobj_path_exists(char *, int);
extern struct _buf *kobj_open_path(char *, int, int);
extern int kobj_read(intptr_t, char *, unsigned int, unsigned int);
extern void kobj_close(intptr_t);
diff --git a/usr/src/uts/sparc/krtld/mapfile b/usr/src/uts/sparc/krtld/mapfile
index 21c552669f..4fb702b4f6 100644
--- a/usr/src/uts/sparc/krtld/mapfile
+++ b/usr/src/uts/sparc/krtld/mapfile
@@ -48,6 +48,7 @@
kobj_notify_remove;
kobj_open;
kobj_open_file;
+ kobj_path_exists;
kobj_open_path;
kobj_read;
kobj_read_file;