This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH 1/2] Eliminate use of Newlib-specific <machine/types.h>
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: newlib at sourceware dot org
- Date: Tue, 12 Apr 2016 20:08:35 +0200 (CEST)
- Subject: Re: [PATCH 1/2] Eliminate use of Newlib-specific <machine/types.h>
- Authentication-results: sourceware.org; auth=none
- References: <1460451014-17006-1-git-send-email-sebastian dot huber at embedded-brains dot de> <20160412141827 dot GA9828 at calimero dot vinschen dot de>
----- Corinna Vinschen <vinschen@redhat.com> schrieb:
> Hi Sebastian,
>
> On Apr 12 10:50, Sebastian Huber wrote:
> > The header file <machine/types.h> is Newlib-specific. It was used
> > instead of <sys/_types.h> to provide the internal type definitions
> > _CLOCK_T, _TIME_T_, _CLOCKID_T_, _TIMER_T_, and __suseconds_t. Move
> > these definitions to <sys/_types.h> (there exist two instances of this
> > file, one for Linux and one for all other targets). This makes the
> > _HAVE_SYSTYPES configuration define obsolete (could possibly break the
> > __RDOS__ target). Use the standard <sys/_types.h> include throughout.
> >
> > Provide the __off_t definition via default (non-Linux) <sys/_types.h>
> > based on _off_t. This prevents a potential __off_t and _off_t
> > incompatibility.
> > [...]
> > diff --git a/newlib/libc/include/machine/types.h b/newlib/libc/include/machine/types.h
> > index 4250ee3..71e6139 100644
> > --- a/newlib/libc/include/machine/types.h
> > +++ b/newlib/libc/include/machine/types.h
> > @@ -2,31 +2,16 @@
> > #define _MACHTYPES_H_
> >
> > /*
> > - * The following section is RTEMS specific and is needed to more
> > - * closely match the types defined in the BSD machine/types.h.
> > - * This is needed to let the RTEMS/BSD TCP/IP stack compile.
> > + * This file is provided for backward compatibility. It is no longer used in
> > + * Newlib. Do not add new things to it.
> > */
> > -#if defined(__rtems__)
> > -#include <machine/_types.h>
> > -#endif
> >
> > -#define _CLOCK_T_ unsigned long /* clock() */
> > -#define _TIME_T_ long /* time() */
> > -#define _CLOCKID_T_ unsigned long
> > -#define _TIMER_T_ unsigned long
> > +#include <sys/_types.h>
> >
> > -#ifndef _HAVE_SYSTYPES
> > -typedef long int __off_t;
> > -typedef int __pid_t;
> > #ifdef __GNUC__
> > __extension__ typedef long long int __loff_t;
> > #else
> > typedef long int __loff_t;
> > #endif
> > -#endif
>
> This breaks Cygwin since __loff_t is not defined anymore.
Sorry, I missed that since __loff_t was indirectly available via <sys/_timespec.h> in "winsup/cygwin/include/cygwin/types.h".
> What's the
> reason to keep __loff_t in machine/types.h and then not including it
> anymore? In glibc __loff_t is defined in bits/types.h so I guess this
> patch should move it to sys/_types.h as well.
Ok, I will move it to this place in v2 tomorrow.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschÃftliche Mitteilung im Sinne des EHUG.