зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1576168 - mach vendor rust. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D43403 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1029a3ce04
Коммит
84c0ce9ed4
|
@ -83,7 +83,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "audio_thread_priority"
|
||||
version = "0.18.0"
|
||||
version = "0.19.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)",
|
||||
|
@ -125,7 +125,7 @@ dependencies = [
|
|||
name = "audioipc-client"
|
||||
version = "0.4.0"
|
||||
dependencies = [
|
||||
"audio_thread_priority 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"audio_thread_priority 0.19.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.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"audio_thread_priority 0.19.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)",
|
||||
|
@ -1256,7 +1256,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.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"audio_thread_priority 0.19.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)",
|
||||
|
@ -3875,7 +3875,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.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5bf0d279b855523da1d60ea3bf145f797b92ed96190f26975730e517e7bfc7df"
|
||||
"checksum audio_thread_priority 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "644202c837854b354c99865a3615fd987498048a33c1a407e31fe5175a940413"
|
||||
"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"
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"97400c81970be22ec890a301b1cc7fe9f6c5da66d7055e5e6b192a86fd9fdf06","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":"2cc14b5da069d2366064d5bd6d18066d24c2dce70cc1e9242fbbda55e3e9946b","src/rt_mach.rs":"14c4285c9cd3083e99ae321ece0dfe41d3b60fc56e01b1844e934009d70c857e","src/rt_win.rs":"f8f5b7af21cadd686cf7d8099d1972d3265c3889574020bd4ea088b832fbfa51"},"package":"5bf0d279b855523da1d60ea3bf145f797b92ed96190f26975730e517e7bfc7df"}
|
||||
{"files":{"Cargo.toml":"a1336fd82a875402bef08fe33724b02029639ae68e844419dc7e12786b95572d","README.md":"bcfa4948edf52fdacd485200a0c1c886a92232cc1931eeb4e1044050f46ec253","audio_thread_priority.h":"880889a154283a87cf84218cc4d6b2b9dd2c8fd09adc6d38f527b08ccd0c6168","generate_osx_bindings.sh":"06e4e03450f788ced18d31fff5660919e6f6ec1119ddace363ffeb82f0518a71","src/lib.rs":"25df84928756bc50fa908d65acace5259b59dfa5fc57a3f0f8b0e1f8a98ab512","src/mach_sys.rs":"352560fcb9b41d877cff92e5b3b04d6dc68b1f30508ce4b9aed78940120a883e","src/rt_linux.rs":"3da1550beacc8f8a0d86c07ed190ceef7d56398c675b99a145919f5c7231eed7","src/rt_mach.rs":"14c4285c9cd3083e99ae321ece0dfe41d3b60fc56e01b1844e934009d70c857e","src/rt_win.rs":"f8f5b7af21cadd686cf7d8099d1972d3265c3889574020bd4ea088b832fbfa51"},"package":"644202c837854b354c99865a3615fd987498048a33c1a407e31fe5175a940413"}
|
|
@ -11,8 +11,9 @@
|
|||
# will likely look very different (and much more reasonable)
|
||||
|
||||
[package]
|
||||
edition = "2018"
|
||||
name = "audio_thread_priority"
|
||||
version = "0.18.0"
|
||||
version = "0.19.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"
|
||||
|
|
|
@ -163,15 +163,14 @@ pub extern "C" fn atp_free_handle(handle: *mut atp_handle) -> i32 {
|
|||
0
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[cfg(feature = "terminal-logging")]
|
||||
use simple_logger;
|
||||
#[test]
|
||||
#[test]
|
||||
fn it_works() {
|
||||
#[cfg(feature = "terminal-logging")]
|
||||
#[cfg(feature = "terminal-logging")]
|
||||
simple_logger::init().unwrap();
|
||||
{
|
||||
assert!(promote_current_thread_to_real_time(0, 0).is_err());
|
||||
|
@ -198,7 +197,7 @@ mod tests {
|
|||
}
|
||||
{
|
||||
match promote_current_thread_to_real_time(512, 44100) {
|
||||
Ok(_) => { }
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
panic!(e);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ extern crate dbus;
|
|||
extern crate libc;
|
||||
|
||||
use std::cmp;
|
||||
use std::error::Error;
|
||||
|
||||
use dbus::{Connection, BusType, Props, MessageItem, Message};
|
||||
|
||||
|
@ -27,7 +28,7 @@ pub struct RtPriorityHandleInternal {
|
|||
param: libc::sched_param,
|
||||
}
|
||||
|
||||
fn item_as_i64(i: MessageItem) -> Result<i64, Box<std::error::Error>> {
|
||||
fn item_as_i64(i: MessageItem) -> Result<i64, Box<dyn Error>> {
|
||||
match i {
|
||||
MessageItem::Int32(i) => Ok(i as i64),
|
||||
MessageItem::Int64(i) => Ok(i),
|
||||
|
@ -35,7 +36,7 @@ fn item_as_i64(i: MessageItem) -> Result<i64, Box<std::error::Error>> {
|
|||
}
|
||||
}
|
||||
|
||||
fn rtkit_set_realtime(c: &Connection, thread: u64, prio: u32) -> Result<(), Box<std::error::Error>> {
|
||||
fn rtkit_set_realtime(c: &Connection, thread: u64, prio: u32) -> Result<(), Box<dyn Error>> {
|
||||
let mut m = Message::new_method_call("org.freedesktop.RealtimeKit1",
|
||||
"/org/freedesktop/RealtimeKit1",
|
||||
"org.freedesktop.RealtimeKit1",
|
||||
|
@ -45,7 +46,7 @@ fn rtkit_set_realtime(c: &Connection, thread: u64, prio: u32) -> Result<(), Box<
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
fn make_realtime(tid: kernel_pid_t, max_slice_us: u64, prio: u32) -> Result<u32, Box<std::error::Error>> {
|
||||
fn make_realtime(tid: kernel_pid_t, requested_slice_us: u64, prio: u32) -> Result<u32, Box<dyn Error>> {
|
||||
let c = Connection::get_private(BusType::System)?;
|
||||
|
||||
let p = Props::new(&c, "org.freedesktop.RealtimeKit1", "/org/freedesktop/RealtimeKit1",
|
||||
|
@ -65,10 +66,12 @@ fn make_realtime(tid: kernel_pid_t, max_slice_us: u64, prio: u32) -> Result<u32,
|
|||
}
|
||||
|
||||
// Only take what we need, or cap at the system limit, no further.
|
||||
let rttime_request = cmp::min(max_slice_us, max_rttime as u64);
|
||||
let rttime_request = cmp::min(requested_slice_us, max_rttime as u64);
|
||||
|
||||
// Set a soft limit to the limit requested, to be able to handle going over the limit using
|
||||
// SIXCPU. Set the hard limit to the maxium slice to prevent getting SIGKILL.
|
||||
let new_limit = libc::rlimit64 { rlim_cur: rttime_request,
|
||||
rlim_max: rttime_request };
|
||||
rlim_max: max_rttime as u64 };
|
||||
let mut old_limit = new_limit;
|
||||
if unsafe { libc::getrlimit64(libc::RLIMIT_RTTIME, &mut old_limit) } < 0 {
|
||||
return Err(Box::from("getrlimit failed"));
|
||||
|
|
Загрузка…
Ссылка в новой задаче