1
# https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/stat.h.html
2
# https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
4
from posix.types cimport (blkcnt_t, blksize_t, dev_t, gid_t, ino_t, mode_t,
5
nlink_t, off_t, time_t, uid_t)
6
from posix.time cimport timespec
9
cdef extern from "<sys/stat.h>" nogil:
10
cdef struct struct_stat "stat":
30
# st_birthtime exists on *BSD and OS X.
31
# Under Linux, defining it here does not hurt. Compilation under Linux
32
# will only (and rightfully) fail when attempting to use the field.
35
# POSIX prescribes including both <sys/stat.h> and <unistd.h> for these
36
cdef extern from "<unistd.h>" nogil:
37
int chmod(const char *, mode_t)
38
int fchmod(int, mode_t)
39
int fchmodat(int, const char *, mode_t, int flags)
41
int stat(const char *, struct_stat *)
42
int lstat(const char *, struct_stat *)
43
int fstat(int, struct_stat *)
44
int fstatat(int, const char *, struct_stat *, int flags)
46
int mkdir(const char *, mode_t)
47
int mkdirat(int, const char *, mode_t)
48
int mkfifo(const char *, mode_t)
49
int mkfifoat(int, const char *, mode_t)
50
int mknod(const char *, mode_t, dev_t)
51
int mknodat(int, const char *, mode_t, dev_t)
53
int futimens(int, const timespec *)
54
int utimensat(int, const char *, const timespec *, int flags)
57
mode_t S_ISREG(mode_t)
58
mode_t S_ISDIR(mode_t)
59
mode_t S_ISCHR(mode_t)
60
mode_t S_ISBLK(mode_t)
61
mode_t S_ISFIFO(mode_t)
62
mode_t S_ISLNK(mode_t)
63
mode_t S_ISSOCK(mode_t)
95
bint S_TYPEISMQ(struct_stat *buf)
96
bint S_TYPEISSEM(struct_stat *buf)
97
bint S_TYPEISSHM(struct_stat *buf)
98
bint S_TYPEISTMO(struct_stat *buf)