Skip to content

Commit c27c3bb

Browse files
LinuxUserGDpadenot
authored andcommitted
Use non-lfs64 api for getrlimit()/setrlimit() wrapper functions
1 parent c8e532a commit c27c3bb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/rt_linux.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ fn rtkit_set_realtime(thread: u64, pid: u64, prio: u32) -> Result<(), Box<dyn Er
112112

113113
/// Returns the maximum priority, maximum real-time time slice, and the current real-time time
114114
/// slice for this process.
115-
fn get_limits() -> Result<(i64, u64, libc::rlimit64), AudioThreadPriorityError> {
115+
fn get_limits() -> Result<(i64, u64, libc::rlimit), AudioThreadPriorityError> {
116116
let c = Connection::get_private(BusType::System)?;
117117

118118
let p = Props::new(
@@ -122,7 +122,7 @@ fn get_limits() -> Result<(i64, u64, libc::rlimit64), AudioThreadPriorityError>
122122
"org.freedesktop.RealtimeKit1",
123123
DBUS_SOCKET_TIMEOUT,
124124
);
125-
let mut current_limit = libc::rlimit64 {
125+
let mut current_limit = libc::rlimit {
126126
rlim_cur: 0,
127127
rlim_max: 0,
128128
};
@@ -141,9 +141,9 @@ fn get_limits() -> Result<(i64, u64, libc::rlimit64), AudioThreadPriorityError>
141141
));
142142
}
143143

144-
if unsafe { libc::getrlimit64(libc::RLIMIT_RTTIME, &mut current_limit) } < 0 {
144+
if unsafe { libc::getrlimit(libc::RLIMIT_RTTIME, &mut current_limit) } < 0 {
145145
return Err(AudioThreadPriorityError::new_with_inner(
146-
"getrlimit64",
146+
"getrlimit",
147147
Box::new(OSError::last_os_error()),
148148
));
149149
}
@@ -154,13 +154,13 @@ fn get_limits() -> Result<(i64, u64, libc::rlimit64), AudioThreadPriorityError>
154154
fn set_limits(request: u64, max: u64) -> Result<(), AudioThreadPriorityError> {
155155
// Set a soft limit to the limit requested, to be able to handle going over the limit using
156156
// 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 {
158158
rlim_cur: request,
159159
rlim_max: max,
160160
};
161-
if unsafe { libc::setrlimit64(libc::RLIMIT_RTTIME, &new_limit) } < 0 {
161+
if unsafe { libc::setrlimit(libc::RLIMIT_RTTIME, &new_limit) } < 0 {
162162
return Err(AudioThreadPriorityError::new_with_inner(
163-
"setrlimit64",
163+
"setrlimit",
164164
Box::new(OSError::last_os_error()),
165165
));
166166
}
@@ -297,10 +297,10 @@ pub fn promote_thread_to_real_time_internal(
297297
Err(e) => {
298298
let (_, _, limits) = get_limits()?;
299299
if limits.rlim_cur != libc::RLIM_INFINITY
300-
&& unsafe { libc::setrlimit64(libc::RLIMIT_RTTIME, &limits) } < 0
300+
&& unsafe { libc::setrlimit(libc::RLIMIT_RTTIME, &limits) } < 0
301301
{
302302
return Err(AudioThreadPriorityError::new_with_inner(
303-
"setrlimit64",
303+
"setrlimit",
304304
Box::new(OSError::last_os_error()),
305305
));
306306
}

0 commit comments

Comments
 (0)