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

linux: Use pthread_setname_np instead of prctl #100287

Merged
merged 1 commit into from
Aug 11, 2022

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Aug 8, 2022

This function is available on Linux since glibc 2.12, musl 1.1.16, and
uClibc 1.0.20. The main advantage over prctl is that it properly
represents the pointer argument, rather than a multi-purpose long,
so we're better representing strict provenance (#95496).

This function is available on Linux since glibc 2.12, musl 1.1.16, and
uClibc 1.0.20. The main advantage over `prctl` is that it properly
represents the pointer argument, rather than a multi-purpose `long`,
so we're better representing strict provenance (rust-lang#95496).
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Aug 8, 2022
@rustbot
Copy link
Collaborator

rustbot commented Aug 8, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 8, 2022
@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Aug 9, 2022

📌 Commit 013986b has been approved by Mark-Simulacrum

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 Aug 9, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 11, 2022
Rollup of 11 pull requests

Successful merges:

 - rust-lang#92744 (Check if enum from foreign crate has any non exhaustive variants when attempting a cast)
 - rust-lang#99110 (Determine match_has_guard from candidates instead of looking up thir table again)
 - rust-lang#100184 (Stabilize ptr_const_cast)
 - rust-lang#100192 ( Remove duplicated temporaries creating during box derefs elaboration)
 - rust-lang#100232 (Do not consider method call receiver as an argument in AST.)
 - rust-lang#100287 (linux: Use `pthread_setname_np` instead of `prctl`)
 - rust-lang#100351 (Use `&mut Diagnostic` instead of `&mut DiagnosticBuilder` unless needed)
 - rust-lang#100370 (Remove more Clean trait implementations)
 - rust-lang#100391 (Improve size assertions)
 - rust-lang#100398 (Improve `-Zhir-stats`)
 - rust-lang#100403 (Improve error messages when running rustdoc GUI tests)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a5b0f72 into rust-lang:master Aug 11, 2022
@rustbot rustbot added this to the 1.65.0 milestone Aug 11, 2022
@cuviper cuviper deleted the no-linux-prctl branch October 15, 2022 00:15
@peku33
Copy link

peku33 commented Oct 21, 2022

I think this commit breaks the previous behavior of setting thread name.

Previously if the thread name exceeded 15+1 characters, it was truncated, but still set.
When using pthread_setname_np, for longer names the function fails (but we don't inspect the result) and does nothing: https://man7.org/linux/man-pages/man3/pthread_setname_np.3.html

       The pthread_setname_np() function can fail with the following
       error:

       ERANGE The length of the string specified pointed to by name
              exceeds the allowed limit.

@cuviper
Copy link
Member Author

cuviper commented Oct 21, 2022

@cuviper
Copy link
Member Author

cuviper commented Oct 30, 2022

FYI, my truncation fix in #103379 was also backported to 1.65-beta in #103739.
(What a coincidence on those slightly-permuted pull request numbers!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

6 participants