Deleted Added
full compact
kern_linker.c (167211) kern_linker.c (168951)
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 167211 2007-03-04 22:36:48Z rwatson $");
28__FBSDID("$FreeBSD: head/sys/kern/kern_linker.c 168951 2007-04-22 15:31:22Z rwatson $");
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>

--- 520 unchanged lines hidden (view full) ---

557 module_t mod, next;
558 modlist_t ml, nextml;
559 struct common_symbol *cp;
560 int error, i;
561
562 /* Refuse to unload modules if securelevel raised. */
563 if (securelevel > 0)
564 return (EPERM);
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>

--- 520 unchanged lines hidden (view full) ---

557 module_t mod, next;
558 modlist_t ml, nextml;
559 struct common_symbol *cp;
560 int error, i;
561
562 /* Refuse to unload modules if securelevel raised. */
563 if (securelevel > 0)
564 return (EPERM);
565#ifdef MAC
566 error = mac_check_kld_unload(curthread->td_ucred);
567 if (error)
568 return (error);
569#endif
570
571 KLD_LOCK_ASSERT();
572 KLD_DPF(FILE, ("linker_file_unload: lf->refs=%d\n", file->refs));
573
574 /* Easy case of just dropping a reference. */
575 if (file->refs > 1) {
576 file->refs--;
577 return (0);

--- 1418 unchanged lines hidden ---
565
566 KLD_LOCK_ASSERT();
567 KLD_DPF(FILE, ("linker_file_unload: lf->refs=%d\n", file->refs));
568
569 /* Easy case of just dropping a reference. */
570 if (file->refs > 1) {
571 file->refs--;
572 return (0);

--- 1418 unchanged lines hidden ---