summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/ld
diff options
context:
space:
mode:
authorOleg Safiullin <form@cvs.openbsd.org>2000-01-27 22:14:58 +0000
committerOleg Safiullin <form@cvs.openbsd.org>2000-01-27 22:14:58 +0000
commitfe5312397f6ae92f5302292bbe7dc1c8a1e24ba4 (patch)
tree24aea270e57ab717aaa5d5051d0a013874a5249d /gnu/usr.bin/ld
parentaddb9eb482958e7f87f658c2a1264081f839ad64 (diff)
Add `-R' option (rescan previously configured directories) support.
Tested by espie@
Diffstat (limited to 'gnu/usr.bin/ld')
-rw-r--r--gnu/usr.bin/ld/ldconfig/ldconfig.88
-rw-r--r--gnu/usr.bin/ld/ldconfig/ldconfig.c61
2 files changed, 41 insertions, 28 deletions
diff --git a/gnu/usr.bin/ld/ldconfig/ldconfig.8 b/gnu/usr.bin/ld/ldconfig/ldconfig.8
index e7181786334..7e257efc18d 100644
--- a/gnu/usr.bin/ld/ldconfig/ldconfig.8
+++ b/gnu/usr.bin/ld/ldconfig/ldconfig.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ldconfig.8,v 1.3 1998/03/26 19:46:47 niklas Exp $
+.\" $OpenBSD: ldconfig.8,v 1.4 2000/01/27 22:14:57 form Exp $
.\"
.\" Copyright (c) 1993,1995 Paul Kranenburg
.\" All rights reserved.
@@ -37,7 +37,7 @@
.Nd configure the shared library cache
.Sh SYNOPSIS
.Nm ldconfig
-.Op Fl mrsv
+.Op Fl Rmrsv
.Op Ar directory Ar ...
.Sh DESCRIPTION
.Nm
@@ -82,6 +82,10 @@ is typically run as part of the boot sequence.
The following options are recognized by
.Nm ldconfig:
.Bl -tag -width indent
+.It Fl R
+Rescan the previously configured directories. This opens the hints file
+and fetches the directory list from the header. Any additional pathnames
+on the command line are also processed.
.It Fl m
Merge the result of the scan of the directories given as arguments into
the existing hints file. The default action is to build the hints file afresh.
diff --git a/gnu/usr.bin/ld/ldconfig/ldconfig.c b/gnu/usr.bin/ld/ldconfig/ldconfig.c
index 6914a845dbb..7625b6dde80 100644
--- a/gnu/usr.bin/ld/ldconfig/ldconfig.c
+++ b/gnu/usr.bin/ld/ldconfig/ldconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldconfig.c,v 1.6 1996/12/18 16:50:07 millert Exp $ */
+/* $OpenBSD: ldconfig.c,v 1.7 2000/01/27 22:14:57 form Exp $ */
/*
* Copyright (c) 1993,1995 Paul Kranenburg
@@ -62,6 +62,7 @@ static int verbose;
static int nostd;
static int justread;
static int merge;
+static int rescan;
struct shlib_list {
/* Internal list of shared libraries found */
@@ -91,8 +92,11 @@ char *argv[];
int i, c;
int rval = 0;
- while ((c = getopt(argc, argv, "mrsv")) != EOF) {
+ while ((c = getopt(argc, argv, "Rmrsv")) != EOF) {
switch (c) {
+ case 'R':
+ rescan = 1;
+ break;
case 'm':
merge = 1;
break;
@@ -115,7 +119,7 @@ char *argv[];
dir_list = xmalloc(1);
*dir_list = '\0';
- if (justread || merge) {
+ if (justread || merge || rescan) {
if ((rval = readhints()) != 0)
return rval;
if (justread) {
@@ -126,6 +130,8 @@ char *argv[];
if (!nostd && !merge)
std_search_path();
+ if (rescan)
+ add_search_path(dir_list);
for (i = 0; i < n_search_dirs; i++)
rval |= dodir(search_dirs[i], 1);
@@ -456,32 +462,35 @@ readhints()
blist = (struct hints_bucket *)(addr + hdr->hh_hashtab);
strtab = (char *)(addr + hdr->hh_strtab);
- for (i = 0; i < hdr->hh_nbucket; i++) {
- struct hints_bucket *bp = &blist[i];
+ if (justread || !rescan) {
+ for (i = 0; i < hdr->hh_nbucket; i++) {
+ struct hints_bucket *bp = &blist[i];
- /* Sanity check */
- if (bp->hi_namex >= hdr->hh_strtab_sz) {
- warnx("Bad name index: %#x", bp->hi_namex);
- return -1;
- }
- if (bp->hi_pathx >= hdr->hh_strtab_sz) {
- warnx("Bad path index: %#x", bp->hi_pathx);
- return -1;
- }
+ /* Sanity check */
+ if (bp->hi_namex >= hdr->hh_strtab_sz) {
+ warnx("Bad name index: %#x", bp->hi_namex);
+ return -1;
+ }
+ if (bp->hi_pathx >= hdr->hh_strtab_sz) {
+ warnx("Bad path index: %#x", bp->hi_pathx);
+ return -1;
+ }
- /* Allocate new list element */
- shp = (struct shlib_list *)xmalloc(sizeof *shp);
- if ((shp->name = strdup(strtab + bp->hi_namex)) == NULL)
- errx(1, "virtual memory exhausted");
- if ((shp->path = strdup(strtab + bp->hi_pathx)) == NULL)
- errx(1, "virtual memory exhausted");
- bcopy(bp->hi_dewey, shp->dewey, sizeof(shp->dewey));
- shp->ndewey = bp->hi_ndewey;
- shp->next = NULL;
-
- *shlib_tail = shp;
- shlib_tail = &shp->next;
+ /* Allocate new list element */
+ shp = (struct shlib_list *)xmalloc(sizeof *shp);
+ if ((shp->name = strdup(strtab + bp->hi_namex)) == NULL)
+ errx(1, "virtual memory exhausted");
+ if ((shp->path = strdup(strtab + bp->hi_pathx)) == NULL)
+ errx(1, "virtual memory exhausted");
+ bcopy(bp->hi_dewey, shp->dewey, sizeof(shp->dewey));
+ shp->ndewey = bp->hi_ndewey;
+ shp->next = NULL;
+
+ *shlib_tail = shp;
+ shlib_tail = &shp->next;
+ }
}
+
if ((dir_list = strdup(strtab + hdr->hh_dirlist)) == NULL)
errx(1, "virtual memory exhausted");