xref: /aoo4110/main/sal/inc/osl/signal.h (revision b1cdbd2c)
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 
23 
24 #ifndef _OSL_SIGNAL_H_
25 #define _OSL_SIGNAL_H_
26 
27 #include "sal/types.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #define OSL_SIGNAL_USER_RESERVED	0
34 
35 #define OSL_SIGNAL_USER_RESOURCEFAILURE		(OSL_SIGNAL_USER_RESERVED - 1)
36 #define OSL_SIGNAL_USER_X11SUBSYSTEMERROR 	(OSL_SIGNAL_USER_RESERVED - 2)
37 #define OSL_SIGNAL_USER_RVPCONNECTIONERROR 	(OSL_SIGNAL_USER_RESERVED - 3)
38 
39 typedef void* oslSignalHandler;
40 
41 typedef enum
42 {
43 	osl_Signal_System,
44 	osl_Signal_Terminate,
45 	osl_Signal_AccessViolation,
46 	osl_Signal_IntegerDivideByZero,
47 	osl_Signal_FloatDivideByZero,
48 	osl_Signal_DebugBreak,
49 	osl_Signal_User,
50 	osl_Signal_Alarm,
51 	osl_Signal_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
52 } oslSignal;
53 
54 typedef enum
55 {
56 	osl_Signal_ActCallNextHdl,
57 	osl_Signal_ActIgnore,
58 	osl_Signal_ActAbortApp,
59 	osl_Signal_ActKillApp,
60 	osl_Signal_Act_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
61 } oslSignalAction;
62 
63 #ifdef SAL_W32
64 #	pragma pack(push, 8)
65 #elif defined(SAL_OS2)
66 #	pragma pack(push, 4)
67 #endif
68 
69 typedef struct
70 {
71 	oslSignal	Signal;
72 	sal_Int32	UserSignal;
73 	void* 		UserData;
74 } oslSignalInfo;
75 
76 #if defined( SAL_W32) ||  defined(SAL_OS2)
77 #	pragma pack(pop)
78 #endif
79 
80 /** the function-ptr. representing the signal handler-function.
81 */
82 typedef oslSignalAction (SAL_CALL *oslSignalHandlerFunction)(void* pData, oslSignalInfo* pInfo);
83 
84 oslSignalHandler SAL_CALL osl_addSignalHandler(oslSignalHandlerFunction Handler, void* pData);
85 
86 sal_Bool SAL_CALL osl_removeSignalHandler(oslSignalHandler hHandler);
87 
88 oslSignalAction SAL_CALL osl_raiseSignal(sal_Int32 UserSignal, void* UserData);
89 
90 /** Enables or disables error reporting
91 
92 	On default error reporting is enabled after process startup.
93 
94 	@param	bEnable [in]
95 	Enables or disables error reporting.
96 
97 	@return
98 	sal_True if previous state of error reporting was enabled<br>
99 	sal_False if previous state of error reporting was disbaled<br>
100 */
101 
102 sal_Bool SAL_CALL osl_setErrorReporting( sal_Bool bEnable );
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #endif	/* _OSL_SIGNAL_H_ */
109 
110 
111