Skip to content

Commit

Permalink
Remove runtime::set_thread_name, which is obviated by `thread::set_…
Browse files Browse the repository at this point in the history
…name`. (#952)
  • Loading branch information
sunfishcode committed Dec 5, 2023
1 parent 2a70730 commit c2e1182
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 31 deletions.
19 changes: 4 additions & 15 deletions src/backend/linux_raw/runtime/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
use crate::backend::c;
#[cfg(target_arch = "x86")]
use crate::backend::conv::by_mut;
#[cfg(target_arch = "x86_64")]
use crate::backend::conv::c_uint;
use crate::backend::conv::{
by_ref, c_int, c_uint, ret, ret_c_int, ret_c_int_infallible, ret_error, ret_infallible,
ret_void_star, size_of, zero,
by_ref, c_int, ret, ret_c_int, ret_c_int_infallible, ret_error, ret_infallible, ret_void_star,
size_of, zero,
};
#[cfg(feature = "fs")]
use crate::fd::BorrowedFd;
Expand All @@ -30,7 +32,6 @@ use linux_raw_sys::general::__kernel_old_timespec;
use linux_raw_sys::general::kernel_sigset_t;
#[cfg(target_arch = "x86_64")]
use linux_raw_sys::general::ARCH_SET_FS;
use linux_raw_sys::prctl::PR_SET_NAME;

#[inline]
pub(crate) unsafe fn fork() -> io::Result<Fork> {
Expand Down Expand Up @@ -139,18 +140,6 @@ pub(crate) mod tls {
Pid::from_raw_unchecked(tid)
}

#[inline]
pub(crate) unsafe fn set_thread_name(name: &CStr) -> io::Result<()> {
ret(syscall_readonly!(
__NR_prctl,
c_uint(PR_SET_NAME),
name,
zero(),
zero(),
zero()
))
}

#[inline]
pub(crate) fn exit_thread(code: c::c_int) -> ! {
unsafe { syscall_noreturn!(__NR_exit, c_int(code)) }
Expand Down
16 changes: 0 additions & 16 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,6 @@ pub unsafe fn set_tid_address(data: *mut c_void) -> Pid {
backend::runtime::syscalls::tls::set_tid_address(data)
}

/// `prctl(PR_SET_NAME, name)`
///
/// # References
/// - [Linux]
///
/// # Safety
///
/// This is a very low-level feature for implementing threading libraries.
/// See the references links above.
///
/// [Linux]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
pub unsafe fn set_thread_name(name: &CStr) -> io::Result<()> {
backend::runtime::syscalls::tls::set_thread_name(name)
}

#[cfg(linux_raw)]
#[cfg(target_arch = "x86")]
pub use backend::runtime::tls::UserDesc;
Expand Down

0 comments on commit c2e1182

Please sign in to comment.