1 /*
2  * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef DFX_SIGNAL_LOCAL_HANDLER_H
16 #define DFX_SIGNAL_LOCAL_HANDLER_H
17 
18 #include <inttypes.h>
19 #include <signal.h>
20 #include <ucontext.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /**
27  * @brief get file descriptor when crash
28  * @param request info about process dump request
29  * @return file descriptor
30 */
31 typedef int (*CrashFdFunc) (const struct ProcessDumpRequest* request);
32 
33 /**
34  * the function to resolve sig of the process
35  *
36  * @param sig sig of process
37  * @param si the pointer tp siginfo
38  * @param context context
39  */
40 void DFX_SignalLocalHandler(int sig, siginfo_t *si, void *context);
41 
42 /**
43  * @brief get CrashFdFunc
44  * @param fn function name of CrashFdFunc
45  *
46 */
47 void DFX_GetCrashFdFunc(CrashFdFunc fn);
48 /**
49  * @brief install local signal handler
50  *
51 */
52 void DFX_InstallLocalSignalHandler(void);
53 
54 #ifdef __cplusplus
55 }
56 #endif
57 #endif
58