From 403b95478316406a6cfd835fac1cc66766aee6ca Mon Sep 17 00:00:00 2001 From: Nicholas Lowell Date: Thu, 31 Jan 2019 14:30:51 -0500 Subject: [PATCH] posix: define mode_t in sys/types.h only if it isn't already defined (potentially by the provided libc) --- include/posix/mqueue.h | 1 - include/posix/sys/types.h | 5 +++++ include/posix/unistd.h | 2 -- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/posix/mqueue.h b/include/posix/mqueue.h index ab498f6..5f19c8b 100644 --- a/include/posix/mqueue.h +++ b/include/posix/mqueue.h @@ -17,7 +17,6 @@ extern "C" { #endif typedef void *mqd_t; -typedef unsigned int mode_t; typedef struct mq_attr { long mq_flags; diff --git a/include/posix/sys/types.h b/include/posix/sys/types.h index 5e657e5..2a5dd1e 100644 --- a/include/posix/sys/types.h +++ b/include/posix/sys/types.h @@ -19,6 +19,11 @@ extern "C" { typedef unsigned long useconds_t; +#ifndef _MODE_T_DECLARED +typedef unsigned int mode_t; +#define _MODE_T_DECLARED +#endif + /* time related attributes */ #ifndef CONFIG_NEWLIB_LIBC typedef u32_t clockid_t; diff --git a/include/posix/unistd.h b/include/posix/unistd.h index 3195de3..7b14f13 100644 --- a/include/posix/unistd.h +++ b/include/posix/unistd.h @@ -16,8 +16,6 @@ extern "C" { #ifdef CONFIG_POSIX_API #include -typedef unsigned int mode_t; - /* File related operations */ extern int open(const char *name, int flags); extern int close(int file); -- 2.7.4