lib/libc/minimal: Refined handle duplicate time definitions

Follow the approach of newlib to use a file sys/_types.h to specify the
underlying type for POSIX/libc types that must be provided in multiple
headers.  The identifier for this type is in the reserved namespace.

Use this type rather than a specific standard type in all headers that
need to provide the type under its public name.

Remove the inclusion of <sys/types.h> from headers that should not bring
in all symbols present in that header, replacing it with the standard
boilerplate to expose the specific symbols that are required.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
Peter A. Bigot 2019-08-07 11:23:10 -05:00 committed by Andrew Boie
commit ef4cd6a1ab
5 changed files with 46 additions and 6 deletions

View file

@ -9,6 +9,7 @@
#define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_TIME_H_
#include <stdint.h>
#include <sys/_types.h>
#include <bits/restrict.h>
/* Minimal time.h to fulfill the requirements of certain libraries
@ -33,12 +34,12 @@ struct tm {
#if !defined(__time_t_defined)
#define __time_t_defined
typedef int64_t time_t;
typedef _TIME_T_ time_t;
#endif
#if !defined(__suseconds_t_defined)
#define __suseconds_t_defined
typedef int32_t suseconds_t;
typedef _SUSECONDS_T_ suseconds_t;
#endif
#include <sys/_timespec.h>