This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH 2/3] Use latest <sys/time.h> from FreeBSD for RTEMS
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: newlib at sourceware dot org
- Date: Wed, 11 Mar 2015 13:11:13 +0100 (CET)
- Subject: Re: [PATCH 2/3] Use latest <sys/time.h> from FreeBSD for RTEMS
- Authentication-results: sourceware.org; auth=none
- References: <1425906188-22578-1-git-send-email-sebastian dot huber at embedded-brains dot de> <1425906188-22578-2-git-send-email-sebastian dot huber at embedded-brains dot de> <20150311104206 dot GV5732 at calimero dot vinschen dot de>
----- UrsprÃngliche Mail -----
> Von: "Corinna Vinschen" <vinschen@redhat.com>
> An: newlib@sourceware.org
> Gesendet: Mittwoch, 11. MÃrz 2015 11:42:06
> Betreff: Re: [PATCH 2/3] Use latest <sys/time.h> from FreeBSD for RTEMS
> On Mar 9 14:03, Sebastian Huber wrote:
>> Import the latest <sys/time.h> from FreeBSD for RTEMS. This has two
>> reasons.
>>
>> 1. We want to use the FreeBSD timecounters for timekeeping in RTEMS.
>> See also https://devel.rtems.org/ticket/2271.
>>
>> 2. This makes the port of the network stack from FreeBSD easier.
>>
>> newlib/ChangeLog
>> 2015-03-09 Sebastian Huber <sebastian.huber@embedded-brains.de>
>>
>> * libc/sys/rtems/include/sys/_timeval.h: Import from FreeBSD.
>> * libc/sys/rtems/include/sys/time.h: Likewise.
>> * libc/include/sys/time.h: Delete RTEMS specifics.
>> * libc/include/sys/types.h (sbintime_t): Define for RTEMS.
>> (suseconds_t): Likewise.
>> * libc/sys/rtems/include/machine/_types.h (__suseconds_t):
>> Define.
>> ---
>> newlib/libc/include/sys/time.h | 6 +-
>> newlib/libc/include/sys/types.h | 12 +
>> newlib/libc/sys/rtems/include/sys/_timeval.h | 52 +++
>> newlib/libc/sys/rtems/include/sys/time.h | 496 +++++++++++++++++++++++++++
>> newlib/libc/sys/rtems/machine/_types.h | 2 +
>> 5 files changed, 565 insertions(+), 3 deletions(-)
>> create mode 100644 newlib/libc/sys/rtems/include/sys/_timeval.h
>> create mode 100644 newlib/libc/sys/rtems/include/sys/time.h
>>
>> diff --git a/newlib/libc/include/sys/time.h b/newlib/libc/include/sys/time.h
>> index 470a1a6..fc42c6c 100644
>> --- a/newlib/libc/include/sys/time.h
>> +++ b/newlib/libc/include/sys/time.h
>> @@ -20,8 +20,8 @@ struct timeval {
>> suseconds_t tv_usec;
>> };
>>
>> -/* BSD time macros used by RTEMS code */
>> -#if defined (__rtems__) || defined (__CYGWIN__)
>> +/* BSD time macros */
>> +#if defined (__CYGWIN__)
>
> I don't quite grok this. You're disabling the BSD timeval macros for
> rtems here, just to re-introduce them verbatim in
> libc/sys/rtems/include/sys/time.h. What's the idea to split them off?
> That's not overly clean, unless their definition is different, which
> it isn't. Care to explain?
In case I understand the build system correctly, then header files in the libc/sys/rtems/include directory are RTEMS specific and replace the ones in libc/include. My aim is to use a purely RTEMS specific <sys/time.h> which is derived from the latest FreeBSD version. I verified that it works for RTEMS with the old and new network stack. Since libc/include/sys/time.h is no longer used for RTEMS, it makes sense to remove RTEMS specifics from this file.