diff options
author | Ron Yorston <rmy@pobox.com> | 2019-02-16 12:36:52 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-02-16 12:36:52 +0000 |
commit | d82db8e9a618ddd9a11cc57aff37f687abb0effb (patch) | |
tree | bd072e7344a3c3f0eff553d41c0f154c4470736e /include | |
parent | 91e49fbc7b55e8be78ac3ff943e9b7d4494dfe59 (diff) | |
download | busybox-w32-d82db8e9a618ddd9a11cc57aff37f687abb0effb.tar.gz busybox-w32-d82db8e9a618ddd9a11cc57aff37f687abb0effb.tar.bz2 busybox-w32-d82db8e9a618ddd9a11cc57aff37f687abb0effb.zip |
win32: make stat(2) fetch additional metadata
Modify the WIN32 implementation of stat(2) to fetch inode number,
device id and number of hardlinks. This requires opening a handle
to the target file so it will be slower.
A number of features can be enabled or start to work:
- tar can detect if an archive is being stored in itself;
- find can support the -inum and -links options;
- ls can display inode numbers;
- diff can detect attempts to compare a file with itself;
- du has better support for hardlinked files;
- cp can detect attempts to copy a file over itself.
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | include/mingw.h | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/include/libbb.h b/include/libbb.h index 0c7e03ee8..61574b5ee 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1712,7 +1712,7 @@ int bb_xioctl(int fd, unsigned request, void *argp) FAST_FUNC; | |||
1712 | #define xioctl(fd,request,argp) bb_xioctl(fd,request,argp) | 1712 | #define xioctl(fd,request,argp) bb_xioctl(fd,request,argp) |
1713 | #endif | 1713 | #endif |
1714 | 1714 | ||
1715 | #if !ENABLE_PLATFORM_MINGW32 | 1715 | #if !ENABLE_PLATFORM_MINGW32 || ENABLE_FEATURE_EXTRA_FILE_DATA |
1716 | char *is_in_ino_dev_hashtable(const struct stat *statbuf) FAST_FUNC; | 1716 | char *is_in_ino_dev_hashtable(const struct stat *statbuf) FAST_FUNC; |
1717 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name) FAST_FUNC; | 1717 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name) FAST_FUNC; |
1718 | void reset_ino_dev_hashtable(void) FAST_FUNC; | 1718 | void reset_ino_dev_hashtable(void) FAST_FUNC; |
diff --git a/include/mingw.h b/include/mingw.h index 185eb66ed..0f403b993 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -283,6 +283,9 @@ int mingw_chmod(const char *path, int mode); | |||
283 | typedef int nlink_t; | 283 | typedef int nlink_t; |
284 | typedef int blksize_t; | 284 | typedef int blksize_t; |
285 | typedef off_t blkcnt_t; | 285 | typedef off_t blkcnt_t; |
286 | #if ENABLE_FEATURE_EXTRA_FILE_DATA | ||
287 | #define ino_t uint64_t | ||
288 | #endif | ||
286 | 289 | ||
287 | struct mingw_stat { | 290 | struct mingw_stat { |
288 | dev_t st_dev; | 291 | dev_t st_dev; |