[PATCH 2/3] Use latest <sys/time.h> from FreeBSD for RTEMS

Sebastian Huber sebastian.huber@embedded-brains.de
Wed Mar 11 12:17:00 GMT 2015


----- 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.



More information about the Newlib mailing list