Skip to content

Commit 4f45b95

Browse files
authored
Merge pull request ARMmbed#12607 from facchinm/sys_stat_h_inclusion
Use toolchain's struct stat if available
2 parents 2a4e481 + b865d90 commit 4f45b95

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

platform/mbed_retarget.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@
4040
#include <errno.h>
4141
#endif
4242

43+
#if defined __has_include
44+
# if __has_include (<sys/stat.h>)
45+
# include <sys/stat.h>
46+
# define HAVE_SYS_STAT_H
47+
# endif
48+
#endif
49+
4350
/* We can get the following standard types from sys/types for gcc, but we
4451
* need to define the types ourselves for the other compilers that normally
4552
* target embedded systems */
@@ -495,6 +502,8 @@ typedef struct Dir DIR;
495502
#define S_IWOTH 0000002 ///< write permission, other
496503
#define S_IXOTH 0000001 ///< execute/search permission, other
497504

505+
#ifndef HAVE_SYS_STAT_H
506+
498507
/* Refer to sys/stat standard
499508
* Note: Not all fields may be supported by the underlying filesystem
500509
*/
@@ -514,6 +523,8 @@ struct stat {
514523
time_t st_ctime; ///< Time of last status change
515524
};
516525

526+
#endif
527+
517528
struct statvfs {
518529
unsigned long f_bsize; ///< Filesystem block size
519530
unsigned long f_frsize; ///< Fragment size (block size)

0 commit comments

Comments
 (0)