This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 01/04] split newlib/libc/reent/timer.c


Checked in with modification of _dummy_time_syscalls variable in the two split files.

-- Jeff J.

Patrick Mansfield wrote:
Index: time-fix-spu/newlib/libc/reent/Makefile.am
===================================================================
--- time-fix-spu.orig/newlib/libc/reent/Makefile.am
+++ time-fix-spu/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
Index: time-fix-spu/newlib/libc/reent/Makefile.in
===================================================================
--- time-fix-spu.orig/newlib/libc/reent/Makefile.in
+++ time-fix-spu/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
Index: time-fix-spu/newlib/libc/reent/gettimeofdayr.c
===================================================================
--- /dev/null
+++ time-fix-spu/newlib/libc/reent/gettimeofdayr.c
@@ -0,0 +1,76 @@
+/* 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. */
+
+#include <reent.h>
+#include <time.h>
+#include <sys/time.h>
+#include <sys/times.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_time_syscalls = 1;
+
+#else
+
+/* We use the errno variable used by the system dependent layer. */
+#undef errno
+extern int errno;
+
+/*
+FUNCTION
+ <<_gettimeofday_r>>---Reentrant version of gettimeofday
+
+INDEX
+ _gettimeofday_r
+
+ANSI_SYNOPSIS
+ #include <reent.h>
+ #include <time.h>
+ int _gettimeofday_r(struct _reent *<[ptr]>,
+ struct timeval *<[ptimeval]>,
+ struct timezone *<[ptimezone]>);
+
+TRAD_SYNOPSIS
+ #include <reent.h>
+ #include <time.h>
+ int _gettimeofday_r(<[ptr]>, <[ptimeval]>, <[ptimezone]>)
+ struct _reent *<[ptr]>;
+ struct timeval *<[ptimeval]>;
+ struct timezone *<[ptimezone]>;
+
+DESCRIPTION
+ This is a reentrant version of <<gettimeofday>>. It
+ takes a pointer to the global data block, which holds
+ <<errno>>.
+
+ This function is only available for a few targets.
+ Check libc.a to see if its available on yours.
+*/
+
+int
+_DEFUN (_gettimeofday_r, (ptr, ptimeval, ptimezone),
+ struct _reent *ptr _AND
+ struct timeval *ptimeval _AND
+ struct timezone *ptimezone)
+{
+ int ret;
+
+ errno = 0;
+ if ((ret = _gettimeofday (ptimeval, ptimezone)) == -1 && errno != 0)
+ ptr->_errno = errno;
+ return ret;
+}
+
+#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
Index: time-fix-spu/newlib/libc/reent/timer.c
===================================================================
--- time-fix-spu.orig/newlib/libc/reent/timer.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Reentrant versions of times and gettimeofday system calls for the
- clock and time ANSI C routines.
- 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. */
-
-#include <reent.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/times.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_time_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 <reent.h>
- #include <sys/times.h>
- clock_t _times_r(struct _reent *<[ptr]>, struct tms *<[ptms]>);
-
-TRAD_SYNOPSIS
- #include <reent.h>
- #include <sys/times.h>
- clock_t _times_r(<[ptr]>, <[ptms]>)
- struct _reent *<[ptr]>;
- struct tms *<[ptms]>;
-
-DESCRIPTION
- This is a reentrant version of <<times>>. It
- takes a pointer to the global data block, which holds
- <<errno>>.
-*/
-
-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
-
-ANSI_SYNOPSIS
- #include <reent.h>
- #include <time.h>
- int _gettimeofday_r(struct _reent *<[ptr]>,
- struct timeval *<[ptimeval]>,
- struct timezone *<[ptimezone]>);
-
-TRAD_SYNOPSIS
- #include <reent.h>
- #include <time.h>
- int _gettimeofday_r(<[ptr]>, <[ptimeval]>, <[ptimezone]>)
- struct _reent *<[ptr]>;
- struct timeval *<[ptimeval]>;
- struct timezone *<[ptimezone]>;
-
-DESCRIPTION
- This is a reentrant version of <<gettimeofday>>. It
- takes a pointer to the global data block, which holds
- <<errno>>.
-
- This function is only available for a few targets.
- Check libc.a to see if its available on yours.
-*/
-
-int
-_DEFUN (_gettimeofday_r, (ptr, ptimeval, ptimezone),
- struct _reent *ptr _AND
- struct timeval *ptimeval _AND
- struct timezone *ptimezone)
-{
- int ret;
-
- errno = 0;
- if ((ret = _gettimeofday (ptimeval, ptimezone)) == -1 && errno != 0)
- ptr->_errno = errno;
- return ret;
-}
-
-#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
Index: time-fix-spu/newlib/libc/reent/timesr.c
===================================================================
--- /dev/null
+++ time-fix-spu/newlib/libc/reent/timesr.c
@@ -0,0 +1,63 @@
+/* Reentrant versions of times system calls */
+
+#include <reent.h>
+#include <time.h>
+#include <sys/time.h>
+#include <sys/times.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_time_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 <reent.h>
+ #include <sys/times.h>
+ clock_t _times_r(struct _reent *<[ptr]>, struct tms *<[ptms]>);
+
+TRAD_SYNOPSIS
+ #include <reent.h>
+ #include <sys/times.h>
+ clock_t _times_r(<[ptr]>, <[ptms]>)
+ struct _reent *<[ptr]>;
+ struct tms *<[ptms]>;
+
+DESCRIPTION
+ This is a reentrant version of <<times>>. It
+ takes a pointer to the global data block, which holds
+ <<errno>>.
+*/
+
+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) */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]