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

add MAP_UNINITIALIZED flag (Linux-only) for mmap #3274

Closed
wants to merge 1 commit into from

Conversation

raymontag
Copy link

MAP_UNINITIALIZED is a Linux-only flag for mmap that is generically defined in mmap-common.h: https://elixir.bootlin.com/linux/latest/source/include/uapi/asm-generic/mman-common.h#L33

@rustbot
Copy link
Collaborator

rustbot commented Jun 15, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@JohnTitor
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 24, 2023

📌 Commit 5a8e3ff has been approved by JohnTitor

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jun 24, 2023

⌛ Testing commit 5a8e3ff with merge 31e5ecd...

bors added a commit that referenced this pull request Jun 24, 2023
add MAP_UNINITIALIZED flag (Linux-only) for mmap

MAP_UNINITIALIZED is a Linux-only flag for mmap that is generically defined in mmap-common.h: https://elixir.bootlin.com/linux/latest/source/include/uapi/asm-generic/mman-common.h#L33
@bors
Copy link
Contributor

bors commented Jun 24, 2023

💔 Test failed - checks-actions

@JohnTitor
Copy link
Member

Seems the musl header here is old and doesn't know these items, we have to ignore them on the test. See this for example: #3278 (comment)

@JohnTitor
Copy link
Member

Ping from triage: @raymontag Could you check the above comment if you have time? Thanks!

@JohnTitor
Copy link
Member

Closing as inactive, feel free to re-submit if you're still interested in this change. Thank you for the PR anyway!

@JohnTitor JohnTitor closed this Nov 1, 2023
@SteveLauC
Copy link
Contributor

From the source code of glibc:

sysdeps/unix/sysv/linux/tst-mman-consts.py

        # A series of MAP_HUGE_<size> macros are defined by the kernel
        # but not by glibc.  MAP_UNINITIALIZED is kernel-only.
        # MAP_FAILED is not a MAP_* flag and is glibc-only, as is the
        # MAP_ANON alias for MAP_ANONYMOUS.  MAP_RENAME, MAP_AUTOGROW,
        # MAP_LOCAL and MAP_AUTORSRV are in the kernel header for
        # MIPS, marked as "not used by linux"; SPARC has MAP_INHERIT
        # in the kernel header, but does not use it.  The kernel
        # header for HPPA removed a define of MAP_VARIABLE to 0 in
        # Linux 6.2.

MAP_UNINITIALIZED is kernel-only.

which seems to mean that this constant is defined in the kernel, not libcs. And there is a patch which also seems to prove it.

If so, why we are defining this constants across {libc}/{arch}/mod.rs but not linux/mod.rs

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.

None yet

5 participants