2014-09-22 13:43:27 +04:00
/*
Unix SMB / CIFS implementation .
Critical Fault handling
Copyright ( C ) Andrew Tridgell 1992 - 1998
Copyright ( C ) Tim Prouty 2009
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 3 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
# ifndef _SAMBA_FAULT_H_
# define _SAMBA_FAULT_H_
# include <sys/types.h>
# include "attr.h"
2015-01-08 12:24:36 +03:00
2015-03-05 13:26:46 +03:00
/* Please include header file debug.h if you want to use macro SMB_ASSERT */
2014-09-22 13:43:27 +04:00
/**
* assert macros
*/
2015-01-08 12:24:36 +03:00
# ifdef _SAMBA_DEBUG_H
2014-09-22 13:43:27 +04:00
# define SMB_ASSERT(b) \
do { \
2022-08-18 17:06:02 +03:00
if ( unlikely ( ! ( b ) ) ) { \
2014-09-22 13:43:27 +04:00
DEBUG ( 0 , ( " PANIC: assert failed at %s(%d): %s \n " , \
__FILE__ , __LINE__ , # b ) ) ; \
smb_panic ( " assert failed: " # b ) ; \
} \
} while ( 0 )
2015-01-08 12:24:36 +03:00
# endif /* _SAMBA_DEBUG_H */
2014-09-22 13:43:27 +04:00
extern const char * panic_action ;
/**
Something really nasty happened - panic !
* */
typedef void ( * smb_panic_handler_t ) ( const char * why ) ;
void fault_configure ( smb_panic_handler_t panic_handler ) ;
void fault_setup ( void ) ;
void fault_setup_disable ( void ) ;
_NORETURN_ void smb_panic ( const char * reason ) ;
2020-02-26 02:02:36 +03:00
void smb_panic_log ( const char * reason ) ;
2014-09-22 13:43:27 +04:00
2018-04-10 07:35:07 +03:00
void log_stack_trace ( void ) ;
2014-09-22 13:43:27 +04:00
# endif /* _SAMBA_FAULT_H_ */