diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2008-11-25 00:16:06 +0300 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2008-11-25 00:16:06 +0300 |
commit | 0ef912dfc442abcadcc8a6f01c6a6de86a8a2ea9 (patch) | |
tree | 98f4ecb977037458d569cef636991574628f787d /newlib/libc | |
parent | 9aa929ef17d4518dde4f508d12eb984840df376e (diff) |
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.
Diffstat (limited to 'newlib/libc')
-rw-r--r-- | newlib/libc/reent/Makefile.am | 2 | ||||
-rw-r--r-- | newlib/libc/reent/Makefile.in | 11 | ||||
-rw-r--r-- | newlib/libc/reent/stat64r.c | 68 | ||||
-rw-r--r-- | newlib/libc/search/hash_func.c | 8 |
4 files changed, 88 insertions, 1 deletions
diff --git a/newlib/libc/reent/Makefile.am b/newlib/libc/reent/Makefile.am index 0d21285a1..e61153c68 100644 --- a/newlib/libc/reent/Makefile.am +++ b/newlib/libc/reent/Makefile.am @@ -8,11 +8,13 @@ if HAVE_STDIO64_DIR STDIO64_SOURCES = \ fstat64r.c \ lseek64r.c \ + stat64r.c \ open64r.c STDIO64_DEFS = \ fstat64r.def \ lseek64r.def \ + stat64r.def \ open64r.def endif diff --git a/newlib/libc/reent/Makefile.in b/newlib/libc/reent/Makefile.in index 9c05a57f6..171c71ac7 100644 --- a/newlib/libc/reent/Makefile.in +++ b/newlib/libc/reent/Makefile.in @@ -69,6 +69,7 @@ am__objects_1 = lib_a-closer.$(OBJEXT) lib_a-reent.$(OBJEXT) \ lib_a-unlinkr.$(OBJEXT) lib_a-writer.$(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-stat64r.$(OBJEXT) \ @HAVE_STDIO64_DIR_TRUE@ lib_a-open64r.$(OBJEXT) am__objects_3 = $(am__objects_2) 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 \ statr.lo timesr.lo unlinkr.lo writer.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_9 = execr.lo @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@ fstat64r.c \ @HAVE_STDIO64_DIR_TRUE@ lseek64r.c \ +@HAVE_STDIO64_DIR_TRUE@ stat64r.c \ @HAVE_STDIO64_DIR_TRUE@ open64r.c @HAVE_STDIO64_DIR_TRUE@STDIO64_DEFS = \ @HAVE_STDIO64_DIR_TRUE@ fstat64r.def \ @HAVE_STDIO64_DIR_TRUE@ lseek64r.def \ +@HAVE_STDIO64_DIR_TRUE@ stat64r.def \ @HAVE_STDIO64_DIR_TRUE@ open64r.def ELIX_2_SOURCES = $(STDIO64_SOURCES) @@ -552,6 +555,12 @@ lib_a-lseek64r.o: 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` +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 $(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 diff --git a/newlib/libc/reent/stat64r.c b/newlib/libc/reent/stat64r.c new file mode 100644 index 000000000..695b7f813 --- /dev/null +++ b/newlib/libc/reent/stat64r.c @@ -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) */ diff --git a/newlib/libc/search/hash_func.c b/newlib/libc/search/hash_func.c index 52cb31ccb..355f0b592 100644 --- a/newlib/libc/search/hash_func.c +++ b/newlib/libc/search/hash_func.c @@ -45,9 +45,11 @@ static char sccsid[] = "@(#)hash_func.c 8.2 (Berkeley) 2/21/94"; #include "page.h" #include "extern.h" +#if 0 static __uint32_t hash1(const void *, size_t); static __uint32_t hash2(const void *, size_t); static __uint32_t hash3(const void *, size_t); +#endif static __uint32_t hash4(const void *, size_t); /* Global default hash function */ @@ -65,6 +67,7 @@ __uint32_t (*__default_hash)(const void *, size_t) = hash4; #define PRIME1 37 #define PRIME2 1048583 +#if 0 static __uint32_t hash1(keyarg, len) const void *keyarg; @@ -79,12 +82,14 @@ hash1(keyarg, len) h %= PRIME2; return (h); } +#endif /* * Phong's linear congruential hash */ #define dcharhash(h, c) ((h) = 0x63c63cd9*(h) + 0x9c39c33d + (c)) +#if 0 static __uint32_t hash2(keyarg, len) const void *keyarg; @@ -104,6 +109,7 @@ hash2(keyarg, len) } return (h); } +#endif /* * 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 */ +#if 0 static __uint32_t hash3(keyarg, len) const void *keyarg; @@ -160,6 +167,7 @@ hash3(keyarg, len) } return (h); } +#endif /* Hash function from Chris Torek. */ static __uint32_t |