Skip to content

Commit b35135e

Browse files
committed
signal: Add basic signal implementation (only IGN & DFL are supported).
1 parent 2441900 commit b35135e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

signal/signal.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import _libc
2+
3+
4+
SIG_DFL = 0
5+
SIG_IGN = 1
6+
7+
SIGINT = 2
8+
SIGPIPE = 13
9+
SIGTERM = 15
10+
11+
libc = _libc.get()
12+
13+
signal_ = libc.func("i", "signal", "ii")
14+
15+
def signal(n, handler):
16+
if isinstance(handler, int):
17+
return signal_(n, handler)
18+
raise NotImplementedError

0 commit comments

Comments
 (0)