Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
Makefile.am | 2 +-
configure.ac | 1 +
docs/Makefile.am | 2 +-
docs/man8/qb-blackbox.8 | 59 +++++++++++++++++++++++++++++++++++++++++++++++
libqb.spec.in | 1 +
tools/.gitignore | 1 +
tools/Makefile.am | 28 ++++++++++++++++++++++
tools/qb_blackbox.c | 29 +++++++++++++++++++++++
8 files changed, 121 insertions(+), 2 deletions(-)
create mode 100644 docs/man8/qb-blackbox.8
create mode 100644 tools/.gitignore
create mode 100644 tools/Makefile.am
create mode 100644 tools/qb_blackbox.c
diff --git a/Makefile.am b/Makefile.am
index 099e1d0..74a464e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,7 +41,7 @@ ACLOCAL_AMFLAGS = -I m4
dist_doc_DATA = COPYING INSTALL README.markdown
-SUBDIRS = include lib docs tests examples
+SUBDIRS = include lib docs tools tests examples
doxygen:
$(MAKE) -C docs doxygen
diff --git a/configure.ac b/configure.ac
index ace78b4..5de6604 100644
--- a/configure.ac
+++ b/configure.ac
@@ -530,6 +530,7 @@ AC_CONFIG_FILES([Makefile
include/qb/Makefile
lib/Makefile
lib/libqb.pc
+ tools/Makefile
tests/Makefile
examples/Makefile
docs/Makefile
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 257ddd4..9e5439c 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -27,7 +27,7 @@ dependant_headers = $(wildcard $(inc_dir)/qb*.h)
dist_man_MANS = man3/qbipcc.h.3 man3/qbipcs.h.3 man3/qbatomic.h.3 \
man3/qbhdb.h.3 man3/qbipc_common.h.3 man3/qblist.h.3 \
man3/qbloop.h.3 man3/qbutil.h.3 man3/qbarray.h.3 \
- man3/qblog.h.3 man3/qbmap.h.3
+ man3/qblog.h.3 man3/qbmap.h.3 man8/qb-blackbox.8
$(dist_man_MANS): man.dox $(dependant_headers)
diff --git a/docs/man8/qb-blackbox.8 b/docs/man8/qb-blackbox.8
new file mode 100644
index 0000000..976848c
--- /dev/null
+++ b/docs/man8/qb-blackbox.8
@@ -0,0 +1,59 @@
+.\"/*
+.\" * Copyright (C) 2012 Red Hat, Inc.
+.\" *
+.\" * Author: Angus Salkeld <asalkeld(a)redhat.com>
+.\" *
+.\" * This file is part of libqb.
+.\" *
+.\" * libqb is free software: you can redistribute it and/or modify
+.\" * it under the terms of the GNU Lesser General Public License as published by
+.\" * the Free Software Foundation, either version 2.1 of the License, or
+.\" * (at your option) any later version.
+.\" *
+.\" * libqb 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 Lesser General Public License for more details.
+.\" *
+.\" * You should have received a copy of the GNU Lesser General Public License
+.\" * along with libqb. If not, see <
http://www.gnu.org/licenses/>.
+.\" */
+.TH QB-BLACKBOX 8 2012-05-28
+.SH NAME
+qb-blackbox \- Display "flight data" from the "blackbox".
+.SH SYNOPSIS
+.B "qb-blackbox <blackbox files>..."
+.SH DESCRIPTION
+.B qb-blackbox
+Print out the logs (including debug logs) that were recorded using libqb's blackbox.
+.SH EXAMPLES
+.TP
+Get info to help developers diagnose a crash.
+.br
+$ qb-blackbox /var/lib/corosync/fdata
+.br
+Dumping the contents of /var/lib/corosync/fdata
+.br
+Mar 23 20:58:57 message_handler_orf_token():3677 install seq 0 aru 0 high seq received 0
+.br
+Mar 23 20:58:57 message_handler_orf_token():3696 retrans flag count 4 token aru 0 install
seq 0 aru 0 0
+.br
+Mar 23 20:58:57 old_ring_state_reset():1487 Resetting old ring state
+.br
+Mar 23 20:58:57 deliver_messages_from_recovery_to_regular():1693 recovery to regular 1-0
+.br
+Mar 23 20:58:57 memb_state_operational_enter():1779 Delivering to app 1 to 0
+.br
+Mar 23 20:58:57 sync_abort():594 ENTERING sync_abort()
+.br
+Mar 23 20:58:57 sync_save_transitional():586 ENTERING sync_save_transitional()
+.br
+Mar 23 20:58:57 member_object_joined():301 Member joined: r(0) ip(192.168.122.1)
+.br
+Mar 23 20:58:57 sync_abort():594 ENTERING sync_abort()
+.br
+.SH SEE ALSO
+.BR qblog.h (3),
+.SH AUTHOR
+Angus Salkeld
+.PP
diff --git a/libqb.spec.in b/libqb.spec.in
index f734656..afba44e 100644
--- a/libqb.spec.in
+++ b/libqb.spec.in
@@ -46,6 +46,7 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc COPYING
+%{_sbindir}/qb-blackbox
%{_libdir}/libqb.so.*
%package devel
diff --git a/tools/.gitignore b/tools/.gitignore
new file mode 100644
index 0000000..0a87671
--- /dev/null
+++ b/tools/.gitignore
@@ -0,0 +1 @@
+qb-blackbox
diff --git a/tools/Makefile.am b/tools/Makefile.am
new file mode 100644
index 0000000..7125831
--- /dev/null
+++ b/tools/Makefile.am
@@ -0,0 +1,28 @@
+# Copyright (c) 2011 Red Hat, Inc.
+#
+# Authors: Angus Salkeld <asalkeld(a)redhat.com>
+#
+# This file is part of libqb.
+#
+# libqb is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# libqb 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with libqb. If not, see <
http://www.gnu.org/licenses/>.
+#
+MAINTAINERCLEANFILES = Makefiles.in
+EXTRA_DIST =
+CLEANFILES =
+
+sbin_PROGRAMS = qb-blackbox
+
+qb_blackbox_SOURCES = qb_blackbox.c $(top_builddir)/include/qb/qblog.h
+qb_blackbox_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
+qb_blackbox_LDADD = $(LIB_RT) $(top_builddir)/lib/libqb.la
diff --git a/tools/qb_blackbox.c b/tools/qb_blackbox.c
new file mode 100644
index 0000000..0b3f310
--- /dev/null
+++ b/tools/qb_blackbox.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2012 Andrew Beekhof <andrew(a)beekhof.net>
+ *
+ * libqb is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * libqb 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libqb. If not, see <
http://www.gnu.org/licenses/>.
+ */
+
+#include <qb/qblog.h>
+
+int
+main(int argc, char **argv)
+{
+ int lpc = 0;
+ for(lpc = 1; lpc < argc && argv[lpc] != NULL; lpc++) {
+ printf("Dumping the contents of %s\n", argv[lpc]);
+ qb_log_blackbox_print_from_file(argv[lpc]);
+ }
+ return 0;
+}
--
1.7.10.2