Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 915979 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-10 / +10 lines)
Line  Link Here
0
-- a/third_party/rust/audio_thread_priority/src/rt_linux.rs
0
++ b/third_party/rust/audio_thread_priority/src/rt_linux.rs
Lines 112-118 Link Here
112
112
113
/// Returns the maximum priority, maximum real-time time slice, and the current real-time time
113
/// Returns the maximum priority, maximum real-time time slice, and the current real-time time
114
/// slice for this process.
114
/// slice for this process.
115
fn get_limits() -> Result<(i64, u64, libc::rlimit64), AudioThreadPriorityError> {
115
fn get_limits() -> Result<(i64, u64, libc::rlimit), AudioThreadPriorityError> {
116
    let c = Connection::get_private(BusType::System)?;
116
    let c = Connection::get_private(BusType::System)?;
117
117
118
    let p = Props::new(
118
    let p = Props::new(
Lines 122-128 Link Here
122
        "org.freedesktop.RealtimeKit1",
122
        "org.freedesktop.RealtimeKit1",
123
        DBUS_SOCKET_TIMEOUT,
123
        DBUS_SOCKET_TIMEOUT,
124
    );
124
    );
125
    let mut current_limit = libc::rlimit64 {
125
    let mut current_limit = libc::rlimit {
126
        rlim_cur: 0,
126
        rlim_cur: 0,
127
        rlim_max: 0,
127
        rlim_max: 0,
128
    };
128
    };
Lines 141-149 Link Here
141
        ));
141
        ));
142
    }
142
    }
143
143
144
    if unsafe { libc::getrlimit64(libc::RLIMIT_RTTIME, &mut current_limit) } < 0 {
144
    if unsafe { libc::getrlimit(libc::RLIMIT_RTTIME, &mut current_limit) } < 0 {
145
        return Err(AudioThreadPriorityError::new_with_inner(
145
        return Err(AudioThreadPriorityError::new_with_inner(
146
            "getrlimit64",
146
            "getrlimit",
147
            Box::new(OSError::last_os_error()),
147
            Box::new(OSError::last_os_error()),
148
        ));
148
        ));
149
    }
149
    }
Lines 154-166 Link Here
154
fn set_limits(request: u64, max: u64) -> Result<(), AudioThreadPriorityError> {
154
fn set_limits(request: u64, max: u64) -> Result<(), AudioThreadPriorityError> {
155
    // Set a soft limit to the limit requested, to be able to handle going over the limit using
155
    // Set a soft limit to the limit requested, to be able to handle going over the limit using
156
    // SIGXCPU. Set the hard limit to the maxium slice to prevent getting SIGKILL.
156
    // SIGXCPU. Set the hard limit to the maxium slice to prevent getting SIGKILL.
157
    let new_limit = libc::rlimit64 {
157
    let new_limit = libc::rlimit {
158
        rlim_cur: request,
158
        rlim_cur: request,
159
        rlim_max: max,
159
        rlim_max: max,
160
    };
160
    };
161
    if unsafe { libc::setrlimit64(libc::RLIMIT_RTTIME, &new_limit) } < 0 {
161
    if unsafe { libc::setrlimit(libc::RLIMIT_RTTIME, &new_limit) } < 0 {
162
        return Err(AudioThreadPriorityError::new_with_inner(
162
        return Err(AudioThreadPriorityError::new_with_inner(
163
            "setrlimit64",
163
            "setrlimit",
164
            Box::new(OSError::last_os_error()),
164
            Box::new(OSError::last_os_error()),
165
        ));
165
        ));
166
    }
166
    }
Lines 296-304 Link Here
296
    match r {
296
    match r {
297
        Ok(_) => Ok(handle),
297
        Ok(_) => Ok(handle),
298
        Err(e) => {
298
        Err(e) => {
299
            if unsafe { libc::setrlimit64(libc::RLIMIT_RTTIME, &limits) } < 0 {
299
            if unsafe { libc::setrlimit(libc::RLIMIT_RTTIME, &limits) } < 0 {
300
                return Err(AudioThreadPriorityError::new_with_inner(
300
                return Err(AudioThreadPriorityError::new_with_inner(
301
                    "setrlimit64",
301
                    "setrlimit",
302
                    Box::new(OSError::last_os_error()),
302
                    Box::new(OSError::last_os_error()),
303
                ));
303
                ));
304
            }
304
            }

Return to bug 915979