From: Martin Schwenke Date: Mon, 22 Sep 2014 09:43:27 +0000 (+1000) Subject: lib/util: Clean up includes for fault.c X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=8dac190ee1bc0e7f6d17eeca097f027fcaf584ed;p=metze%2Fsamba%2Fwip.git lib/util: Clean up includes for fault.c Add fault.h. Allows standalone compiles without external includes.h. Signed-off-by: Martin Schwenke Reviewed-by: Jeremy Allison --- diff --git a/lib/util/fault.c b/lib/util/fault.c index 78d91775472a..54d847117423 100644 --- a/lib/util/fault.c +++ b/lib/util/fault.c @@ -18,8 +18,9 @@ along with this program. If not, see . */ -#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 #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; diff --git a/lib/util/fault.h b/lib/util/fault.h new file mode 100644 index 000000000000..98a24a347093 --- /dev/null +++ b/lib/util/fault.h @@ -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 . +*/ + +#ifndef _SAMBA_FAULT_H_ +#define _SAMBA_FAULT_H_ + +#include + +#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_ */ diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h index b9ee211a9c1e..2578af80f694 100644 --- a/lib/util/samba_util.h +++ b/lib/util/samba_util.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. diff --git a/lib/util/wscript_build b/lib/util/wscript_build index 88fb171b4086..0a29fbcf333d 100755 --- a/lib/util/wscript_build +++ b/lib/util/wscript_build @@ -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',