kern_linker.c (159845) | kern_linker.c (160142) |
---|---|
1/*- 2 * Copyright (c) 1997-2000 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997-2000 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/kern/kern_linker.c 159845 2006-06-21 20:42:08Z jhb $"); | 28__FBSDID("$FreeBSD: head/sys/kern/kern_linker.c 160142 2006-07-06 21:39:39Z jhb $"); |
29 30#include "opt_ddb.h" 31#include "opt_hwpmc_hooks.h" 32#include "opt_mac.h" 33 34#include <sys/param.h> 35#include <sys/kernel.h> 36#include <sys/systm.h> --- 20 unchanged lines hidden (view full) --- 57#ifdef HWPMC_HOOKS 58#include <sys/pmckern.h> 59#endif 60 61#ifdef KLD_DEBUG 62int kld_debug = 0; 63#endif 64 | 29 30#include "opt_ddb.h" 31#include "opt_hwpmc_hooks.h" 32#include "opt_mac.h" 33 34#include <sys/param.h> 35#include <sys/kernel.h> 36#include <sys/systm.h> --- 20 unchanged lines hidden (view full) --- 57#ifdef HWPMC_HOOKS 58#include <sys/pmckern.h> 59#endif 60 61#ifdef KLD_DEBUG 62int kld_debug = 0; 63#endif 64 |
65#define KLD_LOCK() do { sx_xlock(&kld_sx); mtx_lock(&Giant); } while (0) 66#define KLD_UNLOCK() do { mtx_unlock(&Giant); sx_xunlock(&kld_sx); } while (0) | 65#define KLD_LOCK() sx_xlock(&kld_sx) 66#define KLD_UNLOCK() sx_xunlock(&kld_sx) |
67#define KLD_LOCKED() sx_xlocked(&kld_sx) | 67#define KLD_LOCKED() sx_xlocked(&kld_sx) |
68#define KLD_LOCK_ASSERT() do { if (!cold) sx_assert(&kld_sx, SX_XLOCKED); } while (0) | 68#define KLD_LOCK_ASSERT() do { \ 69 if (!cold) \ 70 sx_assert(&kld_sx, SX_XLOCKED); \ 71} while (0) |
69 70/* 71 * static char *linker_search_path(const char *name, struct mod_depend 72 * *verinfo); 73 */ 74static const char *linker_basename(const char *path); 75 76/* --- 130 unchanged lines hidden (view full) --- 207 *xipp = save; 208 } 209 } 210 211 /* 212 * Traverse the (now) ordered list of system initialization tasks. 213 * Perform each task, and continue on to the next task. 214 */ | 72 73/* 74 * static char *linker_search_path(const char *name, struct mod_depend 75 * *verinfo); 76 */ 77static const char *linker_basename(const char *path); 78 79/* --- 130 unchanged lines hidden (view full) --- 210 *xipp = save; 211 } 212 } 213 214 /* 215 * Traverse the (now) ordered list of system initialization tasks. 216 * Perform each task, and continue on to the next task. 217 */ |
218 mtx_lock(&Giant); |
|
215 for (sipp = start; sipp < stop; sipp++) { 216 if ((*sipp)->subsystem == SI_SUB_DUMMY) 217 continue; /* skip dummy task(s) */ 218 219 /* Call function */ 220 (*((*sipp)->func)) ((*sipp)->udata); 221 } | 219 for (sipp = start; sipp < stop; sipp++) { 220 if ((*sipp)->subsystem == SI_SUB_DUMMY) 221 continue; /* skip dummy task(s) */ 222 223 /* Call function */ 224 (*((*sipp)->func)) ((*sipp)->udata); 225 } |
226 mtx_unlock(&Giant); |
|
222} 223 224static void 225linker_file_sysuninit(linker_file_t lf) 226{ 227 struct sysinit **start, **stop, **sipp, **xipp, *save; 228 229 KLD_DPF(FILE, ("linker_file_sysuninit: calling SYSUNINITs for %s\n", --- 21 unchanged lines hidden (view full) --- 251 *xipp = save; 252 } 253 } 254 255 /* 256 * Traverse the (now) ordered list of system initialization tasks. 257 * Perform each task, and continue on to the next task. 258 */ | 227} 228 229static void 230linker_file_sysuninit(linker_file_t lf) 231{ 232 struct sysinit **start, **stop, **sipp, **xipp, *save; 233 234 KLD_DPF(FILE, ("linker_file_sysuninit: calling SYSUNINITs for %s\n", --- 21 unchanged lines hidden (view full) --- 256 *xipp = save; 257 } 258 } 259 260 /* 261 * Traverse the (now) ordered list of system initialization tasks. 262 * Perform each task, and continue on to the next task. 263 */ |
264 mtx_lock(&Giant); |
|
259 for (sipp = start; sipp < stop; sipp++) { 260 if ((*sipp)->subsystem == SI_SUB_DUMMY) 261 continue; /* skip dummy task(s) */ 262 263 /* Call function */ 264 (*((*sipp)->func)) ((*sipp)->udata); 265 } | 265 for (sipp = start; sipp < stop; sipp++) { 266 if ((*sipp)->subsystem == SI_SUB_DUMMY) 267 continue; /* skip dummy task(s) */ 268 269 /* Call function */ 270 (*((*sipp)->func)) ((*sipp)->udata); 271 } |
272 mtx_unlock(&Giant); |
|
266} 267 268static void 269linker_file_register_sysctls(linker_file_t lf) 270{ 271 struct sysctl_oid **start, **stop, **oidp; 272 273 KLD_DPF(FILE, --- 1734 unchanged lines hidden --- | 273} 274 275static void 276linker_file_register_sysctls(linker_file_t lf) 277{ 278 struct sysctl_oid **start, **stop, **oidp; 279 280 KLD_DPF(FILE, --- 1734 unchanged lines hidden --- |