From b58ccc96e4b92b083600581550bdeea767cc93a6 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Tue, 19 Nov 2019 09:54:57 -0600 Subject: [PATCH] include/sys/stat.h and include/sys/types.h: Update struct stat to confirm opengroup spec: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/stat.h.html --- include/sys/stat.h | 10 ++++++++-- include/sys/types.h | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/sys/stat.h b/include/sys/stat.h index ca7cad70355..4b88ed4a417 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -124,13 +124,19 @@ struct stat { /* Required, standard fields */ + dev_t st_dev; /* Device ID of device containing file */ + ino_t st_ino; /* File serial number */ mode_t st_mode; /* File type, attributes, and access mode bits */ + nlink_t st_nlink; /* Number of hard links to the file */ + uid_t st_uid; /* User ID of file */ + gid_t st_gid; /* Group ID of file */ + dev_t st_rdev; /* Device ID (if file is character or block special) */ off_t st_size; /* Size of file/directory, in bytes */ - blksize_t st_blksize; /* Block size used for filesystem I/O */ - blkcnt_t st_blocks; /* Number of 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 */ + blksize_t st_blksize; /* Block size used for filesystem I/O */ + blkcnt_t st_blocks; /* Number of blocks allocated */ /* Internal fields. These are part this specific implementation and * should not referenced by application code for portability reasons. diff --git a/include/sys/types.h b/include/sys/types.h index c532c159691..b89298e2723 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -165,6 +165,10 @@ typedef uint16_t dev_t; typedef uint16_t ino_t; +/* nlink_t is used for link counts */ + +typedef uint16_t nlink_t; + /* pid_t is used for process IDs and process group IDs. It must be signed because * negative PID values are used to represent invalid PIDs. */