lib/util: Clean up includes for fault.c
authorMartin Schwenke <martin@meltin.net>
Mon, 22 Sep 2014 09:43:27 +0000 (19:43 +1000)
committerJeremy Allison <jra@samba.org>
Fri, 3 Oct 2014 22:11:21 +0000 (00:11 +0200)
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>
lib/util/fault.c
lib/util/fault.h [new file with mode: 0644]
lib/util/samba_util.h
lib/util/wscript_build

index 78d91775472aa0dace5718360a587f1ed4512555..54d847117423df8279a68f4335bd972c513d4571 100644 (file)
@@ -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
 #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;
diff --git a/lib/util/fault.h b/lib/util/fault.h
new file mode 100644 (file)
index 0000000..98a24a3
--- /dev/null
@@ -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_ */
index b9ee211a9c1e625f29d093af703fb3b67b302a0f..2578af80f694d8ac327d61b052a83fdfc8a178a5 100644 (file)
@@ -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. 
index 88fb171b40866b928303b978d77057f2ebed00b6..0a29fbcf333d5635761b94b253a9d38804724267 100755 (executable)
@@ -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',