1*4a5d661aSToomas Soome /*- 2*4a5d661aSToomas Soome * Copyright (c) 1997-2000 Doug Rabson 3*4a5d661aSToomas Soome * All rights reserved. 4*4a5d661aSToomas Soome * 5*4a5d661aSToomas Soome * Redistribution and use in source and binary forms, with or without 6*4a5d661aSToomas Soome * modification, are permitted provided that the following conditions 7*4a5d661aSToomas Soome * are met: 8*4a5d661aSToomas Soome * 1. Redistributions of source code must retain the above copyright 9*4a5d661aSToomas Soome * notice, this list of conditions and the following disclaimer. 10*4a5d661aSToomas Soome * 2. Redistributions in binary form must reproduce the above copyright 11*4a5d661aSToomas Soome * notice, this list of conditions and the following disclaimer in the 12*4a5d661aSToomas Soome * documentation and/or other materials provided with the distribution. 13*4a5d661aSToomas Soome * 14*4a5d661aSToomas Soome * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15*4a5d661aSToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16*4a5d661aSToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17*4a5d661aSToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18*4a5d661aSToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19*4a5d661aSToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20*4a5d661aSToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21*4a5d661aSToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22*4a5d661aSToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23*4a5d661aSToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24*4a5d661aSToomas Soome * SUCH DAMAGE. 25*4a5d661aSToomas Soome * 26*4a5d661aSToomas Soome * $FreeBSD$ 27*4a5d661aSToomas Soome */ 28*4a5d661aSToomas Soome 29*4a5d661aSToomas Soome #ifndef _SYS_LINKER_H_ 30*4a5d661aSToomas Soome #define _SYS_LINKER_H_ 31*4a5d661aSToomas Soome 32*4a5d661aSToomas Soome #ifdef _KERNEL 33*4a5d661aSToomas Soome 34*4a5d661aSToomas Soome #include <machine/elf.h> 35*4a5d661aSToomas Soome #include <sys/kobj.h> 36*4a5d661aSToomas Soome 37*4a5d661aSToomas Soome #ifdef MALLOC_DECLARE 38*4a5d661aSToomas Soome MALLOC_DECLARE(M_LINKER); 39*4a5d661aSToomas Soome #endif 40*4a5d661aSToomas Soome 41*4a5d661aSToomas Soome struct mod_depend; 42*4a5d661aSToomas Soome 43*4a5d661aSToomas Soome /* 44*4a5d661aSToomas Soome * Object representing a file which has been loaded by the linker. 45*4a5d661aSToomas Soome */ 46*4a5d661aSToomas Soome typedef struct linker_file* linker_file_t; 47*4a5d661aSToomas Soome typedef TAILQ_HEAD(, linker_file) linker_file_list_t; 48*4a5d661aSToomas Soome 49*4a5d661aSToomas Soome typedef caddr_t linker_sym_t; /* opaque symbol */ 50*4a5d661aSToomas Soome typedef c_caddr_t c_linker_sym_t; /* const opaque symbol */ 51*4a5d661aSToomas Soome typedef int (*linker_function_name_callback_t)(const char *, void *); 52*4a5d661aSToomas Soome 53*4a5d661aSToomas Soome /* 54*4a5d661aSToomas Soome * expanded out linker_sym_t 55*4a5d661aSToomas Soome */ 56*4a5d661aSToomas Soome typedef struct linker_symval { 57*4a5d661aSToomas Soome const char* name; 58*4a5d661aSToomas Soome caddr_t value; 59*4a5d661aSToomas Soome size_t size; 60*4a5d661aSToomas Soome } linker_symval_t; 61*4a5d661aSToomas Soome 62*4a5d661aSToomas Soome typedef int (*linker_function_nameval_callback_t)(linker_file_t, int, linker_symval_t *, void *); 63*4a5d661aSToomas Soome 64*4a5d661aSToomas Soome struct common_symbol { 65*4a5d661aSToomas Soome STAILQ_ENTRY(common_symbol) link; 66*4a5d661aSToomas Soome char* name; 67*4a5d661aSToomas Soome caddr_t address; 68*4a5d661aSToomas Soome }; 69*4a5d661aSToomas Soome 70*4a5d661aSToomas Soome struct linker_file { 71*4a5d661aSToomas Soome KOBJ_FIELDS; 72*4a5d661aSToomas Soome int refs; /* reference count */ 73*4a5d661aSToomas Soome int userrefs; /* kldload(2) count */ 74*4a5d661aSToomas Soome int flags; 75*4a5d661aSToomas Soome #define LINKER_FILE_LINKED 0x1 /* file has been fully linked */ 76*4a5d661aSToomas Soome TAILQ_ENTRY(linker_file) link; /* list of all loaded files */ 77*4a5d661aSToomas Soome char* filename; /* file which was loaded */ 78*4a5d661aSToomas Soome char* pathname; /* file name with full path */ 79*4a5d661aSToomas Soome int id; /* unique id */ 80*4a5d661aSToomas Soome caddr_t address; /* load address */ 81*4a5d661aSToomas Soome size_t size; /* size of file */ 82*4a5d661aSToomas Soome caddr_t ctors_addr; /* address of .ctors */ 83*4a5d661aSToomas Soome size_t ctors_size; /* size of .ctors */ 84*4a5d661aSToomas Soome int ndeps; /* number of dependencies */ 85*4a5d661aSToomas Soome linker_file_t* deps; /* list of dependencies */ 86*4a5d661aSToomas Soome STAILQ_HEAD(, common_symbol) common; /* list of common symbols */ 87*4a5d661aSToomas Soome TAILQ_HEAD(, module) modules; /* modules in this file */ 88*4a5d661aSToomas Soome TAILQ_ENTRY(linker_file) loaded; /* preload dependency support */ 89*4a5d661aSToomas Soome int loadcnt; /* load counter value */ 90*4a5d661aSToomas Soome 91*4a5d661aSToomas Soome /* 92*4a5d661aSToomas Soome * Function Boundary Tracing (FBT) or Statically Defined Tracing (SDT) 93*4a5d661aSToomas Soome * fields. 94*4a5d661aSToomas Soome */ 95*4a5d661aSToomas Soome int nenabled; /* number of enabled probes. */ 96*4a5d661aSToomas Soome int fbt_nentries; /* number of fbt entries created. */ 97*4a5d661aSToomas Soome }; 98*4a5d661aSToomas Soome 99*4a5d661aSToomas Soome /* 100*4a5d661aSToomas Soome * Object implementing a class of file (a.out, elf, etc.) 101*4a5d661aSToomas Soome */ 102*4a5d661aSToomas Soome typedef struct linker_class *linker_class_t; 103*4a5d661aSToomas Soome typedef TAILQ_HEAD(, linker_class) linker_class_list_t; 104*4a5d661aSToomas Soome 105*4a5d661aSToomas Soome struct linker_class { 106*4a5d661aSToomas Soome KOBJ_CLASS_FIELDS; 107*4a5d661aSToomas Soome TAILQ_ENTRY(linker_class) link; /* list of all file classes */ 108*4a5d661aSToomas Soome }; 109*4a5d661aSToomas Soome 110*4a5d661aSToomas Soome /* 111*4a5d661aSToomas Soome * Function type used when iterating over the list of linker files. 112*4a5d661aSToomas Soome */ 113*4a5d661aSToomas Soome typedef int linker_predicate_t(linker_file_t, void *); 114*4a5d661aSToomas Soome 115*4a5d661aSToomas Soome /* 116*4a5d661aSToomas Soome * The "file" for the kernel. 117*4a5d661aSToomas Soome */ 118*4a5d661aSToomas Soome extern linker_file_t linker_kernel_file; 119*4a5d661aSToomas Soome 120*4a5d661aSToomas Soome /* 121*4a5d661aSToomas Soome * Obtain a reference to a module, loading it if required. 122*4a5d661aSToomas Soome */ 123*4a5d661aSToomas Soome int linker_reference_module(const char* _modname, struct mod_depend *_verinfo, 124*4a5d661aSToomas Soome linker_file_t* _result); 125*4a5d661aSToomas Soome 126*4a5d661aSToomas Soome /* 127*4a5d661aSToomas Soome * Release a reference to a module, unloading it if there are no more 128*4a5d661aSToomas Soome * references. Note that one should either provide a module name and 129*4a5d661aSToomas Soome * optional version info or a linker file, but not both. 130*4a5d661aSToomas Soome */ 131*4a5d661aSToomas Soome int linker_release_module(const char *_modname, struct mod_depend *_verinfo, 132*4a5d661aSToomas Soome linker_file_t _file); 133*4a5d661aSToomas Soome 134*4a5d661aSToomas Soome /* 135*4a5d661aSToomas Soome * Iterate over all of the currently loaded linker files calling the 136*4a5d661aSToomas Soome * predicate function while the function returns 0. Returns the value 137*4a5d661aSToomas Soome * returned by the last predicate function. 138*4a5d661aSToomas Soome */ 139*4a5d661aSToomas Soome int linker_file_foreach(linker_predicate_t *_predicate, void *_context); 140*4a5d661aSToomas Soome 141*4a5d661aSToomas Soome /* 142*4a5d661aSToomas Soome * Lookup a symbol in a file. If deps is TRUE, look in dependencies 143*4a5d661aSToomas Soome * if not found in file. 144*4a5d661aSToomas Soome */ 145*4a5d661aSToomas Soome caddr_t linker_file_lookup_symbol(linker_file_t _file, const char* _name, 146*4a5d661aSToomas Soome int _deps); 147*4a5d661aSToomas Soome 148*4a5d661aSToomas Soome /* 149*4a5d661aSToomas Soome * Lookup a linker set in a file. Return pointers to the first entry, 150*4a5d661aSToomas Soome * last + 1, and count of entries. Use: for (p = start; p < stop; p++) {} 151*4a5d661aSToomas Soome * void *start is really: "struct yoursetmember ***start;" 152*4a5d661aSToomas Soome */ 153*4a5d661aSToomas Soome int linker_file_lookup_set(linker_file_t _file, const char *_name, 154*4a5d661aSToomas Soome void *_start, void *_stop, int *_count); 155*4a5d661aSToomas Soome 156*4a5d661aSToomas Soome /* 157*4a5d661aSToomas Soome * List all functions in a file. 158*4a5d661aSToomas Soome */ 159*4a5d661aSToomas Soome int linker_file_function_listall(linker_file_t, 160*4a5d661aSToomas Soome linker_function_nameval_callback_t, void *); 161*4a5d661aSToomas Soome 162*4a5d661aSToomas Soome /* 163*4a5d661aSToomas Soome * Functions soley for use by the linker class handlers. 164*4a5d661aSToomas Soome */ 165*4a5d661aSToomas Soome int linker_add_class(linker_class_t _cls); 166*4a5d661aSToomas Soome int linker_file_unload(linker_file_t _file, int flags); 167*4a5d661aSToomas Soome int linker_load_dependencies(linker_file_t _lf); 168*4a5d661aSToomas Soome linker_file_t linker_make_file(const char* _filename, linker_class_t _cls); 169*4a5d661aSToomas Soome 170*4a5d661aSToomas Soome /* 171*4a5d661aSToomas Soome * DDB Helpers, tuned specifically for ddb/db_kld.c 172*4a5d661aSToomas Soome */ 173*4a5d661aSToomas Soome int linker_ddb_lookup(const char *_symstr, c_linker_sym_t *_sym); 174*4a5d661aSToomas Soome int linker_ddb_search_symbol(caddr_t _value, c_linker_sym_t *_sym, 175*4a5d661aSToomas Soome long *_diffp); 176*4a5d661aSToomas Soome int linker_ddb_symbol_values(c_linker_sym_t _sym, linker_symval_t *_symval); 177*4a5d661aSToomas Soome int linker_ddb_search_symbol_name(caddr_t value, char *buf, u_int buflen, 178*4a5d661aSToomas Soome long *offset); 179*4a5d661aSToomas Soome 180*4a5d661aSToomas Soome /* 181*4a5d661aSToomas Soome * stack(9) helper for situations where kernel locking is required. 182*4a5d661aSToomas Soome */ 183*4a5d661aSToomas Soome int linker_search_symbol_name(caddr_t value, char *buf, u_int buflen, 184*4a5d661aSToomas Soome long *offset); 185*4a5d661aSToomas Soome 186*4a5d661aSToomas Soome 187*4a5d661aSToomas Soome /* HWPMC helper */ 188*4a5d661aSToomas Soome void *linker_hwpmc_list_objects(void); 189*4a5d661aSToomas Soome 190*4a5d661aSToomas Soome #endif /* _KERNEL */ 191*4a5d661aSToomas Soome 192*4a5d661aSToomas Soome /* 193*4a5d661aSToomas Soome * Module information subtypes 194*4a5d661aSToomas Soome */ 195*4a5d661aSToomas Soome #define MODINFO_END 0x0000 /* End of list */ 196*4a5d661aSToomas Soome #define MODINFO_NAME 0x0001 /* Name of module (string) */ 197*4a5d661aSToomas Soome #define MODINFO_TYPE 0x0002 /* Type of module (string) */ 198*4a5d661aSToomas Soome #define MODINFO_ADDR 0x0003 /* Loaded address */ 199*4a5d661aSToomas Soome #define MODINFO_SIZE 0x0004 /* Size of module */ 200*4a5d661aSToomas Soome #define MODINFO_EMPTY 0x0005 /* Has been deleted */ 201*4a5d661aSToomas Soome #define MODINFO_ARGS 0x0006 /* Parameters string */ 202*4a5d661aSToomas Soome #define MODINFO_METADATA 0x8000 /* Module-specfic */ 203*4a5d661aSToomas Soome 204*4a5d661aSToomas Soome #define MODINFOMD_AOUTEXEC 0x0001 /* a.out exec header */ 205*4a5d661aSToomas Soome #define MODINFOMD_ELFHDR 0x0002 /* ELF header */ 206*4a5d661aSToomas Soome #define MODINFOMD_SSYM 0x0003 /* start of symbols */ 207*4a5d661aSToomas Soome #define MODINFOMD_ESYM 0x0004 /* end of symbols */ 208*4a5d661aSToomas Soome #define MODINFOMD_DYNAMIC 0x0005 /* _DYNAMIC pointer */ 209*4a5d661aSToomas Soome /* These values are MD on these two platforms */ 210*4a5d661aSToomas Soome #if !defined(__sparc64__) && !defined(__powerpc__) 211*4a5d661aSToomas Soome #define MODINFOMD_ENVP 0x0006 /* envp[] */ 212*4a5d661aSToomas Soome #define MODINFOMD_HOWTO 0x0007 /* boothowto */ 213*4a5d661aSToomas Soome #define MODINFOMD_KERNEND 0x0008 /* kernend */ 214*4a5d661aSToomas Soome #endif 215*4a5d661aSToomas Soome #define MODINFOMD_SHDR 0x0009 /* section header table */ 216*4a5d661aSToomas Soome #define MODINFOMD_CTORS_ADDR 0x000a /* address of .ctors */ 217*4a5d661aSToomas Soome #define MODINFOMD_CTORS_SIZE 0x000b /* size of .ctors */ 218*4a5d661aSToomas Soome #define MODINFOMD_FW_HANDLE 0x000c /* Firmware dependent handle */ 219*4a5d661aSToomas Soome #define MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */ 220*4a5d661aSToomas Soome 221*4a5d661aSToomas Soome #define MODINFOMD_DEPLIST (0x4001 | MODINFOMD_NOCOPY) /* depends on */ 222*4a5d661aSToomas Soome 223*4a5d661aSToomas Soome #ifdef _KERNEL 224*4a5d661aSToomas Soome #define MD_FETCH(mdp, info, type) ({ \ 225*4a5d661aSToomas Soome type *__p; \ 226*4a5d661aSToomas Soome __p = (type *)preload_search_info((mdp), MODINFO_METADATA | (info)); \ 227*4a5d661aSToomas Soome __p ? *__p : 0; \ 228*4a5d661aSToomas Soome }) 229*4a5d661aSToomas Soome #endif 230*4a5d661aSToomas Soome 231*4a5d661aSToomas Soome #define LINKER_HINTS_VERSION 1 /* linker.hints file version */ 232*4a5d661aSToomas Soome #define LINKER_HINTS_MAX (1 << 20) /* Allow at most 1MB for linker.hints */ 233*4a5d661aSToomas Soome 234*4a5d661aSToomas Soome #ifdef _KERNEL 235*4a5d661aSToomas Soome 236*4a5d661aSToomas Soome /* 237*4a5d661aSToomas Soome * Module lookup 238*4a5d661aSToomas Soome */ 239*4a5d661aSToomas Soome extern vm_offset_t preload_addr_relocate; 240*4a5d661aSToomas Soome extern caddr_t preload_metadata; 241*4a5d661aSToomas Soome 242*4a5d661aSToomas Soome extern void * preload_fetch_addr(caddr_t _mod); 243*4a5d661aSToomas Soome extern size_t preload_fetch_size(caddr_t _mod); 244*4a5d661aSToomas Soome extern caddr_t preload_search_by_name(const char *_name); 245*4a5d661aSToomas Soome extern caddr_t preload_search_by_type(const char *_type); 246*4a5d661aSToomas Soome extern caddr_t preload_search_next_name(caddr_t _base); 247*4a5d661aSToomas Soome extern caddr_t preload_search_info(caddr_t _mod, int _inf); 248*4a5d661aSToomas Soome extern void preload_delete_name(const char *_name); 249*4a5d661aSToomas Soome extern void preload_bootstrap_relocate(vm_offset_t _offset); 250*4a5d661aSToomas Soome 251*4a5d661aSToomas Soome #ifdef KLD_DEBUG 252*4a5d661aSToomas Soome 253*4a5d661aSToomas Soome extern int kld_debug; 254*4a5d661aSToomas Soome #define KLD_DEBUG_FILE 1 /* file load/unload */ 255*4a5d661aSToomas Soome #define KLD_DEBUG_SYM 2 /* symbol lookup */ 256*4a5d661aSToomas Soome 257*4a5d661aSToomas Soome #define KLD_DPF(cat, args) \ 258*4a5d661aSToomas Soome do { \ 259*4a5d661aSToomas Soome if (kld_debug & KLD_DEBUG_##cat) printf args; \ 260*4a5d661aSToomas Soome } while (0) 261*4a5d661aSToomas Soome 262*4a5d661aSToomas Soome #else 263*4a5d661aSToomas Soome 264*4a5d661aSToomas Soome #define KLD_DPF(cat, args) 265*4a5d661aSToomas Soome 266*4a5d661aSToomas Soome #endif 267*4a5d661aSToomas Soome 268*4a5d661aSToomas Soome typedef int elf_lookup_fn(linker_file_t, Elf_Size, int, Elf_Addr *); 269*4a5d661aSToomas Soome 270*4a5d661aSToomas Soome /* Support functions */ 271*4a5d661aSToomas Soome int elf_reloc(linker_file_t _lf, Elf_Addr base, const void *_rel, int _type, elf_lookup_fn _lu); 272*4a5d661aSToomas Soome int elf_reloc_local(linker_file_t _lf, Elf_Addr base, const void *_rel, int _type, elf_lookup_fn _lu); 273*4a5d661aSToomas Soome Elf_Addr elf_relocaddr(linker_file_t _lf, Elf_Addr addr); 274*4a5d661aSToomas Soome const Elf_Sym *elf_get_sym(linker_file_t _lf, Elf_Size _symidx); 275*4a5d661aSToomas Soome const char *elf_get_symname(linker_file_t _lf, Elf_Size _symidx); 276*4a5d661aSToomas Soome 277*4a5d661aSToomas Soome typedef struct linker_ctf { 278*4a5d661aSToomas Soome const uint8_t *ctftab; /* Decompressed CTF data. */ 279*4a5d661aSToomas Soome int ctfcnt; /* Number of CTF data bytes. */ 280*4a5d661aSToomas Soome const Elf_Sym *symtab; /* Ptr to the symbol table. */ 281*4a5d661aSToomas Soome int nsym; /* Number of symbols. */ 282*4a5d661aSToomas Soome const char *strtab; /* Ptr to the string table. */ 283*4a5d661aSToomas Soome int strcnt; /* Number of string bytes. */ 284*4a5d661aSToomas Soome uint32_t **ctfoffp; /* Ptr to array of obj/fnc offsets. */ 285*4a5d661aSToomas Soome uint32_t **typoffp; /* Ptr to array of type offsets. */ 286*4a5d661aSToomas Soome long *typlenp; /* Ptr to number of type data entries. */ 287*4a5d661aSToomas Soome } linker_ctf_t; 288*4a5d661aSToomas Soome 289*4a5d661aSToomas Soome int linker_ctf_get(linker_file_t, linker_ctf_t *); 290*4a5d661aSToomas Soome 291*4a5d661aSToomas Soome int elf_cpu_load_file(linker_file_t); 292*4a5d661aSToomas Soome int elf_cpu_unload_file(linker_file_t); 293*4a5d661aSToomas Soome 294*4a5d661aSToomas Soome /* values for type */ 295*4a5d661aSToomas Soome #define ELF_RELOC_REL 1 296*4a5d661aSToomas Soome #define ELF_RELOC_RELA 2 297*4a5d661aSToomas Soome 298*4a5d661aSToomas Soome /* 299*4a5d661aSToomas Soome * This is version 1 of the KLD file status structure. It is identified 300*4a5d661aSToomas Soome * by its _size_ in the version field. 301*4a5d661aSToomas Soome */ 302*4a5d661aSToomas Soome struct kld_file_stat_1 { 303*4a5d661aSToomas Soome int version; /* set to sizeof(struct kld_file_stat_1) */ 304*4a5d661aSToomas Soome char name[MAXPATHLEN]; 305*4a5d661aSToomas Soome int refs; 306*4a5d661aSToomas Soome int id; 307*4a5d661aSToomas Soome caddr_t address; /* load address */ 308*4a5d661aSToomas Soome size_t size; /* size in bytes */ 309*4a5d661aSToomas Soome }; 310*4a5d661aSToomas Soome #endif /* _KERNEL */ 311*4a5d661aSToomas Soome 312*4a5d661aSToomas Soome struct kld_file_stat { 313*4a5d661aSToomas Soome int version; /* set to sizeof(struct kld_file_stat) */ 314*4a5d661aSToomas Soome char name[MAXPATHLEN]; 315*4a5d661aSToomas Soome int refs; 316*4a5d661aSToomas Soome int id; 317*4a5d661aSToomas Soome caddr_t address; /* load address */ 318*4a5d661aSToomas Soome size_t size; /* size in bytes */ 319*4a5d661aSToomas Soome char pathname[MAXPATHLEN]; 320*4a5d661aSToomas Soome }; 321*4a5d661aSToomas Soome 322*4a5d661aSToomas Soome struct kld_sym_lookup { 323*4a5d661aSToomas Soome int version; /* set to sizeof(struct kld_sym_lookup) */ 324*4a5d661aSToomas Soome char *symname; /* Symbol name we are looking up */ 325*4a5d661aSToomas Soome u_long symvalue; 326*4a5d661aSToomas Soome size_t symsize; 327*4a5d661aSToomas Soome }; 328*4a5d661aSToomas Soome #define KLDSYM_LOOKUP 1 329*4a5d661aSToomas Soome 330*4a5d661aSToomas Soome /* 331*4a5d661aSToomas Soome * Flags for kldunloadf() and linker_file_unload() 332*4a5d661aSToomas Soome */ 333*4a5d661aSToomas Soome #define LINKER_UNLOAD_NORMAL 0 334*4a5d661aSToomas Soome #define LINKER_UNLOAD_FORCE 1 335*4a5d661aSToomas Soome 336*4a5d661aSToomas Soome #ifndef _KERNEL 337*4a5d661aSToomas Soome 338*4a5d661aSToomas Soome #include <sys/cdefs.h> 339*4a5d661aSToomas Soome 340*4a5d661aSToomas Soome __BEGIN_DECLS 341*4a5d661aSToomas Soome int kldload(const char* _file); 342*4a5d661aSToomas Soome int kldunload(int _fileid); 343*4a5d661aSToomas Soome int kldunloadf(int _fileid, int flags); 344*4a5d661aSToomas Soome int kldfind(const char* _file); 345*4a5d661aSToomas Soome int kldnext(int _fileid); 346*4a5d661aSToomas Soome int kldstat(int _fileid, struct kld_file_stat* _stat); 347*4a5d661aSToomas Soome int kldfirstmod(int _fileid); 348*4a5d661aSToomas Soome int kldsym(int _fileid, int _cmd, void *_data); 349*4a5d661aSToomas Soome __END_DECLS 350*4a5d661aSToomas Soome 351*4a5d661aSToomas Soome #endif 352*4a5d661aSToomas Soome 353*4a5d661aSToomas Soome #endif /* !_SYS_LINKER_H_ */ 354