Skip to content

Conversation

PaulDance
Copy link
Contributor

@PaulDance PaulDance commented Dec 6, 2024

Description

This adds two new/missing PF_* task flags to the Linux-like platform module:

  • PF_BLOCK_TS that was added relatively recently, in 6.9;
  • PF_SUSPEND_TASK that has been there for a bit more time: 3.11;

This would be for fanotify consumption. It should be easily backportable to 0.2.

Sources

https://github.com/torvalds/linux/blob/2ba9f676d0a2e408aef14d679984c26373bf37b7/include/linux/sched.h#L1661

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot
Copy link
Collaborator

rustbot commented Dec 6, 2024

r? @tgross35

rustbot has assigned @tgross35.
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

@PaulDance
Copy link
Contributor Author

The error in https://github.com/rust-lang/libc/actions/runs/12201653969/job/34040533674?pr=4174 seems unrelated to my changes, no?

@tgross35
Copy link
Contributor

tgross35 commented Dec 6, 2024

The changes look good to me but could you update libc-test/semver/linux.txt? If you wouldn't mind squashing the first and third commit ("Add new process flags" and " Add PF_BLOCK_TS to libc-test/build.rs") that would also be nice to keep tests passing after each (no worries if not, I can do it before merge).

The error in https://github.com/rust-lang/libc/actions/runs/12201653969/job/34040533674?pr=4174 seems unrelated to my changes, no?

Indeed, looks like a new lint was added. If you're up to it feel free to add a patch with:

#[allow(unpredictable_function_pointer_comparisons)] // FIXME(msrv): stabilized in 1.85

Otherwise I'll get it at some point before merging this.

@rustbot label +stable-nominated

@rustbot rustbot added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Dec 6, 2024
@tgross35
Copy link
Contributor

tgross35 commented Dec 7, 2024

Fyi I have a fix for the lint in progress #4177

@PaulDance
Copy link
Contributor Author

The changes look good to me

👍

could you update libc-test/semver/linux.txt?

I wanted to as well, but couldn't see any of the previous PF_* constants in there, so I thought it was on purpose for some reason. Should I still put them all there or only the ones I added?

If you wouldn't mind squashing the first and third commit

Can do!

I have a fix for the lint in progress #4177

I see that, thanks! I'll rebase on top of it once merged.

@tgross35
Copy link
Contributor

tgross35 commented Dec 7, 2024

I wanted to as well, but couldn't see any of the previous PF_* constants in there, so I thought it was on purpose for some reason. Should I still put them all there or only the ones I added?

I can't think of any reason so I would just put them all there, I guess if it causes CI to fail for some reason then I'll change my answer :) thanks for offering.

`PF_BLOCK_TS` and `PF_SUSPEND_TASK`.

They are also added to the tests. Interestingly, `PF_SUSPEND_TASK` is
already there somewhere in the build script 🤔

Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
They didn't seem to already exist, so add them. The new ones are included.

Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the changes!

@tgross35 tgross35 enabled auto-merge December 7, 2024 04:05
@tgross35 tgross35 added this pull request to the merge queue Dec 7, 2024
Merged via the queue into rust-lang:main with commit 96ed9c6 Dec 7, 2024
45 checks passed
@PaulDance
Copy link
Contributor Author

Cool, thanks!

@PaulDance PaulDance deleted the linux-new-proc-flags branch December 7, 2024 04:26
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Dec 9, 2024
`PF_BLOCK_TS` and `PF_SUSPEND_TASK`.

They are also added to the tests. Interestingly, `PF_SUSPEND_TASK` is
already there somewhere in the build script 🤔

Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>

(backport <rust-lang#4174>)
(cherry picked from commit 6934e52)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Dec 9, 2024
Taken from <https://github.com/torvalds/linux/blob/2ba9f676d0a2e408aef14d679984c26373bf37b7/include/linux/sched.h#L1661\>.

Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>

(backport <rust-lang#4174>)
(cherry picked from commit 9a38ea3)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Dec 9, 2024
They didn't seem to already exist, so add them. The new ones are included.

Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>

(backport <rust-lang#4174>)
(cherry picked from commit 5997f35)
@tgross35 tgross35 mentioned this pull request Dec 9, 2024
@github-actions github-actions bot mentioned this pull request Dec 9, 2024
@tgross35 tgross35 added stable-applied This PR has been cherry-picked to libc's stable release branch and removed stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-linux O-unix S-waiting-on-review stable-applied This PR has been cherry-picked to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants