diff --git a/platform/mbed_retarget.h b/platform/mbed_retarget.h index a2be2bdf39..0f0368802f 100644 --- a/platform/mbed_retarget.h +++ b/platform/mbed_retarget.h @@ -40,6 +40,13 @@ #include #endif +#if defined __has_include +# if __has_include () +# include +# define HAVE_SYS_STAT_H +# endif +#endif + /* We can get the following standard types from sys/types for gcc, but we * need to define the types ourselves for the other compilers that normally * target embedded systems */ @@ -495,6 +502,8 @@ typedef struct Dir DIR; #define S_IWOTH 0000002 ///< write permission, other #define S_IXOTH 0000001 ///< execute/search permission, other +#ifndef HAVE_SYS_STAT_H + /* Refer to sys/stat standard * Note: Not all fields may be supported by the underlying filesystem */ @@ -514,6 +523,8 @@ struct stat { time_t st_ctime; ///< Time of last status change }; +#endif + struct statvfs { unsigned long f_bsize; ///< Filesystem block size unsigned long f_frsize; ///< Fragment size (block size)