2008-11-24 Jeff Johnston <jjohnstn@redhat.com>

* libc/search/hash_func.c: Comment out unused static hash functions.
        * libc/reent/stat64r.c: New file.
        * libc/reent/Makefile.am: Add stat64r.c support.
        * libc/reent/Makefile.in: Regenerated.
This commit is contained in:
Jeff Johnston 2008-11-24 21:16:06 +00:00
parent 9aa929ef17
commit 0ef912dfc4
5 changed files with 95 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2008-11-24 Jeff Johnston <jjohnstn@redhat.com>
* libc/search/hash_func.c: Comment out unused static hash functions.
* libc/reent/stat64r.c: New file.
* libc/reent/Makefile.am: Add stat64r.c support.
* libc/reent/Makefile.in: Regenerated.
2008-11-24 Joel Sherrill <joel.sherrill@oarcorp.com> 2008-11-24 Joel Sherrill <joel.sherrill@oarcorp.com>
* libc/posix/scandir.c: Fix memory leaks. * libc/posix/scandir.c: Fix memory leaks.

View File

@ -8,11 +8,13 @@ if HAVE_STDIO64_DIR
STDIO64_SOURCES = \ STDIO64_SOURCES = \
fstat64r.c \ fstat64r.c \
lseek64r.c \ lseek64r.c \
stat64r.c \
open64r.c open64r.c
STDIO64_DEFS = \ STDIO64_DEFS = \
fstat64r.def \ fstat64r.def \
lseek64r.def \ lseek64r.def \
stat64r.def \
open64r.def open64r.def
endif endif

View File

@ -69,6 +69,7 @@ am__objects_1 = lib_a-closer.$(OBJEXT) lib_a-reent.$(OBJEXT) \
lib_a-unlinkr.$(OBJEXT) lib_a-writer.$(OBJEXT) lib_a-unlinkr.$(OBJEXT) lib_a-writer.$(OBJEXT)
@HAVE_STDIO64_DIR_TRUE@am__objects_2 = lib_a-fstat64r.$(OBJEXT) \ @HAVE_STDIO64_DIR_TRUE@am__objects_2 = lib_a-fstat64r.$(OBJEXT) \
@HAVE_STDIO64_DIR_TRUE@ lib_a-lseek64r.$(OBJEXT) \ @HAVE_STDIO64_DIR_TRUE@ lib_a-lseek64r.$(OBJEXT) \
@HAVE_STDIO64_DIR_TRUE@ lib_a-stat64r.$(OBJEXT) \
@HAVE_STDIO64_DIR_TRUE@ lib_a-open64r.$(OBJEXT) @HAVE_STDIO64_DIR_TRUE@ lib_a-open64r.$(OBJEXT)
am__objects_3 = $(am__objects_2) am__objects_3 = $(am__objects_2)
am__objects_4 = lib_a-execr.$(OBJEXT) am__objects_4 = lib_a-execr.$(OBJEXT)
@ -87,7 +88,7 @@ am__objects_6 = closer.lo reent.lo impure.lo fcntlr.lo fstatr.lo \
openr.lo readr.lo renamer.lo signalr.lo signgam.lo sbrkr.lo \ openr.lo readr.lo renamer.lo signalr.lo signgam.lo sbrkr.lo \
statr.lo timesr.lo unlinkr.lo writer.lo statr.lo timesr.lo unlinkr.lo writer.lo
@HAVE_STDIO64_DIR_TRUE@am__objects_7 = fstat64r.lo lseek64r.lo \ @HAVE_STDIO64_DIR_TRUE@am__objects_7 = fstat64r.lo lseek64r.lo \
@HAVE_STDIO64_DIR_TRUE@ open64r.lo @HAVE_STDIO64_DIR_TRUE@ stat64r.lo open64r.lo
am__objects_8 = $(am__objects_7) am__objects_8 = $(am__objects_7)
am__objects_9 = execr.lo am__objects_9 = execr.lo
@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@am__objects_10 = \ @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@am__objects_10 = \
@ -287,11 +288,13 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
@HAVE_STDIO64_DIR_TRUE@STDIO64_SOURCES = \ @HAVE_STDIO64_DIR_TRUE@STDIO64_SOURCES = \
@HAVE_STDIO64_DIR_TRUE@ fstat64r.c \ @HAVE_STDIO64_DIR_TRUE@ fstat64r.c \
@HAVE_STDIO64_DIR_TRUE@ lseek64r.c \ @HAVE_STDIO64_DIR_TRUE@ lseek64r.c \
@HAVE_STDIO64_DIR_TRUE@ stat64r.c \
@HAVE_STDIO64_DIR_TRUE@ open64r.c @HAVE_STDIO64_DIR_TRUE@ open64r.c
@HAVE_STDIO64_DIR_TRUE@STDIO64_DEFS = \ @HAVE_STDIO64_DIR_TRUE@STDIO64_DEFS = \
@HAVE_STDIO64_DIR_TRUE@ fstat64r.def \ @HAVE_STDIO64_DIR_TRUE@ fstat64r.def \
@HAVE_STDIO64_DIR_TRUE@ lseek64r.def \ @HAVE_STDIO64_DIR_TRUE@ lseek64r.def \
@HAVE_STDIO64_DIR_TRUE@ stat64r.def \
@HAVE_STDIO64_DIR_TRUE@ open64r.def @HAVE_STDIO64_DIR_TRUE@ open64r.def
ELIX_2_SOURCES = $(STDIO64_SOURCES) ELIX_2_SOURCES = $(STDIO64_SOURCES)
@ -552,6 +555,12 @@ lib_a-lseek64r.o: lseek64r.c
lib_a-lseek64r.obj: lseek64r.c lib_a-lseek64r.obj: lseek64r.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-lseek64r.obj `if test -f 'lseek64r.c'; then $(CYGPATH_W) 'lseek64r.c'; else $(CYGPATH_W) '$(srcdir)/lseek64r.c'; fi` $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-lseek64r.obj `if test -f 'lseek64r.c'; then $(CYGPATH_W) 'lseek64r.c'; else $(CYGPATH_W) '$(srcdir)/lseek64r.c'; fi`
lib_a-stat64r.o: stat64r.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-stat64r.o `test -f 'stat64r.c' || echo '$(srcdir)/'`stat64r.c
lib_a-stat64r.obj: stat64r.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-stat64r.obj `if test -f 'stat64r.c'; then $(CYGPATH_W) 'stat64r.c'; else $(CYGPATH_W) '$(srcdir)/stat64r.c'; fi`
lib_a-open64r.o: open64r.c lib_a-open64r.o: open64r.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-open64r.o `test -f 'open64r.c' || echo '$(srcdir)/'`open64r.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-open64r.o `test -f 'open64r.c' || echo '$(srcdir)/'`open64r.c

