Skip to content

Conversation

@oherrala
Copy link
Contributor

@oherrala oherrala commented Nov 27, 2025

Description

Add a missing minherit() system call and constants related to it.

minherit(2) from macOS describes this call as:

The minherit() system call changes the specified pages to have the inheritance characteristic inherit, which can be set to VM_INHERIT_NONE, VM_INHERIT_COPY, or VM_INHERIT_SHARE. Not all implementations will guarantee that the inheritance characteristic can be set on a page basis; the granularity of changes may be as large as an entire region.

Sources

https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/bsd/sys/mman.h#L290

https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/osfmk/mach/vm_inherit.h#L85-L88

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

@rustbot rustbot added O-macos O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Nov 27, 2025
@oherrala oherrala marked this pull request as draft November 28, 2025 08:28
@oherrala
Copy link
Contributor Author

The arm-linux-androidabi test failed maybe because "The job has exceeded the maximum execution time of 25m0s".

@oherrala oherrala marked this pull request as ready for review November 28, 2025 08:33
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be able to use mach2 instead? https://docs.rs/mach2/latest/mach2/vm_inherit/index.html. We're tryig to transition away from binding platform API like mach/ and linux/.

@rustbot
Copy link
Collaborator

rustbot commented Nov 30, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@oherrala
Copy link
Contributor Author

oherrala commented Nov 30, 2025

@tgross35 FWIW minherit is not macOS specific. It originates from OpenBSD and is also in FreeBSD, NetBSD and DragonFly:

@tgross35
Copy link
Contributor

Thanks for the links. In that case I think it’s fine here, but would you mind enabling it for those other platforms as well? At least FreeBSD and NetBSD get CI here.

@rustbot rustbot added the O-bsd label Dec 1, 2025
@oherrala oherrala marked this pull request as draft December 1, 2025 19:28
@oherrala oherrala changed the title apple: Add missing minherit system call bsd: Add missing minherit system call Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-bsd O-macos O-unix S-waiting-on-author stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants