Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/system/lib/libc/sigaction.c
6162 views
1
/*
2
* Copyright 2021 The Emscripten Authors. All rights reserved.
3
* Emscripten is available under two separate licenses, the MIT license and the
4
* University of Illinois/NCSA Open Source License. Both these licenses can be
5
* found in the LICENSE file.
6
*/
7
8
#include <stdio.h>
9
#include <signal.h>
10
#include <errno.h>
11
#include "libc.h"
12
13
struct sigaction __sig_actions[_NSIG];
14
15
int __sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old) {
16
if (sig < 0 || sig >= _NSIG) {
17
errno = EINVAL;
18
return -1;
19
}
20
21
if (old) {
22
*old = __sig_actions[sig];
23
}
24
25
if (sa) {
26
__sig_actions[sig] = *sa;
27
}
28
29
return 0;
30
}
31
32
weak_alias(__sigaction, sigaction);
33
34