Deleted Added
full compact
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.7 1994/06/15 22:40:56 rich 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>

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

49#include <string.h>
50#include <unistd.h>
51
52#include "ld.h"
53
54#undef major
55#undef minor
56
57extern char *__progname;
58
59static int verbose;
60static int nostd;
61static int justread;
62
63struct shlib_list {
64 /* Internal list of shared libraries found */
65 char *name;
66 char *path;

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

80
81int
82main(argc, argv)
83int argc;
84char *argv[];
85{
86 int i, c;
87 int rval = 0;
88
89 while ((c = getopt(argc, argv, "rsv")) != EOF) {
90 switch (c) {
91 case 'v':
92 verbose = 1;
93 break;
94 case 's':
95 nostd = 1;
96 break;
97 case 'r':
98 justread = 1;
99 break;
100 default:
101 fprintf(stderr, "Usage: %s [-r][-s][-v][dir ...]\n",
102 __progname);
103 exit(1);
104 break;
105 }
106 }
107
108 if (justread)
109 return listhints();
110

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

359 int i;
360
361 if ((fd = open(_PATH_LD_HINTS, O_RDONLY, 0)) == -1) {
362 perror(_PATH_LD_HINTS);
363 return -1;
364 }
365
366 msize = PAGSIZ;
367 addr = mmap(0, msize, PROT_READ, MAP_COPY, fd, 0);
368
369 if (addr == (caddr_t)-1) {
370 perror(_PATH_LD_HINTS);
371 return -1;
372 }
373
374 hdr = (struct hints_header *)addr;
375 if (HH_BADMAG(*hdr)) {

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

380
381 if (hdr->hh_version != LD_HINTS_VERSION_1) {
382 fprintf(stderr, "Unsupported version: %d\n", hdr->hh_version);
383 return -1;
384 }
385
386 if (hdr->hh_ehints > msize) {
387 if (mmap(addr+msize, hdr->hh_ehints - msize,
388 PROT_READ, MAP_COPY|MAP_FIXED,
389 fd, msize) != (caddr_t)(addr+msize)) {
390
391 perror(_PATH_LD_HINTS);
392 return -1;
393 }
394 }
395 close(fd);
396

--- 29 unchanged lines hidden ---