From 59673dbb2a1642ea97716cdf457ac2a132faf612 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 21 Feb 2007 19:22:33 +0000 Subject: [PATCH] 2007-02-21 Patrick Mansfield * libc/reent/timer.c: Removed (split into two new files). * libc/reent/timesr.c: New file for _times_r. * libc/reent/gettimeofdayr.c: New file out _gettimeofday_r. * reent/Makefile.in: Remove timer.c, add timesr.c and gettimeofdayr.c. * libc/reent/Makefile.am: Regenerate. --- newlib/ChangeLog | 9 +++ newlib/libc/reent/Makefile.am | 6 +- newlib/libc/reent/Makefile.in | 37 ++++++----- .../libc/reent/{timer.c => gettimeofdayr.c} | 43 +------------ newlib/libc/reent/timesr.c | 63 +++++++++++++++++++ 5 files changed, 102 insertions(+), 56 deletions(-) rename newlib/libc/reent/{timer.c => gettimeofdayr.c} (69%) create mode 100644 newlib/libc/reent/timesr.c diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 333b127ad..a1c290e68 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,12 @@ +2007-02-21 Patrick Mansfield + + * libc/reent/timer.c: Removed (split into two new files). + * libc/reent/timesr.c: New file for _times_r. + * libc/reent/gettimeofdayr.c: New file out _gettimeofday_r. + * reent/Makefile.in: Remove timer.c, add timesr.c and + gettimeofdayr.c. + * libc/reent/Makefile.am: Regenerate. + 2007-02-20 Patrick Mansfield * configure.host: Build SPU with default_newlib_atexit_dynamic_alloc="no". diff --git a/newlib/libc/reent/Makefile.am b/newlib/libc/reent/Makefile.am index babdd7046..37a334fe5 100644 --- a/newlib/libc/reent/Makefile.am +++ b/newlib/libc/reent/Makefile.am @@ -36,6 +36,7 @@ GENERAL_SOURCES = \ fcntlr.c \ fstatr.c \ getreent.c \ + gettimeofdayr.c \ linkr.c \ lseekr.c \ openr.c \ @@ -44,7 +45,7 @@ GENERAL_SOURCES = \ signgam.c \ sbrkr.c \ statr.c \ - timer.c \ + timesr.c \ unlinkr.c \ writer.c @@ -69,6 +70,7 @@ CHEWOUT_FILES = \ execr.def \ fcntlr.def \ fstatr.def \ + gettimeofdayr.def \ linkr.def \ lseekr.def \ openr.def \ @@ -76,7 +78,7 @@ CHEWOUT_FILES = \ signalr.def \ sbrkr.def \ statr.def \ - timer.def \ + timesr.def \ unlinkr.def \ $(STDIO64_DEFS) \ writer.def diff --git a/newlib/libc/reent/Makefile.in b/newlib/libc/reent/Makefile.in index 8193d53b1..5d5d70e80 100644 --- a/newlib/libc/reent/Makefile.in +++ b/newlib/libc/reent/Makefile.in @@ -55,12 +55,12 @@ lib_a_LIBADD = am__objects_1 = lib_a-closer.$(OBJEXT) lib_a-reent.$(OBJEXT) \ lib_a-impure.$(OBJEXT) lib_a-fcntlr.$(OBJEXT) \ lib_a-fstatr.$(OBJEXT) lib_a-getreent.$(OBJEXT) \ - lib_a-linkr.$(OBJEXT) lib_a-lseekr.$(OBJEXT) \ - lib_a-openr.$(OBJEXT) lib_a-readr.$(OBJEXT) \ - lib_a-signalr.$(OBJEXT) lib_a-signgam.$(OBJEXT) \ - lib_a-sbrkr.$(OBJEXT) lib_a-statr.$(OBJEXT) \ - lib_a-timer.$(OBJEXT) lib_a-unlinkr.$(OBJEXT) \ - lib_a-writer.$(OBJEXT) + lib_a-gettimeofdayr.$(OBJEXT) lib_a-linkr.$(OBJEXT) \ + lib_a-lseekr.$(OBJEXT) lib_a-openr.$(OBJEXT) \ + lib_a-readr.$(OBJEXT) lib_a-signalr.$(OBJEXT) \ + lib_a-signgam.$(OBJEXT) lib_a-sbrkr.$(OBJEXT) \ + lib_a-statr.$(OBJEXT) lib_a-timesr.$(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-open64r.$(OBJEXT) @@ -77,8 +77,9 @@ lib_a_OBJECTS = $(am_lib_a_OBJECTS) LTLIBRARIES = $(noinst_LTLIBRARIES) libreent_la_LIBADD = am__objects_6 = closer.lo reent.lo impure.lo fcntlr.lo fstatr.lo \ - getreent.lo linkr.lo lseekr.lo openr.lo readr.lo signalr.lo \ - signgam.lo sbrkr.lo statr.lo timer.lo unlinkr.lo writer.lo + getreent.lo gettimeofdayr.lo linkr.lo lseekr.lo openr.lo \ + readr.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 am__objects_8 = $(am__objects_7) @@ -275,6 +276,7 @@ GENERAL_SOURCES = \ fcntlr.c \ fstatr.c \ getreent.c \ + gettimeofdayr.c \ linkr.c \ lseekr.c \ openr.c \ @@ -283,7 +285,7 @@ GENERAL_SOURCES = \ signgam.c \ sbrkr.c \ statr.c \ - timer.c \ + timesr.c \ unlinkr.c \ writer.c @@ -301,6 +303,7 @@ CHEWOUT_FILES = \ execr.def \ fcntlr.def \ fstatr.def \ + gettimeofdayr.def \ linkr.def \ lseekr.def \ openr.def \ @@ -308,7 +311,7 @@ CHEWOUT_FILES = \ signalr.def \ sbrkr.def \ statr.def \ - timer.def \ + timesr.def \ unlinkr.def \ $(STDIO64_DEFS) \ writer.def @@ -420,6 +423,12 @@ lib_a-getreent.o: getreent.c lib_a-getreent.obj: getreent.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getreent.obj `if test -f 'getreent.c'; then $(CYGPATH_W) 'getreent.c'; else $(CYGPATH_W) '$(srcdir)/getreent.c'; fi` +lib_a-gettimeofdayr.o: gettimeofdayr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gettimeofdayr.o `test -f 'gettimeofdayr.c' || echo '$(srcdir)/'`gettimeofdayr.c + +lib_a-gettimeofdayr.obj: gettimeofdayr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gettimeofdayr.obj `if test -f 'gettimeofdayr.c'; then $(CYGPATH_W) 'gettimeofdayr.c'; else $(CYGPATH_W) '$(srcdir)/gettimeofdayr.c'; fi` + lib_a-linkr.o: linkr.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-linkr.o `test -f 'linkr.c' || echo '$(srcdir)/'`linkr.c @@ -468,11 +477,11 @@ lib_a-statr.o: statr.c lib_a-statr.obj: statr.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-statr.obj `if test -f 'statr.c'; then $(CYGPATH_W) 'statr.c'; else $(CYGPATH_W) '$(srcdir)/statr.c'; fi` -lib_a-timer.o: timer.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-timer.o `test -f 'timer.c' || echo '$(srcdir)/'`timer.c +lib_a-timesr.o: timesr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-timesr.o `test -f 'timesr.c' || echo '$(srcdir)/'`timesr.c -lib_a-timer.obj: timer.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-timer.obj `if test -f 'timer.c'; then $(CYGPATH_W) 'timer.c'; else $(CYGPATH_W) '$(srcdir)/timer.c'; fi` +lib_a-timesr.obj: timesr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-timesr.obj `if test -f 'timesr.c'; then $(CYGPATH_W) 'timesr.c'; else $(CYGPATH_W) '$(srcdir)/timesr.c'; fi` lib_a-unlinkr.o: unlinkr.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-unlinkr.o `test -f 'unlinkr.c' || echo '$(srcdir)/'`unlinkr.c diff --git a/newlib/libc/reent/timer.c b/newlib/libc/reent/gettimeofdayr.c similarity index 69% rename from newlib/libc/reent/timer.c rename to newlib/libc/reent/gettimeofdayr.c index b604b90f3..64a8cda55 100644 --- a/newlib/libc/reent/timer.c +++ b/newlib/libc/reent/gettimeofdayr.c @@ -1,5 +1,4 @@ -/* Reentrant versions of times and gettimeofday system calls for the - clock and time ANSI C routines. +/* Reentrant version of gettimeofday system call This implementation just calls the times/gettimeofday system calls. Gettimeofday may not be available on all targets. It's presence here is dubious. Consider it for internal use only. */ @@ -21,7 +20,7 @@ #ifdef REENTRANT_SYSCALLS_PROVIDED -int _dummy_time_syscalls = 1; +int _dummy_gettimeofday_syscalls = 1; #else @@ -29,46 +28,10 @@ int _dummy_time_syscalls = 1; #undef errno extern int errno; -/* -FUNCTION - <<_times_r>>---Reentrant version of times - -INDEX - _times_r - -ANSI_SYNOPSIS - #include - #include - clock_t _times_r(struct _reent *<[ptr]>, struct tms *<[ptms]>); - -TRAD_SYNOPSIS - #include - #include - clock_t _times_r(<[ptr]>, <[ptms]>) - struct _reent *<[ptr]>; - struct tms *<[ptms]>; - -DESCRIPTION - This is a reentrant version of <>. It - takes a pointer to the global data block, which holds - <>. -*/ - -clock_t -_DEFUN (_times_r, (ptr, ptms), - struct _reent *ptr _AND - struct tms *ptms) -{ - clock_t ret; - - ret = _times (ptms); - return ret; -} - /* FUNCTION <<_gettimeofday_r>>---Reentrant version of gettimeofday - + INDEX _gettimeofday_r diff --git a/newlib/libc/reent/timesr.c b/newlib/libc/reent/timesr.c new file mode 100644 index 000000000..1881724ba --- /dev/null +++ b/newlib/libc/reent/timesr.c @@ -0,0 +1,63 @@ +/* Reentrant versions of times system calls */ + +#include +#include +#include +#include +#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_times_syscalls = 1; + +#else + +/* We use the errno variable used by the system dependent layer. */ +#undef errno +extern int errno; + +/* +FUNCTION + <<_times_r>>---Reentrant version of times + +INDEX + _times_r + +ANSI_SYNOPSIS + #include + #include + clock_t _times_r(struct _reent *<[ptr]>, struct tms *<[ptms]>); + +TRAD_SYNOPSIS + #include + #include + clock_t _times_r(<[ptr]>, <[ptms]>) + struct _reent *<[ptr]>; + struct tms *<[ptms]>; + +DESCRIPTION + This is a reentrant version of <>. It + takes a pointer to the global data block, which holds + <>. +*/ + +clock_t +_DEFUN (_times_r, (ptr, ptms), + struct _reent *ptr _AND + struct tms *ptms) +{ + clock_t ret; + + ret = _times (ptms); + return ret; +} +#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */