kern_linker.c (461b36ab541ba709aaf7eccd66d906f8ebc225c7) kern_linker.c (149a155c3b6d60d732f1450880e202ee6ac7acc9)
1/*-
2 * Copyright (c) 1997 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

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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 *
1/*-
2 * Copyright (c) 1997 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

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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 * $Id: kern_linker.c,v 1.21 1999/01/19 22:26:46 peter Exp $
26 * $Id: kern_linker.c,v 1.22 1999/01/23 03:45:22 peter Exp $
27 */
28
29#include "opt_ddb.h"
30
31#include <sys/param.h>
32#include <sys/kernel.h>
33#include <sys/systm.h>
34#include <sys/malloc.h>

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

350 namelen = strlen(filename) + 1;
351 lf = malloc(sizeof(struct linker_file) + namelen, M_LINKER, M_WAITOK);
352 if (!lf)
353 goto out;
354 bzero(lf, sizeof(*lf));
355
356 lf->refs = 1;
357 lf->userrefs = 0;
27 */
28
29#include "opt_ddb.h"
30
31#include <sys/param.h>
32#include <sys/kernel.h>
33#include <sys/systm.h>
34#include <sys/malloc.h>

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

350 namelen = strlen(filename) + 1;
351 lf = malloc(sizeof(struct linker_file) + namelen, M_LINKER, M_WAITOK);
352 if (!lf)
353 goto out;
354 bzero(lf, sizeof(*lf));
355
356 lf->refs = 1;
357 lf->userrefs = 0;
358 lf->flags = 0;
358 lf->filename = (char*) (lf + 1);
359 strcpy(lf->filename, filename);
360 lf->id = next_file_id++;
361 lf->ndeps = 0;
362 lf->deps = NULL;
363 STAILQ_INIT(&lf->common);
364 TAILQ_INIT(&lf->modules);
365

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

405 }
406
407 file->refs--;
408 if (file->refs > 0) {
409 lockmgr(&lock, LK_RELEASE, 0, curproc);
410 goto out;
411 }
412
359 lf->filename = (char*) (lf + 1);
360 strcpy(lf->filename, filename);
361 lf->id = next_file_id++;
362 lf->ndeps = 0;
363 lf->deps = NULL;
364 STAILQ_INIT(&lf->common);
365 TAILQ_INIT(&lf->modules);
366

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

406 }
407
408 file->refs--;
409 if (file->refs > 0) {
410 lockmgr(&lock, LK_RELEASE, 0, curproc);
411 goto out;
412 }
413
413 linker_file_sysuninit(file);
414 /* Don't try to run SYSUNINITs if we are unloaded due to a link error */
415 if (file->flags & LINKER_FILE_LINKED)
416 linker_file_sysuninit(file);
414
415 TAILQ_REMOVE(&files, file, link);
416 lockmgr(&lock, LK_RELEASE, 0, curproc);
417
418 for (i = 0; i < file->ndeps; i++)
419 linker_file_unload(file->deps[i]);
420 free(file->deps, M_LINKER);
421

--- 595 unchanged lines hidden ---
417
418 TAILQ_REMOVE(&files, file, link);
419 lockmgr(&lock, LK_RELEASE, 0, curproc);
420
421 for (i = 0; i < file->ndeps; i++)
422 linker_file_unload(file->deps[i]);
423 free(file->deps, M_LINKER);
424

--- 595 unchanged lines hidden ---