Commit 7047d62c authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Stefan Behnel

include: posix.mman += MAP_FAILED

mmap returns void* and indicates failure via MAP_FAILED that is defined
to be ((void *)-1). Every mmap call has to be checked for failure and
thus posix.mman with mmap, but without MAP_FAILED is not very useful.

We cannot declare MAP_FAILED as enum, because enum assumes int. However
Cython documentation says

	4. If the header file uses macros to define constants, translate
	   them into a normal external variable declaration. ...

	(https://cython.readthedocs.io/en/latest/src/userguide/external_C_code.html#referencing-c-header-files)

So add proper declaration for MAP_FAILED to make posix.mman.mmap usable.

(cherry picked from commit 67253049)
parent d24b3431
......@@ -24,6 +24,8 @@ cdef extern from "<sys/mman.h>" nogil:
enum: MAP_NOCORE # Typically available only on BSD
enum: MAP_NOSYNC
void *MAP_FAILED
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)
......
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