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 mkfifo VSF_LINUX_WRAPPER(mkfifo)
32#define mkfifoat VSF_LINUX_WRAPPER(mkfifoat)
33#define mknod VSF_LINUX_WRAPPER(mknod)
34#define mknodat VSF_LINUX_WRAPPER(mknodat)
40#define __NR_fstat fstat
41#define __NR_fstatat fstatat
42#define __NR_umask umask
43#define __NR_chmod chmod
44#define __NR_fchmod fchmod
45#define __NR_fchmodat fchmodat
46#define __NR_futimesat futimesat
47#define __NR_utimensat utimensat
50#define VSF_FILE_ATTR_CHR (VSF_FILE_ATTR_USER << 0)
51#define VSF_FILE_ATTR_BLK (VSF_FILE_ATTR_USER << 1)
52#define VSF_FILE_ATTR_EXCL (VSF_FILE_ATTR_USER << 3)
53#define VSF_FILE_ATTR_SOCK (VSF_FILE_ATTR_USER << 4)
54#define VSF_FILE_ATTR_TTY (VSF_FILE_ATTR_USER << 5)
55#define VSF_FILE_ATTR_FIFO (VSF_FILE_ATTR_USER << 6)
57#define __VSF_FILE_ATTR_SHARE_PRIV (VSF_FILE_ATTR_USER << 16)
59#define UTIME_NOW ((1l << 30) - 1l)
60#define UTIME_OMIT ((1l << 30) - 2l)
62#define S_IFDIR 0040000
63#define S_IFREG 0100000
64#define S_IFLNK 0120000
65#define S_IFIFO 0010000
66#define S_IFCHR 0020000
67#define S_IFSOCK 0140000
68#define S_IFBLK 0060000
74#define S_IROTH (__S_IR << 0)
75#define S_IWOTH (__S_IW << 0)
76#define S_IXOTH (__S_IX << 0)
77#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
78#define S_IRGRP (__S_IR << 3)
79#define S_IWGRP (__S_IW << 3)
80#define S_IXGRP (__S_IX << 3)
81#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
82#define S_IRUSR (__S_IR << 6)
83#define S_IWUSR (__S_IW << 6)
84#define S_IXUSR (__S_IX << 6)
85#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
87#define S_IREAD S_IRUSR
88#define S_IWRITE S_IWUSR
89#define S_IEXEC S_IXUSR
92#define S_ISUID 0004000
93#define S_ISGID 0002000
94#define S_ISVTX 0001000
96#define S_ISLNK(__MODE) (((__MODE) & S_IFMT) == S_IFLNK)
97#define S_ISREG(__MODE) (((__MODE) & S_IFMT) == S_IFREG)
98#define S_ISDIR(__MODE) (((__MODE) & S_IFMT) == S_IFDIR)
99#define S_ISFIFO(__MODE) (((__MODE) & S_IFMT) == S_IFIFO)
100#define S_ISSOCK(__MODE) (((__MODE) & S_IFMT) == S_IFSOCK)
101#define S_ISCHR(__MODE) (((__MODE) & S_IFMT) == S_IFCHR)
102#define S_ISBLK(__MODE) (((__MODE) & S_IFMT) == S_IFBLK)
121#define st_atime st_atim.tv_sec
122#define st_mtime st_mtim.tv_sec
123#define st_ctime st_ctim.tv_sec
142#define st_atime st_atim.tv_sec
143#define st_mtime st_mtim.tv_sec
144#define st_ctime st_ctim.tv_sec
147#if VSF_LINUX_APPLET_USE_SYS_STAT == ENABLED
165# ifndef __VSF_APPLET__
170#if defined(__VSF_APPLET__) && (defined(__VSF_APPLET_LIB__) || defined(__VSF_APPLET_LINUX_SYS_STAT_LIB__))\
171 && VSF_APPLET_CFG_ABI_PATCH != ENABLED && VSF_LINUX_APPLET_USE_SYS_STAT == ENABLED
173#ifndef VSF_LINUX_APPLET_SYS_STAT_VPLT
174# if VSF_LINUX_USE_APPLET == ENABLED
175# define VSF_LINUX_APPLET_SYS_STAT_VPLT \
176 ((vsf_linux_sys_stat_vplt_t *)(VSF_LINUX_APPLET_VPLT->sys_stat_vplt))
178# define VSF_LINUX_APPLET_SYS_STAT_VPLT \
179 ((vsf_linux_sys_stat_vplt_t *)vsf_vplt((void *)0))
183#define VSF_LINUX_APPLET_SYS_STAT_ENTRY(__NAME) \
184 VSF_APPLET_VPLT_ENTRY_FUNC_ENTRY(VSF_LINUX_APPLET_SYS_STAT_VPLT, __NAME)
185#define VSF_LINUX_APPLET_SYS_STAT_IMP(...) \
186 VSF_APPLET_VPLT_ENTRY_FUNC_IMP(VSF_LINUX_APPLET_SYS_STAT_VPLT, __VA_ARGS__)
190 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
umask)(mask);
192VSF_LINUX_APPLET_SYS_STAT_IMP(
stat,
int,
const char *pathname,
struct stat *buf) {
194 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
stat)(pathname, buf);
196VSF_LINUX_APPLET_SYS_STAT_IMP(
lstat,
int,
const char *pathname,
struct stat *buf) {
198 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
lstat)(pathname, buf);
200VSF_LINUX_APPLET_SYS_STAT_IMP(
fstat,
int,
int fd,
struct stat *buf) {
202 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
fstat)(fd, buf);
204VSF_LINUX_APPLET_SYS_STAT_IMP(
fstatat,
int,
int dirfd,
const char *pathname,
struct stat *buf,
int flags) {
206 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
fstatat)(dirfd, pathname, buf, flags);
208VSF_LINUX_APPLET_SYS_STAT_IMP(
chmod,
int,
const char *pathname,
mode_t mode) {
210 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
chmod)(pathname, mode);
212VSF_LINUX_APPLET_SYS_STAT_IMP(
fchmod,
int,
int fd,
mode_t mode) {
214 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
fchmod)(fd, mode);
216VSF_LINUX_APPLET_SYS_STAT_IMP(
mkfifo,
int,
const char *pathname,
mode_t mode) {
218 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
mkfifo)(pathname, mode);
220VSF_LINUX_APPLET_SYS_STAT_IMP(
mkfifoat,
int,
int dirfd,
const char *pathname,
mode_t mode) {
222 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
mkfifoat)(dirfd, pathname, mode);
224VSF_LINUX_APPLET_SYS_STAT_IMP(
mknod,
int,
const char *pathname,
mode_t mode,
dev_t dev) {
226 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
mknod)(pathname, mode, dev);
228VSF_LINUX_APPLET_SYS_STAT_IMP(
mknodat,
int,
int dirfd,
const char *pathname,
mode_t mode,
dev_t dev) {
230 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
mknodat)(dirfd, pathname, mode, dev);
236VSF_LINUX_APPLET_SYS_STAT_IMP(
utimensat,
int,
int dirfd,
const char *pathname,
const struct timespec times[2],
int flags) {
238 return VSF_LINUX_APPLET_SYS_STAT_ENTRY(
utimensat)(dirfd, pathname,
times, flags);
244int stat(
const char *pathname,
struct stat *buf);
245int lstat(
const char *pathname,
struct stat *buf);
247int fstatat(
int dirfd,
const char *pathname,
struct stat *buf,
int flags);
259static inline int stat64(
const char *pathname,
struct stat64 *buf)
261 return stat(pathname, (
struct stat *)buf);
263static inline int lstat64(
const char *pathname,
struct stat64 *buf)
265 return lstat(pathname, (
struct stat *)buf);
267static 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:34
#define stat
Definition stat.h:22
#define chmod
Definition stat.h:27
#define fchmod
Definition stat.h:28
#define mkfifo
Definition stat.h:31
#define mkfifoat
Definition stat.h:32
__VSF_VPLT_DECORATOR__ vsf_linux_sys_stat_vplt_t vsf_linux_sys_stat_vplt
Definition vsf_linux_fs.c:3661
#define fstatat
Definition stat.h:25
#define mknod
Definition stat.h:33
#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:130
ino64_t st_ino
Definition stat.h:129
gid_t st_gid
Definition stat.h:133
nlink_t st_nlink
Definition stat.h:131
dev_t st_dev
Definition stat.h:127
off64_t st_size
Definition stat.h:134
struct timespec st_ctim
Definition stat.h:141
dev_t st_rdev
Definition stat.h:128
mode_t st_attr
Definition stat.h:137
struct timespec st_mtim
Definition stat.h:140
blksiz_t st_blksize
Definition stat.h:135
uid_t st_uid
Definition stat.h:132
blkcnt64_t st_blocks
Definition stat.h:136
struct timespec st_atim
Definition stat.h:139
nlink_t st_nlink
Definition stat.h:110
ino64_t st_ino
Definition stat.h:108
blkcnt64_t st_blocks
Definition stat.h:115
uid_t st_uid
Definition stat.h:111
mode_t st_mode
Definition stat.h:109
struct timespec st_mtim
Definition stat.h:119
struct timespec st_atim
Definition stat.h:118
struct timespec st_ctim
Definition stat.h:120
dev_t st_rdev
Definition stat.h:107
mode_t st_attr
Definition stat.h:116
gid_t st_gid
Definition stat.h:112
off64_t st_size
Definition stat.h:113
dev_t st_dev
Definition stat.h:106
blksiz_t st_blksize
Definition stat.h:114
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:149
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(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