#kernel #macos #darwin

unmaintained no-std mach

A Rust interface to the user-space API of the Mach 3.0 kernel that underlies OSX

16 releases

Uses old Rust 2015

0.3.2 Jun 1, 2019
0.2.3 Oct 29, 2018
0.2.0 Apr 20, 2018
0.1.2 Jan 26, 2018
0.0.2 Feb 8, 2015

#149 in macOS and iOS APIs

Download history 172142/week @ 2024-07-20 159125/week @ 2024-07-27 157544/week @ 2024-08-03 193203/week @ 2024-08-10 193870/week @ 2024-08-17 193788/week @ 2024-08-24 182360/week @ 2024-08-31 213953/week @ 2024-09-07 186415/week @ 2024-09-14 215055/week @ 2024-09-21 209167/week @ 2024-09-28 242889/week @ 2024-10-05 206771/week @ 2024-10-12 235766/week @ 2024-10-19 229901/week @ 2024-10-26 234650/week @ 2024-11-02

943,398 downloads per month
Used in 1,532 crates (46 directly)

BSD-2-Clause

80KB
2K SLoC

Build Status Latest Version docs

A Rust interface to the user-space API of the Mach 3.0 kernel exposed in /usr/include/mach that underlies macOS and is linked via libSystem (and libsystem_kernel).

This library does not expose the kernel-space API of the Mach 3.0 kernel exposed in SDK/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach.

That is, if you are writing a kernel-resident device drivers or some other kernel extensions you have to use something else. The user-space kernel API is often API-incompatible with the kernel space one, and even in the cases where they match, they are sometimes ABI incompatible such that using this library would have undefined behavior.

Usage

Add the following to your Cargo.toml to conditionally include mach on those platforms that support it.

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.mach]
version = "0.3"

The following crate features are available:

  • deprecated (disabled by default): exposes deprecated APIs that have been removed from the latest versions of the MacOS SDKs. The behavior of using these APIs on MacOS versions that do not support them is undefined (hopefully a linker error).

Platform support

The following table describes the current CI set-up:

Target Min. Rust XCode build ctest run
x86_64-apple-darwin 1.33.0 6.4 - 10.0
i686-apple-darwin 1.33.0 6.4 - 10.0
i386-apple-ios 1.33.0 6.4 - 9.4 [0] - -
x86_64-apple-ios 1.33.0 6.4 - 10.0 - -
armv7-apple-ios nightly 6.4 - 10.0 - -
aarch64-apple-ios nightly 6.4 - 10.0 - -

[0] i386-apple-ios is deprecated in XCode 10.0.

Dependencies