View File

@ -0,0 +1,68 @@
/* Reentrant versions of stat64 system call. This implementation just
calls the stat64 system call. */
#include <reent.h>
#include <unistd.h>
#include <sys/stat.h>
#include <_syslist.h>
/* Some targets provides their own versions of these functions. Those
targets should define REENTRANT_SYSCALLS_PROVIDED in
TARGET_CFLAGS. */
#ifdef _REENT_ONLY
#ifndef REENTRANT_SYSCALLS_PROVIDED
#define REENTRANT_SYSCALLS_PROVIDED
#endif
#endif
#ifdef REENTRANT_SYSCALLS_PROVIDED
int _dummy_stat64_syscalls = 1;
#else
/* We use the errno variable used by the system dependent layer. */
#undef errno
extern int errno;
/*
FUNCTION
<<_stat64_r>>---Reentrant version of stat64
INDEX
_stat64_r
ANSI_SYNOPSIS
#include <reent.h>
int _stat64_r(struct _reent *<[ptr]>,
const char *<[file]>, struct stat64 *<[pstat]>);
TRAD_SYNOPSIS
#include <reent.h>
int _stat64_r(<[ptr]>, <[file]>, <[pstat]>)
struct _reent *<[ptr]>;
char *<[file]>;
struct stat64 *<[pstat]>;
DESCRIPTION
This is a reentrant version of <<stat64>>. It
takes a pointer to the global data block, which holds
<<errno>>.
*/
int
_DEFUN (_stat64_r, (ptr, file, pstat),
struct _reent *ptr _AND
_CONST char *file _AND
struct stat64 *pstat)
{
int ret;
errno = 0;
if ((ret = _stat64 (file, pstat)) == -1 && errno != 0)
ptr->_errno = errno;
return ret;
}
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */

View File

@ -45,9 +45,11 @@ static char sccsid[] = "@(#)hash_func.c 8.2 (Berkeley) 2/21/94";
#include "page.h" #include "page.h"
#include "extern.h" #include "extern.h"
#if 0
static __uint32_t hash1(const void *, size_t); static __uint32_t hash1(const void *, size_t);
static __uint32_t hash2(const void *, size_t); static __uint32_t hash2(const void *, size_t);
static __uint32_t hash3(const void *, size_t); static __uint32_t hash3(const void *, size_t);
#endif
static __uint32_t hash4(const void *, size_t); static __uint32_t hash4(const void *, size_t);
/* Global default hash function */ /* Global default hash function */
@ -65,6 +67,7 @@ __uint32_t (*__default_hash)(const void *, size_t) = hash4;
#define PRIME1 37 #define PRIME1 37
#define PRIME2 1048583 #define PRIME2 1048583
#if 0
static __uint32_t static __uint32_t
hash1(keyarg, len) hash1(keyarg, len)
const void *keyarg; const void *keyarg;
@ -79,12 +82,14 @@ hash1(keyarg, len)
h %= PRIME2; h %= PRIME2;
return (h); return (h);
} }
#endif
/* /*
* Phong's linear congruential hash * Phong's linear congruential hash
*/ */
#define dcharhash(h, c) ((h) = 0x63c63cd9*(h) + 0x9c39c33d + (c)) #define dcharhash(h, c) ((h) = 0x63c63cd9*(h) + 0x9c39c33d + (c))
#if 0
static __uint32_t static __uint32_t
hash2(keyarg, len) hash2(keyarg, len)
const void *keyarg; const void *keyarg;
@ -104,6 +109,7 @@ hash2(keyarg, len)
} }
return (h); return (h);
} }
#endif
/* /*
* This is INCREDIBLY ugly, but fast. We break the string up into 8 byte * This is INCREDIBLY ugly, but fast. We break the string up into 8 byte
@ -114,6 +120,7 @@ hash2(keyarg, len)
* *
* OZ's original sdbm hash * OZ's original sdbm hash
*/ */
#if 0
static __uint32_t static __uint32_t
hash3(keyarg, len) hash3(keyarg, len)
const void *keyarg; const void *keyarg;
@ -160,6 +167,7 @@ hash3(keyarg, len)
} }
return (h); return (h);
} }
#endif
/* Hash function from Chris Torek. */ /* Hash function from Chris Torek. */
static __uint32_t static __uint32_t