Back to index

glibc  2.9
dl-librecon.h
Go to the documentation of this file.
00001 /* Optional code to distinguish library flavours.
00002    Copyright (C) 1998, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019    02111-1307 USA.  */
00020 
00021 #ifndef _DL_LIBRECON_H
00022 
00023 #include <sysdeps/unix/sysv/linux/dl-librecon.h>
00024 
00025 #define DISTINGUISH_LIB_VERSIONS \
00026   do                                                                 \
00027     {                                                                \
00028       /* We have to find out whether the binary is linked against           \
00029         libc 5 or glibc.  We do this by looking at all the DT_NEEDED        \
00030         entries.  If one is libc.so.5 this is a libc 5 linked binary.  */    \
00031       if (main_map->l_info[DT_NEEDED])                                      \
00032        {                                                             \
00033          /* We have dependencies.  */                                       \
00034          const ElfW(Dyn) *d;                                                \
00035          const char *strtab;                                                \
00036                                                                      \
00037          strtab = (const char *) D_PTR (main_map, l_info[DT_STRTAB]);       \
00038                                                                      \
00039          for (d = main_map->l_ld; d->d_tag != DT_NULL; ++d)                 \
00040            if (d->d_tag == DT_NEEDED                                        \
00041               && strcmp (strtab + d->d_un.d_val, "libc.so.5") == 0)         \
00042              break;                                                  \
00043                                                                      \
00044          /* We print a `5' or `6' depending on the outcome.  */             \
00045          _dl_printf (d->d_tag != DT_NULL ? "5\n" : "6\n");                  \
00046        }                                                             \
00047     }                                                                \
00048   while (0)
00049 
00050 /* Recognizing extra environment variables.  */
00051 #define EXTRA_LD_ENVVARS \
00052   case 15:                                                           \
00053     if (memcmp (envline, "LIBRARY_VERSION", 15) == 0)                       \
00054       GLRO(dl_correct_cache_id) = envline[16] == '5' ? 2 : 3;               \
00055     break;                                                           \
00056 
00057 /* Extra unsecure variables.  The names are all stuffed in a single
00058    string which means they have to be terminated with a '\0' explicitly.  */
00059 #define EXTRA_UNSECURE_ENVVARS \
00060   "LD_AOUT_LIBRARY_PATH\0"                                           \
00061   "LD_AOUT_PRELOAD\0"
00062 
00063 #endif /* dl-librecon.h */