PERFORCE change 96024 for review
John Birrell
jb at FreeBSD.org
Mon Apr 24 23:25:31 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=96024
Change 96024 by jb at jb_freebsd2 on 2006/04/24 23:24:52
Add a function to iterate over each linker file and call a
callback function.
DTrace needs to do this. It's important that the linker file
list remains locked while the callback function is in progress.
Ideally the linker file lock would allow the callback function
to allocate memory with wait.
Affected files ...
.. //depot/projects/dtrace/src/sys/kern/kern_linker.c#3 edit
.. //depot/projects/dtrace/src/sys/sys/linker.h#3 edit
Differences ...
==== //depot/projects/dtrace/src/sys/kern/kern_linker.c#3 (text+ko) ====
@@ -608,6 +608,27 @@
return (LINKER_LOOKUP_SET(file, name, firstp, lastp, countp));
}
+/*
+ * List linker files.
+ */
+int
+linker_file_list(int (*callback_func)(linker_file_t,void *),void *arg)
+{
+ linker_file_t lf;
+ int error = 0;
+
+ mtx_lock(&kld_mtx);
+
+ TAILQ_FOREACH(lf, &linker_files, link) {
+ if ((error = callback_func(lf, arg)) != 0)
+ break;
+ }
+
+ mtx_unlock(&kld_mtx);
+
+ return (error);
+}
+
caddr_t
linker_file_lookup_symbol(linker_file_t file, const char *name, int deps)
{
==== //depot/projects/dtrace/src/sys/sys/linker.h#3 (text+ko) ====
@@ -159,6 +159,11 @@
void *_start, void *_stop, int *_count);
/*
+ * List linker files.
+ */
+int linker_file_list(int (*)(linker_file_t,void *),void *);
+
+/*
* This routine is responsible for finding dependencies of userland
* initiated kldload(2)'s of files.
*/
More information about the p4-projects
mailing list