Skip to content

Commit

Permalink
SigSet: Add the repr(transparent) attribute
Browse files Browse the repository at this point in the history
This commit adds the `repr(transparent)` attribute to the `SigSet`
struct, to make sure that its representation is exactly like the
`sigset_t` struct from C, in all cases.

Signed-off-by: German Maglione <gmaglione@redhat.com>
  • Loading branch information
germag committed Jun 21, 2022
1 parent 779da7a commit ab6e19c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
(#[1713](https://github.com/nix-rust/nix/pull/1713))
- `nix::poll::ppoll`: `sigmask` parameter is now optional.
(#[1739](https://github.com/nix-rust/nix/pull/1739))
- `signal:SigSet` it's now marked as `repr(trasparent)`.
(#[1741](https://github.com/nix-rust/nix/pull/1741))

### Fixed

Expand Down
3 changes: 3 additions & 0 deletions src/sys/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,9 @@ use std::iter::FromIterator;
use std::iter::IntoIterator;

/// Specifies a set of [`Signal`]s that may be blocked, waited for, etc.
// We are using `transparent` here to be super sure that `SigSet`
// is represented exactly like the `sigset_t` struct from C.
#[repr(transparent)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct SigSet {
sigset: libc::sigset_t
Expand Down

0 comments on commit ab6e19c

Please sign in to comment.