1#ifndef __VSF_LINUX_SYS_STAT_H__
2#define __VSF_LINUX_SYS_STAT_H__
6#if VSF_LINUX_CFG_RELATIVE_PATH == ENABLED
7# include "../sys/types.h"
8# include "../simple_libc/time.h"
21#if VSF_LINUX_CFG_WRAPPER == ENABLED
22#define stat VSF_LINUX_WRAPPER(stat)
23#define lstat VSF_LINUX_WRAPPER(lstat)
24#define fstat VSF_LINUX_WRAPPER(fstat)
25#define fstatat VSF_LINUX_WRAPPER(fstatat)
26#define umask VSF_LINUX_WRAPPER(umask)
27#define chmod VSF_LINUX_WRAPPER(chmod)
28#define fchmod VSF_LINUX_WRAPPER(fchmod)
29#define futimens VSF_LINUX_WRAPPER(futimens)
30#define utimensat VSF_LINUX_WRAPPER(utimensat)
31#define mkdir VSF_LINUX_WRAPPER(mkdir)
32#define mkfifo VSF_LINUX_WRAPPER(mkfifo)
33#define mkfifoat VSF_LINUX_WRAPPER(mkfifoat)
34#define mknod VSF_LINUX_WRAPPER(mknod)
35#define mknodat VSF_LINUX_WRAPPER(mknodat)
41#define __NR_fstat fstat
42#define __NR_fstatat fstatat
43#define __NR_umask umask
44#define __NR_chmod chmod
45#define __NR_fchmod fchmod
46#define __NR_fchmodat fchmodat
47#define __NR_futimesat futimesat
48#define __NR_utimensat utimensat
51#define VSF_FILE_ATTR_CHR (VSF_FILE_ATTR_USER << 0)
52#define VSF_FILE_ATTR_BLK (VSF_FILE_ATTR_USER << 1)
53#define VSF_FILE_ATTR_EXCL (VSF_FILE_ATTR_USER << 3)
54#define VSF_FILE_ATTR_SOCK (VSF_FILE_ATTR_USER << 4)
55#define VSF_FILE_ATTR_TTY (VSF_FILE_ATTR_USER << 5)
56#define VSF_FILE_ATTR_FIFO (VSF_FILE_ATTR_USER << 6)
58#define __VSF_FILE_ATTR_SHARE_PRIV (VSF_FILE_ATTR_USER << 16)
60#define UTIME_NOW ((1l << 30) - 1l)
61#define UTIME_OMIT ((1l << 30) - 2l)
63#define S_IFDIR 0040000
64#define S_IFREG 0100000
65#define S_IFLNK 0120000
66#define S_IFIFO 0010000
67#define S_IFCHR 0020000
68#define S_IFSOCK 0140000
69#define S_IFBLK 0060000
75#define S_IROTH (__S_IR << 0)
76#define S_IWOTH (__S_IW << 0)
77#define S_IXOTH (__S_IX << 0)
78#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
79#define S_IRGRP (__S_IR << 3)
80#define S_IWGRP (__S_IW << 3)
81#define S_IXGRP (__S_IX << 3)
82#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
83#define S_IRUSR (__S_IR << 6)
84#define S_IWUSR (__S_IW << 6)
85#define S_IXUSR (__S_IX << 6)
86#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
88#define S_IREAD S_IRUSR
89#define S_IWRITE S_IWUSR
90#define S_IEXEC S_IXUSR
93#define S_ISUID 0004000
94#define S_ISGID 0002000
95#define S_ISVTX 0001000
97#define S_ISLNK(__MODE) (((__MODE) & S_IFMT) == S_IFLNK)
98#define S_ISREG(__MODE) (((__MODE) & S_IFMT) == S_IFREG)
99#define S_ISDIR(__MODE) (((__MODE) & S_IFMT) == S_IFDIR)
100#define S_ISFIFO(__MODE) (((__MODE) & S_IFMT) == S_IFIFO)
101#define S_ISSOCK(__MODE) (((__MODE) & S_IFMT) == S_IFSOCK)
102#define S_ISCHR(__MODE) (((__MODE) & S_IFMT) == S_IFCHR)
103#define S_ISBLK(__MODE) (((__MODE) & S_IFMT) == S_IFBLK)
122#define st_atime st_atim.tv_sec
123#define st_mtime st_mtim.tv_sec
124#define st_ctime st_ctim.tv_sec
143#define st_atime st_atim.tv_sec
144#define st_mtime st_mtim.tv_sec
145#define st_ctime st_ctim.tv_sec
148#if VSF_LINUX_APPLET_USE_SYS_STAT == ENABLED
167# ifndef __VSF_APPLET__
172#if defined(__VSF_APPLET__) && (defined(__VSF_APPLET_LIB__) || defined(__VSF_APPLET_LINUX_SYS_STAT_LIB__))\
173 && VSF_APPLET_CFG_ABI_PATCH != ENABLED && VSF_LINUX_APPLET_USE_SYS_STAT == ENABLED
175#ifndef VSF_LINUX_APPLET_SYS_STAT_VPLT
176# if VSF_LINUX_USE_APPLET == ENABLED
177# define VSF_LINUX_APPLET_SYS_STAT_VPLT \
178 ((vsf_linux_sys_stat_vplt_t *)(VSF_LINUX_APPLET_VPLT->sys_stat_vplt))
180# define VSF_LINUX_APPLET_SYS_STAT_VPLT \
181 ((vsf_linux_sys_stat_vplt_t *)vsf_vplt((void *)0))
185#define VSF_LINUX_APPLET_SYS_STAT_ENTRY(__NAME) \
186 VSF_APPLET_VPLT_ENTRY_FUNC_ENTRY(VSF_LINUX_APPLET_SYS_STAT_VPLT, __NAME)
187#define VSF_LINUX_APPLET_SYS_STAT_IMP(...) \
188 VSF_APPLET_VPLT_ENTRY_FUNC_IMP(VSF_LINUX_APPLET_SYS_STAT_VPLT, __VA_ARGS__)
192 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
umask)(mask);
194VSF_LINUX_APPLET_SYS_STAT_IMP(
stat,
int,
const char *pathname,
struct stat *buf) {
196 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
stat)(pathname, buf);
198VSF_LINUX_APPLET_SYS_STAT_IMP(
lstat,
int,
const char *pathname,
struct stat *buf) {
200 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
lstat)(pathname, buf);
202VSF_LINUX_APPLET_SYS_STAT_IMP(
fstat,
int,
int fd,
struct stat *buf) {
204 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
fstat)(fd, buf);
206VSF_LINUX_APPLET_SYS_STAT_IMP(
fstatat,
int,
int dirfd,
const char *pathname,
struct stat *buf,
int flags) {
208 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
fstatat)(dirfd, pathname, buf, flags);
210VSF_LINUX_APPLET_SYS_STAT_IMP(
chmod,
int,
const char *pathname,
mode_t mode) {
212 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
chmod)(pathname, mode);
214VSF_LINUX_APPLET_SYS_STAT_IMP(
fchmod,
int,
int fd,
mode_t mode) {
216 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
fchmod)(fd, mode);
218VSF_LINUX_APPLET_SYS_STAT_IMP(
mkdir,
int,
const char *pathname,
mode_t mode) {
220 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
mkdir)(pathname, mode);
222VSF_LINUX_APPLET_SYS_STAT_IMP(
mkfifo,
int,
const char *pathname,
mode_t mode) {
224 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
mkfifo)(pathname, mode);
226VSF_LINUX_APPLET_SYS_STAT_IMP(
mkfifoat,
int,
int dirfd,
const char *pathname,
mode_t mode) {
228 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
mkfifoat)(dirfd, pathname, mode);
230VSF_LINUX_APPLET_SYS_STAT_IMP(
mknod,
int,
const char *pathname,
mode_t mode,
dev_t dev) {
232 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
mknod)(pathname, mode, dev);
234VSF_LINUX_APPLET_SYS_STAT_IMP(
mknodat,
int,
int dirfd,
const char *pathname,
mode_t mode,
dev_t dev) {
236 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
mknodat)(dirfd, pathname, mode, dev);
242VSF_LINUX_APPLET_SYS_STAT_IMP(
utimensat,
int,
int dirfd,
const char *pathname,
const struct timespec times[2],
int flags) {
244 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
utimensat)(dirfd, pathname,
times, flags);
250int stat(
const char *pathname,
struct stat *buf);
251int lstat(
const char *pathname,
struct stat *buf);
253int fstatat(
int dirfd,
const char *pathname,
struct stat *buf,
int flags);
266static inline int stat64(
const char *pathname,
struct stat64 *buf)
268 return stat(pathname, (
struct stat *)buf);
270static inline int lstat64(
const char *pathname,
struct stat64 *buf)
272 return lstat(pathname, (
struct stat *)buf);
274static inline int fstat64(
int fd,
struct stat64 *buf)
unsigned long long ino64_t
Definition types.h:100
unsigned int blksiz_t
Definition types.h:101
unsigned long long blkcnt64_t
Definition types.h:103
unsigned int uid_t
Definition types.h:90
unsigned int gid_t
Definition types.h:91
long long off64_t
Definition types.h:97
unsigned long dev_t
Definition types.h:98
unsigned int mode_t
Definition types.h:87
unsigned int nlink_t
Definition types.h:89
#define mknodat
Definition stat.h:35
#define stat
Definition stat.h:22
#define mkdir
Definition stat.h:31
#define chmod
Definition stat.h:27
#define fchmod
Definition stat.h:28
#define mkfifo
Definition stat.h:32
#define mkfifoat
Definition stat.h:33
__VSF_VPLT_DECORATOR__ vsf_linux_sys_stat_vplt_t vsf_linux_sys_stat_vplt
Definition vsf_linux_fs.c:3664
#define fstatat
Definition stat.h:25
#define mknod
Definition stat.h:34
#define futimens
Definition stat.h:29
#define fstat
Definition stat.h:24
#define umask
Definition stat.h:26
#define lstat
Definition stat.h:23
#define utimensat
Definition stat.h:30
mode_t st_mode
Definition stat.h:131
ino64_t st_ino
Definition stat.h:130
gid_t st_gid
Definition stat.h:134
nlink_t st_nlink
Definition stat.h:132
dev_t st_dev
Definition stat.h:128
off64_t st_size
Definition stat.h:135
struct timespec st_ctim
Definition stat.h:142
dev_t st_rdev
Definition stat.h:129
mode_t st_attr
Definition stat.h:138
struct timespec st_mtim
Definition stat.h:141
blksiz_t st_blksize
Definition stat.h:136
uid_t st_uid
Definition stat.h:133
blkcnt64_t st_blocks
Definition stat.h:137
struct timespec st_atim
Definition stat.h:140
nlink_t st_nlink
Definition stat.h:111
ino64_t st_ino
Definition stat.h:109
blkcnt64_t st_blocks
Definition stat.h:116
uid_t st_uid
Definition stat.h:112
mode_t st_mode
Definition stat.h:110
struct timespec st_mtim
Definition stat.h:120
struct timespec st_atim
Definition stat.h:119
struct timespec st_ctim
Definition stat.h:121
dev_t st_rdev
Definition stat.h:108
mode_t st_attr
Definition stat.h:117
gid_t st_gid
Definition stat.h:113
off64_t st_size
Definition stat.h:114
dev_t st_dev
Definition stat.h:107
blksiz_t st_blksize
Definition stat.h:115
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(mknodat)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(chmod)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(lstat)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(fstatat)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(fchmod)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(utimensat)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(umask)
vsf_vplt_info_t info
Definition stat.h:150
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(futimens)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(stat)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(mkfifoat)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(mkdir)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(mknod)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(mkfifo)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(fstat)
#define times
Definition times.h:18
#define __VSF_VPLT_DECORATOR__
Definition vsf_cfg.h:93
#define VSF_APPLET_VPLT_ENTRY_FUNC_TRACE()
Definition vsf_cfg.h:165