Back to index

glibc  2.9
dl-cache.h
Go to the documentation of this file.
00001 /* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
00002    Copyright (C) 2003, 2007 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #include <ldconfig.h>
00021 
00022 /* Redefine the cache ID for new ABIs; o32 keeps using the generic check.  */
00023 #if _MIPS_SIM == _ABI64
00024 # define _DL_CACHE_DEFAULT_ID      (FLAG_MIPS64_LIBN64 | FLAG_ELF_LIBC6)
00025 #elif _MIPS_SIM == _ABIN32
00026 # define _DL_CACHE_DEFAULT_ID      (FLAG_MIPS64_LIBN32 | FLAG_ELF_LIBC6)
00027 #endif
00028 
00029 #ifdef _DL_CACHE_DEFAULT_ID
00030 # define _dl_cache_check_flags(flags) \
00031   ((flags) == _DL_CACHE_DEFAULT_ID)
00032 #endif
00033 
00034 #define add_system_dir(dir) \
00035   do                                                    \
00036     {                                                   \
00037       size_t len = strlen (dir);                        \
00038       char path[len + 3];                               \
00039       memcpy (path, dir, len + 1);                      \
00040       if (len >= 6                                      \
00041          && (! memcmp (path + len - 6, "/lib64", 6)            \
00042              || ! memcmp (path + len - 6, "/lib32", 6)))       \
00043        {                                                \
00044          len -= 2;                                      \
00045          path[len] = '\0';                              \
00046        }                                                \
00047       add_dir (path);                                          \
00048       if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4))    \
00049        {                                                \
00050          memcpy (path + len, "32", 3);                         \
00051          add_dir (path);                                \
00052          memcpy (path + len, "64", 3);                         \
00053          add_dir (path);                                \
00054        }                                                \
00055     } while (0)
00056 
00057 #include_next <dl-cache.h>