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

Add sigsuspend #2279

Merged
merged 23 commits into from Jan 7, 2024
Merged

Add sigsuspend #2279

merged 23 commits into from Jan 7, 2024

Conversation

Toru3
Copy link
Contributor

@Toru3 Toru3 commented Jan 3, 2024

What does this PR do

Add sigsuspend as SigSet::suspend().

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

Related #1994 #1997

Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution, generally looks good! I have left some comments

match Errno::result(res).map(drop) {
Err(Errno::EINTR) => Ok(()),
Err(e) => Err(e),
Ok(_) => unreachable!(),
Copy link
Member

Choose a reason for hiding this comment

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

It might be better to slightly state why the Ok() branch is unreachable:

Suggested change
Ok(_) => unreachable!(),
Ok(_) => unreachable!("because this syscall always returns -1 if returns"),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added reason.

Comment on lines 594 to 595
target_os = "linux",
target_os = "android",
Copy link
Member

Choose a reason for hiding this comment

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

We prefer to use alias if available:

Suggested change
target_os = "linux",
target_os = "android",
linux_android,

Copy link
Contributor Author

@Toru3 Toru3 Jan 6, 2024

Choose a reason for hiding this comment

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

I fixed it.

target_os = "linux",
target_os = "android",
target_os = "hurd",
target_os = "nto",
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed nto.

Comment on lines 347 to 348
target_os = "linux",
target_os = "android",
Copy link
Member

Choose a reason for hiding this comment

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

Same here, use alias please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed it.

target_os = "linux",
target_os = "android",
target_os = "hurd",
target_os = "nto",
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed nto.

@SteveLauC
Copy link
Member

Never mind about the CI / tier3 (x86_64-unknown-dragonfly) (pull_request) failure, it is not related to this PR

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

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

Please wait for rust-lang/libc#3518 to merge. Then update Nix's Cargo.toml to point to the merged revision and enable sigsuspend for the additional platforms.

@SteveLauC
Copy link
Member

Please wait for rust-lang/libc#3518 to merge. Then update Nix's Cargo.toml to point to the merged revision and enable sigsuspend for the additional platforms.

That PR is merged, @Toru3, you can update our libc dependency and add sigsuspend for more targets:

[dependencies]
-libc = { git = "https://github.com/rust-lang/libc", rev = "cb18b837963c37a8d21732f3ca2c2096f04e6830", features = ["extra_traits"] }
+libc = { git = "https://github.com/rust-lang/libc", rev = "2f93bfb7678e18a9fc5373dec49384bd23f601c3", features = ["extra_traits"] }
#[cfg(any(
        bsd,
        linux_android,
        solarish,
        target_os = "haiku",
        target_os = "hurd",
        target_os = "aix",
        target_os = "fushsia"
    ))]

@SteveLauC SteveLauC linked an issue Jan 7, 2024 that may be closed by this pull request
I updated libc to use below commit which add sigsuspend to more targets.
rust-lang/libc@11f7c7b
@SteveLauC
Copy link
Member

SteveLauC commented Jan 7, 2024

You may want to rebase your branch to solve the DragonFlyBSD CI error

Never mind, the CI seems to be good

@Toru3
Copy link
Contributor Author

Toru3 commented Jan 7, 2024

@asomers I updated libc and added targets to sigsuspend. Please review this.

Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

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

It is all good, let's merge this:)

@SteveLauC SteveLauC added this pull request to the merge queue Jan 7, 2024
Merged via the queue into nix-rust:master with commit 4bc85e4 Jan 7, 2024
35 checks passed
SteveLauC added a commit to SteveLauC/nix that referenced this pull request Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hints for adding sigsuspend().
3 participants