Skip to content

Commit

Permalink
Auto merge of #2768 - colincross:pthread_setname_np, r=Amanieu
Browse files Browse the repository at this point in the history
Promote pthread_getname_np and pthread_setname_np from glibc to linux

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
bors committed May 11, 2022
2 parents 454fb0e + af887f0 commit cd99f68
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 @@ -3413,6 +3413,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 @@ -2953,6 +2953,7 @@ pthread_condattr_setpshared
pthread_getaffinity_np
pthread_getattr_np
pthread_getcpuclockid
pthread_getname_np
pthread_getschedparam
pthread_kill
pthread_mutex_consistent
Expand All @@ -2965,6 +2966,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 @@ -1305,8 +1305,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 @@ -4090,6 +4090,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 cd99f68

Please sign in to comment.