4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1998 by Sun Microsystems, Inc.
28 #pragma ident "%Z%%M% %I% %E% SMI"
31 * ld.so directory caching
33 #include <sys/types.h>
36 * Shared object lookup performance in the run-time link editor is
37 * enhanced through the use of caches for directories that the editor
38 * searches. A given "cache" describes the contents of a single directory,
39 * and each cache entry contains the canonical name for a shared object
40 * as well as its absolute pathname.
42 * Within a cache, "pointers" are really relative addresses to some absolute
43 * address (often the base address of the containing database).
47 * Relative pointer macros.
49 #define RELPTR(base, absptr) ((long)(absptr) - (long)(base))
50 #define AP(base) ((caddr_t)base)
53 * Definitions for cache structures.
55 #define DB_HASH 11 /* number of hash buckets in caches */
56 #define LD_CACHE_MAGIC 0x041155 /* cookie to identify data structure */
57 #define LD_CACHE_VERSION 0 /* version number of cache structure */
59 struct dbe
{ /* element of a directory cache */
60 long dbe_next
; /* (rp) next element on this list */
61 long dbe_lop
; /* (rp) canonical name for object */
62 long dbe_name
; /* (rp) absolute name */
65 struct db
{ /* directory cache database */
66 long db_name
; /* (rp) directory contained here */
67 struct dbe db_hash
[DB_HASH
]; /* hash buckets */
68 caddr_t db_chain
; /* private to database mapping */
71 struct dbf
{ /* cache file image */
72 long dbf_magic
; /* identifying cookie */
73 long dbf_version
; /* version no. of these dbs */
74 long dbf_machtype
; /* machine type */
75 long dbf_db
; /* directory cache dbs */
79 * Structures used to describe and access a database.
81 struct dbd
{ /* data base descriptor */
82 struct dbd
*dbd_next
; /* next one on this list */
83 struct db
*dbd_db
; /* data base described by this */
86 struct dd
{ /* directory descriptor */
87 struct dd
*dd_next
; /* next one on this list */
88 struct db
*dd_db
; /* data base described by this */
92 * Interfaces imported/exported by the lookup code.
95 char *ask_db(); /* ask db for highest minor number */
96 struct db
*lo_cache(); /* obtain cache for directory name */