Print this page
9696 add /etc/system.d support
Portions contributed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
Reviewed by: Peter Tribble <peter.tribble@gmail.com>
Reviewed by: C Fraire <cfraire@me.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/modctl.h
+++ new/usr/src/uts/common/sys/modctl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 */
24 24
25 25 #ifndef _SYS_MODCTL_H
26 26 #define _SYS_MODCTL_H
27 27
28 28 /*
29 29 * loadable module support.
30 30 */
31 31
32 32 #include <sys/types.h>
33 33 #include <sys/ioccom.h>
34 34 #include <sys/nexusdefs.h>
35 35 #include <sys/thread.h>
36 36 #include <sys/t_lock.h>
37 37 #include <sys/dditypes.h>
38 38 #include <sys/hwconf.h>
39 39
40 40 #ifdef __cplusplus
41 41 extern "C" {
42 42 #endif
43 43
44 44 /*
45 45 * The following structure defines the operations used by modctl
46 46 * to load and unload modules. Each supported loadable module type
47 47 * requires a set of mod_ops.
48 48 */
49 49 struct mod_ops {
50 50 int (*modm_install)(); /* install module in kernel */
51 51 int (*modm_remove)(); /* remove from kernel */
52 52 int (*modm_info)(); /* module info */
53 53 };
54 54
55 55 #ifdef _KERNEL
56 56
57 57 /*
58 58 * The defined set of mod_ops structures for each loadable module type
59 59 * Defined in modctl.c
60 60 */
61 61 extern struct mod_ops mod_brandops;
62 62 #if defined(__i386) || defined(__amd64)
63 63 extern struct mod_ops mod_cpuops;
64 64 #endif
65 65 extern struct mod_ops mod_cryptoops;
66 66 extern struct mod_ops mod_driverops;
67 67 extern struct mod_ops mod_execops;
68 68 extern struct mod_ops mod_fsops;
69 69 extern struct mod_ops mod_miscops;
70 70 extern struct mod_ops mod_schedops;
71 71 extern struct mod_ops mod_strmodops;
72 72 extern struct mod_ops mod_syscallops;
73 73 extern struct mod_ops mod_sockmodops;
74 74 #ifdef _SYSCALL32_IMPL
75 75 extern struct mod_ops mod_syscallops32;
76 76 #endif
77 77 extern struct mod_ops mod_dacfops;
78 78 extern struct mod_ops mod_ippops;
79 79 extern struct mod_ops mod_pcbeops;
80 80 extern struct mod_ops mod_kiconvops;
81 81
82 82 #endif /* _KERNEL */
83 83
84 84 /*
85 85 * Definitions for the module specific linkage structures.
86 86 * The first two fields are the same in all of the structures.
87 87 * The linkinfo is for informational purposes only and is returned by
88 88 * modctl with the MODINFO cmd.
89 89 */
90 90
91 91 /* For drivers */
92 92 struct modldrv {
93 93 struct mod_ops *drv_modops;
94 94 char *drv_linkinfo;
95 95 struct dev_ops *drv_dev_ops;
96 96 };
97 97
98 98 /* For system calls */
99 99 struct modlsys {
100 100 struct mod_ops *sys_modops;
101 101 char *sys_linkinfo;
102 102 struct sysent *sys_sysent;
103 103 };
104 104
105 105 /* For filesystems */
106 106 struct modlfs {
107 107 struct mod_ops *fs_modops;
108 108 char *fs_linkinfo;
109 109 struct vfsdef_v5 *fs_vfsdef; /* version may actually vary */
110 110 };
111 111
112 112 #if defined(__i386) || defined(__amd64)
113 113 struct cmi_ops;
114 114
115 115 /* For CPU modules */
116 116 struct modlcpu {
117 117 struct mod_ops *cpu_modops;
118 118 char *cpu_linkinfo;
119 119 struct cmi_ops *cpu_cmiops;
120 120 };
121 121 #endif
122 122
123 123 /* For cryptographic providers */
124 124 struct modlcrypto {
125 125 struct mod_ops *crypto_modops;
126 126 char *crypto_linkinfo;
127 127 };
128 128
129 129 /* For misc */
130 130 struct modlmisc {
131 131 struct mod_ops *misc_modops;
132 132 char *misc_linkinfo;
133 133 };
134 134
135 135 /* For IP Modules */
136 136 struct modlipp {
137 137 struct mod_ops *ipp_modops;
138 138 char *ipp_linkinfo;
139 139 struct ipp_ops *ipp_ops;
140 140 };
141 141
142 142 /* For Streams Modules. */
143 143 struct modlstrmod {
144 144 struct mod_ops *strmod_modops;
145 145 char *strmod_linkinfo;
146 146 struct fmodsw *strmod_fmodsw;
147 147 };
148 148
149 149 /* For Scheduling classes */
150 150 struct modlsched {
151 151 struct mod_ops *sched_modops;
152 152 char *sched_linkinfo;
153 153 struct sclass *sched_class;
154 154 };
155 155
156 156 /* For Exec file type (like ELF, ...) */
157 157 struct modlexec {
158 158 struct mod_ops *exec_modops;
159 159 char *exec_linkinfo;
160 160 struct execsw *exec_execsw;
161 161 };
162 162
163 163 /* For dacf modules */
164 164 struct modldacf {
165 165 struct mod_ops *dacf_modops;
166 166 char *dacf_linkinfo;
167 167 struct dacfsw *dacf_dacfsw;
168 168 };
169 169
170 170 /* For PCBE modules */
171 171 struct modlpcbe {
172 172 struct mod_ops *pcbe_modops;
173 173 char *pcbe_linkinfo;
174 174 struct __pcbe_ops *pcbe_ops;
175 175 };
176 176
177 177 /* For Brand modules */
178 178 struct modlbrand {
179 179 struct mod_ops *brand_modops;
180 180 char *brand_linkinfo;
181 181 struct brand *brand_branddef;
182 182 };
183 183
184 184 /* For socket Modules. */
185 185 struct modlsockmod {
186 186 struct mod_ops *sockmod_modops;
187 187 char *sockmod_linkinfo;
188 188 struct smod_reg_s *sockmod_reg_info;
189 189 };
190 190
191 191 /* For kiconv modules */
192 192 struct modlkiconv {
193 193 struct mod_ops *kiconv_modops;
194 194 char *kiconv_linkinfo;
195 195 struct kiconv_mod_info *kiconv_moddef;
196 196 };
197 197
198 198 /*
199 199 * Revision number of loadable modules support. This is the value
200 200 * that must be used in the modlinkage structure.
201 201 */
202 202 #define MODREV_1 1
203 203
204 204 /*
205 205 * The modlinkage structure is the structure that the module writer
206 206 * provides to the routines to install, remove, and stat a module.
207 207 * The ml_linkage element is an array of pointers to linkage structures.
208 208 * For most modules there is only one linkage structure. We allocate
209 209 * enough space for 3 linkage structures which happens to be the most
210 210 * we have in any sun supplied module. For those modules with more
211 211 * than 3 linkage structures (which is very unlikely), a modlinkage
212 212 * structure must be kmem_alloc'd in the module wrapper to be big enough
213 213 * for all of the linkage structures.
214 214 */
215 215 struct modlinkage {
216 216 int ml_rev; /* rev of loadable modules system */
217 217 #ifdef _LP64
218 218 void *ml_linkage[7]; /* more space in 64-bit OS */
219 219 #else
220 220 void *ml_linkage[4]; /* NULL terminated list of */
221 221 /* linkage structures */
222 222 #endif
223 223 };
224 224
225 225 /*
226 226 * commands. These are the commands supported by the modctl system call.
227 227 */
228 228 #define MODLOAD 0
229 229 #define MODUNLOAD 1
230 230 #define MODINFO 2
231 231 #define MODRESERVED 3
232 232 #define MODSETMINIROOT 4
233 233 #define MODADDMAJBIND 5
234 234 #define MODGETPATH 6
235 235 #define MODREADSYSBIND 7
236 236 #define MODGETMAJBIND 8
237 237 #define MODGETNAME 9
238 238 #define MODSIZEOF_DEVID 10
239 239 #define MODGETDEVID 11
240 240 #define MODSIZEOF_MINORNAME 12
241 241 #define MODGETMINORNAME 13
242 242 #define MODGETPATHLEN 14
243 243 #define MODEVENTS 15
244 244 #define MODGETFBNAME 16
245 245 #define MODREREADDACF 17
246 246 #define MODLOADDRVCONF 18
247 247 #define MODUNLOADDRVCONF 19
248 248 #define MODREMMAJBIND 20
249 249 #define MODDEVT2INSTANCE 21
250 250 #define MODGETDEVFSPATH_LEN 22
251 251 #define MODGETDEVFSPATH 23
252 252 #define MODDEVID2PATHS 24
253 253 #define MODSETDEVPOLICY 26
254 254 #define MODGETDEVPOLICY 27
255 255 #define MODALLOCPRIV 28
256 256 #define MODGETDEVPOLICYBYNAME 29
257 257 #define MODLOADMINORPERM 31
258 258 #define MODADDMINORPERM 32
259 259 #define MODREMMINORPERM 33
260 260 #define MODREMDRVCLEANUP 34
261 261 #define MODDEVEXISTS 35
262 262 #define MODDEVREADDIR 36
263 263 #define MODDEVNAME 37
264 264 #define MODGETDEVFSPATH_MI_LEN 38
265 265 #define MODGETDEVFSPATH_MI 39
266 266 #define MODRETIRE 40
267 267 #define MODUNRETIRE 41
268 268 #define MODISRETIRED 42
269 269 #define MODDEVEMPTYDIR 43
270 270 #define MODREMDRVALIAS 44
271 271 #define MODHPOPS 45
272 272
273 273 /*
274 274 * sub cmds for MODEVENTS
275 275 */
276 276 #define MODEVENTS_FLUSH 0
277 277 #define MODEVENTS_FLUSH_DUMP 1
278 278 #define MODEVENTS_SET_DOOR_UPCALL_FILENAME 2
279 279 #define MODEVENTS_GETDATA 3
280 280 #define MODEVENTS_FREEDATA 4
281 281 #define MODEVENTS_POST_EVENT 5
282 282 #define MODEVENTS_REGISTER_EVENT 6
283 283
284 284 /*
285 285 * devname subcmds for MODDEVNAME
286 286 */
287 287 #define MODDEVNAME_LOOKUPDOOR 0
288 288 #define MODDEVNAME_PROFILE 3
289 289 #define MODDEVNAME_RECONFIG 4
290 290 #define MODDEVNAME_SYSAVAIL 5
291 291
292 292 /*
293 293 * subcmds for MODHPOPS
294 294 */
295 295 #define MODHPOPS_CHANGE_STATE 0
296 296 #define MODHPOPS_CREATE_PORT 1
297 297 #define MODHPOPS_REMOVE_PORT 2
298 298 #define MODHPOPS_BUS_GET 3
299 299 #define MODHPOPS_BUS_SET 4
300 300
301 301
302 302 /*
303 303 * Data structure passed to modconfig command in kernel to build devfs tree
304 304 */
305 305
306 306 struct aliases {
307 307 struct aliases *a_next;
308 308 char *a_name;
309 309 int a_len;
310 310 };
311 311
312 312 #define MAXMODCONFNAME 256
313 313
314 314 struct modconfig {
315 315 char drvname[MAXMODCONFNAME];
316 316 char drvclass[MAXMODCONFNAME];
317 317 int major;
318 318 int flags;
319 319 int num_aliases;
320 320 struct aliases *ap;
321 321 };
322 322
323 323 #if defined(_SYSCALL32)
324 324
325 325 struct aliases32 {
326 326 caddr32_t a_next;
327 327 caddr32_t a_name;
328 328 int32_t a_len;
329 329 };
330 330
331 331 struct modconfig32 {
332 332 char drvname[MAXMODCONFNAME];
333 333 char drvclass[MAXMODCONFNAME];
334 334 int32_t major;
335 335 int32_t flags;
336 336 int32_t num_aliases;
337 337 caddr32_t ap;
338 338 };
339 339
340 340 #endif /* _SYSCALL32 */
341 341
342 342 /* flags for modconfig */
343 343 #define MOD_UNBIND_OVERRIDE 0x01 /* fail unbind if in use */
344 344 #define MOD_ADDMAJBIND_UPDATE 0x02 /* update only, do not load */
345 345
346 346 /* flags for MODLOADDRVCONF - modctl_load_drvconf() */
347 347 #define MOD_LOADDRVCONF_RECONF 0x01 /* complete configuration */
348 348 /* after update-only */
349 349
350 350 /*
351 351 * Max module path length
352 352 */
353 353 #define MOD_MAXPATH 256
354 354
355 355 /*
356 356 * Default search path for modules ADDITIONAL to the directory
357 357 * where the kernel components we booted from are.
358 358 *
359 359 * Most often, this will be "/platform/{platform}/kernel /kernel /usr/kernel",
360 360 * but we don't wire it down here.
361 361 */
362 362 #define MOD_DEFPATH "/kernel /usr/kernel"
363 363
364 364 /*
365 365 * Default file name extension for autoloading modules.
366 366 */
367 367 #define MOD_DEFEXT ""
368 368
369 369 /*
370 370 * Parameters for modinfo
371 371 */
372 372 #define MODMAXNAMELEN 32 /* max module name length */
373 373 #define MODMAXLINKINFOLEN 32 /* max link info length */
374 374
375 375 /*
376 376 * Module specific information.
377 377 */
378 378 struct modspecific_info {
379 379 char msi_linkinfo[MODMAXLINKINFOLEN]; /* name in linkage struct */
380 380 int msi_p0; /* module specific information */
381 381 };
382 382
383 383 /*
384 384 * Structure returned by modctl with MODINFO command.
385 385 */
386 386 #define MODMAXLINK 10 /* max linkages modinfo can handle */
387 387
388 388 struct modinfo {
389 389 int mi_info; /* Flags for info wanted */
390 390 int mi_state; /* Flags for module state */
391 391 int mi_id; /* id of this loaded module */
392 392 int mi_nextid; /* id of next module or -1 */
393 393 caddr_t mi_base; /* virtual addr of text */
394 394 size_t mi_size; /* size of module in bytes */
395 395 int mi_rev; /* loadable modules rev */
396 396 int mi_loadcnt; /* # of times loaded */
397 397 char mi_name[MODMAXNAMELEN]; /* name of module */
398 398 struct modspecific_info mi_msinfo[MODMAXLINK];
399 399 /* mod specific info */
400 400 };
401 401
402 402
403 403 #if defined(_SYSCALL32)
404 404
405 405 #define MODMAXNAMELEN32 32 /* max module name length */
406 406 #define MODMAXLINKINFOLEN32 32 /* max link info length */
407 407 #define MODMAXLINK32 10 /* max linkages modinfo can handle */
408 408
409 409 struct modspecific_info32 {
410 410 char msi_linkinfo[MODMAXLINKINFOLEN32]; /* name in linkage struct */
411 411 int32_t msi_p0; /* module specific information */
412 412 };
413 413
414 414 struct modinfo32 {
415 415 int32_t mi_info; /* Flags for info wanted */
416 416 int32_t mi_state; /* Flags for module state */
417 417 int32_t mi_id; /* id of this loaded module */
418 418 int32_t mi_nextid; /* id of next module or -1 */
419 419 caddr32_t mi_base; /* virtual addr of text */
420 420 uint32_t mi_size; /* size of module in bytes */
421 421 int32_t mi_rev; /* loadable modules rev */
422 422 int32_t mi_loadcnt; /* # of times loaded */
423 423 char mi_name[MODMAXNAMELEN32]; /* name of module */
424 424 struct modspecific_info32 mi_msinfo[MODMAXLINK32];
425 425 /* mod specific info */
426 426 };
427 427
428 428 #endif /* _SYSCALL32 */
429 429
430 430 /* Values for mi_info flags */
431 431 #define MI_INFO_ONE 1
432 432 #define MI_INFO_ALL 2
433 433 #define MI_INFO_CNT 4
434 434 #ifdef _KERNEL
435 435 #define MI_INFO_LINKAGE 8 /* used internally to extract modlinkage */
436 436 #endif
437 437 /*
438 438 * MI_INFO_NOBASE indicates caller does not need mi_base. Failure to use this
439 439 * flag may lead 32-bit apps to receive an EOVERFLOW error from modctl(MODINFO)
440 440 * when used with a 64-bit kernel.
441 441 */
442 442 #define MI_INFO_NOBASE 16
443 443
444 444 /* Values for mi_state */
445 445 #define MI_LOADED 1
446 446 #define MI_INSTALLED 2
447 447
448 448 /*
449 449 * Macros to vector to the appropriate module specific routine.
450 450 */
451 451 #define MODL_INSTALL(MODL, MODLP) \
452 452 (*(MODL)->misc_modops->modm_install)(MODL, MODLP)
453 453 #define MODL_REMOVE(MODL, MODLP) \
454 454 (*(MODL)->misc_modops->modm_remove)(MODL, MODLP)
455 455 #define MODL_INFO(MODL, MODLP, P0) \
456 456 (*(MODL)->misc_modops->modm_info)(MODL, MODLP, P0)
457 457
458 458 /*
459 459 * Definitions for stubs
460 460 */
461 461 struct mod_stub_info {
462 462 uintptr_t mods_func_adr;
463 463 struct mod_modinfo *mods_modinfo;
464 464 uintptr_t mods_stub_adr;
465 465 int (*mods_errfcn)();
466 466 int mods_flag; /* flags defined below */
467 467 };
468 468
469 469 /*
470 470 * Definitions for mods_flag.
471 471 */
472 472 #define MODS_WEAK 0x01 /* weak stub (not loaded if called) */
473 473 #define MODS_NOUNLOAD 0x02 /* module not unloadable (no _fini()) */
474 474 #define MODS_INSTALLED 0x10 /* module installed */
475 475
476 476 struct mod_modinfo {
477 477 char *modm_module_name;
478 478 struct modctl *mp;
479 479 struct mod_stub_info modm_stubs[1];
480 480 };
481 481
482 482 struct modctl_list {
483 483 struct modctl_list *modl_next;
484 484 struct modctl *modl_modp;
485 485 };
486 486
487 487 /*
488 488 * Structure to manage a loadable module.
489 489 * Note: the module (mod_mp) structure's "text" and "text_size" information
490 490 * are replicated in the modctl structure so that mod_containing_pc()
491 491 * doesn't have to grab any locks (modctls are persistent; modules are not.)
492 492 */
493 493 typedef struct modctl {
494 494 struct modctl *mod_next; /* &modules based list */
495 495 struct modctl *mod_prev;
496 496 int mod_id;
497 497 void *mod_mp;
498 498 kthread_t *mod_inprogress_thread;
499 499 struct mod_modinfo *mod_modinfo;
500 500 struct modlinkage *mod_linkage;
501 501 char *mod_filename;
502 502 char *mod_modname;
503 503
504 504 char mod_busy; /* inprogress_thread has locked */
505 505 char mod_want; /* someone waiting for unlock */
506 506 char mod_prim; /* primary module */
507 507
508 508 int mod_ref; /* ref count - from dependent or stub */
509 509
510 510 char mod_loaded; /* module in memory */
511 511 char mod_installed; /* post _init pre _fini */
512 512 char mod_loadflags;
513 513 char mod_delay_unload; /* deferred unload */
514 514
515 515 struct modctl_list *mod_requisites; /* mods this one depends on. */
516 516 void *mod_unused; /* NOTE: reuse (same size) is OK, */
517 517 /* deletion causes mdb.vs.core issues */
518 518 int mod_loadcnt; /* number of times mod was loaded */
519 519 int mod_nenabled; /* # of enabled DTrace probes in mod */
520 520 char *mod_text;
521 521 size_t mod_text_size;
522 522
523 523 int mod_gencount; /* # times loaded/unloaded */
524 524 struct modctl *mod_requisite_loading; /* mod circular dependency */
525 525 } modctl_t;
526 526
527 527 /*
528 528 * mod_loadflags
529 529 */
530 530
531 531 #define MOD_NOAUTOUNLOAD 0x1 /* Auto mod-unloader skips this mod */
532 532 #define MOD_NONOTIFY 0x2 /* No krtld notifications on (un)load */
533 533 #define MOD_NOUNLOAD 0x4 /* Assume EBUSY for all _fini's */
534 534
535 535
536 536 #ifdef _KERNEL
537 537
538 538 #define MOD_BIND_HASHSIZE 64
↓ open down ↓ |
538 lines elided |
↑ open up ↑ |
539 539 #define MOD_BIND_HASHMASK (MOD_BIND_HASHSIZE-1)
540 540
541 541 typedef int modid_t;
542 542
543 543 /*
544 544 * global function and data declarations
545 545 */
546 546 extern kmutex_t mod_lock;
547 547
548 548 extern char *systemfile;
549 +extern char *self_assembly;
549 550 extern char **syscallnames;
550 551 extern int moddebug;
551 552
552 553 /*
553 554 * this is the head of a doubly linked list. Only the next and prev
554 555 * pointers are used
555 556 */
556 557 extern modctl_t modules;
557 558
558 559 extern int modload_qualified(const char *,
559 560 const char *, const char *, const char *, uint_t[], int, int *);
560 561
561 562 extern void mod_setup(void);
562 563 extern int modload(const char *, const char *);
563 564 extern int modloadonly(const char *, const char *);
564 565 extern int modunload(int);
565 566 extern int mod_hold_stub(struct mod_stub_info *);
566 567 extern void modunload_disable(void);
567 568 extern void modunload_enable(void);
568 569 extern void modunload_begin(void);
569 570 extern void modunload_end(void);
570 571 extern int mod_remove_by_name(char *);
571 572 extern int mod_sysvar(const char *, const char *, u_longlong_t *);
572 573 extern int mod_sysctl(int, void *);
573 574 struct sysparam;
574 575 extern int mod_hold_by_modctl(modctl_t *, int);
575 576 #define MOD_WAIT_ONCE 0x01
576 577 #define MOD_WAIT_FOREVER 0x02
577 578 #define MOD_LOCK_HELD 0x04
578 579 #define MOD_LOCK_NOT_HELD 0x08
579 580 extern int mod_sysctl_type(int, int (*)(struct sysparam *, void *),
580 581 void *);
581 582 extern void mod_read_system_file(int);
582 583 extern void mod_release_stub(struct mod_stub_info *);
583 584 extern void mod_askparams(void);
584 585 extern void mod_uninstall_daemon(void);
585 586 extern void modreap(void);
586 587 extern modctl_t *mod_hold_by_id(modid_t);
587 588 extern modctl_t *mod_hold_by_name(const char *);
588 589 extern void mod_release_mod(modctl_t *);
589 590 extern uintptr_t modlookup(const char *, const char *);
590 591 extern uintptr_t modlookup_by_modctl(modctl_t *, const char *);
591 592 extern char *modgetsymname(uintptr_t, unsigned long *);
592 593 extern void mod_release_requisites(modctl_t *);
593 594 extern modctl_t *mod_load_requisite(modctl_t *, char *);
594 595 extern modctl_t *mod_find_by_filename(char *, char *);
595 596 extern uintptr_t modgetsymvalue(char *, int);
596 597
597 598 extern int major_valid(major_t);
598 599 extern int driver_installed(major_t);
599 600 extern int driver_active(major_t);
600 601
601 602 extern void mod_rele_dev_by_major(major_t);
602 603 extern struct dev_ops *mod_hold_dev_by_major(major_t);
603 604 extern struct dev_ops *mod_hold_dev_by_devi(dev_info_t *);
604 605 extern void mod_rele_dev_by_devi(dev_info_t *);
605 606
606 607 extern int make_devname(char *, major_t, int);
607 608 extern int gmatch(const char *, const char *);
608 609
609 610 extern void make_aliases(struct bind **);
610 611 extern int read_binding_file(char *, struct bind **,
611 612 int (*line_parser)(char *, int, char *, struct bind **));
612 613 extern void clear_binding_hash(struct bind **);
613 614
614 615 extern void read_class_file(void);
615 616 extern void setbootpath(char *);
616 617 extern void setbootfstype(char *);
617 618
618 619 extern int install_stubs_by_name(modctl_t *, char *);
619 620 extern void install_stubs(modctl_t *);
620 621 extern void uninstall_stubs(modctl_t *);
621 622 extern void reset_stubs(modctl_t *);
622 623 extern modctl_t *mod_getctl(struct modlinkage *);
623 624 extern major_t mod_name_to_major(char *);
624 625 extern modid_t mod_name_to_modid(char *);
625 626 extern char *mod_major_to_name(major_t);
626 627 extern void init_devnamesp(int);
627 628 extern void init_syscallnames(int);
628 629
629 630 extern char *mod_getsysname(int);
630 631 extern int mod_getsysnum(char *);
631 632
632 633 extern char *mod_containing_pc(caddr_t);
633 634 extern int mod_in_autounload(void);
634 635 extern const char *mod_modname(struct modlinkage *);
635 636
636 637 extern int dev_minorperm(dev_info_t *, char *, mperm_t *);
637 638 extern void dev_devices_cleanup(void);
638 639
639 640 /*
640 641 * Declarations used for dynamic linking support routines. Interfaces
641 642 * are marked with the pragma "unknown_control_flow" to prevent tail call
642 643 * optimization, so that implementations can reliably use caller() to
643 644 * determine initiating module.
644 645 */
645 646 #define KRTLD_MODE_FIRST 0x0001
646 647 typedef struct __ddi_modhandle *ddi_modhandle_t;
647 648 extern ddi_modhandle_t ddi_modopen(const char *,
648 649 int, int *);
649 650 extern void *ddi_modsym(ddi_modhandle_t,
650 651 const char *, int *);
651 652 extern int ddi_modclose(ddi_modhandle_t);
652 653 #pragma unknown_control_flow(ddi_modopen, ddi_modsym, ddi_modclose)
653 654
654 655 /*
655 656 * Only the following are part of the DDI/DKI
656 657 */
657 658 extern int _init(void);
658 659 extern int _fini(void);
659 660 extern int _info(struct modinfo *);
660 661 extern int mod_install(struct modlinkage *);
661 662 extern int mod_remove(struct modlinkage *);
662 663 extern int mod_info(struct modlinkage *, struct modinfo *);
663 664
664 665 #else /* _KERNEL */
665 666
666 667 extern int modctl(int, ...);
667 668
668 669 #endif /* _KERNEL */
669 670
670 671 /*
671 672 * bit definitions for moddebug.
672 673 */
673 674 #define MODDEBUG_LOADMSG 0x80000000 /* print "[un]loading..." msg */
674 675 #define MODDEBUG_ERRMSG 0x40000000 /* print detailed error msgs */
675 676 #define MODDEBUG_LOADMSG2 0x20000000 /* print 2nd level msgs */
676 677 #define MODDEBUG_RETIRE 0x10000000 /* print retire msgs */
677 678 #define MODDEBUG_BINDING 0x00040000 /* driver/alias binding */
678 679 #define MODDEBUG_FINI_EBUSY 0x00020000 /* pretend fini returns EBUSY */
679 680 #define MODDEBUG_NOAUL_IPP 0x00010000 /* no Autounloading ipp mods */
680 681 #define MODDEBUG_NOAUL_DACF 0x00008000 /* no Autounloading dacf mods */
681 682 #define MODDEBUG_KEEPTEXT 0x00004000 /* keep text after unloading */
682 683 #define MODDEBUG_NOAUL_DRV 0x00001000 /* no Autounloading Drivers */
683 684 #define MODDEBUG_NOAUL_EXEC 0x00000800 /* no Autounloading Execs */
684 685 #define MODDEBUG_NOAUL_FS 0x00000400 /* no Autounloading File sys */
685 686 #define MODDEBUG_NOAUL_MISC 0x00000200 /* no Autounloading misc */
686 687 #define MODDEBUG_NOAUL_SCHED 0x00000100 /* no Autounloading scheds */
687 688 #define MODDEBUG_NOAUL_STR 0x00000080 /* no Autounloading streams */
688 689 #define MODDEBUG_NOAUL_SYS 0x00000040 /* no Autounloading syscalls */
689 690 #define MODDEBUG_NOCTF 0x00000020 /* do not load CTF debug data */
690 691 #define MODDEBUG_NOAUTOUNLOAD 0x00000010 /* no autounloading at all */
691 692 #define MODDEBUG_DDI_MOD 0x00000008 /* ddi_mod{open,sym,close} */
692 693 #define MODDEBUG_MP_MATCH 0x00000004 /* dev_minorperm */
693 694 #define MODDEBUG_MINORPERM 0x00000002 /* minor perm modctls */
694 695 #define MODDEBUG_USERDEBUG 0x00000001 /* bpt after init_module() */
695 696
696 697 #ifdef __cplusplus
697 698 }
698 699 #endif
699 700
700 701 #endif /* _SYS_MODCTL_H */
↓ open down ↓ |
142 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX