xref: /trunk/main/sal/inc/osl/signal.h (revision ffd38472365e95f6a578737bc9a5eb0fac624a86)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef _OSL_SIGNAL_H_
23 #define _OSL_SIGNAL_H_
24 
25 #include "sal/types.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #define OSL_SIGNAL_USER_RESERVED    0
32 
33 #define OSL_SIGNAL_USER_RESOURCEFAILURE     (OSL_SIGNAL_USER_RESERVED - 1)
34 #define OSL_SIGNAL_USER_X11SUBSYSTEMERROR   (OSL_SIGNAL_USER_RESERVED - 2)
35 #define OSL_SIGNAL_USER_RVPCONNECTIONERROR  (OSL_SIGNAL_USER_RESERVED - 3)
36 
37 typedef void* oslSignalHandler;
38 
39 typedef enum
40 {
41     osl_Signal_System,
42     osl_Signal_Terminate,
43     osl_Signal_AccessViolation,
44     osl_Signal_IntegerDivideByZero,
45     osl_Signal_FloatDivideByZero,
46     osl_Signal_DebugBreak,
47     osl_Signal_User,
48     osl_Signal_Alarm,
49     osl_Signal_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
50 } oslSignal;
51 
52 typedef enum
53 {
54     osl_Signal_ActCallNextHdl,
55     osl_Signal_ActIgnore,
56     osl_Signal_ActAbortApp,
57     osl_Signal_ActKillApp,
58     osl_Signal_Act_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
59 } oslSignalAction;
60 
61 #ifdef SAL_W32
62 #   pragma pack(push, 8)
63 #elif defined(SAL_OS2)
64 #   pragma pack(push, 4)
65 #endif
66 
67 typedef struct
68 {
69     oslSignal   Signal;
70     sal_Int32   UserSignal;
71     void*       UserData;
72 } oslSignalInfo;
73 
74 #if defined( SAL_W32) || defined(SAL_OS2)
75 #   pragma pack(pop)
76 #endif
77 
78 /** the function-ptr. representing the signal handler-function.
79 */
80 typedef oslSignalAction (SAL_CALL *oslSignalHandlerFunction)(void* pData, oslSignalInfo* pInfo);
81 
82 oslSignalHandler SAL_CALL osl_addSignalHandler(oslSignalHandlerFunction Handler, void* pData);
83 
84 sal_Bool SAL_CALL osl_removeSignalHandler(oslSignalHandler hHandler);
85 
86 oslSignalAction SAL_CALL osl_raiseSignal(sal_Int32 UserSignal, void* UserData);
87 
88 /** Enables or disables error reporting
89 
90     On default error reporting is enabled after process startup.
91 
92     @param  bEnable [in]
93     Enables or disables error reporting.
94 
95     @return
96     sal_True if previous state of error reporting was enabled<br>
97     sal_False if previous state of error reporting was disabled<br>
98 */
99 
100 sal_Bool SAL_CALL osl_setErrorReporting( sal_Bool bEnable );
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif  /* _OSL_SIGNAL_H_ */
107