Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F172016209
D44594.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D44594.id.diff
View Options
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -516,6 +516,7 @@
*/
linker_ctf_load_file(lf);
EVENTHANDLER_INVOKE(kld_load, lf);
+ lf->flags |= LINKER_FILE_READY;
*result = lf;
return (0);
}
@@ -701,10 +702,12 @@
}
/* Give eventhandlers a chance to prevent the unload. */
- error = 0;
- EVENTHANDLER_INVOKE(kld_unload_try, file, &error);
- if (error != 0)
- return (EBUSY);
+ if ((file->flags & LINKER_FILE_READY) != 0) {
+ error = 0;
+ EVENTHANDLER_INVOKE(kld_unload_try, file, &error);
+ if (error != 0)
+ return (EBUSY);
+ }
KLD_DPF(FILE, ("linker_file_unload: file is unloading,"
" informing modules\n"));
@@ -787,8 +790,9 @@
LINKER_UNLOAD(file);
- EVENTHANDLER_INVOKE(kld_unload, file->filename, file->address,
- file->size);
+ if ((file->flags & LINKER_FILE_READY) != 0)
+ EVENTHANDLER_INVOKE(kld_unload, file->filename, file->address,
+ file->size);
if (file->filename) {
free(file->filename, M_LINKER);
@@ -1822,7 +1826,7 @@
&si_stop, NULL) == 0)
sysinit_add(si_start, si_stop);
linker_file_register_sysctls(lf, true);
- lf->flags |= LINKER_FILE_LINKED;
+ lf->flags |= LINKER_FILE_LINKED | LINKER_FILE_READY;
continue;
fail:
TAILQ_REMOVE(&depended_files, lf, loaded);
diff --git a/sys/sys/linker.h b/sys/sys/linker.h
--- a/sys/sys/linker.h
+++ b/sys/sys/linker.h
@@ -74,6 +74,7 @@
int flags;
#define LINKER_FILE_LINKED 0x1 /* file has been fully linked */
#define LINKER_FILE_MODULES 0x2 /* file has >0 modules at preload */
+#define LINKER_FILE_READY 0x4 /* file is fully functional */
TAILQ_ENTRY(linker_file) link; /* list of all loaded files */
char* filename; /* file which was loaded */
char* pathname; /* file name with full path */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 16, 10:16 AM (7 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39009888
Default Alt Text
D44594.id.diff (1 KB)
Attached To
Mode
D44594: kern linker: Do not invoke event handlers for partially linked file
Attached
Detach File
Event Timeline
Log In to Comment