messages_ctdb: Use message_hdr_[get/put]
[Samba.git] / lib / util / fault.h
blob0ac6cb9ceb5a428fe130a339ac0c9e9f7f27b298
1 /*
2 Unix SMB/CIFS implementation.
3 Critical Fault handling
4 Copyright (C) Andrew Tridgell 1992-1998
5 Copyright (C) Tim Prouty 2009
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef _SAMBA_FAULT_H_
22 #define _SAMBA_FAULT_H_
24 #include <sys/types.h>
26 #include "attr.h"
28 /* Please include header file debug.h if you want to use macro SMB_ASSERT */
30 /**
31 * assert macros
33 #ifdef _SAMBA_DEBUG_H
34 #define SMB_ASSERT(b) \
35 do { \
36 if (!(b)) { \
37 DEBUG(0,("PANIC: assert failed at %s(%d): %s\n", \
38 __FILE__, __LINE__, #b)); \
39 smb_panic("assert failed: " #b); \
40 } \
41 } while(0)
42 #endif /* _SAMBA_DEBUG_H */
44 extern const char *panic_action;
46 /**
47 Something really nasty happened - panic !
48 **/
49 typedef void (*smb_panic_handler_t)(const char *why);
51 void fault_configure(smb_panic_handler_t panic_handler);
52 void fault_setup(void);
53 void fault_setup_disable(void);
54 _NORETURN_ void smb_panic(const char *reason);
57 #endif /* _SAMBA_FAULT_H_ */