Deleted Added
full compact
kern_linker.c (159596) kern_linker.c (159791)
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 159596 2006-06-14 03:01:06Z marcel $");
28__FBSDID("$FreeBSD: head/sys/kern/kern_linker.c 159791 2006-06-20 19:32:10Z 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>

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

340 lf = linker_find_file_by_name(filename);
341 if (lf) {
342 KLD_DPF(FILE, ("linker_load_file: file %s is already loaded,"
343 " incrementing refs\n", filename));
344 *result = lf;
345 lf->refs++;
346 return (0);
347 }
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>

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

340 lf = linker_find_file_by_name(filename);
341 if (lf) {
342 KLD_DPF(FILE, ("linker_load_file: file %s is already loaded,"
343 " incrementing refs\n", filename));
344 *result = lf;
345 lf->refs++;
346 return (0);
347 }
348 lf = NULL;
349 foundfile = 0;
350 error = 0;
351
352 /*
353 * We do not need to protect (lock) classes here because there is
354 * no class registration past startup (SI_SUB_KLD, SI_ORDER_ANY)
355 * and there is no class deregistration mechanism at this time.
356 */

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

889 * MPSAFE
890 */
891int
892kldfind(struct thread *td, struct kldfind_args *uap)
893{
894 char *pathname;
895 const char *filename;
896 linker_file_t lf;
348 foundfile = 0;
349 error = 0;
350
351 /*
352 * We do not need to protect (lock) classes here because there is
353 * no class registration past startup (SI_SUB_KLD, SI_ORDER_ANY)
354 * and there is no class deregistration mechanism at this time.
355 */

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

888 * MPSAFE
889 */
890int
891kldfind(struct thread *td, struct kldfind_args *uap)
892{
893 char *pathname;
894 const char *filename;
895 linker_file_t lf;
897 int error = 0;
896 int error;
898
899#ifdef MAC
900 error = mac_check_kld_stat(td->td_ucred);
901 if (error)
902 return (error);
903#endif
904
905 mtx_lock(&Giant);

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

911
912 filename = linker_basename(pathname);
913 lf = linker_find_file_by_name(filename);
914 if (lf)
915 td->td_retval[0] = lf->id;
916 else
917 error = ENOENT;
918out:
897
898#ifdef MAC
899 error = mac_check_kld_stat(td->td_ucred);
900 if (error)
901 return (error);
902#endif
903
904 mtx_lock(&Giant);

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

910
911 filename = linker_basename(pathname);
912 lf = linker_find_file_by_name(filename);
913 if (lf)
914 td->td_retval[0] = lf->id;
915 else
916 error = ENOENT;
917out:
919 if (pathname)
920 free(pathname, M_TEMP);
918 free(pathname, M_TEMP);
921 mtx_unlock(&Giant);
922 return (error);
923}
924
925/*
926 * MPSAFE
927 */
928int

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

1784 error = linker_file_add_dependency(parent, lfdep);
1785 if (error)
1786 break;
1787 }
1788 if (lfpp)
1789 *lfpp = lfdep;
1790 } while (0);
1791out:
919 mtx_unlock(&Giant);
920 return (error);
921}
922
923/*
924 * MPSAFE
925 */
926int

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

1782 error = linker_file_add_dependency(parent, lfdep);
1783 if (error)
1784 break;
1785 }
1786 if (lfpp)
1787 *lfpp = lfdep;
1788 } while (0);
1789out:
1792 if (pathname)
1793 free(pathname, M_LINKER);
1790 free(pathname, M_LINKER);
1794 return (error);
1795}
1796
1797/*
1798 * This routine is responsible for finding dependencies of userland initiated
1799 * kldload(2)'s of files.
1800 */
1801int

--- 119 unchanged lines hidden ---
1791 return (error);
1792}
1793
1794/*
1795 * This routine is responsible for finding dependencies of userland initiated
1796 * kldload(2)'s of files.
1797 */
1798int

--- 119 unchanged lines hidden ---