diff options
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/_strerror.c | 2 | ||||
-rw-r--r-- | sysdeps/generic/des_impl.c | 2 | ||||
-rw-r--r-- | sysdeps/generic/dl-cache.c | 21 | ||||
-rw-r--r-- | sysdeps/generic/memcmp.c | 54 | ||||
-rw-r--r-- | sysdeps/generic/pread.c | 3 | ||||
-rw-r--r-- | sysdeps/generic/pread64.c | 3 | ||||
-rw-r--r-- | sysdeps/generic/pwrite.c | 3 | ||||
-rw-r--r-- | sysdeps/generic/pwrite64.c | 3 |
8 files changed, 57 insertions, 34 deletions
diff --git a/sysdeps/generic/_strerror.c b/sysdeps/generic/_strerror.c index 83156293a5..bcba45d519 100644 --- a/sysdeps/generic/_strerror.c +++ b/sysdeps/generic/_strerror.c @@ -45,7 +45,7 @@ _strerror_internal (int errnum, char *buf, size_t buflen) const size_t unklen = strlen (unk); char *p = buf + buflen; *--p = '\0'; - p = _itoa (errnum, p, 10, 0); + p = _itoa_word (errnum, p, 10, 0); return memcpy (p - unklen, unk, unklen); } diff --git a/sysdeps/generic/des_impl.c b/sysdeps/generic/des_impl.c index e0a3af9dd9..f801a841fc 100644 --- a/sysdeps/generic/des_impl.c +++ b/sysdeps/generic/des_impl.c @@ -18,6 +18,8 @@ /* We must not distribute the DES implementation as part of the glibc. So we have to provide a dummy version here. */ +#include <des.h> + int _des_crypt (char *buf, unsigned len, struct desparams *desp) { diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index c704fd869d..36d6c707d3 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -53,10 +53,7 @@ _dl_load_cache_lookup (const char *name) static struct cache_file *cache; static size_t cachesize; unsigned int i; - - if (cache == (void *) -1) - /* Previously looked for the cache file and didn't find it. */ - return NULL; + const char *best; if (cache == NULL) { @@ -76,6 +73,11 @@ _dl_load_cache_lookup (const char *name) } } + if (cache == (void *) -1) + /* Previously looked for the cache file and didn't find it. */ + return NULL; + + best = NULL; for (i = 0; i < cache->nlibs; ++i) if ((cache->libs[i].flags == 1 || cache->libs[i].flags == 3) && /* ELF library entry. */ @@ -85,7 +87,14 @@ _dl_load_cache_lookup (const char *name) /* Does the name match? */ ! strcmp (name, ((const char *) &cache->libs[cache->nlibs] + cache->libs[i].key))) - return (const char *) &cache->libs[cache->nlibs] + cache->libs[i].value; + { + best = ((const char *) &cache->libs[cache->nlibs] + + cache->libs[i].value); - return NULL; + if (cache->libs[i].flags == 3) + /* We've found an exact match for the shared object and no + general `ELF' release. Stop searching. */ + break; + } + return best; } diff --git a/sysdeps/generic/memcmp.c b/sysdeps/generic/memcmp.c index 844cdc6afb..213ccc07de 100644 --- a/sysdeps/generic/memcmp.c +++ b/sysdeps/generic/memcmp.c @@ -18,56 +18,64 @@ Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include "config.h" #endif #undef __ptr_t -#if defined (__cplusplus) || (defined (__STDC__) && __STDC__) -#define __ptr_t void * +#if defined __cplusplus || (defined __STDC__ && __STDC__) +# define __ptr_t void * #else /* Not C++ or ANSI C. */ -#undef const -#define const -#define __ptr_t char * +# undef const +# define const +# define __ptr_t char * #endif /* C++ or ANSI C. */ -#if defined (HAVE_STRING_H) || defined (_LIBC) -#include <string.h> +#ifndef __P +# if defined __GNUC__ || (defined __STDC__ && __STDC__) +# define __P(args) args +# else +# define __P(args) () +# endif /* GCC. */ +#endif /* Not __P. */ + +#if defined HAVE_STRING_H || defined _LIBC +# include <string.h> #endif #undef memcmp #ifdef _LIBC -#include <memcopy.h> +# include <memcopy.h> #else /* Not in the GNU C library. */ -#include <sys/types.h> +# include <sys/types.h> /* Type to use for aligned memory operations. This should normally be the biggest type supported by a single load and store. Must be an unsigned type. */ -#define op_t unsigned long int -#define OPSIZ (sizeof(op_t)) +# define op_t unsigned long int +# define OPSIZ (sizeof(op_t)) /* Threshold value for when to enter the unrolled loops. */ -#define OP_T_THRES 16 +# define OP_T_THRES 16 /* Type to use for unaligned operations. */ typedef unsigned char byte; -#ifndef WORDS_BIGENDIAN -#define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2))) -#else -#define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2))) -#endif +# ifndef WORDS_BIGENDIAN +# define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2))) +# else +# define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2))) +# endif #endif /* In the GNU C library. */ #ifdef WORDS_BIGENDIAN -#define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1) +# define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1) #else -#define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b)) +# define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b)) #endif /* BE VERY CAREFUL IF YOU CHANGE THIS CODE! */ @@ -90,9 +98,9 @@ typedef unsigned char byte; static int memcmp_bytes __P((op_t, op_t)); -#ifdef __GNUC__ +# ifdef __GNUC__ __inline -#endif +# endif static int memcmp_bytes (a, b) op_t a, b; @@ -376,6 +384,6 @@ memcmp (s1, s2, len) } #ifdef weak_alias -#undef bcmp +# undef bcmp weak_alias (memcmp, bcmp) #endif diff --git a/sysdeps/generic/pread.c b/sysdeps/generic/pread.c index 5fdaf7b4af..82548d0272 100644 --- a/sysdeps/generic/pread.c +++ b/sysdeps/generic/pread.c @@ -22,7 +22,7 @@ /* Read NBYTES into BUF from FD at the given position OFFSET without changing the file pointer. Return the number read or -1. */ ssize_t -pread (int fd, void *buf, size_t nbytes, off_t offset) +__pread (int fd, void *buf, size_t nbytes, off_t offset) { if (nbytes == 0) return 0; @@ -40,5 +40,6 @@ pread (int fd, void *buf, size_t nbytes, off_t offset) __set_errno (ENOSYS); return -1; } +weak_alias (__pread, pread) stub_warning (pread) #include <stub-tag.h> diff --git a/sysdeps/generic/pread64.c b/sysdeps/generic/pread64.c index fdf622250b..e1596038ac 100644 --- a/sysdeps/generic/pread64.c +++ b/sysdeps/generic/pread64.c @@ -22,7 +22,7 @@ /* Read NBYTES into BUF from FD at the given position OFFSET without changing the file pointer. Return the number read or -1. */ ssize_t -pread64 (int fd, void *buf, size_t nbytes, off64_t offset) +__pread64 (int fd, void *buf, size_t nbytes, off64_t offset) { if (nbytes == 0) return 0; @@ -40,5 +40,6 @@ pread64 (int fd, void *buf, size_t nbytes, off64_t offset) __set_errno (ENOSYS); return -1; } +weak_alias (__pread64, pread64) stub_warning (pread64) #include <stub-tag.h> diff --git a/sysdeps/generic/pwrite.c b/sysdeps/generic/pwrite.c index 48a1dc6089..8eec560c9d 100644 --- a/sysdeps/generic/pwrite.c +++ b/sysdeps/generic/pwrite.c @@ -22,7 +22,7 @@ /* Write NBYTES of BUF to FD at given position OFFSET without changing the file position. Return the number written, or -1. */ ssize_t -pwrite (int fd, const void *buf, size_t nbytes, off_t offset) +__pwrite (int fd, const void *buf, size_t nbytes, off_t offset) { if (nbytes == 0) return 0; @@ -40,5 +40,6 @@ pwrite (int fd, const void *buf, size_t nbytes, off_t offset) __set_errno (ENOSYS); return -1; } +weak_alias (__pwrite, pwrite) stub_warning (pwrite) #include <stub-tag.h> diff --git a/sysdeps/generic/pwrite64.c b/sysdeps/generic/pwrite64.c index df229f877f..d84b63576a 100644 --- a/sysdeps/generic/pwrite64.c +++ b/sysdeps/generic/pwrite64.c @@ -22,7 +22,7 @@ /* Write NBYTES of BUF to FD at given position OFFSET without changing the file position. Return the number written, or -1. */ ssize_t -pwrite64 (int fd, const void *buf, size_t nbytes, off64_t offset) +__pwrite64 (int fd, const void *buf, size_t nbytes, off64_t offset) { if (nbytes == 0) return 0; @@ -40,5 +40,6 @@ pwrite64 (int fd, const void *buf, size_t nbytes, off64_t offset) __set_errno (ENOSYS); return -1; } +weak_alias (__pwrite64, pwrite64) stub_warning (pwrite64) #include <stub-tag.h> |