mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
lib/util: Clean up includes for fault.c
Add fault.h. Allows standalone compiles without external includes.h. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
d92940819f
commit
8dac190ee1
@ -18,8 +18,9 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "replace.h"
|
||||
#include "system/filesys.h"
|
||||
#include "system/wait.h"
|
||||
#include "version.h"
|
||||
|
||||
#ifdef HAVE_SYS_SYSCTL_H
|
||||
@ -31,6 +32,11 @@
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
#include "lib/util/signal.h" /* Avoid /usr/include/signal.h */
|
||||
#include "substitute.h"
|
||||
#include "fault.h"
|
||||
|
||||
static struct {
|
||||
bool disabled;
|
||||
smb_panic_handler_t panic_handler;
|
||||
|
54
lib/util/fault.h
Normal file
54
lib/util/fault.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
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"
|
||||
#include "debug.h"
|
||||
|
||||
/**
|
||||
* assert macros
|
||||
*/
|
||||
#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)
|
||||
|
||||
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);
|
||||
|
||||
|
||||
#endif /* _SAMBA_FAULT_H_ */
|
@ -45,18 +45,6 @@ extern const char *panic_action;
|
||||
#include "lib/util/byteorder.h"
|
||||
#include "lib/util/talloc_stack.h"
|
||||
|
||||
/**
|
||||
* assert macros
|
||||
*/
|
||||
#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)
|
||||
|
||||
#ifndef ABS
|
||||
#define ABS(a) ((a)>0?(a):(-(a)))
|
||||
#endif
|
||||
@ -66,22 +54,14 @@ do { \
|
||||
#include "../libcli/util/ntstatus.h"
|
||||
#include "lib/util/string_wrappers.h"
|
||||
|
||||
#include "fault.h"
|
||||
|
||||
/**
|
||||
* Write backtrace to debug log
|
||||
*/
|
||||
_PUBLIC_ void call_backtrace(void);
|
||||
|
||||
/**
|
||||
Something really nasty happened - panic !
|
||||
**/
|
||||
typedef void (*smb_panic_handler_t)(const char *why);
|
||||
|
||||
_PUBLIC_ void fault_configure(smb_panic_handler_t panic_handler);
|
||||
_PUBLIC_ void fault_setup(void);
|
||||
_PUBLIC_ void fault_setup_disable(void);
|
||||
_PUBLIC_ void dump_core_setup(const char *progname, const char *logfile);
|
||||
_PUBLIC_ _NORETURN_ void smb_panic(const char *reason);
|
||||
|
||||
|
||||
/**
|
||||
register a fault handler.
|
||||
|
@ -42,7 +42,7 @@ bld.SAMBA_LIBRARY('samba-util',
|
||||
tevent_debug.c util_process.c memcache.c''',
|
||||
deps='DYNCONFIG time-basic close-low-fd samba-debug tini tiniparser socket-blocking',
|
||||
public_deps='talloc tevent execinfo pthread LIBCRYPTO charset util_setid systemd-daemon',
|
||||
public_headers='debug.h attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h xfile.h dlinklist.h samba_util.h string_wrappers.h idtree.h idtree_random.h blocking.h signal.h substitute.h',
|
||||
public_headers='debug.h attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h xfile.h dlinklist.h samba_util.h string_wrappers.h idtree.h idtree_random.h blocking.h signal.h substitute.h fault.h',
|
||||
header_path= [ ('dlinklist.h samba_util.h', '.'), ('*', 'util') ],
|
||||
local_include=False,
|
||||
vnum='0.0.1',
|
||||
|
Loading…
x
Reference in New Issue
Block a user