/* * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _SIGCHAIN_H #define _SIGCHAIN_H #ifdef __cplusplus extern "C" { #endif #define _GNU_SOURCE #include #include #include static const int SIGCHAIN_ALLOW_NORETURN = 0x1UL; /* The action of the sigchain. */ struct signal_chain_action { bool (*sca_sigaction)(int, siginfo_t*, void*); sigset_t sca_mask; int sca_flags; }; /* Mark the signal to the sigchain, add the special handler to the sigchain. */ void add_special_signal_handler(int signo, struct signal_chain_action* sa); /* Remove the special the handler form the sigchain. */ void remove_special_signal_handler(int signo, bool (*fn)(int, siginfo_t*, void*)); #ifdef __cplusplus } #endif #endif