Commit 1510bfd5 authored by scoder's avatar scoder

Merge pull request #324 from c-blake/master

Add mman.pxd and wait.pxd
parents fd13c811 8ef3936b
# http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/mman.h.html
from posix.types cimport off_t, mode_t
cdef extern from "sys/mman.h" nogil:
enum: PROT_EXEC # protection bits for mmap/mprotect
enum: PROT_READ
enum: PROT_WRITE
enum: PROT_NONE
enum: MAP_PRIVATE # flag bits for mmap
enum: MAP_SHARED
enum: MAP_FIXED
enum: MAP_ANON # These three are not in POSIX, but are
enum: MAP_ANONYMOUS # fairly common in spelling/semantics
enum: MAP_STACK
enum: MAP_LOCKED # Typically available only on Linux
enum: MAP_HUGETLB
enum: MAP_POPULATE
enum: MAP_NORESERVE
enum: MAP_GROWSDOWN
enum: MAP_NOCORE # Typically available only on BSD
enum: MAP_NOSYNC
void *mmap(void *addr, size_t Len, int prot, int flags, int fd, off_t off)
int munmap(void *addr, size_t Len)
int mprotect(void *addr, size_t Len, int prot)
enum: MS_ASYNC
enum: MS_SYNC
enum: MS_INVALIDATE
int msync(void *addr, size_t Len, int flags)
enum: POSIX_MADV_NORMAL # POSIX advice flags
enum: POSIX_MADV_SEQUENTIAL
enum: POSIX_MADV_RANDOM
enum: POSIX_MADV_WILLNEED
enum: POSIX_MADV_DONTNEED
int posix_madvise(void *addr, size_t Len, int advice)
enum: MCL_CURRENT
enum: MCL_FUTURE
int mlock(const void *addr, size_t Len)
int munlock(const void *addr, size_t Len)
int mlockall(int flags)
int munlockall()
int shm_open(const char *name, int oflag, mode_t mode)
int shm_unlink(const char *name)
# often available
enum: MADV_REMOVE # pre-POSIX advice flags; often available
enum: MADV_DONTFORK
enum: MADV_DOFORK
enum: MADV_HWPOISON
enum: MADV_MERGEABLE,
enum: MADV_UNMERGEABLE
int madvise(void *addr, size_t Len, int advice)
# sometimes available
int mincore(void *addr, size_t Len, unsigned char *vec)
# These two are Linux specific but sometimes very efficient
void *mremap(void *old_addr, size_t old_len, size_t new_len, int flags, ...)
int remap_file_pages(void *addr, size_t Len, int prot,
size_t pgoff, int flags)
# The rare but standardized typed memory option
enum: POSIX_TYPED_MEM_ALLOCATE
enum: POSIX_TYPED_MEM_ALLOCATE_CONTIG
enum: POSIX_TYPED_MEM_MAP_ALLOCATABLE
int posix_typed_mem_open(const char *name, int oflag, int tflag)
int posix_mem_offset(const void *addr, size_t Len, off_t *off,
size_t *contig_len, int *fildes)
cdef struct posix_typed_mem_info:
size_t posix_tmi_length
int posix_typed_mem_get_info(int fildes, posix_typed_mem_info *info)
# http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/wait.h.html
from posix.types cimport pid_t, id_t
from posix.signal cimport siginfo_t
from posix.resource cimport rusage
cdef extern from "sys/wait.h" nogil:
enum: WNOHANG
enum: WUNTRACED
enum: WCONTINUED
enum: WEXITED
enum: WSTOPPED
enum: WNOWAIT
int WEXITSTATUS(int status)
int WIFCONTINUED(int status)
int WIFEXITED(int status)
int WIFSIGNALED(int status)
int WIFSTOPPED(int status)
int WSTOPSIG(int status)
int WTERMSIG(int status)
ctypedef int idtype_t
enum: P_ALL # idtype_t values
enum: P_PID
enum: P_PGID
pid_t wait(int *stat_loc)
pid_t waitpid(pid_t pid, int *status, int options)
int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options)
# wait3 was in POSIX until 2008 while wait4 was never standardized.
# Even so, these calls are in almost every Unix, always in sys/wait.h.
# Hence, posix.wait is the least surprising place to declare them for Cython.
# libc may require _XXX_SOURCE to be defined at C-compile time to provide them.
pid_t wait3(int *status, int options, rusage *rusage)
pid_t wait4(pid_t pid, int *status, int options, rusage *rusage)
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