]>
git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/generic/dl-cache.h
1 /* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #ifndef _DL_CACHE_DEFAULT_ID
21 # define _DL_CACHE_DEFAULT_ID 3
24 #ifndef _dl_cache_check_flags
25 # define _dl_cache_check_flags(flags) \
26 ((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID)
30 # define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
33 #define CACHEMAGIC "ld.so-1.7.0"
35 /* libc5 and glibc 2.0/2.1 use the same format. For glibc 2.2 another
36 format has been added in a compatible way:
37 The beginning of the string table is used for the new table:
43 pad, new magic needs to be aligned
44 - this is string[0] for the old format
45 new magic - this is string[0] for the new format
57 int flags
; /* This is 1 for an ELF library. */
58 unsigned int key
, value
; /* String table indices. */
63 char magic
[sizeof CACHEMAGIC
- 1];
65 struct file_entry libs
[0];
68 #define CACHEMAGIC_NEW "glibc-ld.so.cache"
69 #define CACHE_VERSION "1.0"
74 int flags
; /* This is 1 for an ELF library. */
75 unsigned int key
, value
; /* String table indices. */
76 unsigned long hwcap
; /* Hwcap entry. */
81 char magic
[sizeof CACHEMAGIC_NEW
- 1];
82 char version
[sizeof CACHE_VERSION
- 1];
83 unsigned int nlibs
; /* Number of entries. */
84 unsigned int len_strings
; /* Size of string table. */
85 unsigned int unused
[4]; /* Leave space for future extensions. */
86 struct file_entry_new libs
[0]; /* Entries describing libraries. */
87 /* After this the string table of size len_strings is found. */
90 /* Used to align cache_file_new. */
91 #define ALIGN_CACHE(addr) \
92 (((addr) + __alignof__ (struct cache_file_new) -1) \
93 & (~(__alignof__ (struct cache_file_new) - 1)))
96 _dl_cache_libcmp (const char *p1
, const char *p2
)
100 if (*p1
>= '0' && *p1
<= '9')
102 if (*p2
>= '0' && *p2
<= '9')
104 /* Must compare this numerically. */
110 while (*p1
>= '0' && *p1
<= '9')
111 val1
= val1
* 10 + *p1
++ - '0';
112 while (*p2
>= '0' && *p2
<= '9')
113 val2
= val2
* 10 + *p2
++ - '0';
120 else if (*p2
>= '0' && *p2
<= '9')