Skip to content

Rollup of 7 pull requests #135327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jan 10, 2025
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2a2e87b
Rename the internal simpler `quote` macro to `minimal_quote`
SpriteOvO Jan 1, 2025
e4193e2
Do not ICE when encountering predicates from other items in method er…
compiler-errors Jan 3, 2025
be92ac3
Only treat plain literal patterns as short
oli-obk Jan 8, 2025
b321cd5
Add note back to conditionally-const error message
compiler-errors Dec 23, 2024
5a9f0be
Make the non-const part swappable in the diagnostic
compiler-errors Dec 23, 2024
924000d
Unify conditional and non const call error reporting
compiler-errors Dec 23, 2024
8795750
Used pthread name functions returning result for FreeBSD and DragonFly
YohDeadfall Nov 4, 2024
d525641
Append `TokenTree` with `ToTokens` in `proc_macro::quote!`
SpriteOvO Jan 5, 2025
e9063c3
Migrate basic tests for `proc_macro::quote!` from `quote` crate
SpriteOvO Jan 8, 2025
2ab9db5
Migrate check-fail tests for `proc_macro::quote!` from `quote` crate
SpriteOvO Jan 9, 2025
ef69c30
Fix `proc_macro::quote!` for raw ident
SpriteOvO Jan 9, 2025
7c91f89
Fix typo in `#[coroutine]` gating error
camelid Jan 10, 2025
1c61937
remove more redundant into() conversions
matthiaskrgr Jan 10, 2025
5eec2b0
Rollup merge of #132607 - YohDeadfall:pthread-name-fn-with-result, r=…
jhpratt Jan 10, 2025
34fa27b
Rollup merge of #134693 - SpriteOvO:proc-macro-use-to-tokens-in-quote…
jhpratt Jan 10, 2025
9e24b6b
Rollup merge of #134732 - compiler-errors:unify-conditional-const-err…
jhpratt Jan 10, 2025
a6d38a1
Rollup merge of #135083 - compiler-errors:invalid-predicate-source, r…
jhpratt Jan 10, 2025
0dcbda8
Rollup merge of #135251 - oli-obk:push-lmpyvvyrtplk, r=ytmimi
jhpratt Jan 10, 2025
ee521df
Rollup merge of #135320 - camelid:coroutines-typo, r=lqd
jhpratt Jan 10, 2025
b557f1b
Rollup merge of #135321 - matthiaskrgr:out_of_into, r=lqd
jhpratt Jan 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Used pthread name functions returning result for FreeBSD and DragonFly
  • Loading branch information
YohDeadfall committed Jan 9, 2025
commit 8795750d43e650e35246e590538c73a4f18818cd
24 changes: 13 additions & 11 deletions library/std/src/sys/pal/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,25 +129,27 @@ impl Thread {
}
}

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly"))]
pub fn set_name(name: &CStr) {
const TASK_COMM_LEN: usize = 16;

unsafe {
// Available since glibc 2.12, musl 1.1.16, and uClibc 1.0.20.
let name = truncate_cstr::<{ TASK_COMM_LEN }>(name);
cfg_if::cfg_if! {
if #[cfg(target_os = "linux")] {
// Linux limits the allowed length of the name.
const TASK_COMM_LEN: usize = 16;
let name = truncate_cstr::<{ TASK_COMM_LEN }>(name);
} else {
// FreeBSD and DragonFly BSD do not enforce length limits.
}
};
// Available since glibc 2.12, musl 1.1.16, and uClibc 1.0.20 for Linux,
// FreeBSD 12.2 and 13.0, and DragonFly BSD 6.0.
let res = libc::pthread_setname_np(libc::pthread_self(), name.as_ptr());
// We have no good way of propagating errors here, but in debug-builds let's check that this actually worked.
debug_assert_eq!(res, 0);
}
}

#[cfg(any(
target_os = "freebsd",
target_os = "dragonfly",
target_os = "openbsd",
target_os = "nuttx"
))]
#[cfg(any(target_os = "openbsd", target_os = "nuttx"))]
pub fn set_name(name: &CStr) {
unsafe {
libc::pthread_set_name_np(libc::pthread_self(), name.as_ptr());
Expand Down
Loading