summaryrefslogtreecommitdiff
path: root/Cross.toml
diff options
context:
space:
mode:
authorGerman Maglione <gmaglione@redhat.com>2022-06-08 15:55:13 +0200
committerGerman Maglione <gmaglione@redhat.com>2022-07-12 17:25:51 +0200
commit3d44d276e768f47cefe301e3affbefd315dc1327 (patch)
tree4a2c5236c5325ad7e4d353bd8c0d285424761768 /Cross.toml
parent5f859d10dfd21b99405054d80392649adc392fd0 (diff)
downloadnix-3d44d276e768f47cefe301e3affbefd315dc1327.zip
SigSet: A new unsafe helper method to create a SigSet from a sigset_t
Currently, the only way to create a `SigSet` from a `sigset_t` object is by using pointer casts, like: ``` unsafe { let sigset = *(&sigset as *const libc::sigset_t as *const SigSet) }; ``` This is un-ergonomic for library creators with interfaces to C. So, let's add a new unsafe method that creates a `SigSet` from a `libc::sigset_t` object. We can't implement `From` since converting from `libc::sigset_t` to `SigSet` is unsafe, because objects of type `libc::sigset_t` must be initialized by calling either `sigemptyset(3)` or `sigfillset(3)` before being used. In other case, the results are undefined. We can't implement `TryFrom` either, because there is no way to check if an object of type `libc::sigset_t` is initialized. Signed-off-by: German Maglione <gmaglione@redhat.com>
Diffstat (limited to 'Cross.toml')
0 files changed, 0 insertions, 0 deletions