blob: a6f69fff3e8fb66ac5d7e922a1f9726f8df95195 (
plain)
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
|
#include <mlibc/ansi-sysdeps.hpp>
#include <mlibc/debug.hpp>
#include <aero/syscall.h>
#include <sys/types.h>
#define LOG_SIGACTION_INSTALL 0
extern "C" void __mlibc_signal_restore(); // defined in `signals.S`
namespace mlibc {
int sys_sigaction(int how, const struct sigaction *__restrict action,
struct sigaction *__restrict old_action) {
#if LOG_SIGACTION_INSTALL
mlibc::infoLogger() << "sys_sigaction: signal " << how << frg::endlog;
mlibc::infoLogger() << "sys_sigaction: size: " << sizeof(*action)
<< frg::endlog;
if (action != NULL) {
mlibc::infoLogger() << "sys_sigaction: handler "
<< (int64_t)action->sa_handler << frg::endlog;
mlibc::infoLogger() << "sys_sigaction: action "
<< (int64_t)action->sa_sigaction << frg::endlog;
mlibc::infoLogger() << "sys_sigaction: flags "
<< (int64_t)action->sa_flags << frg::endlog;
}
mlibc::infoLogger() << frg::endlog;
#endif
auto sigreturn = (sc_word_t)__mlibc_signal_restore;
auto res = syscall(SYS_SIGACTION, how, (sc_word_t)action, sigreturn,
(sc_word_t)old_action);
if (res < 0) {
return -res;
}
return 0;
}
int sys_sigprocmask(int how, const sigset_t *__restrict set,
sigset_t *__restrict retrieve) {
auto result = syscall(SYS_SIGPROCMASK, how, set, retrieve);
if (result < 0) {
return -result;
}
return 0;
}
} // namespace mlibc
|