From e7d19e2a58f08c432d2e90f025ba019e6ee7edcf Mon Sep 17 00:00:00 2001 From: Jeremy Soller <jeremy@system76.com> Date: Thu, 8 Aug 2019 20:06:38 -0600 Subject: [PATCH] Move SIG_IGN and friends to C in order to define them correctly --- include/bits/signal.h | 8 ++++++++ src/header/signal/cbindgen.toml | 1 + src/header/signal/mod.rs | 6 +++--- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 include/bits/signal.h diff --git a/include/bits/signal.h b/include/bits/signal.h new file mode 100644 index 000000000..46cc2553e --- /dev/null +++ b/include/bits/signal.h @@ -0,0 +1,8 @@ +#ifndef _BITS_SIGNAL_H +#define _BITS_SIGNAL_H + +#define SIG_DFL ((void (*)(int))0) +#define SIG_IGN ((void (*)(int))1) +#define SIG_ERR ((void (*)(int))-1) + +#endif // _BITS_SIGNAL_H diff --git a/src/header/signal/cbindgen.toml b/src/header/signal/cbindgen.toml index cbcd1afc4..73a7c9e41 100644 --- a/src/header/signal/cbindgen.toml +++ b/src/header/signal/cbindgen.toml @@ -1,5 +1,6 @@ sys_includes = ["stdint.h", "sys/types.h"] include_guard = "_SIGNAL_H" +trailer = "#include <bits/signal.h>" language = "C" style = "Tag" no_includes = true diff --git a/src/header/signal/mod.rs b/src/header/signal/mod.rs index d8cb65cb6..0ce5ec9d4 100644 --- a/src/header/signal/mod.rs +++ b/src/header/signal/mod.rs @@ -21,9 +21,9 @@ pub mod sys; type SigSet = BitSet<[c_ulong; 1]>; -pub const SIG_DFL: usize = 0; -pub const SIG_IGN: usize = 1; -pub const SIG_ERR: isize = -1; +pub (crate) const SIG_DFL: usize = 0; +pub (crate) const SIG_IGN: usize = 1; +pub (crate) const SIG_ERR: isize = -1; pub const SIG_BLOCK: c_int = 0; pub const SIG_UNBLOCK: c_int = 1; -- GitLab