This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: SH: implement time()
Alexandre Oliva wrote:
>
> On Jan 25, 2001, Alexandre Oliva <aoliva@redhat.com> wrote:
>
> > On Jan 25, 2001, Alexandre Oliva <aoliva@redhat.com> wrote:
> >> On Jan 24, 2001, Alexandre Oliva <aoliva@redhat.com> wrote:
> >>> * configure.host (sh*-*-*): Add -DHAVE_GETTIMEOFDAY to newlib_cflags.
> >>> * libc/sys/sh/syscalls.c (_gettimeofday_r): New.
>
> >> I've just checked this in, approved by Jeff Johnston.
>
> > Forgot to mention that I adjusted the ChangeLog entry to remove the
> > `_r', so that it matches the actual implementation, as suggested by
> > Jeff.
>
> And the very fact that I renamed the function in the last minute
> before submitting the patch was the reason why a linker error showed
> up in recent tests that hadn't showed up before. The problem is that
> gettimeofday_r and times_r are implemented in the same source file,
> so, even though I had implemented _gettimeofday(), I had to implement
> _times() too otherwise it wouldn't link. I plead guilty :-)
>
> Ok to install?
>
Yes.
-- Jeff J.
> ----------------------------------------------------------------------------------------------------
> Index: newlib/ChangeLog
> from Alexandre Oliva <aoliva@redhat.com>
> * libc/sys/sh/syscalls.c (_times): New.
>
> 2001-01-25 Alexandre Oliva <aoliva@redhat.com>
>
> Index: newlib/libc/sys/sh/syscalls.c
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/sys/sh/syscalls.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 syscalls.c
> --- newlib/libc/sys/sh/syscalls.c 2001/01/25 21:40:28 1.3
> +++ newlib/libc/sys/sh/syscalls.c 2001/01/25 23:22:48
> @@ -176,6 +176,14 @@ _pipe (int *fd)
> return __trap34 (SYS_pipe, fd);
> }
>
> +/* This is only provided because _gettimeofday_r and _times_r are
> + defined in the same module, so we avoid a link error. */
> +clock_t
> +_times (struct tms *tp)
> +{
> + return -1;
> +}
> +
> int
> _gettimeofday (struct timeval *tv, struct timezone *tz)
> {
>
> ----------------------------------------------------------------------------------------------------
>
> --
> Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
> Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
> CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
> Free Software Evangelist *Please* write to mailing lists, not to me