Skip to content
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

Fix set_name in thread mod for NuttX #135991

Merged
merged 1 commit into from
Jan 25, 2025
Merged

Fix set_name in thread mod for NuttX #135991

merged 1 commit into from
Jan 25, 2025

Conversation

no1wudi
Copy link
Contributor

@no1wudi no1wudi commented Jan 24, 2025

Replace pthread_set_name_np with pthread_setname_np for NuttX in the set_name function, this change aligns the implementation with the correct API available on NuttX

This patch ensures thread naming works correctly on NuttX platforms.

See also:
https://github.com/rust-lang/libc/blob/0f9f8c91adb0365c0d13b34ec27ac8019818cf1f/src/unix/nuttx/mod.rs#L562
https://github.com/apache/nuttx/blob/8f3a2a6f7645dd95b6a7608b9cde3cb693b118c2/include/pthread.h#L511-L514

Replace `pthread_set_name_np` with `pthread_setname_np` for NuttX in the `set_name` function,
this change aligns the implementation with the correct API available on NuttX

This patch ensures thread naming works correctly on NuttX platforms.

Signed-off-by: Huang Qi <[email protected]>
@rustbot
Copy link
Collaborator

rustbot commented Jan 24, 2025

r? @thomcc

rustbot has assigned @thomcc.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 24, 2025
@thomcc
Copy link
Member

thomcc commented Jan 25, 2025

LGTM

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 25, 2025

📌 Commit e170c9d has been approved by thomcc

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 25, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 25, 2025
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#135971 (Properly report error when object type param default references self)
 - rust-lang#135977 (Fix `FormattingOptions` instantiation with `Default`)
 - rust-lang#135985 (Rename test to `unresolvable-upvar-issue-87987.rs` and add some notes)
 - rust-lang#135991 (Fix set_name in thread mod for NuttX)
 - rust-lang#136009 (bootstrap: Handle bootstrap lockfile race condition better)
 - rust-lang#136018 (Use short ty string for move errors)
 - rust-lang#136027 (Skip suggestions in `derive`d code)
 - rust-lang#136029 (Bootstrap: Don't move ownership of job object)
 - rust-lang#136034 (fix(bootstrap): deserialize null as `f64::NAN`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7a79024 into rust-lang:master Jan 25, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 25, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 25, 2025
Rollup merge of rust-lang#135991 - no1wudi:master, r=thomcc

Fix set_name in thread mod for NuttX

Replace `pthread_set_name_np` with `pthread_setname_np` for NuttX in the `set_name` function, this change aligns the implementation with the correct API available on NuttX

This patch ensures thread naming works correctly on NuttX platforms.

See also:
https://github.com/rust-lang/libc/blob/0f9f8c91adb0365c0d13b34ec27ac8019818cf1f/src/unix/nuttx/mod.rs#L562
https://github.com/apache/nuttx/blob/8f3a2a6f7645dd95b6a7608b9cde3cb693b118c2/include/pthread.h#L511-L514
@@ -139,7 +144,7 @@ impl Thread {
const TASK_COMM_LEN: usize = 16;
let name = truncate_cstr::<{ TASK_COMM_LEN }>(name);
} else {
// FreeBSD and DragonFly BSD do not enforce length limits.
// FreeBSD, DragonFly, FreeBSD and NuttX do not enforce length limits.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you write down FreeBSD twice? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry, I thought "BSD" referred to "FreeBSD" rather than "Dragonfly BSD". I'll revert it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-unix Operating system: Unix-like S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants