summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC
diff options
context:
space:
mode:
authorGunnar Beutner <gunnar@beutner.name>2021-04-17 09:35:46 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-17 11:12:42 +0200
commitc33592d28cac46a4193c1d727f6b3a34aebea978 (patch)
treeff713e179c7d14ea769629174d94e5817a3a18a8 /Userland/Libraries/LibC
parente6b396c24832daf771c1b06a0daf04b898b3af13 (diff)
downloadserenity-c33592d28cac46a4193c1d727f6b3a34aebea978.zip
Kernel+LibC: Update struct stat to use struct timespec instead of time_t
Some programs unconditionally expect struct stat to have nanosecond support.
Diffstat (limited to 'Userland/Libraries/LibC')
-rw-r--r--Userland/Libraries/LibC/sys/stat.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/Userland/Libraries/LibC/sys/stat.h b/Userland/Libraries/LibC/sys/stat.h
index 81f2d5175b..f7748756f9 100644
--- a/Userland/Libraries/LibC/sys/stat.h
+++ b/Userland/Libraries/LibC/sys/stat.h
@@ -28,6 +28,7 @@
#include <sys/cdefs.h>
#include <sys/types.h>
+#include <time.h>
__BEGIN_DECLS
@@ -69,21 +70,25 @@ __BEGIN_DECLS
#define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK)
struct stat {
- dev_t st_dev; /* ID of device containing file */
- ino_t st_ino; /* inode number */
- mode_t st_mode; /* protection */
- nlink_t st_nlink; /* number of hard links */
- uid_t st_uid; /* user ID of owner */
- gid_t st_gid; /* group ID of owner */
- dev_t st_rdev; /* device ID (if special file) */
- off_t st_size; /* total size, in bytes */
- blksize_t st_blksize; /* blocksize for file system I/O */
- blkcnt_t st_blocks; /* number of 512B blocks allocated */
- time_t st_atime; /* time of last access */
- time_t st_mtime; /* time of last modification */
- time_t st_ctime; /* time of last status change */
+ dev_t st_dev; /* ID of device containing file */
+ ino_t st_ino; /* inode number */
+ mode_t st_mode; /* protection */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of owner */
+ gid_t st_gid; /* group ID of owner */
+ dev_t st_rdev; /* device ID (if special file) */
+ off_t st_size; /* total size, in bytes */
+ blksize_t st_blksize; /* blocksize for file system I/O */
+ blkcnt_t st_blocks; /* number of 512B blocks allocated */
+ struct timespec st_atim; /* time of last access */
+ struct timespec st_mtim; /* time of last modification */
+ struct timespec st_ctim; /* time of last status change */
};
+#define st_atime st_atim.tv_sec
+#define st_mtime st_mtim.tv_sec
+#define st_ctime st_ctim.tv_sec
+
mode_t umask(mode_t);
int chmod(const char* pathname, mode_t);
int fchmod(int fd, mode_t);