diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-13 13:10:15 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2016-04-13 13:30:27 +0200 |
commit | 477463a2011ba81907a753df9ce7a71b6563db54 (patch) | |
tree | 909f65c55a7c1d9f8421e2b77047482327e958a3 /newlib/libc/sys | |
parent | eb6f1d7b77b5a66f036f183d3cb9d4f157a09564 (diff) | |
download | cygnal-477463a2011ba81907a753df9ce7a71b6563db54.tar.gz cygnal-477463a2011ba81907a753df9ce7a71b6563db54.tar.bz2 cygnal-477463a2011ba81907a753df9ce7a71b6563db54.zip |
Eliminate use of Newlib-specific <machine/types.h>
This change solves a glibc/BSD compatibility problem.
glibc and BSD use double underscore types for internal types. The Linux
port of Newlib uses some glibc provided internal type definitions which
are not protected by guard defines, e.g. __off_t. To avoid a conflict
Newlib uses single underscore types for some internal types, e.g.
_off_t. However, for BSD compatibility we have to define the internal
types with double underscore names in <sys/_types.h>.
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.
Move __loff_t defintion to default (non-Linux) <sys/_types.h>. Define
it via _off64_t to avoid a dependency on the compiler.
Provide the __off_t definition via default (non-Linux) <sys/_types.h>
based on _off_t for all systems except Cygwin. For Cygwin use _off64_t.
Define off_t via __off_t.
Provide the __pid_t definition via default (non-Linux) <sys/_types.h>.
This prevents a potential __pid_t and pid_t incompatibility. Add BSD
guard defines for pid_t.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Diffstat (limited to 'newlib/libc/sys')
-rw-r--r-- | newlib/libc/sys/linux/sys/_types.h | 7 | ||||
-rw-r--r-- | newlib/libc/sys/linux/sys/types.h | 1 | ||||
-rw-r--r-- | newlib/libc/sys/rtems/include/machine/_types.h | 3 | ||||
-rw-r--r-- | newlib/libc/sys/sparc64/sys/_timeval.h | 2 |
4 files changed, 8 insertions, 5 deletions
diff --git a/newlib/libc/sys/linux/sys/_types.h b/newlib/libc/sys/linux/sys/_types.h index 1ad429dba..2fd140520 100644 --- a/newlib/libc/sys/linux/sys/_types.h +++ b/newlib/libc/sys/linux/sys/_types.h @@ -51,4 +51,11 @@ typedef struct typedef struct { __flock_mutex_t mutex; } _flock_t; +#define _CLOCK_T_ unsigned long /* clock() */ +#define _TIME_T_ long /* time() */ +#define _CLOCKID_T_ unsigned long +#define _TIMER_T_ unsigned long + +typedef long __suseconds_t; /* microseconds (signed) */ + #endif /* _SYS__TYPES_H */ diff --git a/newlib/libc/sys/linux/sys/types.h b/newlib/libc/sys/linux/sys/types.h index 8e674eff6..20dab2f53 100644 --- a/newlib/libc/sys/linux/sys/types.h +++ b/newlib/libc/sys/linux/sys/types.h @@ -54,7 +54,6 @@ #include <stddef.h> #include <sys/config.h> #include <features.h> -#include <machine/types.h> #include <sys/_types.h> #if !defined(__time_t_defined) && !defined(_TIME_T) diff --git a/newlib/libc/sys/rtems/include/machine/_types.h b/newlib/libc/sys/rtems/include/machine/_types.h index 1711c7ae8..e0d93f7fe 100644 --- a/newlib/libc/sys/rtems/include/machine/_types.h +++ b/newlib/libc/sys/rtems/include/machine/_types.h @@ -5,9 +5,6 @@ #ifndef _MACHINE__TYPES_H #define _MACHINE__TYPES_H -/* This disables some conflicting type definitions in <machine/types.h> */ -#define _HAVE_SYSTYPES - #include <machine/_default_types.h> typedef __int32_t blksize_t; diff --git a/newlib/libc/sys/sparc64/sys/_timeval.h b/newlib/libc/sys/sparc64/sys/_timeval.h index 84ee717bb..fbe9ce64d 100644 --- a/newlib/libc/sys/sparc64/sys/_timeval.h +++ b/newlib/libc/sys/sparc64/sys/_timeval.h @@ -1,7 +1,7 @@ #ifndef _SYS_TIME_H #define _SYS_TIME_H -#include <machine/types.h> +#include <sys/_types.h> #ifndef __time_t_defined typedef _TIME_T_ time_t; |