Date: Mon, 24 Apr 2006 23:25:30 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 96024 for review Message-ID: <200604242325.k3ONPURu003311@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96024 Change 96024 by jb@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. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604242325.k3ONPURu003311>