xref: /AOO41X/main/sal/inc/osl/signal.h (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _OSL_SIGNAL_H_
29 #define _OSL_SIGNAL_H_
30 
31 #include "sal/types.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #define OSL_SIGNAL_USER_RESERVED	0
38 
39 #define OSL_SIGNAL_USER_RESOURCEFAILURE		(OSL_SIGNAL_USER_RESERVED - 1)
40 #define OSL_SIGNAL_USER_X11SUBSYSTEMERROR 	(OSL_SIGNAL_USER_RESERVED - 2)
41 #define OSL_SIGNAL_USER_RVPCONNECTIONERROR 	(OSL_SIGNAL_USER_RESERVED - 3)
42 
43 typedef void* oslSignalHandler;
44 
45 typedef enum
46 {
47 	osl_Signal_System,
48 	osl_Signal_Terminate,
49 	osl_Signal_AccessViolation,
50 	osl_Signal_IntegerDivideByZero,
51 	osl_Signal_FloatDivideByZero,
52 	osl_Signal_DebugBreak,
53 	osl_Signal_User,
54 	osl_Signal_Alarm,
55 	osl_Signal_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
56 } oslSignal;
57 
58 typedef enum
59 {
60 	osl_Signal_ActCallNextHdl,
61 	osl_Signal_ActIgnore,
62 	osl_Signal_ActAbortApp,
63 	osl_Signal_ActKillApp,
64 	osl_Signal_Act_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
65 } oslSignalAction;
66 
67 #ifdef SAL_W32
68 #	pragma pack(push, 8)
69 #elif defined(SAL_OS2)
70 #	pragma pack(push, 4)
71 #endif
72 
73 typedef struct
74 {
75 	oslSignal	Signal;
76 	sal_Int32	UserSignal;
77 	void* 		UserData;
78 } oslSignalInfo;
79 
80 #if defined( SAL_W32) ||  defined(SAL_OS2)
81 #	pragma pack(pop)
82 #endif
83 
84 /** the function-ptr. representing the signal handler-function.
85 */
86 typedef oslSignalAction (SAL_CALL *oslSignalHandlerFunction)(void* pData, oslSignalInfo* pInfo);
87 
88 oslSignalHandler SAL_CALL osl_addSignalHandler(oslSignalHandlerFunction Handler, void* pData);
89 
90 sal_Bool SAL_CALL osl_removeSignalHandler(oslSignalHandler hHandler);
91 
92 oslSignalAction SAL_CALL osl_raiseSignal(sal_Int32 UserSignal, void* UserData);
93 
94 /** Enables or disables error reporting
95 
96 	On default error reporting is enabled after process startup.
97 
98 	@param	bEnable [in]
99 	Enables or disables error reporting.
100 
101 	@return
102 	sal_True if previous state of error reporting was enabled<br>
103 	sal_False if previous state of error reporting was disbaled<br>
104 */
105 
106 sal_Bool SAL_CALL osl_setErrorReporting( sal_Bool bEnable );
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif	/* _OSL_SIGNAL_H_ */
113 
114 
115