1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/lib/util/fault.h
Andrew Bartlett f7fe6fa550 lib/util/fault.c: Unify printing of the stack trace with the INTERNAL ERROR string
We can diverged into the s3 and lib/fault panic action stuff once
we have printed the backtrace.

Our tests require we use the word PANIC, and some administrative scripts
might look for similar things, so keep those words.

The use of DEBUG(0, ... is deliberate to keep the output
of the PANIC line as consistent as possible with the historical smbd output.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Feb 27 05:09:44 UTC 2020 on sn-devel-184
2020-02-27 05:09:44 +00:00

60 lines
1.6 KiB
C

/*
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"
/* Please include header file debug.h if you want to use macro SMB_ASSERT */
/**
* assert macros
*/
#ifdef _SAMBA_DEBUG_H
#define SMB_ASSERT(b) \
do { \
if (!(b)) { \
DEBUG(0,("PANIC: assert failed at %s(%d): %s\n", \
__FILE__, __LINE__, #b)); \
smb_panic("assert failed: " #b); \
} \
} while(0)
#endif /* _SAMBA_DEBUG_H */
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);
void smb_panic_log(const char *reason);
void log_stack_trace(void);
#endif /* _SAMBA_FAULT_H_ */