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