1/* 2 * Copyright (c) 1993 Paul Kranenburg 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 --- 13 unchanged lines hidden (view full) --- 22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * |
30 * $Id: ldconfig.c,v 1.6 1994/06/05 19:04:11 ats Exp $ |
31 */ 32 33#include <sys/param.h> |
34#include <sys/types.h> 35#include <sys/stat.h> 36#include <sys/file.h> 37#include <sys/time.h> 38#include <sys/mman.h> 39#include <sys/resource.h> |
40#include <dirent.h> |
41#include <errno.h> |
42#include <fcntl.h> |
43#include <ar.h> 44#include <ranlib.h> 45#include <a.out.h> 46#include <stab.h> |
47#include <stdio.h> 48#include <stdlib.h> |
49#include <string.h> |
50#include <unistd.h> |
51 52#include "ld.h" 53 54#undef major 55#undef minor 56 57char *progname; 58static int verbose; --- 11 unchanged lines hidden (view full) --- 70 struct shlib_list *next; 71}; 72 73static struct shlib_list *shlib_head = NULL, **shlib_tail = &shlib_head; 74 75static void enter __P((char *, char *, char *, int *, int)); 76static int dodir __P((char *, int)); 77static int build_hints __P((void)); |
78static int listhints __P((void)); |
79 80int 81main(argc, argv) 82int argc; 83char *argv[]; 84{ 85 int i, c; 86 int rval = 0; --- 21 unchanged lines hidden (view full) --- 108 break; 109 } 110 } 111 112 if (justread) 113 return listhints(); 114 115 if (!nostd) |
116 std_search_path(); |
117 118 for (i = 0; i < n_search_dirs; i++) 119 rval |= dodir(search_dirs[i], 1); 120 121 for (i = optind; i < argc; i++) 122 rval |= dodir(argv[i], 0); 123 124 rval |= build_hints(); --- 221 unchanged lines hidden (view full) --- 346 if (rename(tmpfile, _PATH_LD_HINTS) != 0) { 347 perror(_PATH_LD_HINTS); 348 return -1; 349 } 350 351 return 0; 352} 353 |
354static int |
355listhints() 356{ 357 int fd; 358 caddr_t addr; 359 long msize; 360 struct hints_header *hdr; 361 struct hints_bucket *blist; 362 char *strtab; --- 9 unchanged lines hidden (view full) --- 372 373 if (addr == (caddr_t)-1) { 374 perror(_PATH_LD_HINTS); 375 return -1; 376 } 377 378 hdr = (struct hints_header *)addr; 379 if (HH_BADMAG(*hdr)) { |
380 fprintf(stderr, "%s: Bad magic: %o\n", 381 _PATH_LD_HINTS, hdr->hh_magic); |
382 return -1; 383 } 384 385 if (hdr->hh_version != LD_HINTS_VERSION_1) { 386 fprintf(stderr, "Unsupported version: %d\n", hdr->hh_version); 387 return -1; 388 } 389 --- 40 unchanged lines hidden --- |