PERFORCE change 97437 for review

John Birrell jb at FreeBSD.org
Fri May 19 01:05:12 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=97437

Change 97437 by jb at jb_freebsd2 on 2006/05/19 01:04:31

	Add a function to look through all linker files for a symbol name
	and return it's value.

Affected files ...

.. //depot/projects/dtrace/src/sys/kern/kern_linker.c#5 edit
.. //depot/projects/dtrace/src/sys/sys/linker.h#5 edit

Differences ...

==== //depot/projects/dtrace/src/sys/kern/kern_linker.c#5 (text+ko) ====

@@ -630,6 +630,28 @@
 }
 
 caddr_t
+linker_file_lookup_value(const char *name)
+{
+	linker_file_t lf;
+	c_linker_sym_t sym;
+	linker_symval_t symval;
+
+	symval.value = 0;
+
+	mtx_lock(&kld_mtx);
+
+	TAILQ_FOREACH(lf, &linker_files, link) {
+		if (LINKER_LOOKUP_SYMBOL(lf, name, &sym) == 0 &&
+		    LINKER_SYMBOL_VALUES(lf, sym, &symval) == 0)
+			break;
+	}
+
+	mtx_unlock(&kld_mtx);
+
+	return (symval.value);
+}
+
+caddr_t
 linker_file_lookup_symbol(linker_file_t file, const char *name, int deps)
 {
 	c_linker_sym_t sym;

==== //depot/projects/dtrace/src/sys/sys/linker.h#5 (text+ko) ====

@@ -151,6 +151,11 @@
 				  int _deps);
 
 /*
+ * Lookup a symbol in all files, returning it's value.
+ */
+caddr_t linker_file_lookup_value(const char* _name);
+
+/*
  * Lookup a linker set in a file.  Return pointers to the first entry,
  * last + 1, and count of entries.  Use: for (p = start; p < stop; p++) {}
  * void *start is really: "struct yoursetmember ***start;"


More information about the p4-projects mailing list