Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include: posix.mman += MAP_FAILED #2894

Merged
merged 1 commit into from
Mar 15, 2019
Merged

Conversation

navytux
Copy link
Contributor

@navytux navytux commented Mar 14, 2019

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.

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.
@scoder scoder added this to the 3.0 milestone Mar 15, 2019
@scoder scoder merged commit f9ab976 into cython:master Mar 15, 2019
@navytux
Copy link
Contributor Author

navytux commented Mar 15, 2019

Thanks.

@navytux navytux deleted the y/MMAP_FAILED branch March 15, 2019 08:34
@scoder scoder modified the milestones: 3.0, 0.29.13 Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants