Skip to content

Commit

Permalink
Promote pthread_getname_np and pthread_setname_np from glibc to linux
Browse files Browse the repository at this point in the history
musl libc added pthread_setname_np in 1.1.16 and pthread_getname_np
in 1.2.3, and uClibc has had them since v1.0.20.
  • Loading branch information
colincross committed May 11, 2022
1 parent f6df53f commit af887f0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions libc-test/build.rs
Expand Up @@ -3401,6 +3401,9 @@ fn test_linux(target: &str) {
// Not defined in uclibc as of 1.0.34
"gettid" if uclibc => true,

// Needs musl 1.2.3 or later.
"pthread_getname_np" if musl => true,

_ => false,
}
});
Expand Down
2 changes: 0 additions & 2 deletions libc-test/semver/linux-gnu.txt
Expand Up @@ -624,11 +624,9 @@ process_vm_readv
process_vm_writev
pthread_attr_getaffinity_np
pthread_attr_setaffinity_np
pthread_getname_np
pthread_rwlockattr_getkind_np
pthread_rwlockattr_getpshared
pthread_rwlockattr_setkind_np
pthread_setname_np
ptrace_peeksiginfo_args
ptrace_syscall_info
pututxline
Expand Down
2 changes: 2 additions & 0 deletions libc-test/semver/linux.txt
Expand Up @@ -2950,6 +2950,7 @@ pthread_condattr_setpshared
pthread_getaffinity_np
pthread_getattr_np
pthread_getcpuclockid
pthread_getname_np
pthread_getschedparam
pthread_kill
pthread_mutex_consistent
Expand All @@ -2962,6 +2963,7 @@ pthread_mutexattr_getrobust
pthread_mutexattr_setrobust
pthread_rwlockattr_setpshared
pthread_setaffinity_np
pthread_setname_np
pthread_setschedparam
pthread_setschedprio
pthread_spin_destroy
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/mod.rs
Expand Up @@ -1301,8 +1301,6 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;

pub fn sethostid(hostid: ::c_long) -> ::c_int;

Expand Down
3 changes: 3 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Expand Up @@ -4097,6 +4097,9 @@ extern "C" {
needlelen: ::size_t,
) -> *mut ::c_void;
pub fn sched_getcpu() -> ::c_int;

pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
}

cfg_if! {
Expand Down

0 comments on commit af887f0

Please sign in to comment.