Skip to content

Commit b207aae

Browse files
committed
SigSet: Add the repr(transparent) attribute
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 <[email protected]>
1 parent 3d44d27 commit b207aae

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
3939
(#[1739](https://github.com/nix-rust/nix/pull/1739))
4040
- Changed `gethostname` to return an owned `OsString`.
4141
(#[1745](https://github.com/nix-rust/nix/pull/1745))
42+
- `signal:SigSet` is now marked as `repr(transparent)`.
43+
(#[1741](https://github.com/nix-rust/nix/pull/1741))
4244

4345
### Fixed
4446

src/sys/signal.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,9 @@ use std::iter::FromIterator;
465465
use std::iter::IntoIterator;
466466

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

0 commit comments

Comments
 (0)