aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1997-08-22 04:42:12 +0000
committerPeter Wemm <peter@FreeBSD.org>1997-08-22 04:42:12 +0000
commitd4ba5766dde61481c91cb861ae7894fb7e3eac9b (patch)
treede7a88a25b57dfbfd79fb8f42c6b4b4ec8500330 /sbin
parent89721f6f1aed6b2d7e568270daa6eef94fe4e148 (diff)
downloadsrc-d4ba5766dde61481c91cb861ae7894fb7e3eac9b.tar.gz
src-d4ba5766dde61481c91cb861ae7894fb7e3eac9b.zip
Add -R (rescan or refresh) option to rescan and rebuild the hints
file based on the previous list of directories stored there which should overcome a weakness of the '-m' switch which can only add libs. This is an ideal way of updating the hints list after adding or removing a shlib since it will remove entries that are gone and doesn't need to have all the directories spelled out each time. (eg: rm -f /usr/lib/libtcl75*; ldconfig -R) This only works for version 2 hints files (which we've been generating for a year or so) which store the path.
Notes
Notes: svn path=/head/; revision=28559
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ldconfig/ldconfig.811
-rw-r--r--sbin/ldconfig/ldconfig.c29
2 files changed, 27 insertions, 13 deletions
diff --git a/sbin/ldconfig/ldconfig.8 b/sbin/ldconfig/ldconfig.8
index 3aee7bd533b4..6f97599e1bad 100644
--- a/sbin/ldconfig/ldconfig.8
+++ b/sbin/ldconfig/ldconfig.8
@@ -27,7 +27,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $Id: ldconfig.8,v 1.12 1997/02/22 15:46:37 peter Exp $
+.\" $Id: ldconfig.8,v 1.13 1997/07/11 14:45:40 jkh Exp $
.\"
.Dd October 3, 1993
.Dt LDCONFIG 8
@@ -37,7 +37,7 @@
.Nd configure the shared library cache
.Sh SYNOPSIS
.Nm ldconfig
-.Op Fl mrsv
+.Op Fl Rmrsv
.Op Fl f Ar hints_file
.Op Ar directory | file Ar ...
.Sh DESCRIPTION
@@ -90,6 +90,10 @@ is typically run as part of the boot sequence.
The following options recognized by
.Nm ldconfig:
.Bl -tag -width indent
+.It Fl R
+Rescan the previously configured directories. This opens the previous hints
+file and fetches the directory list from the header. Any additional pathnames
+on the command line are also processed.
.It Fl f Ar hints_file
Read and/or update the specified hints file, instead of
.Pa /var/run/ld.so.hints .
@@ -104,7 +108,8 @@ Directories recorded in the hints file by previous runs of
are also rescanned for new shared libraries.
.It Fl r
List the current contents of the hints file
-on the standard output. The hints file is not modified.
+on the standard output. The hints file is not modified. The list of
+directories stored in the hints file is included.
.It Fl s
Do not scan the built-in system directory
.Pq Dq /usr/lib
diff --git a/sbin/ldconfig/ldconfig.c b/sbin/ldconfig/ldconfig.c
index 3eed70a3a049..1f54178ce7a0 100644
--- a/sbin/ldconfig/ldconfig.c
+++ b/sbin/ldconfig/ldconfig.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: ldconfig.c,v 1.18 1997/02/22 15:46:38 peter Exp $
+ * $Id: ldconfig.c,v 1.19 1997/07/11 14:45:41 jkh Exp $
*/
#include <sys/param.h>
@@ -66,12 +66,11 @@
#undef major
#undef minor
-extern char *__progname;
-
static int verbose;
static int nostd;
static int justread;
static int merge;
+static int rescan;
static char *hints_file = _PATH_LD_HINTS;
struct shlib_list {
@@ -102,8 +101,11 @@ char *argv[];
int i, c;
int rval = 0;
- while ((c = getopt(argc, argv, "f:mrsv")) != EOF) {
+ while ((c = getopt(argc, argv, "Rf:mrsv")) != EOF) {
switch (c) {
+ case 'R':
+ rescan = 1;
+ break;
case 'f':
hints_file = optarg;
break;
@@ -120,20 +122,20 @@ char *argv[];
verbose = 1;
break;
default:
- errx(1, "Usage: %s [-mrsv] [-f hints_file] [dir | file ...]",
- __progname);
+ errx(1, "Usage: %s [-Rmrsv] [-f hints_file] "
+ "[dir | file ...]", argv[0]);
break;
}
}
dir_list = strdup("");
- if (justread || merge) {
+ if (justread || merge || rescan) {
if ((rval = readhints()) != 0)
return rval;
}
- if (!nostd && !merge)
+ if (!nostd && !merge && !rescan)
std_search_path();
/* Add any directories/files from the command line */
@@ -525,6 +527,15 @@ readhints()
blist = (struct hints_bucket *)(addr + hdr->hh_hashtab);
strtab = (char *)(addr + hdr->hh_strtab);
+ if (hdr->hh_version >= LD_HINTS_VERSION_2)
+ add_search_path(strtab + hdr->hh_dirlist);
+ else if (rescan)
+ errx(1, "%s too old and does not contain the search path",
+ hints_file);
+
+ if (rescan)
+ return 0;
+
for (i = 0; i < hdr->hh_nbucket; i++) {
struct hints_bucket *bp = &blist[i];
@@ -549,8 +560,6 @@ readhints()
*shlib_tail = shp;
shlib_tail = &shp->next;
}
- if (hdr->hh_version >= LD_HINTS_VERSION_2)
- add_search_path(strtab + hdr->hh_dirlist);
return 0;
}