Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
5bbcdb77
Commit
5bbcdb77
authored
May 06, 2014
by
scoder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #293 from larsmans/more-posix
Expanded POSIX interface
parents
b82b9d64
fd1cbe0b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
131 additions
and
28 deletions
+131
-28
Cython/Includes/posix/stat.pxd
Cython/Includes/posix/stat.pxd
+55
-0
Cython/Includes/posix/stdlib.pxd
Cython/Includes/posix/stdlib.pxd
+29
-0
Cython/Includes/posix/types.pxd
Cython/Includes/posix/types.pxd
+12
-0
Cython/Includes/posix/unistd.pxd
Cython/Includes/posix/unistd.pxd
+23
-28
tests/compile/posix_pxds.pyx
tests/compile/posix_pxds.pyx
+12
-0
No files found.
Cython/Includes/posix/stat.pxd
0 → 100644
View file @
5bbcdb77
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
Cython/Includes/posix/stdlib.pxd
0 → 100644
View file @
5bbcdb77
# POSIX additions to <stdlib.h>
# http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html
cdef
extern
from
"stdlib.h"
nogil
:
void
_Exit
(
int
)
double
drand48
()
double
erand48
(
unsigned
short
*
)
int
getsubopt
(
char
**
,
char
*
const
*
,
char
**
)
void
lcong48
(
unsigned
short
*
)
long
lrand
()
char
*
mkdtemp
(
char
*
)
int
mkstemp
(
char
*
)
long
mrand
()
long
nrand48
(
unsigned
short
*
)
int
posix_memalign
(
void
**
,
size_t
,
size_t
)
int
posix_openpt
(
int
)
char
*
ptsname
(
int
)
int
putenv
(
char
*
)
int
rand_r
(
unsigned
*
)
long
random
()
char
*
realpath
(
const
char
*
,
char
*
)
unsigned
short
*
seed48
(
unsigned
short
*
)
int
setenv
(
const
char
*
,
const
char
*
,
int
)
void
setkey
(
const
char
*
)
char
*
setstate
(
char
*
)
void
srand48
(
long
)
void
srandom
(
unsigned
)
int
unlockpt
(
int
)
int
unsetenv
(
const
char
*
)
Cython/Includes/posix/types.pxd
0 → 100644
View file @
5bbcdb77
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
Cython/Includes/posix/unistd.pxd
View file @
5bbcdb77
# 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,32 +34,25 @@ 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
(
char
*
,
int
)
int
access
(
c
onst
c
har
*
,
int
)
unsigned
alarm
(
unsigned
)
int
chdir
(
char
*
)
int
chown
(
char
*
,
uid_t
,
gid_t
)
int
chdir
(
c
onst
c
har
*
)
int
chown
(
c
onst
c
har
*
,
uid_t
,
gid_t
)
int
close
(
int
)
size_t
confstr
(
int
,
char
*
,
size_t
)
char
*
crypt
(
c
har
*
,
char
*
)
char
*
crypt
(
c
onst
char
*
,
const
char
*
)
char
*
ctermid
(
char
*
)
int
dup
(
int
)
int
dup2
(
int
,
int
)
void
encrypt
(
char
[
64
],
int
)
int
execl
(
c
har
*
,
char
*
,
...)
int
execle
(
c
har
*
,
char
*
,
...)
int
execlp
(
c
har
*
,
char
*
,
...)
int
execv
(
char
*
,
char
*
[])
int
execve
(
char
*
,
char
*
[],
char
*
[])
int
execvp
(
char
*
,
char
*
[])
int
execl
(
c
onst
char
*
,
const
char
*
,
...)
int
execle
(
c
onst
char
*
,
const
char
*
,
...)
int
execlp
(
c
onst
char
*
,
const
char
*
,
...)
int
execv
(
c
onst
c
har
*
,
char
*
[])
int
execve
(
c
onst
c
har
*
,
char
*
[],
char
*
[])
int
execvp
(
c
onst
c
har
*
,
char
*
[])
void
_exit
(
int
)
int
fchown
(
int
,
uid_t
,
gid_t
)
int
fchdir
(
int
)
...
...
@@ -75,7 +70,7 @@ cdef extern from "unistd.h" nogil:
int
gethostname
(
char
*
,
size_t
)
char
*
getlogin
()
int
getlogin_r
(
char
*
,
size_t
)
int
getopt
(
int
,
char
*
[],
char
*
)
int
getopt
(
int
,
char
*
[],
c
onst
c
har
*
)
pid_t
getpgid
(
pid_t
)
pid_t
getpgrp
()
pid_t
getpid
()
...
...
@@ -84,8 +79,8 @@ cdef extern from "unistd.h" nogil:
uid_t
getuid
()
char
*
getwd
(
char
*
)
int
isatty
(
int
)
int
lchown
(
char
*
,
uid_t
,
gid_t
)
int
link
(
c
har
*
,
char
*
)
int
lchown
(
c
onst
c
har
*
,
uid_t
,
gid_t
)
int
link
(
c
onst
char
*
,
const
char
*
)
int
lockf
(
int
,
int
,
off_t
)
off_t
lseek
(
int
,
off_t
,
int
)
int
nice
(
int
)
...
...
@@ -93,10 +88,10 @@ cdef extern from "unistd.h" nogil:
int
pause
()
int
pipe
(
int
[
2
])
ssize_t
pread
(
int
,
void
*
,
size_t
,
off_t
)
ssize_t
pwrite
(
int
,
void
*
,
size_t
,
off_t
)
ssize_t
pwrite
(
int
,
const
void
*
,
size_t
,
off_t
)
ssize_t
read
(
int
,
void
*
,
size_t
)
ssize_t
readlink
(
char
*
,
char
*
,
size_t
)
int
rmdir
(
char
*
)
ssize_t
readlink
(
c
onst
c
har
*
,
char
*
,
size_t
)
int
rmdir
(
c
onst
c
har
*
)
int
setegid
(
gid_t
)
int
seteuid
(
uid_t
)
int
setgid
(
gid_t
)
...
...
@@ -107,20 +102,20 @@ cdef extern from "unistd.h" nogil:
pid_t
setsid
()
int
setuid
(
uid_t
)
unsigned
sleep
(
unsigned
)
void
swab
(
void
*
,
void
*
,
ssize_t
)
int
symlink
(
c
har
*
,
char
*
)
void
swab
(
const
void
*
,
void
*
,
ssize_t
)
int
symlink
(
c
onst
char
*
,
const
char
*
)
void
sync
()
long
sysconf
(
int
)
pid_t
tcgetpgrp
(
int
)
int
tcsetpgrp
(
int
,
pid_t
)
int
truncate
(
char
*
,
off_t
)
int
truncate
(
c
onst
c
har
*
,
off_t
)
char
*
ttyname
(
int
)
int
ttyname_r
(
int
,
char
*
,
size_t
)
useconds_t
ualarm
(
useconds_t
,
useconds_t
)
int
unlink
(
char
*
)
int
unlink
(
c
onst
c
har
*
)
int
usleep
(
useconds_t
)
pid_t
vfork
()
ssize_t
write
(
int
,
void
*
,
size_t
)
ssize_t
write
(
int
,
const
void
*
,
size_t
)
char
*
optarg
int
optind
int
opterr
...
...
tests/compile/posix_pxds.pyx
View file @
5bbcdb77
...
...
@@ -10,3 +10,15 @@ 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
*
cimport
posix.stdlib
from
posix
cimport
stdlib
from
posix.stdlib
cimport
*
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment