1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//! C FFI for [`crate::signal`].
//!
//! The exposed surface is deliberately per-platform, matching what the
//! native backend actually compiles (see `signal/mod.rs`'s `cfg` gates):
//!
//! - **Windows**: [`dtact_util_signal_ctrl_c`] / [`dtact_util_signal_ctrl_break`] /
//! [`dtact_util_signal_ctrl_close`] / [`dtact_util_signal_ctrl_logoff`] /
//! [`dtact_util_signal_ctrl_shutdown`] (there is no general POSIX-signal
//! delivery on Windows).
//! - **Unix**: [`dtact_util_signal_register`] for an arbitrary signal number
//! (`SIGINT`, `SIGTERM`, `SIGUSR1`, ...).
//!
//! Both platforms share [`dtact_util_signal_recv`] (blocking wait for the
//! next delivery) and [`dtact_util_signal_free`].
use crate;
use crateDtactSignalStream;
/// Register a listener for a raw signal number (`libc::SIGINT` etc.),
/// returning an owning handle. Free with [`dtact_util_signal_free`].
///
/// # Safety
///
/// See the [`crate::ffi`] module-level Safety contract. Takes no pointers.
pub unsafe extern "C"
/// Register a listener for Ctrl+C (`CTRL_C_EVENT`), returning an owning
/// handle. Free with [`dtact_util_signal_free`].
///
/// # Safety
///
/// See the [`crate::ffi`] module-level Safety contract. Takes no pointers.
pub unsafe extern "C"
/// Register a listener for Ctrl+Break (`CTRL_BREAK_EVENT`), returning an
/// owning handle. Free with [`dtact_util_signal_free`].
///
/// # Safety
///
/// See the [`crate::ffi`] module-level Safety contract. Takes no pointers.
pub unsafe extern "C"
/// Register a listener for console-window-close (`CTRL_CLOSE_EVENT`),
/// returning an owning handle. Free with [`dtact_util_signal_free`].
///
/// # Safety
///
/// See the [`crate::ffi`] module-level Safety contract. Takes no pointers.
pub unsafe extern "C"
/// Register a listener for user-logoff (`CTRL_LOGOFF_EVENT`), returning an
/// owning handle. Free with [`dtact_util_signal_free`].
///
/// # Safety
///
/// See the [`crate::ffi`] module-level Safety contract. Takes no pointers.
pub unsafe extern "C"
/// Register a listener for system-shutdown (`CTRL_SHUTDOWN_EVENT`),
/// returning an owning handle. Free with [`dtact_util_signal_free`].
///
/// # Safety
///
/// See the [`crate::ffi`] module-level Safety contract. Takes no pointers.
pub unsafe extern "C"
/// Block until this signal is next delivered.
///
/// # Safety
///
/// See the [`crate::ffi`] module-level Safety contract. `stream` must be a
/// live handle from one of the signal constructors above.
pub unsafe extern "C"
/// Free a signal listener handle. Passing null is a no-op.
///
/// # Safety
///
/// See the [`crate::ffi`] module-level Safety contract.
pub unsafe extern "C"