Skip to content

Commit af887f0

Browse files
committed
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.
1 parent f6df53f commit af887f0

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

libc-test/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3401,6 +3401,9 @@ fn test_linux(target: &str) {
34013401
// Not defined in uclibc as of 1.0.34
34023402
"gettid" if uclibc => true,
34033403

3404+
// Needs musl 1.2.3 or later.
3405+
"pthread_getname_np" if musl => true,
3406+
34043407
_ => false,
34053408
}
34063409
});

libc-test/semver/linux-gnu.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,11 +624,9 @@ process_vm_readv
624624
process_vm_writev
625625
pthread_attr_getaffinity_np
626626
pthread_attr_setaffinity_np
627-
pthread_getname_np
628627
pthread_rwlockattr_getkind_np
629628
pthread_rwlockattr_getpshared
630629
pthread_rwlockattr_setkind_np
631-
pthread_setname_np
632630
ptrace_peeksiginfo_args
633631
ptrace_syscall_info
634632
pututxline

libc-test/semver/linux.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,6 +2950,7 @@ pthread_condattr_setpshared
29502950
pthread_getaffinity_np
29512951
pthread_getattr_np
29522952
pthread_getcpuclockid
2953+
pthread_getname_np
29532954
pthread_getschedparam
29542955
pthread_kill
29552956
pthread_mutex_consistent
@@ -2962,6 +2963,7 @@ pthread_mutexattr_getrobust
29622963
pthread_mutexattr_setrobust
29632964
pthread_rwlockattr_setpshared
29642965
pthread_setaffinity_np
2966+
pthread_setname_np
29652967
pthread_setschedparam
29662968
pthread_setschedprio
29672969
pthread_spin_destroy

src/unix/linux_like/linux/gnu/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,8 +1301,6 @@ extern "C" {
13011301
buflen: ::size_t,
13021302
result: *mut *mut ::group,
13031303
) -> ::c_int;
1304-
pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int;
1305-
pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
13061304

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

src/unix/linux_like/linux/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4097,6 +4097,9 @@ extern "C" {
40974097
needlelen: ::size_t,
40984098
) -> *mut ::c_void;
40994099
pub fn sched_getcpu() -> ::c_int;
4100+
4101+
pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int;
4102+
pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
41004103
}
41014104

41024105
cfg_if! {

0 commit comments

Comments
 (0)