summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-05-11 03:11:58 +0000
committerbors <bors@rust-lang.org>2022-05-11 03:11:58 +0000
commitcd99f681181c310abfba742aef11115d2eff03dc (patch)
tree3155d0f1efc7376cb59a792484da75690dfa1032
parent454fb0ef68f4b75fc772412c70027d10d9cf8af8 (diff)
parentaf887f0dec467307de6af78b198ea4540fc54286 (diff)
downloadrust-libc-cd99f681181c310abfba742aef11115d2eff03dc.tar.gz
Auto merge of #2768 - colincross:pthread_setname_np, r=Amanieu
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.
-rw-r--r--libc-test/build.rs3
-rw-r--r--libc-test/semver/linux-gnu.txt2
-rw-r--r--libc-test/semver/linux.txt2
-rw-r--r--src/unix/linux_like/linux/gnu/mod.rs2
-rw-r--r--src/unix/linux_like/linux/mod.rs3
5 files changed, 8 insertions, 4 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 1618f49890..0a37df2740 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -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,
}
});
diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt
index c7ef8ef358..14c4ab9cfe 100644
--- a/libc-test/semver/linux-gnu.txt
+++ b/libc-test/semver/linux-gnu.txt
@@ -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
diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt
index 770dfa8f4c..3ffc8be856 100644
--- a/libc-test/semver/linux.txt
+++ b/libc-test/semver/linux.txt
@@ -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
@@ -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
diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs
index a80e43e210..8a5f9d1698 100644
--- a/src/unix/linux_like/linux/gnu/mod.rs
+++ b/src/unix/linux_like/linux/gnu/mod.rs
@@ -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;
diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs
index 89f58ee0dd..2086f705a2 100644
--- a/src/unix/linux_like/linux/mod.rs
+++ b/src/unix/linux_like/linux/mod.rs
@@ -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! {