Merge pull request #12607 from facchinm/sys_stat_h_inclusion

Use toolchain's struct stat if available
pull/12643/head
Martin Kojtal 2020-03-17 09:30:03 +01:00 committed by GitHub
commit 4f45b95ca3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

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