summaryrefslogtreecommitdiffstats
path: root/stat.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2018-11-01 21:46:50 -0400
committerTavian Barnes <tavianator@tavianator.com>2018-11-01 21:46:50 -0400
commit8c3b9aaaab11be9d0fe24a72ebb16e171ca22125 (patch)
tree1eceebe2763cec5a010a193d48b50edef5fb78a2 /stat.c
parentb74261ac825ec2b9c02d73e36f7b44b64c9d184c (diff)
downloadbfs-8c3b9aaaab11be9d0fe24a72ebb16e171ca22125.tar.xz
Print device major/minor numbers for -ls
Diffstat (limited to 'stat.c')
-rw-r--r--stat.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/stat.c b/stat.c
index 2e046d6..b8f1704 100644
--- a/stat.c
+++ b/stat.c
@@ -32,7 +32,6 @@
#if HAVE_STATX || defined(__NR_statx)
# define HAVE_BFS_STATX true
-# include <sys/sysmacros.h>
#endif
#if __APPLE__
@@ -82,6 +81,9 @@ static void bfs_stat_convert(const struct stat *statbuf, struct bfs_stat *buf) {
buf->blocks = statbuf->st_blocks;
buf->mask |= BFS_STAT_BLOCKS;
+ buf->rdev = statbuf->st_rdev;
+ buf->mask |= BFS_STAT_RDEV;
+
buf->atime = statbuf->st_atim;
buf->mask |= BFS_STAT_ATIME;
@@ -154,7 +156,7 @@ static int bfs_statx_impl(int at_fd, const char *at_path, int at_flags, enum bfs
buf->mask = 0;
- buf->dev = makedev(xbuf.stx_dev_major, xbuf.stx_dev_minor);
+ buf->dev = bfs_makedev(xbuf.stx_dev_major, xbuf.stx_dev_minor);
buf->mask |= BFS_STAT_DEV;
if (xbuf.stx_mask & STATX_INO) {
@@ -195,6 +197,9 @@ static int bfs_statx_impl(int at_fd, const char *at_path, int at_flags, enum bfs
buf->mask |= BFS_STAT_BLOCKS;
}
+ buf->rdev = bfs_makedev(xbuf.stx_rdev_major, xbuf.stx_rdev_minor);
+ buf->mask |= BFS_STAT_RDEV;
+
if (xbuf.stx_mask & STATX_ATIME) {
buf->atime.tv_sec = xbuf.stx_atime.tv_sec;
buf->atime.tv_nsec = xbuf.stx_atime.tv_nsec;