Commit 4345655e authored by Lars Buitinck's avatar Lars Buitinck

POSIX interface: stat.h, types.h

parent 9c0c8a89
from posix.types cimport (blkcnt_t, blksize_t, dev_t, gid_t, ino_t, mode_t,
nlink_t, off_t, time_t, uid_t)
cdef extern from "sys/stat.h" nogil:
cdef struct struct_stat "stat":
dev_t st_dev
ino_t st_ino
# POSIX prescribes including both <sys/stat.h> and <unistd.h> for these
cdef extern from "unistd.h" nogil:
int fchmod(int, mode_t)
int chmod(const char *, mode_t)
int fstat(int, struct_stat *)
int lstat(const char *, struct_stat *)
int stat(const char *, struct_stat *)
# Macros for st_mode
mode_t S_ISREG(mode_t)
mode_t S_ISDIR(mode_t)
mode_t S_ISCHR(mode_t)
mode_t S_ISBLK(mode_t)
mode_t S_ISFIFO(mode_t)
mode_t S_ISLNK(mode_t)
mode_t S_ISSOCK(mode_t)
mode_t S_IFMT
mode_t S_IFREG
mode_t S_IFDIR
mode_t S_IFCHR
mode_t S_IFBLK
mode_t S_IFIFO
mode_t S_IFLNK
mode_t S_IFSOCK
# Permissions
mode_t S_ISUID
mode_t S_ISGID
mode_t S_ISVTX
mode_t S_IRWXU
mode_t S_IRUSR
mode_t S_IWUSR
mode_t S_IXUSR
mode_t S_IRWXG
mode_t S_IRGRP
mode_t S_IWGRP
mode_t S_IXGRP
mode_t S_IRWXO
mode_t S_IROTH
mode_t S_IWOTH
mode_t S_IXOTH
cdef extern from "sys/types.h":
ctypedef long blkcnt_t
ctypedef long blksize_t
ctypedef long dev_t
ctypedef long gid_t
ctypedef long ino_t
ctypedef long mode_t
ctypedef long nlink_t
ctypedef long off_t
ctypedef long pid_t
ctypedef long time_t
ctypedef long uid_t
# http://www.opengroup.org/onlinepubs/009695399/basedefs/unistd.h.html
from posix.types cimport gid_t, pid_t, off_t, uid_t
cdef extern from "unistd.h" nogil:
#:NULL
......@@ -32,14 +34,7 @@ cdef extern from "unistd.h" nogil:
enum: STDOUT_FILENO #1
enum: STDERR_FILENO #2
#:ctypedef unsigned size_t
#:ctypedef signed ssize_t
ctypedef int uid_t
ctypedef int gid_t
ctypedef signed off_t
ctypedef signed pid_t
ctypedef unsigned useconds_t
ctypedef signed intptr_t
int access(const char *, int)
unsigned alarm(unsigned)
......
......@@ -10,3 +10,11 @@ from posix.unistd cimport *
cimport posix.fcntl
from posix cimport fcntl
from posix.fcntl cimport *
cimport posix.types
from posix cimport types
from posix.types cimport *
cimport posix.stat
from posix cimport stat
from posix.stat cimport *
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment