/*1* Copyright 2021 The Emscripten Authors. All rights reserved.2* Emscripten is available under two separate licenses, the MIT license and the3* University of Illinois/NCSA Open Source License. Both these licenses can be4* found in the LICENSE file.5*/67#include <stdio.h>8#include <signal.h>9#include <errno.h>10#include "libc.h"1112struct sigaction __sig_actions[_NSIG];1314int __sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old) {15if (sig < 0 || sig >= _NSIG) {16errno = EINVAL;17return -1;18}1920if (old) {21*old = __sig_actions[sig];22}2324if (sa) {25__sig_actions[sig] = *sa;26}2728return 0;29}3031weak_alias(__sigaction, sigaction);323334