summaryrefslogtreecommitdiffstats
path: root/stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'stat.c')
-rw-r--r--stat.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/stat.c b/stat.c
index 7fb6b50..d1132ad 100644
--- a/stat.c
+++ b/stat.c
@@ -24,6 +24,10 @@
#include <sys/types.h>
#include <sys/stat.h>
+#if BFS_HAS_SYS_PARAM
+# include <sys/param.h>
+#endif
+
#ifdef STATX_BASIC_STATS
# define HAVE_STATX true
#elif __linux__
@@ -65,6 +69,8 @@ const char *bfs_stat_field_name(enum bfs_stat_field field) {
return "block count";
case BFS_STAT_RDEV:
return "underlying device";
+ case BFS_STAT_ATTRS:
+ return "attributes";
case BFS_STAT_ATIME:
return "access time";
case BFS_STAT_BTIME:
@@ -121,6 +127,11 @@ static void bfs_stat_convert(const struct stat *statbuf, struct bfs_stat *buf) {
buf->rdev = statbuf->st_rdev;
buf->mask |= BFS_STAT_RDEV;
+#if BSD
+ buf->attrs = statbuf->st_flags;
+ buf->mask |= BFS_STAT_ATTRS;
+#endif
+
buf->atime = statbuf->st_atim;
buf->mask |= BFS_STAT_ATIME;
@@ -244,6 +255,9 @@ static int bfs_statx_impl(int at_fd, const char *at_path, int at_flags, enum bfs
buf->rdev = bfs_makedev(xbuf.stx_rdev_major, xbuf.stx_rdev_minor);
buf->mask |= BFS_STAT_RDEV;
+ buf->attrs = xbuf.stx_attributes;
+ buf->mask |= BFS_STAT_ATTRS;
+
if (xbuf.stx_mask & STATX_ATIME) {
buf->atime.tv_sec = xbuf.stx_atime.tv_sec;
buf->atime.tv_nsec = xbuf.stx_atime.tv_nsec;