зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1570948 - mach vendor rust. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D40411 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
6e399961ed
Коммит
753de36d43
|
@ -83,14 +83,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "audio_thread_priority"
|
||||
version = "0.15.0"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dbus 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mach 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mach 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (git+https://github.com/froydnj/winapi-rs?branch=aarch64)",
|
||||
]
|
||||
|
||||
|
@ -125,7 +125,7 @@ dependencies = [
|
|||
name = "audioipc-client"
|
||||
version = "0.4.0"
|
||||
dependencies = [
|
||||
"audio_thread_priority 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"audio_thread_priority 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"audioipc 0.2.4",
|
||||
"cubeb-backend 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -139,7 +139,7 @@ dependencies = [
|
|||
name = "audioipc-server"
|
||||
version = "0.2.3"
|
||||
dependencies = [
|
||||
"audio_thread_priority 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"audio_thread_priority 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"audioipc 0.2.4",
|
||||
"cubeb-core 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1238,7 +1238,7 @@ name = "gkrust-shared"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"audio_thread_priority 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"audio_thread_priority 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"audioipc-client 0.4.0",
|
||||
"audioipc-server 0.2.3",
|
||||
"authenticator 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1685,7 +1685,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "mach"
|
||||
version = "0.1.2"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3901,7 +3901,7 @@ dependencies = [
|
|||
"checksum atomic 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c210c1f4db048cda477b652d170572d84c9640695835f17663595d3bd543fc28"
|
||||
"checksum atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb2dcb6e6d35f20276943cc04bb98e538b348d525a04ac79c10021561d202f21"
|
||||
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
|
||||
"checksum audio_thread_priority 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "047460864ea9f62fbdfb80fc04a2e5d844aef9e50727e6e9730ca58d9f1a9267"
|
||||
"checksum audio_thread_priority 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f8cc5f07f196c632ae83eeaec2aca5404e97d02bf506d2e9aa82f157ec4d9b2"
|
||||
"checksum authenticator 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ec149e5d5d4caa2c9ead53a8ce1ea9c4204c388c65bf3b96c2d1dc0fcf4aeb66"
|
||||
"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799"
|
||||
"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a"
|
||||
|
@ -4036,7 +4036,7 @@ dependencies = [
|
|||
"checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff"
|
||||
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
|
||||
"checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084"
|
||||
"checksum mach 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2fd13ee2dd61cc82833ba05ade5a30bb3d63f7ced605ef827063c63078302de9"
|
||||
"checksum mach 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
|
||||
"checksum malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "35adee9ed962cf7d07d62cb58bc45029f3227f5b5b86246caa8632f06c187bc3"
|
||||
"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
|
||||
"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a"
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"4c85ca3ce6ee93571667a430f548a1c9e73cfa621b2dac9fffa35bf280a90d9e","Makefile":"8c6b9e8afffb14ae03f9cd95bc7d6011c8b4fe01c474aef17360e3f0c4d202ad","README.md":"bcfa4948edf52fdacd485200a0c1c886a92232cc1931eeb4e1044050f46ec253","audio_thread_priority.h":"880889a154283a87cf84218cc4d6b2b9dd2c8fd09adc6d38f527b08ccd0c6168","generate_osx_bindings.sh":"06e4e03450f788ced18d31fff5660919e6f6ec1119ddace363ffeb82f0518a71","src/lib.rs":"d1e04bc2901472ce98be1a79b6844b49e38598eda3e4f8c0e7b08c5b33247375","src/mach_sys.rs":"352560fcb9b41d877cff92e5b3b04d6dc68b1f30508ce4b9aed78940120a883e","src/rt_linux.rs":"238264f4a3e010743ea2f44b3b13cb912f2b57786cd97e583575415d7e84b6b2","src/rt_mach.rs":"381f709a59d21031caf70e1bf4e9c26cd25fd3d2618ae0d91c1fbc236ce519ca","src/rt_win.rs":"f8f5b7af21cadd686cf7d8099d1972d3265c3889574020bd4ea088b832fbfa51"},"package":"047460864ea9f62fbdfb80fc04a2e5d844aef9e50727e6e9730ca58d9f1a9267"}
|
||||
{"files":{"Cargo.toml":"5c24ddbf95d388f8c3c335f3e760108560516428d61a2eb48bd51c35228886e9","Makefile":"8c6b9e8afffb14ae03f9cd95bc7d6011c8b4fe01c474aef17360e3f0c4d202ad","README.md":"bcfa4948edf52fdacd485200a0c1c886a92232cc1931eeb4e1044050f46ec253","audio_thread_priority.h":"880889a154283a87cf84218cc4d6b2b9dd2c8fd09adc6d38f527b08ccd0c6168","generate_osx_bindings.sh":"06e4e03450f788ced18d31fff5660919e6f6ec1119ddace363ffeb82f0518a71","src/lib.rs":"d1e04bc2901472ce98be1a79b6844b49e38598eda3e4f8c0e7b08c5b33247375","src/mach_sys.rs":"352560fcb9b41d877cff92e5b3b04d6dc68b1f30508ce4b9aed78940120a883e","src/rt_linux.rs":"238264f4a3e010743ea2f44b3b13cb912f2b57786cd97e583575415d7e84b6b2","src/rt_mach.rs":"14c4285c9cd3083e99ae321ece0dfe41d3b60fc56e01b1844e934009d70c857e","src/rt_win.rs":"f8f5b7af21cadd686cf7d8099d1972d3265c3889574020bd4ea088b832fbfa51"},"package":"3f8cc5f07f196c632ae83eeaec2aca5404e97d02bf506d2e9aa82f157ec4d9b2"}
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
[package]
|
||||
name = "audio_thread_priority"
|
||||
version = "0.15.0"
|
||||
version = "0.17.0"
|
||||
authors = ["Paul Adenot <paul@paul.cx>"]
|
||||
description = "Bump a thread to real-time priority, for audio work, on Linux, Windows and macOS"
|
||||
license = "MPL-2.0"
|
||||
|
@ -42,7 +42,7 @@ version = "0.2"
|
|||
version = "0.2"
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies.mach]
|
||||
version = "0.1"
|
||||
version = "0.3"
|
||||
[target."cfg(target_os = \"windows\")".dependencies.winapi]
|
||||
version = "0.3"
|
||||
features = ["avrt", "errhandlingapi", "ntdef", "minwindef"]
|
||||
|
|
|
@ -6,8 +6,9 @@ use mach::kern_return::{kern_return_t, KERN_SUCCESS};
|
|||
use mach::port::mach_port_t;
|
||||
use mach::message::mach_msg_type_number_t;
|
||||
use mach_sys::*;
|
||||
use libc::{pthread_self, pthread_t, mach_timebase_info, mach_timebase_info_data_t};
|
||||
use std::mem::size_of;
|
||||
use mach::mach_time::{mach_timebase_info_data_t, mach_timebase_info};
|
||||
use libc::{pthread_t, pthread_self};
|
||||
|
||||
extern "C" {
|
||||
fn pthread_mach_thread_np(tid: pthread_t) -> mach_port_t;
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"43cd097ac12109401eff2dda98d0b46064ad8415ea6e1a0a9381869938a4348c","LICENSE.md":"399507a62fba271ddb3e24dc857e85b571fbb76435546f51b212cf04d8463f58","README.md":"721e4f3fe70db2cabfb05367d2a341d071b589f7387d609b2e5edefb7f91db4f","examples/dump_process_registers.rs":"9bb011138980efda1bc24fb27bb582f4a6f175444b518c5c52d94e74282d8f21","src/boolean.rs":"1d24ea9872748881cd7269a383a7c344e3a650df23f0e44e3b6c266fb8205d9a","src/bootstrap.rs":"f197811f56bc633410dabfd2156e3ae17f50b3ff51329314e558c3c80e00d0e2","src/clock_types.rs":"3ccf57f85d30766b1c243357dbd5a86b6dda0ce9084da25a1ed139cf506859e0","src/kern_return.rs":"18bff1c0f47ac5f4f754b66ab7e09265acd43b1bfdac773be938c33d9decfe85","src/lib.rs":"2cf5554ea70b4c180eadbae651fbeb87b9e842e2ee51e53f3f3ff339cd6b8478","src/mach_port.rs":"7a89693d21575923c0e9967876546f64c4f4defa2438e2ef7cad220614c56875","src/mach_types.rs":"0d7699edef5468c5d3f5fe841351efdd7e28e1fd2679ecc4a8583f6cd12369f8","src/memory_object_types.rs":"3805f6076131a98b0a5607cf9420cc8248fe2b9ac6afd06c21ebe1e5ed3329f4","src/message.rs":"393dd1d6149e5219099f776f5a7d2d101cccf0c50dff38de3578c0d0b3ab2583","src/port.rs":"1a0a3659a92aca0b02ec3388dfea7a8f385ab9471c5d17ac166eb2310adfb6c9","src/structs.rs":"f6abc0adf79831f1ace6b606de39ac0aa9211033b4a2d3307545b09305d8eeb3","src/task.rs":"097bec27fefd7e17bf1b465ccaf1ad2c649438f66d2cb3f23b6b9d7ae72362d2","src/task_info.rs":"34856be5eb0a57bffa965a7e0b15337a23b1c73303387604af6b8d493e592451","src/thread_act.rs":"e70ed8f18fd303ffb724e9f52959c6b10f71dd81e2f283c81b4c2ec0d1521d17","src/thread_status.rs":"a900380c6743b77525ac0eb79f8155f8fe37eae13d93c09737d437e426b39053","src/traps.rs":"73d8d45ba97acbfad5e5f65233c114732c8e7dd90aebefd9e3c7c2604817e491","src/types.rs":"92e1fa7a09d068b0eabb32099018cddca8080ab3d7ff444dbdab87f138c52a6d","src/vm.rs":"e732dfb766500cafe159be0f2a418d73950a556801799d3b6a57792b4dac6b74","src/vm_attributes.rs":"2933380b6ac2bc8892923946d4484f481e30a2cc80a055ca64801d3497318ad1","src/vm_behavior.rs":"746eee444987a0292393e066fa30e83bbffb8fe91b273d6633f1536c3406cd6e","src/vm_inherit.rs":"fdbf7320faa3cfa73f8cf1d1e549460f370eca9ad9c27e04eedf8f2fc36cbb67","src/vm_page_size.rs":"7a6e7f6aa82a4e8962aa50a44484edc33ed1a9c02fa11b2f3b2425013acbb074","src/vm_prot.rs":"2372650264dc27d04fb90d6e548addacb923bfc813a4e5f0f836257e4d114aeb","src/vm_purgable.rs":"acd54e47f8a3a6aa20ca884da7e4a3cf5cc294ecc1c483987416b389fe5fdcbc","src/vm_region.rs":"e7eec2ef80a65f67992f10e9d6779779caea76f417b0c8448cdc8188cfa81f51","src/vm_statistics.rs":"2043854845f9fbc152698d61fb917284600f8cf573cbed45e05d047405831e26","src/vm_sync.rs":"c782a5a3f417532beef1480a1961d8215d4be7b30877ec3c56273cbbfbf68930","src/vm_types.rs":"5a0f21a8e54fab48af5c07f4ab3692dfe812a14534959d478bdf4cb10b5fa6b1"},"package":"2fd13ee2dd61cc82833ba05ade5a30bb3d63f7ced605ef827063c63078302de9"}
|
||||
{"files":{"Cargo.toml":"6cf25dae1f0fd842fb63275ae47904879e66b36290f6fc7ed02090f3ac657b51","LICENSE.md":"399507a62fba271ddb3e24dc857e85b571fbb76435546f51b212cf04d8463f58","README.md":"8e5094a355def0f762dcc92fd68f475bb65016dd0fbeadc0d8a50303d6fb5381","ci/build_fail.sh":"6c2401edd356a43739ef6c27deccfc7703f883ff8d21f49395d8edb806542728","ci/deploy_and_run_on_ios_simulator.rs":"acde74c117544575b2e7ef7531759ec0a6e28bd65d69da16944c746f711ec27d","ci/run.sh":"2eef6140f5f53373f961c682d2b292f8d4b57b2124f1f0e53d5168db27f38d52","examples/dump_process_registers.rs":"e9d0d023cb2cc8272f239cd134152dfa0169017c2a454db1490d2f4548efe6c8","src/boolean.rs":"1d24ea9872748881cd7269a383a7c344e3a650df23f0e44e3b6c266fb8205d9a","src/bootstrap.rs":"a5ab69d74ad8bfb8fad1cb45c8c571977c0bf907a70e767309a437580cee184c","src/clock.rs":"a33c1bfb2f174abb695d164c469ee744be52fec4bc345656e6027d063e150d71","src/clock_priv.rs":"a8e6a96896a94eda67c9fb6e45c564581a711cc9fdcf7674251bb6c0c28b47c2","src/clock_reply.rs":"bac04b6602dcdd4daac8e3a0a1e56fa4b6de20cf2c3fe7bb583358166aca8a3b","src/clock_types.rs":"d55d1d2a953e477f9dd064bd684b118235aa7bd79de85cdeaf75e21510aaaefa","src/dyld_kernel.rs":"566a17f597aa29619a1ce15f6b22577fc70ac5356f96e00fddbcb28560a5c83c","src/exc.rs":"2246493bef2c596b92f115ab673a10d50c6003d11abb8e73d7707ebc19e8ae5a","src/exception_types.rs":"c7894831d73145adb1a4b5d2a5d0b346f2b2dc05382b97f2f3f0275d337f6dfc","src/kern_return.rs":"153339995674136ef05d9595bdcf831595db0d0714a737ecd1ccd45391c56657","src/lib.rs":"7570054fdec1fb73200cb1cf736c97bdeeb82f2aef78aec11e8498af769bba86","src/mach_init.rs":"df49bd287fd05fb74bc76254df7607fad0d6b90cb20da803e9f9a1dc2fcfe2fc","src/mach_port.rs":"07e300871eac4687ccc98d725e550482f136f9780f9f353a0f01f768bc58229b","src/mach_time.rs":"b9493e820acf21fee1f6e7e82a510d887925dc1117d6b71b681acc40cfa776af","src/mach_types.rs":"e2d17741ebcdcdff9686ec9ee5c90fb7a150ce990979507da01c351771fb3a19","src/memory_object_types.rs":"6fcb446c00ddd5ef4920efe618bd89df2e87f7ae3cf660a2bc1d25cf1f331dc2","src/message.rs":"501e743438342ea37cf7db81d6ebd17528da9d78e77d1f1643412e7dc569649f","src/port.rs":"36fc636e2cae2c1f69246b54eb3ca2b33d7e75846df50587fb14597d34b05594","src/structs.rs":"132e21e91313e6ec13e3ad5ed9c71852e8a55fbbaba449dbb1b3ca889bed4889","src/task.rs":"282ea602db2d08711785e0050a06b322a3fe4a4aac34b3c9116fe13e033898dd","src/task_info.rs":"cf87cffe567fee8871e0ce9762b7d8bbd5058dfbb309678d382149dedbe7f14a","src/thread_act.rs":"647198e0f9e3fe409a0610ee98560de3af4f152bcc4761f943e67723193b8a25","src/thread_status.rs":"3fe98fadd61ce01b4f9dc3bc0ef8c9496798f0147822a4ddffe5d0eaf2f32c0a","src/traps.rs":"a15d0dc206c53cf69cb9d11c6ed5477b7dd9937ea68b5a453011be9d004c44a9","src/vm.rs":"9edecf858dcd8e22efbc6ad1838cbfa6a0fc5b334bd21d87b3f05d24058b549e","src/vm_attributes.rs":"55fd9c1661a147a4e374051a6da1884f0c9629aabc514e01561f0e0c365aa18a","src/vm_behavior.rs":"a5d195a52602f5ebe2991774c2390a6f20f1bfa82168dd62e88f2804134da1f3","src/vm_inherit.rs":"dbc7432350869733d6e7cf1da8617d97aafbeb1afcb1bdc60ed7ab53e37abf61","src/vm_page_size.rs":"9e5333f750cd7380465cd34b4611c1f7b5251c11befca0d4482a323e0b1c20b2","src/vm_prot.rs":"15f8f82fbdd67ed31185abd5cc3418332f4371d39ecef6a7e47ddf17bdb5146c","src/vm_purgable.rs":"a39a9fcd85f0394cd169c888e2d7e461d56bf97cf9f81a384df06262e40c9f24","src/vm_region.rs":"d95de52828f28987fa95eb54327b2d278f31769091befb653d286b21d51efc73","src/vm_statistics.rs":"49b452bf56080200d6bf3c32ae8b6642b142fbb13560849ef6a2dc96b650ab4a","src/vm_sync.rs":"4897306cf6c57929830766253637c9adc475e472949a351efc8ada28c20e0d0f","src/vm_types.rs":"a47f71193172ce233018dfd40de2b9a56cdfcdfb18e04c1c0761cb6fc36f51b8"},"package":"b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"}
|
|
@ -3,7 +3,7 @@
|
|||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g. crates.io) dependencies
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
|
@ -11,12 +11,36 @@
|
|||
# will likely look very different (and much more reasonable)
|
||||
|
||||
[package]
|
||||
edition = "2015"
|
||||
name = "mach"
|
||||
version = "0.1.2"
|
||||
authors = ["Nick Fitzgerald <fitzgen@gmail.com>", "David Cuddeback <david.cuddeback@gmail.com>"]
|
||||
description = "A Rust interface to the Mach 3.0 kernel that underlies OSX."
|
||||
version = "0.3.2"
|
||||
authors = ["Nick Fitzgerald <fitzgen@gmail.com>", "David Cuddeback <david.cuddeback@gmail.com>", "Gonzalo Brito Gadeschi <gonzalobg88@gmail.com>"]
|
||||
description = "A Rust interface to the user-space API of the Mach 3.0 kernel that underlies OSX."
|
||||
readme = "README.md"
|
||||
keywords = ["kernel", "macos", "darwin"]
|
||||
categories = ["api-bindings", "external-ffi-bindings", "no-std", "os"]
|
||||
license = "BSD-2-Clause"
|
||||
repository = "https://github.com/fitzgen/mach"
|
||||
[dependencies.libc]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
deprecated = []
|
||||
rustc-dep-of-std = ["rustc-std-workspace-core", "libc/rustc-dep-of-std"]
|
||||
[target."cfg(any(target_os = \"macos\", target_os = \"ios\"))".dependencies.libc]
|
||||
version = "0.2"
|
||||
default-features = false
|
||||
|
||||
[target."cfg(any(target_os = \"macos\", target_os = \"ios\"))".dependencies.rustc-std-workspace-core]
|
||||
version = "1.0.0"
|
||||
optional = true
|
||||
[badges.is-it-maintained-issue-resolution]
|
||||
repository = "fitzgen/mach"
|
||||
|
||||
[badges.is-it-maintained-open-issues]
|
||||
repository = "fitzgen/mach"
|
||||
|
||||
[badges.maintenance]
|
||||
status = "passively-maintained"
|
||||
|
||||
[badges.travis-ci]
|
||||
repository = "fitzgen/mach"
|
||||
|
|
|
@ -1,3 +1,55 @@
|
|||
[![Build Status](https://travis-ci.org/fitzgen/mach.png?branch=master)](https://travis-ci.org/fitzgen/mach)
|
||||
[![Build Status][travis_ci_badge]][travis_ci] [![Latest Version]][crates.io] [![docs]][docs.rs]
|
||||
|
||||
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.
|
||||
|
||||
```toml
|
||||
[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.
|
||||
|
||||
[travis_ci]: https://travis-ci.org/fitzgen/mach
|
||||
[travis_ci_badge]: https://travis-ci.org/fitzgen/mach.png?branch=master
|
||||
[crates.io]: https://crates.io/crates/mach
|
||||
[Latest Version]: https://img.shields.io/crates/v/mach.svg
|
||||
[docs]: https://docs.rs/mach/badge.svg
|
||||
[docs.rs]: https://docs.rs/mach/
|
||||
|
||||
A rust interface to the Mach 3.0 kernel that underlies OSX.
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
: "${TARGET?The TARGET environment variable must be set.}"
|
||||
|
||||
! cargo build --target "${TARGET}"
|
|
@ -0,0 +1,175 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// This is a script to deploy and execute a binary on an iOS simulator.
|
||||
// The primary use of this is to be able to run unit tests on the simulator and
|
||||
// retrieve the results.
|
||||
//
|
||||
// To do this through Cargo instead, use Dinghy
|
||||
// (https://github.com/snipsco/dinghy): cargo dinghy install, then cargo dinghy
|
||||
// test.
|
||||
//
|
||||
// Source: this script is part of libc
|
||||
// https://github.com/rust-lang/libc/blob/master/ci/ios/deploy_and_run_on_ios_simulator.rs
|
||||
// and should be sync'ed with it when ci breaks (or periodically).
|
||||
|
||||
use std::env;
|
||||
use std::fs::{self, File};
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use std::process;
|
||||
use std::process::Command;
|
||||
|
||||
macro_rules! t {
|
||||
($e:expr) => (match $e {
|
||||
Ok(e) => e,
|
||||
Err(e) => panic!("{} failed with: {}", stringify!($e), e),
|
||||
})
|
||||
}
|
||||
|
||||
// Step one: Wrap as an app
|
||||
fn package_as_simulator_app(crate_name: &str, test_binary_path: &Path) {
|
||||
println!("Packaging simulator app");
|
||||
drop(fs::remove_dir_all("ios_simulator_app"));
|
||||
t!(fs::create_dir("ios_simulator_app"));
|
||||
t!(fs::copy(test_binary_path,
|
||||
Path::new("ios_simulator_app").join(crate_name)));
|
||||
|
||||
let mut f = t!(File::create("ios_simulator_app/Info.plist"));
|
||||
t!(f.write_all(format!(r#"
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC
|
||||
"-//Apple//DTD PLIST 1.0//EN"
|
||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>{}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.rust.unittests</string>
|
||||
</dict>
|
||||
</plist>
|
||||
"#, crate_name).as_bytes()));
|
||||
}
|
||||
|
||||
// Step two: Start the iOS simulator
|
||||
fn start_simulator() {
|
||||
println!("Looking for iOS simulator");
|
||||
let output = t!(Command::new("xcrun").arg("simctl").arg("list").output());
|
||||
assert!(output.status.success());
|
||||
let mut simulator_exists = false;
|
||||
let mut simulator_booted = false;
|
||||
let mut found_rust_sim = false;
|
||||
let stdout = t!(String::from_utf8(output.stdout));
|
||||
for line in stdout.lines() {
|
||||
if line.contains("rust_ios") {
|
||||
if found_rust_sim {
|
||||
panic!("Duplicate rust_ios simulators found. Please \
|
||||
double-check xcrun simctl list.");
|
||||
}
|
||||
simulator_exists = true;
|
||||
simulator_booted = line.contains("(Booted)");
|
||||
found_rust_sim = true;
|
||||
}
|
||||
}
|
||||
|
||||
if simulator_exists == false {
|
||||
println!("Creating iOS simulator");
|
||||
Command::new("xcrun")
|
||||
.arg("simctl")
|
||||
.arg("create")
|
||||
.arg("rust_ios")
|
||||
.arg("com.apple.CoreSimulator.SimDeviceType.iPhone-SE")
|
||||
.arg("com.apple.CoreSimulator.SimRuntime.iOS-10-2")
|
||||
.check_status();
|
||||
} else if simulator_booted == true {
|
||||
println!("Shutting down already-booted simulator");
|
||||
Command::new("xcrun")
|
||||
.arg("simctl")
|
||||
.arg("shutdown")
|
||||
.arg("rust_ios")
|
||||
.check_status();
|
||||
}
|
||||
|
||||
println!("Starting iOS simulator");
|
||||
// We can't uninstall the app (if present) as that will hang if the
|
||||
// simulator isn't completely booted; just erase the simulator instead.
|
||||
Command::new("xcrun").arg("simctl").arg("erase").arg("rust_ios").check_status();
|
||||
Command::new("xcrun").arg("simctl").arg("boot").arg("rust_ios").check_status();
|
||||
}
|
||||
|
||||
// Step three: Install the app
|
||||
fn install_app_to_simulator() {
|
||||
println!("Installing app to simulator");
|
||||
Command::new("xcrun")
|
||||
.arg("simctl")
|
||||
.arg("install")
|
||||
.arg("booted")
|
||||
.arg("ios_simulator_app/")
|
||||
.check_status();
|
||||
}
|
||||
|
||||
// Step four: Run the app
|
||||
fn run_app_on_simulator() {
|
||||
println!("Running app");
|
||||
let output = t!(Command::new("xcrun")
|
||||
.arg("simctl")
|
||||
.arg("launch")
|
||||
.arg("--console")
|
||||
.arg("booted")
|
||||
.arg("com.rust.unittests")
|
||||
.output());
|
||||
|
||||
println!("stdout --\n{}\n", String::from_utf8_lossy(&output.stdout));
|
||||
println!("stderr --\n{}\n", String::from_utf8_lossy(&output.stderr));
|
||||
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
let passed = stdout.lines()
|
||||
.find(|l| l.contains("PASSED"))
|
||||
.map(|l| l.contains("tests"))
|
||||
.unwrap_or(false);
|
||||
|
||||
println!("Shutting down simulator");
|
||||
Command::new("xcrun")
|
||||
.arg("simctl")
|
||||
.arg("shutdown")
|
||||
.arg("rust_ios")
|
||||
.check_status();
|
||||
if !passed {
|
||||
panic!("tests didn't pass");
|
||||
}
|
||||
}
|
||||
|
||||
trait CheckStatus {
|
||||
fn check_status(&mut self);
|
||||
}
|
||||
|
||||
impl CheckStatus for Command {
|
||||
fn check_status(&mut self) {
|
||||
println!("\trunning: {:?}", self);
|
||||
assert!(t!(self.status()).success());
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
if args.len() != 2 {
|
||||
println!("Usage: {} <executable>", args[0]);
|
||||
process::exit(-1);
|
||||
}
|
||||
|
||||
let test_binary_path = Path::new(&args[1]);
|
||||
let crate_name = test_binary_path.file_name().unwrap();
|
||||
|
||||
package_as_simulator_app(crate_name.to_str().unwrap(), test_binary_path);
|
||||
start_simulator();
|
||||
install_app_to_simulator();
|
||||
run_app_on_simulator();
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
set -ex
|
||||
|
||||
: "${TARGET?The TARGET environment variable must be set.}"
|
||||
: "${TRAVIS_RUST_VERSION?The TRAVIS_RUST_VERSION environment variable must be set.}"
|
||||
|
||||
echo "Running tests for target: ${TARGET}"
|
||||
export RUST_BACKTRACE=1
|
||||
export RUST_TEST_THREADS=1
|
||||
export RUST_TEST_NOCAPTURE=1
|
||||
export CARGO_INCREMENTAL=0
|
||||
export CARGO_CODEGEN_UNITS=1
|
||||
export RUSTFLAGS="-C codegen-units=1 "
|
||||
|
||||
case "${TARGET}" in
|
||||
*"ios"*)
|
||||
export RUSTFLAGS="${RUSTFLAGS} -C link-args=-mios-simulator-version-min=7.0"
|
||||
rustc ./ci/deploy_and_run_on_ios_simulator.rs -o ios_cargo_runner --verbose
|
||||
if [ "${TARGET}" = "x86_64-apple-ios" ]; then
|
||||
export CARGO_TARGET_X86_64_APPLE_IOS_RUNNER
|
||||
CARGO_TARGET_X86_64_APPLE_IOS_RUNNER="$(pwd)/ios_cargo_runner"
|
||||
fi
|
||||
if [ "${TARGET}" = "i386-apple-ios" ]; then
|
||||
export CARGO_TARGET_I386_APPLE_IOS_RUNNER
|
||||
CARGO_TARGET_I386_APPLE_IOS_RUNNER="$(pwd)/ios_cargo_runner"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Build w/o std
|
||||
cargo clean
|
||||
cargo build --no-default-features --target "${TARGET}" -vv 2>&1 | tee build_no_std.txt
|
||||
|
||||
# Check that the no-std builds are not linked against a libc with default
|
||||
# features or the std feature enabled:
|
||||
! grep -q "default" build_no_std.txt
|
||||
! grep -q "std" build_no_std.txt
|
||||
# Make sure that the resulting build contains no std symbols
|
||||
! find target/ -name "*.rlib" -exec nm {} \; | grep "std"
|
||||
|
||||
# Runs mach's run-time tests:
|
||||
if [ -z "$NORUN" ]; then
|
||||
cargo test --target "${TARGET}" -vv
|
||||
cargo test --target "${TARGET}" -vv --features deprecated
|
||||
cargo test --no-default-features --target "${TARGET}" -vv
|
||||
fi
|
||||
|
||||
# Runs ctest to verify mach's ABI against the system libraries:
|
||||
if [ -z "$NOCTEST" ]; then
|
||||
if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]; then
|
||||
cargo test --manifest-path mach-test/Cargo.toml --target "${TARGET}" -vv
|
||||
cargo test --no-default-features --manifest-path mach-test/Cargo.toml --target "${TARGET}" -vv
|
||||
fi
|
||||
fi
|
|
@ -8,15 +8,15 @@ use std::io;
|
|||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
use mach::kern_return::{KERN_SUCCESS};
|
||||
use mach::message::{mach_msg_type_number_t};
|
||||
use mach::port::{mach_port_name_t};
|
||||
use mach::structs::{x86_thread_state64_t};
|
||||
use mach::kern_return::KERN_SUCCESS;
|
||||
use mach::mach_types::{task_t, thread_act_array_t};
|
||||
use mach::message::mach_msg_type_number_t;
|
||||
use mach::port::mach_port_name_t;
|
||||
use mach::structs::x86_thread_state64_t;
|
||||
use mach::task::{task_resume, task_suspend, task_threads};
|
||||
use mach::thread_act::{thread_get_state};
|
||||
use mach::thread_status::{x86_THREAD_STATE64};
|
||||
use mach::thread_act::thread_get_state;
|
||||
use mach::thread_status::x86_THREAD_STATE64;
|
||||
use mach::traps::{mach_task_self, task_for_pid};
|
||||
use mach::types::{task_t, thread_act_array_t};
|
||||
|
||||
use std::io::prelude::*;
|
||||
|
||||
|
@ -57,16 +57,18 @@ fn main() {
|
|||
Err(_) => {
|
||||
println!("Bad pid!");
|
||||
return;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
println!("pid = {}", &pid);
|
||||
|
||||
let task: mach_port_name_t = 0;
|
||||
unsafe {
|
||||
let kret = task_for_pid(mach_task_self() as mach_port_name_t,
|
||||
let kret = task_for_pid(
|
||||
mach_task_self() as mach_port_name_t,
|
||||
pid,
|
||||
mem::transmute(&task));
|
||||
mem::transmute(&task),
|
||||
);
|
||||
if kret != KERN_SUCCESS {
|
||||
println!("Did not succeed in getting task for pid {}", pid);
|
||||
println!("kern_return_t error {}", kret);
|
||||
|
@ -91,9 +93,11 @@ fn main() {
|
|||
let thread_list: thread_act_array_t = ptr::null_mut();
|
||||
let thread_count: mach_msg_type_number_t = 0;
|
||||
unsafe {
|
||||
let kret = task_threads(task as task_t,
|
||||
let kret = task_threads(
|
||||
task as task_t,
|
||||
mem::transmute(&thread_list),
|
||||
mem::transmute(&thread_count));
|
||||
mem::transmute(&thread_count),
|
||||
);
|
||||
if kret != KERN_SUCCESS {
|
||||
println!("Did not succeed in getting task's threads");
|
||||
println!("kern_return_t error {}", kret);
|
||||
|
@ -105,15 +109,18 @@ fn main() {
|
|||
println!("Task is running {} threads", &thread_count);
|
||||
|
||||
unsafe {
|
||||
let threads = Vec::from_raw_parts(thread_list, thread_count as usize, thread_count as usize);
|
||||
let threads =
|
||||
Vec::from_raw_parts(thread_list, thread_count as usize, thread_count as usize);
|
||||
let state = x86_thread_state64_t::new();
|
||||
let state_count = x86_thread_state64_t::count();
|
||||
for (idx, &thread) in threads.iter().enumerate() {
|
||||
println!("Thread {}:", idx);
|
||||
let kret = thread_get_state(thread,
|
||||
let kret = thread_get_state(
|
||||
thread,
|
||||
x86_THREAD_STATE64,
|
||||
mem::transmute(&state),
|
||||
mem::transmute(&state_count));
|
||||
mem::transmute(&state_count),
|
||||
);
|
||||
if kret != KERN_SUCCESS {
|
||||
println!("Did not succeed in getting task's thread state");
|
||||
println!("kern_return_t error {}", kret);
|
||||
|
|
|
@ -1,14 +1,76 @@
|
|||
//! This module corresponds to `bootstrap.h`
|
||||
|
||||
use kern_return::{kern_return_t};
|
||||
use libc;
|
||||
use port::{mach_port_t};
|
||||
use boolean::boolean_t;
|
||||
use kern_return::kern_return_t;
|
||||
use port::mach_port_t;
|
||||
|
||||
pub const BOOTSTRAP_MAX_NAME_LEN: libc::c_uint = 128;
|
||||
pub const BOOTSTRAP_MAX_NAME_LEN: ::libc::c_uint = 128;
|
||||
pub const BOOTSTRAP_MAX_CMD_LEN: ::libc::c_uint = 512;
|
||||
|
||||
pub const BOOTSTRAP_MAX_LOOKUP_COUNT: ::libc::c_uint = 20;
|
||||
|
||||
pub const BOOTSTRAP_SUCCESS: ::libc::c_uint = 0;
|
||||
pub const BOOTSTRAP_NOT_PRIVILEGED: ::libc::c_uint = 1100;
|
||||
pub const BOOTSTRAP_NAME_IN_USE: ::libc::c_uint = 1101;
|
||||
pub const BOOTSTRAP_UNKNOWN_SERVICE: ::libc::c_uint = 1102;
|
||||
pub const BOOTSTRAP_SERVICE_ACTIVE: ::libc::c_uint = 1103;
|
||||
pub const BOOTSTRAP_BAD_COUNT: ::libc::c_uint = 1104;
|
||||
pub const BOOTSTRAP_NO_MEMORY: ::libc::c_uint = 1105;
|
||||
pub const BOOTSTRAP_NO_CHILDREN: ::libc::c_uint = 1106;
|
||||
|
||||
pub const BOOTSTRAP_STATUS_INACTIVE: ::libc::c_uint = 0;
|
||||
pub const BOOTSTRAP_STATUS_ACTIVE: ::libc::c_uint = 1;
|
||||
pub const BOOTSTRAP_STATUS_ON_DEMAND: ::libc::c_uint = 2;
|
||||
|
||||
pub type name_t = [::libc::c_char; 128];
|
||||
pub type cmd_t = [::libc::c_char; 512];
|
||||
pub type name_array_t = *mut name_t;
|
||||
pub type bootstrap_status_t = ::libc::c_int;
|
||||
pub type bootstrap_status_array_t = *mut bootstrap_status_t;
|
||||
pub type bootstrap_property_t = ::libc::c_uint;
|
||||
pub type bootstrap_property_array_t = *mut bootstrap_property_t;
|
||||
pub type bool_array_t = *mut boolean_t;
|
||||
|
||||
extern "C" {
|
||||
pub fn bootstrap_look_up(bp: mach_port_t,
|
||||
service_name: *const libc::c_char,
|
||||
sp: *mut mach_port_t)
|
||||
-> kern_return_t;
|
||||
pub static bootstrap_port: mach_port_t;
|
||||
pub fn bootstrap_create_server(
|
||||
bp: mach_port_t,
|
||||
server_cmd: *mut ::libc::c_char,
|
||||
server_uid: ::libc::uid_t,
|
||||
on_demand: boolean_t,
|
||||
server_port: *mut mach_port_t,
|
||||
) -> kern_return_t;
|
||||
pub fn bootstrap_subset(
|
||||
bp: mach_port_t,
|
||||
requestor_port: mach_port_t,
|
||||
subset_port: *mut mach_port_t,
|
||||
) -> kern_return_t;
|
||||
pub fn bootstrap_unprivileged(bp: mach_port_t, unpriv_port: *mut mach_port_t) -> kern_return_t;
|
||||
pub fn bootstrap_parent(bp: mach_port_t, parent_port: *mut mach_port_t) -> kern_return_t;
|
||||
pub fn bootstrap_register(
|
||||
bp: mach_port_t,
|
||||
service_name: *mut ::libc::c_char,
|
||||
sp: mach_port_t,
|
||||
) -> kern_return_t;
|
||||
pub fn bootstrap_create_service(
|
||||
bp: mach_port_t,
|
||||
service_name: *mut ::libc::c_char,
|
||||
sp: *mut mach_port_t,
|
||||
) -> kern_return_t;
|
||||
pub fn bootstrap_check_in(
|
||||
bp: mach_port_t,
|
||||
service_name: *const ::libc::c_char,
|
||||
sp: *mut mach_port_t,
|
||||
) -> kern_return_t;
|
||||
pub fn bootstrap_look_up(
|
||||
bp: mach_port_t,
|
||||
service_name: *const ::libc::c_char,
|
||||
sp: *mut mach_port_t,
|
||||
) -> kern_return_t;
|
||||
pub fn bootstrap_status(
|
||||
bp: mach_port_t,
|
||||
service_name: *mut ::libc::c_char,
|
||||
service_active: *mut bootstrap_status_t,
|
||||
) -> kern_return_t;
|
||||
pub fn bootstrap_strerror(r: kern_return_t) -> *const ::libc::c_char;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
//! This module roughly corresponds to `mach/clock.h`.
|
||||
|
||||
pub const clock_MSG_COUNT: ::libc::c_uint = 3;
|
||||
|
||||
use clock_types::{alarm_type_t, clock_attr_t, clock_flavor_t, mach_timespec_t};
|
||||
use kern_return::kern_return_t;
|
||||
use mach_types::{clock_reply_t, clock_serv_t};
|
||||
use message::mach_msg_type_number_t;
|
||||
|
||||
extern "C" {
|
||||
pub fn clock_get_time(
|
||||
clock_serv: clock_serv_t,
|
||||
cur_time: *mut mach_timespec_t,
|
||||
) -> kern_return_t;
|
||||
pub fn clock_get_attributes(
|
||||
clock_serv: clock_serv_t,
|
||||
flavor: clock_flavor_t,
|
||||
clock_attr: clock_attr_t,
|
||||
clock_attrCnt: *mut mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
pub fn clock_alarm(
|
||||
clock_serv: clock_serv_t,
|
||||
alarm_type: alarm_type_t,
|
||||
alarm_time: mach_timespec_t,
|
||||
alarm_port: clock_reply_t,
|
||||
) -> kern_return_t;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
//! This module roughly corresponds to `mach/clock_priv.h`.
|
||||
|
||||
use clock_types::{clock_attr_t, clock_flavor_t, mach_timespec_t};
|
||||
use kern_return::kern_return_t;
|
||||
use mach_types::clock_ctrl_t;
|
||||
use message::mach_msg_type_number_t;
|
||||
|
||||
extern "C" {
|
||||
pub fn clock_set_time(clock_ctrl: clock_ctrl_t, new_time: mach_timespec_t) -> kern_return_t;
|
||||
pub fn clock_set_attributes(
|
||||
clock_ctrl: clock_ctrl_t,
|
||||
flavor: clock_flavor_t,
|
||||
clock_attr: clock_attr_t,
|
||||
clock_attrCnt: mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
//! This module roughly corresponds to `mach/clock_reply.h`.
|
||||
|
||||
use clock_types::{alarm_type_t, mach_timespec_t};
|
||||
use kern_return::kern_return_t;
|
||||
use mach_types::clock_reply_t;
|
||||
use message::mach_msg_type_name_t;
|
||||
|
||||
extern "C" {
|
||||
pub fn clock_alarm_reply(
|
||||
alarm_port: clock_reply_t,
|
||||
alarm_portPoly: mach_msg_type_name_t,
|
||||
alarm_code: kern_return_t,
|
||||
alarm_type: alarm_type_t,
|
||||
alarm_time: mach_timespec_t,
|
||||
) -> kern_return_t;
|
||||
}
|
|
@ -8,8 +8,68 @@ pub type clock_attr_t = *mut ::libc::c_int;
|
|||
pub type clock_res_t = ::libc::c_int;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_timespec {
|
||||
tv_sec: ::libc::c_uint,
|
||||
tv_nsec: clock_res_t
|
||||
pub tv_sec: ::libc::c_uint,
|
||||
pub tv_nsec: clock_res_t,
|
||||
}
|
||||
pub type mach_timespec_t = mach_timespec;
|
||||
|
||||
pub const SYSTEM_CLOCK: ::libc::c_uint = 0;
|
||||
pub const CALENDAR_CLOCK: ::libc::c_uint = 1;
|
||||
pub const REALTIME_CLOCK: ::libc::c_uint = 0;
|
||||
|
||||
pub const CLOCK_GET_TIME_RES: ::libc::c_uint = 1;
|
||||
pub const CLOCK_ALARM_CURRES: ::libc::c_uint = 3;
|
||||
pub const CLOCK_ALARM_MINRES: ::libc::c_uint = 4;
|
||||
pub const CLOCK_ALARM_MAXRES: ::libc::c_uint = 5;
|
||||
|
||||
pub const NSEC_PER_USEC: ::libc::c_ulonglong = 1000;
|
||||
pub const USEC_PER_SEC: ::libc::c_ulonglong = 1_000_000;
|
||||
pub const NSEC_PER_SEC: ::libc::c_ulonglong = 1_000_000_000;
|
||||
pub const NSEC_PER_MSEC: ::libc::c_ulonglong = 1_000_000;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn BAD_MACH_TIMESPEC(t: mach_timespec) -> bool {
|
||||
t.tv_nsec < 0 || (t.tv_nsec as ::libc::c_ulonglong) >= NSEC_PER_SEC
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn CMP_MACH_TIMESPEC(t1: &mach_timespec, t2: &mach_timespec) -> ::libc::c_ulonglong {
|
||||
if t1.tv_sec > t2.tv_sec {
|
||||
return NSEC_PER_SEC;
|
||||
}
|
||||
if t1.tv_sec < t2.tv_sec {
|
||||
return !NSEC_PER_SEC;
|
||||
}
|
||||
(t1.tv_nsec as ::libc::c_ulonglong) - (t2.tv_nsec as ::libc::c_ulonglong)
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn ADD_MACH_TIMESPEC(t1: &mut mach_timespec, t2: &mach_timespec) {
|
||||
t1.tv_nsec += t2.tv_nsec;
|
||||
if (t1.tv_nsec as ::libc::c_ulonglong) >= NSEC_PER_SEC {
|
||||
t1.tv_nsec = (t1.tv_nsec as ::libc::c_ulonglong - NSEC_PER_SEC) as clock_res_t;
|
||||
t1.tv_sec += 1;
|
||||
}
|
||||
t1.tv_sec += t2.tv_sec;
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn SUB_MACH_TIMESPEC(t1: &mut mach_timespec, t2: &mach_timespec) {
|
||||
t1.tv_nsec -= t2.tv_nsec;
|
||||
if t1.tv_nsec < 0 {
|
||||
t1.tv_nsec = (t1.tv_nsec as ::libc::c_ulonglong + NSEC_PER_SEC) as clock_res_t;
|
||||
t1.tv_sec -= 1;
|
||||
}
|
||||
t1.tv_sec -= t2.tv_sec;
|
||||
}
|
||||
|
||||
pub const ALRMTYPE: ::libc::c_uint = 0xff;
|
||||
pub const TIME_ABSOLUTE: ::libc::c_uint = 0x00;
|
||||
pub const TIME_RELATIVE: ::libc::c_uint = 0x01;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn BAD_ALRMTYPE(t: ::libc::c_uint) -> bool {
|
||||
t & (!TIME_RELATIVE) != 0
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
//! This module roughly corresponds to `mach/dyld_kernel.h`.
|
||||
|
||||
use boolean::boolean_t;
|
||||
use mach_types::{fsid_t, fsobj_id_t, uuid_t};
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct dyld_kernel_image_info {
|
||||
pub uuid: uuid_t,
|
||||
pub fsobjid: fsobj_id_t,
|
||||
pub fsid: fsid_t,
|
||||
pub load_addr: u64,
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct dyld_kernel_process_info {
|
||||
pub cache_image_info: dyld_kernel_image_info,
|
||||
pub timestamp: u64,
|
||||
pub imageCount: u32,
|
||||
pub initialImageCount: u32,
|
||||
pub dyldState: u8,
|
||||
pub no_cache: boolean_t,
|
||||
pub private_cache: boolean_t,
|
||||
}
|
||||
|
||||
pub type dyld_kernel_image_info_t = dyld_kernel_image_info;
|
||||
pub type dyld_kernel_process_info_t = dyld_kernel_process_info;
|
||||
pub type dyld_kernel_image_info_array_t = *mut dyld_kernel_image_info_t;
|
|
@ -0,0 +1,44 @@
|
|||
//! This module roughly corresponds to `mach/exc.h`.
|
||||
|
||||
use exception_types::{exception_data_t, exception_type_t};
|
||||
use kern_return::kern_return_t;
|
||||
use message::mach_msg_type_number_t;
|
||||
use port::mach_port_t;
|
||||
use thread_status::thread_state_t;
|
||||
|
||||
pub const exc_MSG_COUNT: ::libc::c_uint = 3;
|
||||
|
||||
extern "C" {
|
||||
pub fn exception_raise(
|
||||
exception_port: mach_port_t,
|
||||
thread: mach_port_t,
|
||||
task: mach_port_t,
|
||||
exception: exception_type_t,
|
||||
code: exception_data_t,
|
||||
codeCnt: mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
pub fn exception_raise_state(
|
||||
exception_port: mach_port_t,
|
||||
exception: exception_type_t,
|
||||
code: exception_data_t,
|
||||
codeCnt: mach_msg_type_number_t,
|
||||
flavor: *mut ::libc::c_int,
|
||||
old_state: thread_state_t,
|
||||
old_stateCnt: mach_msg_type_number_t,
|
||||
new_state: thread_state_t,
|
||||
new_stateCnt: *mut mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
pub fn exception_raise_state_identity(
|
||||
exception_port: mach_port_t,
|
||||
thread: mach_port_t,
|
||||
task: mach_port_t,
|
||||
exception: exception_type_t,
|
||||
code: exception_data_t,
|
||||
codeCnt: mach_msg_type_number_t,
|
||||
flavor: *mut ::libc::c_int,
|
||||
old_state: thread_state_t,
|
||||
old_stateCnt: mach_msg_type_number_t,
|
||||
new_state: thread_state_t,
|
||||
new_stateCnt: *mut mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
//! This module roughly corresponds to `mach/exception_types.h`.
|
||||
|
||||
use port::mach_port_t;
|
||||
use thread_status::thread_state_flavor_t;
|
||||
use vm_types::integer_t;
|
||||
|
||||
pub const EXC_BAD_ACCESS: ::libc::c_uint = 1;
|
||||
pub const EXC_BAD_INSTRUCTION: ::libc::c_uint = 2;
|
||||
pub const EXC_ARITHMETIC: ::libc::c_uint = 3;
|
||||
pub const EXC_EMULATION: ::libc::c_uint = 4;
|
||||
pub const EXC_SOFTWARE: ::libc::c_uint = 5;
|
||||
pub const EXC_BREAKPOINT: ::libc::c_uint = 6;
|
||||
pub const EXC_SYSCALL: ::libc::c_uint = 7;
|
||||
pub const EXC_MACH_SYSCALL: ::libc::c_uint = 8;
|
||||
pub const EXC_RPC_ALERT: ::libc::c_uint = 9;
|
||||
pub const EXC_CRASH: ::libc::c_uint = 10;
|
||||
pub const EXC_RESOURCE: ::libc::c_uint = 11;
|
||||
pub const EXC_GUARD: ::libc::c_uint = 12;
|
||||
pub const EXC_CORPSE_NOTIFY: ::libc::c_uint = 13;
|
||||
pub const EXC_CORPSE_VARIANT_BIT: ::libc::c_uint = 256;
|
||||
pub const EXCEPTION_DEFAULT: ::libc::c_uint = 1;
|
||||
pub const EXCEPTION_STATE: ::libc::c_uint = 2;
|
||||
pub const EXCEPTION_STATE_IDENTITY: ::libc::c_uint = 3;
|
||||
pub const MACH_EXCEPTION_CODES: ::libc::c_uint = 2_147_483_648;
|
||||
pub const EXC_MASK_BAD_ACCESS: ::libc::c_uint = 2;
|
||||
pub const EXC_MASK_BAD_INSTRUCTION: ::libc::c_uint = 4;
|
||||
pub const EXC_MASK_ARITHMETIC: ::libc::c_uint = 8;
|
||||
pub const EXC_MASK_EMULATION: ::libc::c_uint = 16;
|
||||
pub const EXC_MASK_SOFTWARE: ::libc::c_uint = 32;
|
||||
pub const EXC_MASK_BREAKPOINT: ::libc::c_uint = 64;
|
||||
pub const EXC_MASK_SYSCALL: ::libc::c_uint = 128;
|
||||
pub const EXC_MASK_MACH_SYSCALL: ::libc::c_uint = 256;
|
||||
pub const EXC_MASK_RPC_ALERT: ::libc::c_uint = 512;
|
||||
pub const EXC_MASK_CRASH: ::libc::c_uint = 1024;
|
||||
pub const EXC_MASK_RESOURCE: ::libc::c_uint = 2048;
|
||||
pub const EXC_MASK_GUARD: ::libc::c_uint = 4096;
|
||||
pub const EXC_MASK_CORPSE_NOTIFY: ::libc::c_uint = 8192;
|
||||
pub const EXC_MASK_ALL: ::libc::c_uint = 7166;
|
||||
pub const FIRST_EXCEPTION: ::libc::c_uint = 1;
|
||||
pub const EXC_SOFT_SIGNAL: ::libc::c_uint = 65_539;
|
||||
pub const EXC_MACF_MIN: ::libc::c_uint = 131_072;
|
||||
pub const EXC_MACF_MAX: ::libc::c_uint = 196_607;
|
||||
|
||||
pub type exception_type_t = ::libc::c_int;
|
||||
pub type exception_data_type_t = integer_t;
|
||||
pub type mach_exception_data_type_t = i64;
|
||||
pub type exception_behavior_t = ::libc::c_int;
|
||||
pub type exception_data_t = *mut exception_data_type_t;
|
||||
pub type mach_exception_data_t = *mut mach_exception_data_type_t;
|
||||
pub type exception_mask_t = ::libc::c_uint;
|
||||
pub type exception_mask_array_t = *mut exception_mask_t;
|
||||
pub type exception_behavior_array_t = *mut exception_behavior_t;
|
||||
pub type exception_flavor_array_t = *mut thread_state_flavor_t;
|
||||
pub type exception_port_array_t = *mut mach_port_t;
|
||||
pub type mach_exception_code_t = mach_exception_data_type_t;
|
||||
pub type mach_exception_subcode_t = mach_exception_data_type_t;
|
|
@ -1,13 +1,42 @@
|
|||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![deny(missing_debug_implementations)]
|
||||
#![deny(missing_copy_implementations)]
|
||||
#![cfg_attr(feature = "rustc-dep-of-std", feature(no_core))]
|
||||
#![cfg_attr(feature = "rustc-dep-of-std", no_core)]
|
||||
#![cfg_attr(not(feature = "rustc-dep-of-std"), no_std)]
|
||||
#![allow(
|
||||
clippy::module_name_repetitions,
|
||||
clippy::cast_sign_loss,
|
||||
clippy::cast_possible_truncation,
|
||||
clippy::trivially_copy_pass_by_ref
|
||||
)]
|
||||
|
||||
#[cfg(not(any(target_os = "macos", target_os = "ios")))]
|
||||
compile_error!("mach requires MacOSX or iOS");
|
||||
|
||||
#[cfg(feature = "rustc-dep-of-std")]
|
||||
extern crate rustc_std_workspace_core as core;
|
||||
|
||||
extern crate libc;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use core::{clone, cmp, default, fmt, hash, marker, mem, option};
|
||||
|
||||
pub mod boolean;
|
||||
pub mod bootstrap;
|
||||
pub mod clock_types;
|
||||
pub mod clock;
|
||||
pub mod clock_priv;
|
||||
pub mod clock_reply;
|
||||
pub mod clock_types; // TODO: test
|
||||
pub mod dyld_kernel;
|
||||
// pub mod error; // TODO
|
||||
pub mod exc;
|
||||
pub mod exception_types;
|
||||
pub mod kern_return;
|
||||
pub mod mach_init;
|
||||
pub mod mach_port;
|
||||
pub mod mach_time;
|
||||
pub mod mach_types;
|
||||
pub mod memory_object_types;
|
||||
pub mod message;
|
||||
|
@ -18,7 +47,6 @@ pub mod task_info;
|
|||
pub mod thread_act;
|
||||
pub mod thread_status;
|
||||
pub mod traps;
|
||||
pub mod types;
|
||||
pub mod vm;
|
||||
pub mod vm_attributes;
|
||||
pub mod vm_behavior;
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
//! This module corresponds to `mach/mach_init.h`.
|
||||
|
||||
use mach_types::thread_port_t;
|
||||
|
||||
extern "C" {
|
||||
pub fn mach_thread_self() -> thread_port_t;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use mach_init::*;
|
||||
use port::*;
|
||||
|
||||
#[test]
|
||||
fn mach_thread_self_test() {
|
||||
unsafe {
|
||||
let this_thread = mach_thread_self();
|
||||
assert!(this_thread != MACH_PORT_NULL);
|
||||
assert!(this_thread != MACH_PORT_DEAD);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,29 @@
|
|||
//! This module corresponds to `mach/mach_port.h`
|
||||
|
||||
use kern_return::{kern_return_t};
|
||||
use message::{mach_msg_type_name_t};
|
||||
use kern_return::kern_return_t;
|
||||
use mach_types::ipc_space_t;
|
||||
use message::mach_msg_type_name_t;
|
||||
use port::{mach_port_name_t, mach_port_right_t, mach_port_t};
|
||||
use types::{ipc_space_t};
|
||||
|
||||
extern "C" {
|
||||
pub fn mach_port_allocate(task: ipc_space_t, right: mach_port_right_t,
|
||||
name: *mut mach_port_name_t) -> kern_return_t;
|
||||
pub fn mach_port_destroy(task: ipc_space_t,
|
||||
name: mach_port_name_t) -> kern_return_t;
|
||||
pub fn mach_port_deallocate(task: ipc_space_t,
|
||||
name: mach_port_name_t) -> kern_return_t;
|
||||
pub fn mach_port_insert_right(task: ipc_space_t, name: mach_port_name_t,
|
||||
pub fn mach_port_allocate(
|
||||
task: ipc_space_t,
|
||||
right: mach_port_right_t,
|
||||
name: *mut mach_port_name_t,
|
||||
) -> kern_return_t;
|
||||
pub fn mach_port_destroy(task: ipc_space_t, name: mach_port_name_t) -> kern_return_t;
|
||||
pub fn mach_port_deallocate(task: ipc_space_t, name: mach_port_name_t) -> kern_return_t;
|
||||
pub fn mach_port_insert_right(
|
||||
task: ipc_space_t,
|
||||
name: mach_port_name_t,
|
||||
poly: mach_port_t,
|
||||
polyPoly: mach_msg_type_name_t) -> kern_return_t;
|
||||
pub fn mach_port_extract_right(task: ipc_space_t, name: mach_port_name_t,
|
||||
polyPoly: mach_msg_type_name_t,
|
||||
) -> kern_return_t;
|
||||
pub fn mach_port_extract_right(
|
||||
task: ipc_space_t,
|
||||
name: mach_port_name_t,
|
||||
msgt_name: mach_msg_type_name_t,
|
||||
poly: *mut mach_port_t,
|
||||
polyPoly: *mut mach_msg_type_name_t) -> kern_return_t;
|
||||
polyPoly: *mut mach_msg_type_name_t,
|
||||
) -> kern_return_t;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
//! This module corresponds to `mach/mach_time.h`
|
||||
use kern_return::kern_return_t;
|
||||
pub type mach_timebase_info_t = *mut mach_timebase_info;
|
||||
pub type mach_timebase_info_data_t = mach_timebase_info;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_timebase_info {
|
||||
pub numer: u32,
|
||||
pub denom: u32,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn mach_timebase_info(info: mach_timebase_info_t) -> kern_return_t;
|
||||
pub fn mach_wait_until(deadline: u64) -> kern_return_t;
|
||||
pub fn mach_absolute_time() -> u64;
|
||||
pub fn mach_approximate_time() -> u64;
|
||||
pub fn mach_continuous_time() -> u64;
|
||||
pub fn mach_continuous_approximate_time() -> u64;
|
||||
}
|
|
@ -1,3 +1,106 @@
|
|||
//! This module corresponds to `mach/mach_types.h`
|
||||
|
||||
use port::mach_port_t;
|
||||
|
||||
pub type task_t = mach_port_t;
|
||||
pub type task_name_t = mach_port_t;
|
||||
pub type task_suspension_token_t = mach_port_t;
|
||||
pub type thread_t = mach_port_t;
|
||||
pub type thread_act_t = mach_port_t;
|
||||
pub type ipc_space_t = mach_port_t;
|
||||
pub type coalition_t = mach_port_t;
|
||||
pub type host_t = mach_port_t;
|
||||
pub type host_priv_t = mach_port_t;
|
||||
pub type host_security_t = mach_port_t;
|
||||
pub type processor_t = mach_port_t;
|
||||
pub type processor_set_t = mach_port_t;
|
||||
pub type processor_set_control_t = mach_port_t;
|
||||
pub type semaphore_t = mach_port_t;
|
||||
pub type lock_set_t = mach_port_t;
|
||||
pub type ledger_t = mach_port_t;
|
||||
pub type alarm_t = mach_port_t;
|
||||
pub type clock_serv_t = mach_port_t;
|
||||
pub type clock_ctrl_t = mach_port_t;
|
||||
|
||||
pub type processor_set_name_t = processor_set_t;
|
||||
|
||||
pub type clock_reply_t = mach_port_t;
|
||||
pub type bootstrap_t = mach_port_t;
|
||||
pub type mem_entry_name_port_t = mach_port_t;
|
||||
pub type exception_handler_t = mach_port_t;
|
||||
pub type exception_handler_array_t = *mut exception_handler_t;
|
||||
pub type vm_task_entry_t = mach_port_t;
|
||||
pub type io_master_t = mach_port_t;
|
||||
pub type UNDServerRef = mach_port_t;
|
||||
|
||||
pub type task_array_t = *mut task_t;
|
||||
pub type thread_array_t = *mut thread_t;
|
||||
pub type processor_set_array_t = *mut processor_set_t;
|
||||
pub type processor_set_name_array_t = *mut processor_set_t;
|
||||
pub type processor_array_t = *mut processor_t;
|
||||
pub type thread_act_array_t = *mut thread_act_t;
|
||||
pub type ledger_array_t = *mut ledger_t;
|
||||
|
||||
pub type task_port_t = task_t;
|
||||
pub type task_port_array_t = task_array_t;
|
||||
pub type thread_port_t = thread_t;
|
||||
pub type thread_port_array_t = thread_array_t;
|
||||
pub type ipc_space_port_t = ipc_space_t;
|
||||
pub type host_name_t = host_t;
|
||||
pub type host_name_port_t = host_t;
|
||||
pub type processor_set_port_t = processor_set_t;
|
||||
pub type processor_set_name_port_t = processor_set_t;
|
||||
pub type processor_set_name_port_array_t = processor_set_array_t;
|
||||
pub type processor_set_control_port_t = processor_set_t;
|
||||
pub type processor_port_t = processor_t;
|
||||
pub type processor_port_array_t = processor_array_t;
|
||||
pub type thread_act_port_t = thread_act_t;
|
||||
pub type thread_act_port_array_t = thread_act_array_t;
|
||||
pub type semaphore_port_t = semaphore_t;
|
||||
pub type lock_set_port_t = lock_set_t;
|
||||
pub type ledger_port_t = ledger_t;
|
||||
pub type ledger_port_array_t = ledger_array_t;
|
||||
pub type alarm_port_t = alarm_t;
|
||||
pub type clock_serv_port_t = clock_serv_t;
|
||||
pub type clock_ctrl_port_t = clock_ctrl_t;
|
||||
pub type exception_port_t = exception_handler_t;
|
||||
pub type exception_port_arrary_t = exception_handler_array_t;
|
||||
|
||||
pub const TASK_NULL: task_t = 0;
|
||||
pub const TASK_NAME_NULL: task_name_t = 0;
|
||||
pub const THREAD_NULL: thread_t = 0;
|
||||
pub const TID_NULL: u64 = 0;
|
||||
pub const THR_ACT_NULL: thread_act_t = 0;
|
||||
pub const IPC_SPACE_NULL: ipc_space_t = 0;
|
||||
pub const COALITION_NULL: coalition_t = 0;
|
||||
pub const HOST_NULL: host_t = 0;
|
||||
pub const HOST_PRIV_NULL: host_priv_t = 0;
|
||||
pub const HOST_SECURITY_NULL: host_security_t = 0;
|
||||
pub const PROCESSOR_SET_NULL: processor_set_t = 0;
|
||||
pub const PROCESSOR_NULL: processor_t = 0;
|
||||
pub const SEMAPHORE_NULL: semaphore_t = 0;
|
||||
pub const LOCK_SET_NULL: lock_set_t = 0;
|
||||
pub const LEDGER_NULL: ledger_t = 0;
|
||||
pub const ALARM_NULL: alarm_t = 0;
|
||||
pub const CLOCK_NULL: ::libc::clock_t = 0;
|
||||
pub const UND_SERVER_NULL: UNDServerRef = 0;
|
||||
|
||||
// <sys/_types.h>: typedef unsigned char __darwin_uuid_t[16];
|
||||
pub type uuid_t = [::libc::c_uchar; 16];
|
||||
|
||||
// <sys/_types/_fsid_t.h>
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct fsid {
|
||||
pub val: [i32; 2],
|
||||
}
|
||||
pub type fsid_t = fsid;
|
||||
|
||||
// <sys/_types/_fsobj_id_t.h>
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct fsobj_id {
|
||||
pub fid_objno: u32,
|
||||
pub fid_generation: u32,
|
||||
}
|
||||
pub type fsobj_id_t = fsobj_id;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! This module roughly corresponds to `mach/memory_object_types.h`.
|
||||
|
||||
use vm_types::{natural_t};
|
||||
use vm_types::natural_t;
|
||||
|
||||
pub type memory_object_offset_t = ::libc::c_ulonglong;
|
||||
pub type memory_object_size_t = ::libc::c_ulonglong;
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
//! This module corresponds to `mach/message.h`.
|
||||
|
||||
use std::os::raw::{c_uint, c_void};
|
||||
|
||||
use kern_return::{kern_return_t};
|
||||
use kern_return::kern_return_t;
|
||||
use port::{mach_port_name_t, mach_port_t};
|
||||
use vm_types::{integer_t, natural_t};
|
||||
|
||||
pub type mach_msg_timeout_t = natural_t;
|
||||
|
||||
pub type mach_msg_bits_t = c_uint;
|
||||
pub type mach_msg_bits_t = ::libc::c_uint;
|
||||
pub type mach_msg_id_t = integer_t;
|
||||
pub type mach_msg_size_t = natural_t;
|
||||
|
||||
pub type mach_msg_copy_options_t = c_uint;
|
||||
pub type mach_msg_descriptor_type_t = c_uint;
|
||||
pub type mach_msg_type_name_t = c_uint;
|
||||
pub type mach_msg_copy_options_t = ::libc::c_uint;
|
||||
pub type mach_msg_descriptor_type_t = ::libc::c_uint;
|
||||
pub type mach_msg_type_name_t = ::libc::c_uint;
|
||||
|
||||
pub type mach_msg_trailer_type_t = c_uint;
|
||||
pub type mach_msg_trailer_size_t = c_uint;
|
||||
pub type mach_msg_trailer_type_t = ::libc::c_uint;
|
||||
pub type mach_msg_trailer_size_t = ::libc::c_uint;
|
||||
|
||||
pub type mach_msg_option_t = integer_t;
|
||||
|
||||
|
@ -28,18 +26,18 @@ pub type mach_msg_return_t = kern_return_t;
|
|||
|
||||
pub const MACH_MSG_TIMEOUT_NONE: mach_msg_timeout_t = 0;
|
||||
|
||||
pub const MACH_MSGH_BITS_ZERO: mach_msg_bits_t = 0x00000000;
|
||||
pub const MACH_MSGH_BITS_ZERO: mach_msg_bits_t = 0x0000_0000;
|
||||
|
||||
pub const MACH_MSGH_BITS_REMOTE_MASK: mach_msg_bits_t = 0x0000001f;
|
||||
pub const MACH_MSGH_BITS_LOCAL_MASK: mach_msg_bits_t = 0x00001f00;
|
||||
pub const MACH_MSGH_BITS_VOUCHER_MASK: mach_msg_bits_t = 0x001f0000;
|
||||
pub const MACH_MSGH_BITS_REMOTE_MASK: mach_msg_bits_t = 0x0000_001f;
|
||||
pub const MACH_MSGH_BITS_LOCAL_MASK: mach_msg_bits_t = 0x0000_1f00;
|
||||
pub const MACH_MSGH_BITS_VOUCHER_MASK: mach_msg_bits_t = 0x001f_0000;
|
||||
|
||||
pub const MACH_MSGH_BITS_PORTS_MASK: mach_msg_bits_t =
|
||||
MACH_MSGH_BITS_REMOTE_MASK | MACH_MSGH_BITS_LOCAL_MASK | MACH_MSGH_BITS_VOUCHER_MASK;
|
||||
|
||||
pub const MACH_MSGH_BITS_COMPLEX: mach_msg_bits_t = 0x80000000;
|
||||
pub const MACH_MSGH_BITS_COMPLEX: mach_msg_bits_t = 0x8000_0000;
|
||||
|
||||
pub const MACH_MSGH_BITS_USER: mach_msg_bits_t = 0x801f1f1f;
|
||||
pub const MACH_MSGH_BITS_USER: mach_msg_bits_t = 0x801f_1f1f;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn MACH_MSGH_BITS(remote: mach_msg_bits_t, local: mach_msg_bits_t) -> mach_msg_bits_t {
|
||||
|
@ -66,74 +64,74 @@ pub const MACH_MSG_OOL_DESCRIPTOR: mach_msg_descriptor_type_t = 1;
|
|||
pub const MACH_MSG_OOL_PORTS_DESCRIPTOR: mach_msg_descriptor_type_t = 2;
|
||||
pub const MACH_MSG_OOL_VOLATILE_DESCRIPTOR: mach_msg_descriptor_type_t = 3;
|
||||
|
||||
pub const MACH_MSG_OPTION_NONE: mach_msg_option_t = 0x00000000;
|
||||
pub const MACH_MSG_OPTION_NONE: mach_msg_option_t = 0x0000_0000;
|
||||
|
||||
pub const MACH_SEND_MSG: mach_msg_option_t = 0x00000001;
|
||||
pub const MACH_RCV_MSG: mach_msg_option_t = 0x00000002;
|
||||
pub const MACH_SEND_MSG: mach_msg_option_t = 0x0000_0001;
|
||||
pub const MACH_RCV_MSG: mach_msg_option_t = 0x0000_0002;
|
||||
|
||||
pub const MACH_RCV_LARGE: mach_msg_option_t = 0x00000004;
|
||||
pub const MACH_RCV_LARGE_IDENTITY: mach_msg_option_t = 0x00000008;
|
||||
pub const MACH_RCV_LARGE: mach_msg_option_t = 0x0000_0004;
|
||||
pub const MACH_RCV_LARGE_IDENTITY: mach_msg_option_t = 0x0000_0008;
|
||||
|
||||
pub const MACH_SEND_TIMEOUT: mach_msg_option_t = 0x00000010;
|
||||
pub const MACH_SEND_INTERRUPT: mach_msg_option_t = 0x00000040;
|
||||
pub const MACH_SEND_NOTIFY: mach_msg_option_t = 0x00000080;
|
||||
pub const MACH_SEND_ALWAYS: mach_msg_option_t = 0x00010000;
|
||||
pub const MACH_SEND_TRAILER: mach_msg_option_t = 0x00020000;
|
||||
pub const MACH_SEND_NOIMPORTANCE: mach_msg_option_t = 0x00040000;
|
||||
pub const MACH_SEND_TIMEOUT: mach_msg_option_t = 0x0000_0010;
|
||||
pub const MACH_SEND_INTERRUPT: mach_msg_option_t = 0x0000_0040;
|
||||
pub const MACH_SEND_NOTIFY: mach_msg_option_t = 0x0000_0080;
|
||||
pub const MACH_SEND_ALWAYS: mach_msg_option_t = 0x0001_0000;
|
||||
pub const MACH_SEND_TRAILER: mach_msg_option_t = 0x0002_0000;
|
||||
pub const MACH_SEND_NOIMPORTANCE: mach_msg_option_t = 0x0004_0000;
|
||||
pub const MACH_SEND_NODENAP: mach_msg_option_t = MACH_SEND_NOIMPORTANCE;
|
||||
pub const MACH_SEND_IMPORTANCE: mach_msg_option_t = 0x00080000;
|
||||
pub const MACH_SEND_IMPORTANCE: mach_msg_option_t = 0x0008_0000;
|
||||
|
||||
pub const MACH_RCV_TIMEOUT: mach_msg_option_t = 0x00000100;
|
||||
pub const MACH_RCV_NOTIFY: mach_msg_option_t = 0x00000200;
|
||||
pub const MACH_RCV_INTERRUPT: mach_msg_option_t = 0x00000400;
|
||||
pub const MACH_RCV_VOUCHER: mach_msg_option_t = 0x00000800;
|
||||
pub const MACH_RCV_OVERWRITE: mach_msg_option_t = 0x00001000;
|
||||
pub const MACH_RCV_TIMEOUT: mach_msg_option_t = 0x0000_0100;
|
||||
pub const MACH_RCV_NOTIFY: mach_msg_option_t = 0x0000_0200;
|
||||
pub const MACH_RCV_INTERRUPT: mach_msg_option_t = 0x0000_0400;
|
||||
pub const MACH_RCV_VOUCHER: mach_msg_option_t = 0x0000_0800;
|
||||
pub const MACH_RCV_OVERWRITE: mach_msg_option_t = 0x0000_1000;
|
||||
|
||||
pub const MACH_MSG_SUCCESS: mach_msg_return_t = 0x00000000;
|
||||
pub const MACH_MSG_SUCCESS: mach_msg_return_t = 0x0000_0000;
|
||||
|
||||
pub const MACH_MSG_MASK: mach_msg_return_t = 0x00003e00;
|
||||
pub const MACH_MSG_IPC_SPACE: mach_msg_return_t = 0x00002000;
|
||||
pub const MACH_MSG_VM_SPACE: mach_msg_return_t = 0x00001000;
|
||||
pub const MACH_MSG_IPC_KERNEL: mach_msg_return_t = 0x00000800;
|
||||
pub const MACH_MSG_VM_KERNEL: mach_msg_return_t = 0x00000400;
|
||||
pub const MACH_MSG_MASK: mach_msg_return_t = 0x0000_3e00;
|
||||
pub const MACH_MSG_IPC_SPACE: mach_msg_return_t = 0x0000_2000;
|
||||
pub const MACH_MSG_VM_SPACE: mach_msg_return_t = 0x0000_1000;
|
||||
pub const MACH_MSG_IPC_KERNEL: mach_msg_return_t = 0x0000_0800;
|
||||
pub const MACH_MSG_VM_KERNEL: mach_msg_return_t = 0x0000_0400;
|
||||
|
||||
pub const MACH_SEND_IN_PROGRESS: mach_msg_return_t = 0x10000001;
|
||||
pub const MACH_SEND_INVALID_DATA: mach_msg_return_t = 0x10000002;
|
||||
pub const MACH_SEND_INVALID_DEST: mach_msg_return_t = 0x10000003;
|
||||
pub const MACH_SEND_TIMED_OUT: mach_msg_return_t = 0x10000004;
|
||||
pub const MACH_SEND_INVALID_VOUCHER: mach_msg_return_t = 0x10000005;
|
||||
pub const MACH_SEND_INTERRUPTED: mach_msg_return_t = 0x10000007;
|
||||
pub const MACH_SEND_MSG_TOO_SMALL: mach_msg_return_t = 0x10000008;
|
||||
pub const MACH_SEND_INVALID_REPLY: mach_msg_return_t = 0x10000009;
|
||||
pub const MACH_SEND_INVALID_RIGHT: mach_msg_return_t = 0x1000000a;
|
||||
pub const MACH_SEND_INVALID_NOTIFY: mach_msg_return_t = 0x1000000b;
|
||||
pub const MACH_SEND_INVALID_MEMORY: mach_msg_return_t = 0x1000000c;
|
||||
pub const MACH_SEND_NO_BUFFER: mach_msg_return_t = 0x1000000d;
|
||||
pub const MACH_SEND_TOO_LARGE: mach_msg_return_t = 0x1000000e;
|
||||
pub const MACH_SEND_INVALID_TYPE: mach_msg_return_t = 0x1000000f;
|
||||
pub const MACH_SEND_INVALID_HEADER: mach_msg_return_t = 0x10000010;
|
||||
pub const MACH_SEND_INVALID_TRAILER: mach_msg_return_t = 0x10000011;
|
||||
pub const MACH_SEND_INVALID_RT_OOL_SIZE: mach_msg_return_t = 0x10000015;
|
||||
pub const MACH_SEND_IN_PROGRESS: mach_msg_return_t = 0x1000_0001;
|
||||
pub const MACH_SEND_INVALID_DATA: mach_msg_return_t = 0x1000_0002;
|
||||
pub const MACH_SEND_INVALID_DEST: mach_msg_return_t = 0x1000_0003;
|
||||
pub const MACH_SEND_TIMED_OUT: mach_msg_return_t = 0x1000_0004;
|
||||
pub const MACH_SEND_INVALID_VOUCHER: mach_msg_return_t = 0x1000_0005;
|
||||
pub const MACH_SEND_INTERRUPTED: mach_msg_return_t = 0x1000_0007;
|
||||
pub const MACH_SEND_MSG_TOO_SMALL: mach_msg_return_t = 0x1000_0008;
|
||||
pub const MACH_SEND_INVALID_REPLY: mach_msg_return_t = 0x1000_0009;
|
||||
pub const MACH_SEND_INVALID_RIGHT: mach_msg_return_t = 0x1000_000a;
|
||||
pub const MACH_SEND_INVALID_NOTIFY: mach_msg_return_t = 0x1000_000b;
|
||||
pub const MACH_SEND_INVALID_MEMORY: mach_msg_return_t = 0x1000_000c;
|
||||
pub const MACH_SEND_NO_BUFFER: mach_msg_return_t = 0x1000_000d;
|
||||
pub const MACH_SEND_TOO_LARGE: mach_msg_return_t = 0x1000_000e;
|
||||
pub const MACH_SEND_INVALID_TYPE: mach_msg_return_t = 0x1000_000f;
|
||||
pub const MACH_SEND_INVALID_HEADER: mach_msg_return_t = 0x1000_0010;
|
||||
pub const MACH_SEND_INVALID_TRAILER: mach_msg_return_t = 0x1000_0011;
|
||||
pub const MACH_SEND_INVALID_RT_OOL_SIZE: mach_msg_return_t = 0x1000_0015;
|
||||
|
||||
pub const MACH_RCV_IN_PROGRESS: mach_msg_return_t = 0x10004001;
|
||||
pub const MACH_RCV_INVALID_NAME: mach_msg_return_t = 0x10004002;
|
||||
pub const MACH_RCV_TIMED_OUT: mach_msg_return_t = 0x10004003;
|
||||
pub const MACH_RCV_TOO_LARGE: mach_msg_return_t = 0x10004004;
|
||||
pub const MACH_RCV_INTERRUPTED: mach_msg_return_t = 0x10004005;
|
||||
pub const MACH_RCV_PORT_CHANGED: mach_msg_return_t = 0x10004006;
|
||||
pub const MACH_RCV_INVALID_NOTIFY: mach_msg_return_t = 0x10004007;
|
||||
pub const MACH_RCV_INVALID_DATA: mach_msg_return_t = 0x10004008;
|
||||
pub const MACH_RCV_PORT_DIED: mach_msg_return_t = 0x10004009;
|
||||
pub const MACH_RCV_IN_SET: mach_msg_return_t = 0x1000400a;
|
||||
pub const MACH_RCV_HEADER_ERROR: mach_msg_return_t = 0x1000400b;
|
||||
pub const MACH_RCV_BODY_ERROR: mach_msg_return_t = 0x1000400c;
|
||||
pub const MACH_RCV_INVALID_TYPE: mach_msg_return_t = 0x1000400d;
|
||||
pub const MACH_RCV_SCATTER_SMALL: mach_msg_return_t = 0x1000400e;
|
||||
pub const MACH_RCV_INVALID_TRAILER: mach_msg_return_t = 0x1000400f;
|
||||
pub const MACH_RCV_IN_PROGRESS_TIMED: mach_msg_return_t = 0x10004011;
|
||||
pub const MACH_RCV_IN_PROGRESS: mach_msg_return_t = 0x1000_4001;
|
||||
pub const MACH_RCV_INVALID_NAME: mach_msg_return_t = 0x1000_4002;
|
||||
pub const MACH_RCV_TIMED_OUT: mach_msg_return_t = 0x1000_4003;
|
||||
pub const MACH_RCV_TOO_LARGE: mach_msg_return_t = 0x1000_4004;
|
||||
pub const MACH_RCV_INTERRUPTED: mach_msg_return_t = 0x1000_4005;
|
||||
pub const MACH_RCV_PORT_CHANGED: mach_msg_return_t = 0x1000_4006;
|
||||
pub const MACH_RCV_INVALID_NOTIFY: mach_msg_return_t = 0x1000_4007;
|
||||
pub const MACH_RCV_INVALID_DATA: mach_msg_return_t = 0x1000_4008;
|
||||
pub const MACH_RCV_PORT_DIED: mach_msg_return_t = 0x1000_4009;
|
||||
pub const MACH_RCV_IN_SET: mach_msg_return_t = 0x1000_400a;
|
||||
pub const MACH_RCV_HEADER_ERROR: mach_msg_return_t = 0x1000_400b;
|
||||
pub const MACH_RCV_BODY_ERROR: mach_msg_return_t = 0x1000_400c;
|
||||
pub const MACH_RCV_INVALID_TYPE: mach_msg_return_t = 0x1000_400d;
|
||||
pub const MACH_RCV_SCATTER_SMALL: mach_msg_return_t = 0x1000_400e;
|
||||
pub const MACH_RCV_INVALID_TRAILER: mach_msg_return_t = 0x1000_400f;
|
||||
pub const MACH_RCV_IN_PROGRESS_TIMED: mach_msg_return_t = 0x1000_4011;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_header_t {
|
||||
pub msgh_bits: mach_msg_bits_t,
|
||||
pub msgh_size: mach_msg_size_t,
|
||||
|
@ -144,13 +142,13 @@ pub struct mach_msg_header_t {
|
|||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_body_t {
|
||||
pub msgh_descriptor_count: mach_msg_size_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_base_t {
|
||||
pub header: mach_msg_header_t,
|
||||
pub body: mach_msg_body_t,
|
||||
|
@ -159,14 +157,14 @@ pub struct mach_msg_base_t {
|
|||
pub const MACH_MSG_TRAILER_FORMAT_0: mach_msg_trailer_type_t = 0;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_trailer_t {
|
||||
pub msgh_trailer_type: mach_msg_trailer_type_t,
|
||||
pub msgh_trailer_size: mach_msg_trailer_size_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_port_descriptor_t {
|
||||
pub name: mach_port_t,
|
||||
pub pad1: mach_msg_size_t,
|
||||
|
@ -177,8 +175,8 @@ pub struct mach_msg_port_descriptor_t {
|
|||
|
||||
impl mach_msg_port_descriptor_t {
|
||||
pub fn new(name: mach_port_t, disposition: mach_msg_type_name_t) -> Self {
|
||||
mach_msg_port_descriptor_t {
|
||||
name: name,
|
||||
Self {
|
||||
name,
|
||||
pad1: 0,
|
||||
pad2: 0,
|
||||
disposition: disposition as u8,
|
||||
|
@ -188,9 +186,9 @@ impl mach_msg_port_descriptor_t {
|
|||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_ool_descriptor_t {
|
||||
pub address: *mut c_void,
|
||||
pub address: *mut ::libc::c_void,
|
||||
#[cfg(not(target_pointer_width = "64"))]
|
||||
pub size: mach_msg_size_t,
|
||||
pub deallocate: u8, // boolean_t bitfield
|
||||
|
@ -202,26 +200,27 @@ pub struct mach_msg_ool_descriptor_t {
|
|||
}
|
||||
|
||||
impl mach_msg_ool_descriptor_t {
|
||||
pub fn new(address: *mut c_void,
|
||||
pub fn new(
|
||||
address: *mut ::libc::c_void,
|
||||
deallocate: bool,
|
||||
copy: mach_msg_copy_options_t,
|
||||
size: u32)
|
||||
-> Self {
|
||||
mach_msg_ool_descriptor_t {
|
||||
address: address,
|
||||
size: u32,
|
||||
) -> Self {
|
||||
Self {
|
||||
address,
|
||||
deallocate: if deallocate { 1 } else { 0 },
|
||||
copy: copy as u8,
|
||||
pad1: 0,
|
||||
type_: MACH_MSG_OOL_DESCRIPTOR as u8,
|
||||
size: size,
|
||||
size,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_msg_ool_ports_descriptor_t {
|
||||
pub address: *mut c_void,
|
||||
pub address: *mut ::libc::c_void,
|
||||
#[cfg(not(target_pointer_width = "64"))]
|
||||
pub count: mach_msg_size_t,
|
||||
pub deallocate: u8, // boolean_t bitfield
|
||||
|
@ -233,14 +232,15 @@ pub struct mach_msg_ool_ports_descriptor_t {
|
|||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn mach_msg(msg: *mut mach_msg_header_t,
|
||||
pub fn mach_msg(
|
||||
msg: *mut mach_msg_header_t,
|
||||
option: mach_msg_option_t,
|
||||
send_size: mach_msg_size_t,
|
||||
recv_size: mach_msg_size_t,
|
||||
recv_name: mach_port_name_t,
|
||||
timeout: mach_msg_timeout_t,
|
||||
notify: mach_port_name_t)
|
||||
-> mach_msg_return_t;
|
||||
notify: mach_port_name_t,
|
||||
) -> mach_msg_return_t;
|
||||
|
||||
// from mach/mach.h
|
||||
pub fn mach_msg_send(msg: *mut mach_msg_header_t) -> mach_msg_return_t;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
//! This module corresponds to `mach/port.h`
|
||||
|
||||
use vm_types::{natural_t};
|
||||
use vm_types::natural_t;
|
||||
|
||||
pub type mach_port_name_t = natural_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct ipc_port;
|
||||
|
||||
pub type ipc_port_t = *mut ipc_port;
|
||||
|
@ -12,6 +13,7 @@ pub type ipc_port_t = *mut ipc_port;
|
|||
pub type mach_port_t = ::libc::c_uint;
|
||||
|
||||
pub const MACH_PORT_NULL: mach_port_t = 0;
|
||||
pub const MACH_PORT_DEAD: mach_port_t = !0;
|
||||
|
||||
pub type mach_port_right_t = natural_t;
|
||||
|
||||
|
|
|
@ -1,39 +1,37 @@
|
|||
//! This module corresponds to `mach/_structs.h`.
|
||||
|
||||
use std::mem;
|
||||
|
||||
use message::{mach_msg_type_number_t};
|
||||
use mem;
|
||||
use message::mach_msg_type_number_t;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone)]
|
||||
#[derive(Debug)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct x86_thread_state64_t {
|
||||
__rax: u64,
|
||||
__rbx: u64,
|
||||
__rcx: u64,
|
||||
__rdx: u64,
|
||||
__rdi: u64,
|
||||
__rsi: u64,
|
||||
__rbp: u64,
|
||||
__rsp: u64,
|
||||
__r8: u64,
|
||||
__r9: u64,
|
||||
__r10: u64,
|
||||
__r11: u64,
|
||||
__r12: u64,
|
||||
__r13: u64,
|
||||
__r14: u64,
|
||||
__r15: u64,
|
||||
__rip: u64,
|
||||
__rflags: u64,
|
||||
__cs: u64,
|
||||
__fs: u64,
|
||||
__gs: u64,
|
||||
pub __rax: u64,
|
||||
pub __rbx: u64,
|
||||
pub __rcx: u64,
|
||||
pub __rdx: u64,
|
||||
pub __rdi: u64,
|
||||
pub __rsi: u64,
|
||||
pub __rbp: u64,
|
||||
pub __rsp: u64,
|
||||
pub __r8: u64,
|
||||
pub __r9: u64,
|
||||
pub __r10: u64,
|
||||
pub __r11: u64,
|
||||
pub __r12: u64,
|
||||
pub __r13: u64,
|
||||
pub __r14: u64,
|
||||
pub __r15: u64,
|
||||
pub __rip: u64,
|
||||
pub __rflags: u64,
|
||||
pub __cs: u64,
|
||||
pub __fs: u64,
|
||||
pub __gs: u64,
|
||||
}
|
||||
|
||||
impl x86_thread_state64_t {
|
||||
pub fn new() -> x86_thread_state64_t {
|
||||
x86_thread_state64_t {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
__rax: 0,
|
||||
__rbx: 0,
|
||||
__rcx: 0,
|
||||
|
@ -59,7 +57,6 @@ impl x86_thread_state64_t {
|
|||
}
|
||||
|
||||
pub fn count() -> mach_msg_type_number_t {
|
||||
(mem::size_of::<x86_thread_state64_t>() / mem::size_of::<::libc::c_int>())
|
||||
as mach_msg_type_number_t
|
||||
(mem::size_of::<Self>() / mem::size_of::<::libc::c_int>()) as mach_msg_type_number_t
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
//! This module corresponds to `mach/task.defs`.
|
||||
|
||||
use kern_return::{kern_return_t};
|
||||
use mach_types::task_name_t;
|
||||
use message::{mach_msg_type_number_t};
|
||||
use port::{mach_port_t};
|
||||
use kern_return::kern_return_t;
|
||||
use mach_types::{task_name_t, task_t, thread_act_array_t};
|
||||
use message::mach_msg_type_number_t;
|
||||
use port::mach_port_t;
|
||||
use task_info::{task_flavor_t, task_info_t};
|
||||
use types::{task_t, thread_act_array_t};
|
||||
|
||||
pub type task_special_port_t = ::std::os::raw::c_int;
|
||||
pub type task_special_port_t = ::libc::c_int;
|
||||
|
||||
pub const TASK_KERNEL_PORT: task_special_port_t = 1;
|
||||
pub const TASK_HOST_PORT: task_special_port_t = 2;
|
||||
|
@ -17,20 +16,26 @@ pub const TASK_BOOTSTRAP_PORT: task_special_port_t = 4;
|
|||
extern "C" {
|
||||
pub fn task_resume(target_task: task_t) -> kern_return_t;
|
||||
pub fn task_suspend(target_task: task_t) -> kern_return_t;
|
||||
pub fn task_get_special_port(task: task_t,
|
||||
pub fn task_get_special_port(
|
||||
task: task_t,
|
||||
which_port: task_special_port_t,
|
||||
special_port: *mut mach_port_t) -> kern_return_t;
|
||||
pub fn task_threads(target_task: task_t,
|
||||
special_port: *mut mach_port_t,
|
||||
) -> kern_return_t;
|
||||
pub fn task_threads(
|
||||
target_task: task_t,
|
||||
act_list: *mut thread_act_array_t,
|
||||
act_list_cnt: *mut mach_msg_type_number_t) -> kern_return_t;
|
||||
act_list_cnt: *mut mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
pub fn task_info(
|
||||
target_task: task_name_t,
|
||||
flavor: task_flavor_t,
|
||||
task_info_out: task_info_t,
|
||||
task_info_outCnt: *mut mach_msg_type_number_t) -> kern_return_t;
|
||||
task_info_outCnt: *mut mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
pub fn task_set_info(
|
||||
target_task: task_t,
|
||||
flavor: task_flavor_t,
|
||||
task_info_in: task_info_t,
|
||||
task_info_inCnt: mach_msg_type_number_t) -> kern_return_t;
|
||||
task_info_inCnt: mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
}
|
||||
|
|
|
@ -1,39 +1,44 @@
|
|||
//! This module roughly corresponds to `mach/task_info.h`.
|
||||
|
||||
use vm_types::{integer_t, natural_t, mach_vm_address_t, mach_vm_size_t};
|
||||
pub const TASK_INFO_MAX: ::std::os::raw::c_uint = 1024;
|
||||
pub const TASK_BASIC_INFO_32: ::std::os::raw::c_uint = 4;
|
||||
pub const TASK_BASIC2_INFO_32: ::std::os::raw::c_uint = 6;
|
||||
pub const TASK_BASIC_INFO_64: ::std::os::raw::c_uint = 5;
|
||||
pub const TASK_BASIC_INFO: ::std::os::raw::c_uint = 5;
|
||||
pub const TASK_EVENTS_INFO: ::std::os::raw::c_uint = 2;
|
||||
pub const TASK_THREAD_TIMES_INFO: ::std::os::raw::c_uint = 3;
|
||||
pub const TASK_ABSOLUTETIME_INFO: ::std::os::raw::c_uint = 1;
|
||||
pub const TASK_KERNELMEMORY_INFO: ::std::os::raw::c_uint = 7;
|
||||
pub const TASK_SECURITY_TOKEN: ::std::os::raw::c_uint = 13;
|
||||
pub const TASK_AUDIT_TOKEN: ::std::os::raw::c_uint = 15;
|
||||
pub const TASK_AFFINITY_TAG_INFO: ::std::os::raw::c_uint = 16;
|
||||
pub const TASK_DYLD_INFO: ::std::os::raw::c_uint = 17;
|
||||
pub const TASK_DYLD_ALL_IMAGE_INFO_32: ::std::os::raw::c_uint = 0;
|
||||
pub const TASK_DYLD_ALL_IMAGE_INFO_64: ::std::os::raw::c_uint = 1;
|
||||
pub const TASK_EXTMOD_INFO: ::std::os::raw::c_uint = 19;
|
||||
pub const MACH_TASK_BASIC_INFO: ::std::os::raw::c_uint = 20;
|
||||
pub const TASK_POWER_INFO: ::std::os::raw::c_uint = 21;
|
||||
pub const TASK_VM_INFO: ::std::os::raw::c_uint = 22;
|
||||
pub const TASK_VM_INFO_PURGEABLE: ::std::os::raw::c_uint = 23;
|
||||
pub const TASK_TRACE_MEMORY_INFO: ::std::os::raw::c_uint = 24;
|
||||
pub const TASK_WAIT_STATE_INFO: ::std::os::raw::c_uint = 25;
|
||||
pub const TASK_POWER_INFO_V2: ::std::os::raw::c_uint = 26;
|
||||
pub const TASK_VM_INFO_PURGEABLE_ACCOUNT: ::std::os::raw::c_uint = 27;
|
||||
pub const TASK_FLAGS_INFO: ::std::os::raw::c_uint = 28;
|
||||
pub const TASK_DEBUG_INFO_INTERNAL: ::std::os::raw::c_uint = 29;
|
||||
use vm_types::{integer_t, mach_vm_address_t, mach_vm_size_t, natural_t};
|
||||
|
||||
pub const TASK_INFO_MAX: ::libc::c_uint = 1024;
|
||||
pub const TASK_BASIC_INFO_32: ::libc::c_uint = 4;
|
||||
pub const TASK_BASIC2_INFO_32: ::libc::c_uint = 6;
|
||||
pub const TASK_BASIC_INFO_64: ::libc::c_uint = 5;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub const TASK_BASIC_INFO: ::libc::c_uint = 5;
|
||||
#[cfg(target_arch = "x86")]
|
||||
pub const TASK_BASIC_INFO: ::libc::c_uint = 4;
|
||||
pub const TASK_EVENTS_INFO: ::libc::c_uint = 2;
|
||||
pub const TASK_THREAD_TIMES_INFO: ::libc::c_uint = 3;
|
||||
pub const TASK_ABSOLUTETIME_INFO: ::libc::c_uint = 1;
|
||||
pub const TASK_KERNELMEMORY_INFO: ::libc::c_uint = 7;
|
||||
pub const TASK_SECURITY_TOKEN: ::libc::c_uint = 13;
|
||||
pub const TASK_AUDIT_TOKEN: ::libc::c_uint = 15;
|
||||
pub const TASK_AFFINITY_TAG_INFO: ::libc::c_uint = 16;
|
||||
pub const TASK_DYLD_INFO: ::libc::c_uint = 17;
|
||||
pub const TASK_DYLD_ALL_IMAGE_INFO_32: ::libc::c_uint = 0;
|
||||
pub const TASK_DYLD_ALL_IMAGE_INFO_64: ::libc::c_uint = 1;
|
||||
pub const TASK_EXTMOD_INFO: ::libc::c_uint = 19;
|
||||
pub const MACH_TASK_BASIC_INFO: ::libc::c_uint = 20;
|
||||
pub const TASK_POWER_INFO: ::libc::c_uint = 21;
|
||||
pub const TASK_VM_INFO: ::libc::c_uint = 22;
|
||||
pub const TASK_VM_INFO_PURGEABLE: ::libc::c_uint = 23;
|
||||
pub const TASK_TRACE_MEMORY_INFO: ::libc::c_uint = 24;
|
||||
pub const TASK_WAIT_STATE_INFO: ::libc::c_uint = 25;
|
||||
pub const TASK_POWER_INFO_V2: ::libc::c_uint = 26;
|
||||
pub const TASK_VM_INFO_PURGEABLE_ACCOUNT: ::libc::c_uint = 27;
|
||||
pub const TASK_FLAGS_INFO: ::libc::c_uint = 28;
|
||||
pub const TASK_DEBUG_INFO_INTERNAL: ::libc::c_uint = 29;
|
||||
|
||||
pub type task_flavor_t = natural_t;
|
||||
pub type task_info_t = *mut integer_t;
|
||||
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct task_dyld_info {
|
||||
all_image_info_addr: mach_vm_address_t,
|
||||
all_image_info_size: mach_vm_size_t,
|
||||
all_image_info_format: integer_t,
|
||||
pub all_image_info_addr: mach_vm_address_t,
|
||||
pub all_image_info_size: mach_vm_size_t,
|
||||
pub all_image_info_format: integer_t,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,23 @@
|
|||
//! This module corresponds to `mach/thread_act.defs`.
|
||||
|
||||
use kern_return::{kern_return_t};
|
||||
use message::{mach_msg_type_number_t};
|
||||
use thread_status::{thread_state_t, thread_state_flavor_t};
|
||||
use types::{thread_act_t};
|
||||
use kern_return::kern_return_t;
|
||||
use mach_types::thread_act_t;
|
||||
use message::mach_msg_type_number_t;
|
||||
use thread_status::{thread_state_flavor_t, thread_state_t};
|
||||
|
||||
extern "C" {
|
||||
pub fn thread_get_state(target_act: thread_act_t,
|
||||
pub fn thread_get_state(
|
||||
target_act: thread_act_t,
|
||||
flavor: thread_state_flavor_t,
|
||||
new_state: thread_state_t,
|
||||
new_state_count: *mut mach_msg_type_number_t)
|
||||
-> kern_return_t;
|
||||
new_state_count: *mut mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn thread_suspend(target_act: thread_act_t) -> kern_return_t;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn thread_resume(target_act: thread_act_t) -> kern_return_t;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
//! This module corresponds to `mach/thread_status.h`.
|
||||
|
||||
use vm_types::{natural_t};
|
||||
use vm_types::natural_t;
|
||||
|
||||
pub type thread_state_t = *mut natural_t;
|
||||
pub type thread_state_flavor_t = ::libc::c_int;
|
||||
|
|
|
@ -1,19 +1,35 @@
|
|||
//! This module corresponds to `mach/mach_traps.h`.
|
||||
|
||||
use kern_return::{kern_return_t};
|
||||
use kern_return::kern_return_t;
|
||||
use port::{mach_port_name_t, mach_port_t};
|
||||
|
||||
extern "C" {
|
||||
pub fn mach_task_self() -> mach_port_t;
|
||||
pub fn task_for_pid(target_tport: mach_port_name_t,
|
||||
static mach_task_self_: mach_port_t;
|
||||
pub fn task_for_pid(
|
||||
target_tport: mach_port_name_t,
|
||||
pid: ::libc::c_int,
|
||||
tn: *mut mach_port_name_t) -> kern_return_t;
|
||||
tn: *mut mach_port_name_t,
|
||||
) -> kern_return_t;
|
||||
}
|
||||
|
||||
pub unsafe fn mach_task_self() -> mach_port_t {
|
||||
mach_task_self_
|
||||
}
|
||||
|
||||
pub unsafe fn current_task() -> mach_port_t {
|
||||
mach_task_self()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use port::*;
|
||||
use traps::*;
|
||||
|
||||
#[test]
|
||||
fn mach_task_self_sanity_test() {
|
||||
fn mach_task_self_sanity() {
|
||||
unsafe {
|
||||
let this_task = mach_task_self();
|
||||
println!("{:?}", this_task);
|
||||
assert!(this_task != MACH_PORT_NULL);
|
||||
assert!(this_task != MACH_PORT_DEAD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
//! This module corresponds to `mach/mach_types.h`
|
||||
|
||||
use port::{mach_port_t};
|
||||
|
||||
pub type task_t = mach_port_t;
|
||||
pub type task_name_t = mach_port_t;
|
||||
pub type task_suspension_token_t = mach_port_t;
|
||||
pub type thread_t = mach_port_t;
|
||||
pub type thread_act_t = mach_port_t;
|
||||
pub type ipc_space_t = mach_port_t;
|
||||
pub type coalition_t = mach_port_t;
|
||||
pub type host_t = mach_port_t;
|
||||
pub type host_priv_t = mach_port_t;
|
||||
pub type host_security_t = mach_port_t;
|
||||
pub type processor_t = mach_port_t;
|
||||
pub type processor_set_t = mach_port_t;
|
||||
pub type processor_set_control_t = mach_port_t;
|
||||
pub type semaphore_t = mach_port_t;
|
||||
pub type lock_set_t = mach_port_t;
|
||||
pub type ledger_t = mach_port_t;
|
||||
pub type alarm_t = mach_port_t;
|
||||
pub type clock_serv_t = mach_port_t;
|
||||
pub type clock_ctrl_t = mach_port_t;
|
||||
|
||||
pub type processor_set_name_t = processor_set_t;
|
||||
|
||||
pub type clock_reply_t = mach_port_t;
|
||||
pub type bootstrap_t = mach_port_t;
|
||||
pub type mem_entry_name_port_t = mach_port_t;
|
||||
pub type exception_handler_t = mach_port_t;
|
||||
pub type exception_handler_array_t = *mut exception_handler_t;
|
||||
pub type vm_task_entry_t = mach_port_t;
|
||||
pub type io_master_t = mach_port_t;
|
||||
pub type UNDServerRef = mach_port_t;
|
||||
|
||||
pub type task_array_t = *mut task_t;
|
||||
pub type thread_array_t = *mut thread_t;
|
||||
pub type processor_set_array_t = *mut processor_set_t;
|
||||
pub type processor_set_name_array_t = *mut processor_set_t;
|
||||
pub type processor_array_t = *mut processor_t;
|
||||
pub type thread_act_array_t = *mut thread_act_t;
|
||||
pub type ledger_array_t = *mut ledger_t;
|
||||
|
||||
pub type task_port_t = task_t;
|
||||
pub type task_port_array_t = task_array_t;
|
||||
pub type thread_port_t = thread_t;
|
||||
pub type thread_port_array_t = thread_array_t;
|
||||
pub type ipc_space_port_t = ipc_space_t;
|
||||
pub type host_name_t = host_t;
|
||||
pub type host_name_port_t = host_t;
|
||||
pub type processor_set_port_t = processor_set_t;
|
||||
pub type processor_set_name_port_t = processor_set_t;
|
||||
pub type processor_set_name_port_array_t = processor_set_array_t;
|
||||
pub type processor_set_control_port_t = processor_set_t;
|
||||
pub type processor_port_t = processor_t;
|
||||
pub type processor_port_array_t = processor_array_t;
|
||||
pub type thread_act_port_t = thread_act_t;
|
||||
pub type thread_act_port_array_t = thread_act_array_t;
|
||||
pub type semaphore_port_t = semaphore_t;
|
||||
pub type lock_set_port_t = lock_set_t;
|
||||
pub type ledger_port_t = ledger_t;
|
||||
pub type ledger_port_array_t = ledger_array_t;
|
||||
pub type alarm_port_t = alarm_t;
|
||||
pub type clock_serv_port_t = clock_serv_t;
|
||||
pub type clock_ctrl_port_t = clock_ctrl_t;
|
||||
pub type exception_port_t = exception_handler_t;
|
||||
pub type exception_port_arrary_t = exception_handler_array_t;
|
||||
|
||||
pub const TASK_NULL: task_t = 0;
|
||||
pub const TASK_NAME_NULL: task_name_t = 0;
|
||||
pub const THREAD_NULL: thread_t = 0;
|
||||
pub const TID_NULL: u64 = 0;
|
||||
pub const THR_ACT_NULL: thread_act_t = 0;
|
||||
pub const IPC_SPACE_NULL: ipc_space_t = 0;
|
||||
pub const COALITION_NULL: coalition_t = 0;
|
||||
pub const HOST_NULL: host_t = 0;
|
||||
pub const HOST_PRIV_NULL: host_priv_t = 0;
|
||||
pub const HOST_SECURITY_NULL: host_security_t = 0;
|
||||
pub const PROCESSOR_SET_NULL: processor_set_t = 0;
|
||||
pub const PROCESSOR_NULL: processor_t = 0;
|
||||
pub const SEMAPHORE_NULL: semaphore_t = 0;
|
||||
pub const LOCK_SET_NULL: lock_set_t = 0;
|
||||
pub const LEDGER_NULL: ledger_t = 0;
|
||||
pub const ALARM_NULL: alarm_t = 0;
|
||||
pub const CLOCK_NULL: ::libc::clock_t = 0;
|
||||
pub const UND_SERVER_NULL: UNDServerRef = 0;
|
|
@ -1,79 +1,109 @@
|
|||
//! This module roughly corresponds to `mach/mach_vm.defs`.
|
||||
|
||||
use boolean::{boolean_t};
|
||||
use kern_return::{kern_return_t};
|
||||
use boolean::boolean_t;
|
||||
use kern_return::kern_return_t;
|
||||
use mach_types::{mem_entry_name_port_t, vm_task_entry_t};
|
||||
use memory_object_types::{memory_object_offset_t, memory_object_size_t};
|
||||
use message::{mach_msg_type_number_t};
|
||||
use port::{mach_port_t};
|
||||
use types::{mem_entry_name_port_t, vm_task_entry_t};
|
||||
use message::mach_msg_type_number_t;
|
||||
use port::mach_port_t;
|
||||
use vm_attributes::{vm_machine_attribute_t, vm_machine_attribute_val_t};
|
||||
use vm_behavior::{vm_behavior_t};
|
||||
use vm_inherit::{vm_inherit_t};
|
||||
use vm_prot::{vm_prot_t};
|
||||
use vm_purgable::{vm_purgable_t};
|
||||
use vm_region::*;
|
||||
use vm_sync::{vm_sync_t};
|
||||
use vm_types::*;
|
||||
use vm_behavior::vm_behavior_t;
|
||||
use vm_inherit::vm_inherit_t;
|
||||
use vm_prot::vm_prot_t;
|
||||
use vm_purgable::vm_purgable_t;
|
||||
use vm_region::mach_vm_read_entry_t;
|
||||
use vm_region::{
|
||||
vm_page_info_flavor_t, vm_page_info_t, vm_region_flavor_t, vm_region_info_t,
|
||||
vm_region_recurse_info_t,
|
||||
};
|
||||
use vm_sync::vm_sync_t;
|
||||
use vm_types::{
|
||||
integer_t, mach_vm_address_t, mach_vm_offset_t, mach_vm_size_t, natural_t, vm_map_t,
|
||||
vm_offset_t, vm_size_t,
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
pub fn mach_vm_allocate(target: vm_task_entry_t,
|
||||
pub fn mach_vm_allocate(
|
||||
target: vm_task_entry_t,
|
||||
address: *mut mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
flags: ::libc::c_int) -> kern_return_t;
|
||||
flags: ::libc::c_int,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_deallocate(target: vm_task_entry_t,
|
||||
pub fn mach_vm_deallocate(
|
||||
target: vm_task_entry_t,
|
||||
address: mach_vm_address_t,
|
||||
size: mach_vm_size_t) -> kern_return_t;
|
||||
size: mach_vm_size_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_protect(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_protect(
|
||||
target_task: vm_task_entry_t,
|
||||
address: mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
set_maximum: boolean_t,
|
||||
new_protection: vm_prot_t) -> kern_return_t;
|
||||
new_protection: vm_prot_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_inherit(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_inherit(
|
||||
target_task: vm_task_entry_t,
|
||||
address: mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
new_inheritance: vm_inherit_t) -> kern_return_t;
|
||||
new_inheritance: vm_inherit_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_read(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_read(
|
||||
target_task: vm_task_entry_t,
|
||||
address: mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
data: *mut vm_offset_t,
|
||||
dataCnt: *mut mach_msg_type_number_t) -> kern_return_t;
|
||||
dataCnt: *mut mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_read_list(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_read_list(
|
||||
target_task: vm_task_entry_t,
|
||||
data_list: mach_vm_read_entry_t,
|
||||
count: natural_t) -> kern_return_t;
|
||||
count: natural_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_write(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_write(
|
||||
target_task: vm_map_t,
|
||||
address: mach_vm_address_t,
|
||||
data: vm_offset_t,
|
||||
dataCnt: mach_msg_type_number_t);
|
||||
dataCnt: mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_copy(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_copy(
|
||||
target_task: vm_task_entry_t,
|
||||
source_address: mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
dest_address: mach_vm_address_t) -> kern_return_t;
|
||||
dest_address: mach_vm_address_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_read_overwrite(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_read_overwrite(
|
||||
target_task: vm_task_entry_t,
|
||||
address: mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
data: mach_vm_address_t,
|
||||
outsize: *mut mach_vm_size_t) -> kern_return_t;
|
||||
outsize: *mut mach_vm_size_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_msync(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_msync(
|
||||
target_task: vm_task_entry_t,
|
||||
address: mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
sync_flags: vm_sync_t) -> kern_return_t;
|
||||
sync_flags: vm_sync_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_behavior_set(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_behavior_set(
|
||||
target_task: vm_task_entry_t,
|
||||
address: mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
new_behavior: vm_behavior_t) -> kern_return_t;
|
||||
new_behavior: vm_behavior_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_map(target_task: vm_task_entry_t,
|
||||
inout: mach_vm_address_t,
|
||||
pub fn mach_vm_map(
|
||||
target_task: vm_task_entry_t,
|
||||
inout: *mut mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
mask: mach_vm_offset_t,
|
||||
flags: ::libc::c_int,
|
||||
|
@ -82,15 +112,19 @@ extern "C" {
|
|||
copy: boolean_t,
|
||||
cur_protection: vm_prot_t,
|
||||
max_protection: vm_prot_t,
|
||||
inheritance: vm_inherit_t) -> kern_return_t;
|
||||
inheritance: vm_inherit_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_machine_attribute(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_machine_attribute(
|
||||
target_task: vm_task_entry_t,
|
||||
address: mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
attribute: vm_machine_attribute_t,
|
||||
value: *mut vm_machine_attribute_val_t) -> kern_return_t;
|
||||
value: *mut vm_machine_attribute_val_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_remap(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_remap(
|
||||
target_task: vm_task_entry_t,
|
||||
target_address: *mut mach_vm_address_t,
|
||||
size: mach_vm_size_t,
|
||||
mask: mach_vm_offset_t,
|
||||
|
@ -100,92 +134,114 @@ extern "C" {
|
|||
copy: boolean_t,
|
||||
cur_protection: *mut vm_prot_t,
|
||||
out: *mut vm_prot_t,
|
||||
inheritance: vm_inherit_t) -> kern_return_t;
|
||||
inheritance: vm_inherit_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_page_query(target_map: vm_map_t,
|
||||
pub fn mach_vm_page_query(
|
||||
target_map: vm_map_t,
|
||||
offset: mach_vm_offset_t,
|
||||
disposition: *mut integer_t,
|
||||
ref_count: *mut integer_t) -> kern_return_t;
|
||||
ref_count: *mut integer_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_region_recurse(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_region_recurse(
|
||||
target_task: vm_task_entry_t,
|
||||
address: *mut mach_vm_address_t,
|
||||
size: *mut mach_vm_size_t,
|
||||
nesting_depth: *mut natural_t,
|
||||
info: vm_region_recurse_info_t,
|
||||
infoCnt: *mut mach_msg_type_number_t) -> kern_return_t;
|
||||
infoCnt: *mut mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_region(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_region(
|
||||
target_task: vm_task_entry_t,
|
||||
address: *mut mach_vm_address_t,
|
||||
size: *mut mach_vm_size_t,
|
||||
flavor: vm_region_flavor_t,
|
||||
info: vm_region_info_t,
|
||||
infoCnt: *mut mach_msg_type_number_t,
|
||||
object_name: *mut mach_port_t) -> kern_return_t;
|
||||
object_name: *mut mach_port_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_make_memory_entry(target_task: vm_task_entry_t,
|
||||
size: *mut memory_object_size_t,
|
||||
offset: memory_object_offset_t,
|
||||
pub fn mach_make_memory_entry(
|
||||
target_task: vm_map_t,
|
||||
size: *mut vm_size_t,
|
||||
offset: vm_offset_t,
|
||||
permission: vm_prot_t,
|
||||
object_handle: *mut mem_entry_name_port_t,
|
||||
parent_handle: mem_entry_name_port_t) -> kern_return_t;
|
||||
parent_handle: mem_entry_name_port_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_make_memory_entry_64(target_task: vm_map_t,
|
||||
pub fn mach_make_memory_entry_64(
|
||||
target_task: vm_map_t,
|
||||
size: *mut memory_object_size_t,
|
||||
offset: memory_object_offset_t,
|
||||
permission: vm_prot_t,
|
||||
object_handle: *mut mach_port_t,
|
||||
parent_entry: mem_entry_name_port_t) -> kern_return_t;
|
||||
parent_entry: mem_entry_name_port_t,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_purgable_control(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_purgable_control(
|
||||
target_task: vm_task_entry_t,
|
||||
address: mach_vm_address_t,
|
||||
control: vm_purgable_t,
|
||||
state: *mut ::libc::c_int) -> kern_return_t;
|
||||
state: *mut ::libc::c_int,
|
||||
) -> kern_return_t;
|
||||
|
||||
pub fn mach_vm_page_info(target_task: vm_task_entry_t,
|
||||
pub fn mach_vm_page_info(
|
||||
target_task: vm_task_entry_t,
|
||||
address: mach_vm_address_t,
|
||||
flavor: vm_page_info_flavor_t,
|
||||
info: vm_page_info_t,
|
||||
infoCnt: *mut mach_msg_type_number_t) -> kern_return_t;
|
||||
infoCnt: *mut mach_msg_type_number_t,
|
||||
) -> kern_return_t;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mach_vm_allocate_sanity_test() {
|
||||
use kern_return::*;
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use kern_return::KERN_SUCCESS;
|
||||
use traps::mach_task_self;
|
||||
use vm_statistics::VM_FLAGS_ANYWHERE;
|
||||
|
||||
#[test]
|
||||
fn mach_vm_allocate_sanity() {
|
||||
unsafe {
|
||||
let size = 0x100;
|
||||
let task = mach_task_self();
|
||||
|
||||
let mut address: mach_vm_address_t = 0;
|
||||
assert_eq!(mach_vm_allocate(task, &mut address, size, VM_FLAGS_ANYWHERE), KERN_SUCCESS);
|
||||
println!("0x{:x}", address);
|
||||
assert_eq!(
|
||||
mach_vm_allocate(task, &mut address, size, VM_FLAGS_ANYWHERE),
|
||||
KERN_SUCCESS
|
||||
);
|
||||
assert_eq!(mach_vm_deallocate(task, address, size), KERN_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mach_vm_region_sanity_test() {
|
||||
use kern_return::*;
|
||||
use traps::mach_task_self;
|
||||
use vm_prot::*;
|
||||
|
||||
fn mach_vm_region_sanity() {
|
||||
use mem;
|
||||
use vm_prot::{VM_PROT_EXECUTE, VM_PROT_READ};
|
||||
use vm_region::{vm_region_basic_info_64, VM_REGION_BASIC_INFO_64};
|
||||
unsafe {
|
||||
let mut size = 0x10;
|
||||
let mut object_name = 0;
|
||||
let mut address = mach_vm_region_sanity_test as mach_vm_address_t;
|
||||
let mut info: vm_region_basic_info_64 = ::std::mem::zeroed();
|
||||
let mut address = mach_vm_region_sanity as mach_vm_address_t;
|
||||
let mut info: vm_region_basic_info_64 = mem::zeroed();
|
||||
let mut info_size = vm_region_basic_info_64::count();
|
||||
|
||||
let result = mach_vm_region(mach_task_self(),
|
||||
let result = mach_vm_region(
|
||||
mach_task_self(),
|
||||
&mut address,
|
||||
&mut size,
|
||||
VM_REGION_BASIC_INFO_64,
|
||||
(&mut info as *mut _) as vm_region_info_t,
|
||||
&mut info_size,
|
||||
&mut object_name);
|
||||
&mut object_name,
|
||||
);
|
||||
assert_eq!(result, KERN_SUCCESS);
|
||||
assert_eq!(info.protection, VM_PROT_READ | VM_PROT_EXECUTE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
pub type vm_machine_attribute_t = ::libc::c_uint;
|
||||
|
||||
pub const MATTR_CACHE: vm_machine_attribute_t = (1 << 0);
|
||||
pub const MATTR_CACHE: vm_machine_attribute_t = 1;
|
||||
pub const MATTR_MIGRATE: vm_machine_attribute_t = (1 << 1);
|
||||
pub const MATTR_REPLICATE: vm_machine_attribute_t = (1 << 2);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! This module roughly corresponds to `mach/vm_page_size.h`
|
||||
|
||||
use vm_types::{vm_size_t, mach_vm_size_t, mach_vm_offset_t};
|
||||
use vm_types::{mach_vm_offset_t, mach_vm_size_t, vm_size_t};
|
||||
|
||||
extern "C" {
|
||||
pub static vm_page_size: vm_size_t;
|
||||
|
@ -16,12 +16,18 @@ pub unsafe fn mach_vm_round_page(x: mach_vm_offset_t) -> mach_vm_offset_t {
|
|||
((x + vm_page_mask as mach_vm_size_t) & !(vm_page_mask as mach_vm_size_t))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use vm_page_size::*;
|
||||
use vm_types::mach_vm_size_t;
|
||||
|
||||
#[test]
|
||||
fn page_size_test() {
|
||||
fn page_size() {
|
||||
unsafe {
|
||||
assert!(vm_page_size > 0);
|
||||
assert!(vm_page_size % 2 == 0);
|
||||
assert_eq!(mach_vm_round_page(1), vm_page_size as mach_vm_size_t);
|
||||
println!("{:?}", vm_page_size);
|
||||
assert_eq!(vm_page_size, 4096);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
pub type vm_prot_t = ::libc::c_int;
|
||||
|
||||
pub const VM_PROT_NONE: vm_prot_t = 0;
|
||||
pub const VM_PROT_READ: vm_prot_t = (1 << 0);
|
||||
pub const VM_PROT_READ: vm_prot_t = 1;
|
||||
pub const VM_PROT_WRITE: vm_prot_t = (1 << 1);
|
||||
pub const VM_PROT_EXECUTE: vm_prot_t = (1 << 2);
|
||||
pub const VM_PROT_NO_CHANGE: vm_prot_t = (1 << 3);
|
||||
|
|
|
@ -7,7 +7,7 @@ pub const VM_PURGABLE_GET_STATE: vm_purgable_t = 1;
|
|||
|
||||
pub const VM_VOLATILE_GROUP_SHIFT: ::libc::c_int = 8;
|
||||
pub const VM_VOLATILE_GROUP_MASK: ::libc::c_int = (7 << VM_VOLATILE_GROUP_SHIFT);
|
||||
pub const VM_VOLATILE_GROUP_DEFAULT: ::libc::c_int = VM_VOLATILE_GROUP_7;
|
||||
pub const VM_VOLATILE_GROUP_DEFAULT: ::libc::c_int = VM_VOLATILE_GROUP_0;
|
||||
|
||||
pub const VM_VOLATILE_GROUP_0: ::libc::c_int = (0 << VM_VOLATILE_GROUP_SHIFT);
|
||||
pub const VM_VOLATILE_GROUP_1: ::libc::c_int = (1 << VM_VOLATILE_GROUP_SHIFT);
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
//! This module roughly corresponds to `mach/vm_region.h`.
|
||||
|
||||
use std::mem;
|
||||
|
||||
use boolean::{boolean_t};
|
||||
use boolean::boolean_t;
|
||||
use mem;
|
||||
use memory_object_types::{memory_object_offset_t, vm_object_id_t};
|
||||
use message::{mach_msg_type_number_t};
|
||||
use vm_behavior::{vm_behavior_t};
|
||||
use vm_inherit::{vm_inherit_t};
|
||||
use vm_prot::{vm_prot_t};
|
||||
use message::mach_msg_type_number_t;
|
||||
use vm_behavior::vm_behavior_t;
|
||||
use vm_inherit::vm_inherit_t;
|
||||
use vm_prot::vm_prot_t;
|
||||
use vm_types::{mach_vm_address_t, mach_vm_size_t};
|
||||
|
||||
pub type vm32_object_id_t = ::libc::uint32_t;
|
||||
pub type vm32_object_id_t = u32;
|
||||
|
||||
pub type vm_region_info_t = *mut ::libc::c_int;
|
||||
pub type vm_region_info_64_t = *mut ::libc::c_int;
|
||||
|
@ -18,6 +17,7 @@ pub type vm_region_recurse_info_t = *mut ::libc::c_int;
|
|||
pub type vm_region_recurse_info_64_t = *mut ::libc::c_int;
|
||||
pub type vm_region_flavor_t = ::libc::c_int;
|
||||
pub type vm_region_info_data_t = [::libc::c_int; VM_REGION_INFO_MAX as usize];
|
||||
|
||||
pub type vm_region_basic_info_64_t = *mut vm_region_basic_info_64;
|
||||
pub type vm_region_basic_info_data_64_t = vm_region_basic_info_64;
|
||||
pub type vm_region_basic_info_t = *mut vm_region_basic_info;
|
||||
|
@ -45,7 +45,7 @@ pub const VM_PAGE_INFO_BASIC: vm_page_info_flavor_t = 1;
|
|||
|
||||
pub const VM_REGION_BASIC_INFO_64: vm_region_flavor_t = 9;
|
||||
pub const VM_REGION_BASIC_INFO: vm_region_flavor_t = 10;
|
||||
pub const VM_REGION_EXTENDED_INFO: vm_region_flavor_t = 11;
|
||||
pub const VM_REGION_EXTENDED_INFO: vm_region_flavor_t = 13;
|
||||
pub const VM_REGION_TOP_INFO: vm_region_flavor_t = 12;
|
||||
|
||||
pub const SM_COW: ::libc::c_uchar = 1;
|
||||
|
@ -56,8 +56,8 @@ pub const SM_TRUESHARED: ::libc::c_uchar = 5;
|
|||
pub const SM_PRIVATE_ALIASED: ::libc::c_uchar = 6;
|
||||
pub const SM_SHARED_ALIASED: ::libc::c_uchar = 7;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_region_basic_info_64 {
|
||||
pub protection: vm_prot_t,
|
||||
pub max_protection: vm_prot_t,
|
||||
|
@ -76,14 +76,14 @@ impl vm_region_basic_info_64 {
|
|||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_region_basic_info {
|
||||
pub protection: vm_prot_t,
|
||||
pub max_protection: vm_prot_t,
|
||||
pub inheritance: vm_inherit_t,
|
||||
pub shared: boolean_t,
|
||||
pub reserved: boolean_t,
|
||||
pub offset: ::libc::uint32_t,
|
||||
pub offset: u32,
|
||||
pub behavior: vm_behavior_t,
|
||||
pub user_wired_count: ::libc::c_ushort,
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ impl vm_region_basic_info {
|
|||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_region_extended_info {
|
||||
pub protection: vm_prot_t,
|
||||
pub user_tag: ::libc::c_uint,
|
||||
|
@ -107,6 +107,7 @@ pub struct vm_region_extended_info {
|
|||
pub shadow_depth: ::libc::c_ushort,
|
||||
pub external_pager: ::libc::c_uchar,
|
||||
pub share_mode: ::libc::c_uchar,
|
||||
pub pages_reusable: ::libc::c_uint,
|
||||
}
|
||||
|
||||
impl vm_region_extended_info {
|
||||
|
@ -116,7 +117,7 @@ impl vm_region_extended_info {
|
|||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_region_top_info {
|
||||
pub obj_id: ::libc::c_uint,
|
||||
pub ref_count: ::libc::c_uint,
|
||||
|
@ -132,12 +133,12 @@ impl vm_region_top_info {
|
|||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_region_submap_info {
|
||||
pub protection: vm_prot_t,
|
||||
pub max_protection: vm_prot_t,
|
||||
pub inheritance: vm_inherit_t,
|
||||
pub offset: ::libc::uint32_t,
|
||||
pub offset: u32,
|
||||
pub user_tag: ::libc::c_uint,
|
||||
pub pages_resident: ::libc::c_uint,
|
||||
pub pages_shared_now_private: ::libc::c_uint,
|
||||
|
@ -159,8 +160,8 @@ impl vm_region_submap_info {
|
|||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_region_submap_info_64 {
|
||||
pub protection: vm_prot_t,
|
||||
pub max_protection: vm_prot_t,
|
||||
|
@ -179,6 +180,7 @@ pub struct vm_region_submap_info_64 {
|
|||
pub behavior: vm_behavior_t,
|
||||
pub object_id: vm32_object_id_t,
|
||||
pub user_wired_count: ::libc::c_ushort,
|
||||
pub pages_reusable: ::libc::c_uint,
|
||||
}
|
||||
|
||||
impl vm_region_submap_info_64 {
|
||||
|
@ -187,8 +189,8 @@ impl vm_region_submap_info_64 {
|
|||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_region_submap_short_info_64 {
|
||||
pub protection: vm_prot_t,
|
||||
pub max_protection: vm_prot_t,
|
||||
|
@ -212,7 +214,7 @@ impl vm_region_submap_short_info_64 {
|
|||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_page_info_basic {
|
||||
pub disposition: ::libc::c_int,
|
||||
pub ref_count: ::libc::c_int,
|
||||
|
@ -228,10 +230,9 @@ impl vm_page_info_basic {
|
|||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[repr(C, packed(4))]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct mach_vm_read_entry {
|
||||
pub address: mach_vm_address_t,
|
||||
pub size: mach_vm_size_t,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
//! This module roughly corresponds to `mach/vm_statistics.h`
|
||||
|
||||
use vm_types::integer_t;
|
||||
use vm_types::{integer_t, natural_t};
|
||||
|
||||
pub type vm_statistics_t = *mut vm_statistics;
|
||||
pub type vm_statistics_data_t = vm_statistics;
|
||||
#[cfg(feature = "deprecated")]
|
||||
#[deprecated(
|
||||
since = "0.2.3",
|
||||
note = "`pmap_statistics_t` was removed after MacOSX 10.3.9"
|
||||
)]
|
||||
#[allow(deprecated)]
|
||||
pub type pmap_statistics_t = *mut pmap_statistics;
|
||||
|
||||
pub const VM_PAGE_QUERY_PAGE_PRESENT: integer_t = (1 << 0);
|
||||
pub const VM_PAGE_QUERY_PAGE_PRESENT: integer_t = 1;
|
||||
pub const VM_PAGE_QUERY_PAGE_FICTITIOUS: integer_t = (1 << 1);
|
||||
pub const VM_PAGE_QUERY_PAGE_REF: integer_t = (1 << 2);
|
||||
pub const VM_PAGE_QUERY_PAGE_DIRTY: integer_t = (1 << 3);
|
||||
|
@ -36,22 +42,36 @@ pub const VM_MEMORY_APPLICATION_SPECIFIC_16: ::libc::c_uint = 255;
|
|||
|
||||
pub const VM_FLAGS_FIXED: ::libc::c_int = 0x0;
|
||||
pub const VM_FLAGS_ANYWHERE: ::libc::c_int = 0x1;
|
||||
pub const VM_FLAGS_OVERWRITE: ::libc::c_int = 0x4000;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct vm_statistics {
|
||||
pub free_count: integer_t,
|
||||
pub active_count: integer_t,
|
||||
pub inactive_count: integer_t,
|
||||
pub wire_count: integer_t,
|
||||
pub zero_fill_count: integer_t,
|
||||
pub reactivations: integer_t,
|
||||
pub pageins: integer_t,
|
||||
pub pageouts: integer_t,
|
||||
pub faults: integer_t,
|
||||
pub cow_faults: integer_t,
|
||||
pub lookups: integer_t,
|
||||
pub hits: integer_t,
|
||||
pub free_count: natural_t,
|
||||
pub active_count: natural_t,
|
||||
pub inactive_count: natural_t,
|
||||
pub wire_count: natural_t,
|
||||
pub zero_fill_count: natural_t,
|
||||
pub reactivations: natural_t,
|
||||
pub pageins: natural_t,
|
||||
pub pageouts: natural_t,
|
||||
pub faults: natural_t,
|
||||
pub cow_faults: natural_t,
|
||||
pub lookups: natural_t,
|
||||
pub hits: natural_t,
|
||||
pub purgeable_count: natural_t,
|
||||
pub purges: natural_t,
|
||||
pub speculative_count: natural_t,
|
||||
}
|
||||
|
||||
#[cfg(feature = "deprecated")]
|
||||
#[deprecated(
|
||||
since = "0.2.3",
|
||||
note = "`pmap_statistics` was removed after MacOSX 10.3.9"
|
||||
)]
|
||||
#[cfg_attr(feature = "deprecated", allow(deprecated))]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
|
||||
pub struct pmap_statistics {
|
||||
pub resident_count: integer_t,
|
||||
pub wired_count: integer_t,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
pub type vm_sync_t = ::libc::c_uint;
|
||||
|
||||
pub const VM_SYNC_ASYNCHRONOUS: vm_sync_t = (1 << 0);
|
||||
pub const VM_SYNC_ASYNCHRONOUS: vm_sync_t = 1;
|
||||
pub const VM_SYNC_SYNCHRONOUS: vm_sync_t = (1 << 1);
|
||||
pub const VM_SYNC_INVALIDATE: vm_sync_t = (1 << 2);
|
||||
pub const VM_SYNC_KILLPAGES: vm_sync_t = (1 << 3);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
pub type natural_t = ::libc::c_uint;
|
||||
pub type integer_t = ::libc::c_int;
|
||||
|
||||
pub type user_addr_t = usize;
|
||||
pub type user_addr_t = u64;
|
||||
|
||||
pub type mach_vm_address_t = u64;
|
||||
pub type mach_vm_offset_t = u64;
|
||||
|
|
Загрузка…
Ссылка в новой задаче