problems with SCHED_IDLE
by Dietmar Maurer
I get the following error when compiling the latest source:
/bin/bash ../libtool --silent --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../include -I../include/qb -I../include -I../include -fPIC -Wall -Wshadow -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wdeclaration-after-statement -Wpointer-arith -Wwrite-strings -Wcast-align -Wbad-function-cast -Wmissing-format-attribute -Wformat=2 -Wformat-security -Wno-format-nonliteral -Wno-long-long -Wno-strict-aliasing -c -o libqb_la-log_thread.lo `test -f 'log_thread.c' || echo './'`log_thread.c
log_thread.c: In function \u2018qb_log_thread_priority_set\u2019:
log_thread.c:126: error: \u2018SCHED_IDLE\u2019 undeclared (first use in this function)
log_thread.c:126: error: (Each undeclared identifier is reported only once
log_thread.c:126: error: for each function it appears in.)
(using debian squeeze)
- Dietmar
12 years, 6 months
[PATCH] skiplist: destroy the list header last.
by Angus Salkeld
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
lib/skiplist.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/skiplist.c b/lib/skiplist.c
index 60e962d..ba1d33f 100644
--- a/lib/skiplist.c
+++ b/lib/skiplist.c
@@ -275,13 +275,16 @@ static void
skiplist_destroy(struct qb_map *map)
{
struct skiplist *list = (struct skiplist *)map;
- struct skiplist_node *cur_node = list->header;
+ struct skiplist_node *cur_node;
struct skiplist_node *fwd_node;
- do {
+ for (cur_node = skiplist_node_next(list->header);
+ cur_node;
+ cur_node = fwd_node) {
fwd_node = skiplist_node_next(cur_node);
skiplist_node_destroy(cur_node, list);
- } while ((cur_node = fwd_node));
+ }
+ skiplist_node_destroy(list->header, list);
free(list);
}
--
1.7.6.4
12 years, 6 months
[PATCH 1/3] Move simple-log.c to examples/
by Angus Salkeld
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
Makefile.am | 2 +-
configure.ac | 1 +
examples/.gitignore | 1 +
examples/Makefile.am | 28 ++++++
examples/simplelog.c | 224 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/.gitignore | 1 -
tests/Makefile.am | 7 +--
tests/simple-log.c | 224 --------------------------------------------------
8 files changed, 256 insertions(+), 232 deletions(-)
create mode 100644 examples/.gitignore
create mode 100644 examples/Makefile.am
create mode 100644 examples/simplelog.c
delete mode 100644 tests/simple-log.c
diff --git a/Makefile.am b/Makefile.am
index a64a7fc..09aa451 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
+SUBDIRS = include lib docs tests examples
doxygen:
$(MAKE) -C docs doxygen
diff --git a/configure.ac b/configure.ac
index c425e94..c8dcd2c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -450,6 +450,7 @@ AC_CONFIG_FILES([Makefile
lib/Makefile
lib/libqb.pc
tests/Makefile
+ examples/Makefile
docs/Makefile
docs/man.dox
docs/html.dox])
diff --git a/examples/.gitignore b/examples/.gitignore
new file mode 100644
index 0000000..097ac67
--- /dev/null
+++ b/examples/.gitignore
@@ -0,0 +1 @@
+simplelog
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..2b7cad8
--- /dev/null
+++ b/examples/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 =
+
+noinst_PROGRAMS = simplelog
+
+simplelog_SOURCES = simplelog.c $(top_builddir)/include/qb/qblog.h
+simplelog_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
+simplelog_LDADD = -lrt $(top_builddir)/lib/libqb.la
diff --git a/examples/simplelog.c b/examples/simplelog.c
new file mode 100644
index 0000000..ef57503
--- /dev/null
+++ b/examples/simplelog.c
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2011 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Angus Salkeld <asalkeld(a)redhat.com>
+ *
+ * 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 "os_base.h"
+#include <signal.h>
+#include <syslog.h>
+
+#include <qb/qbdefs.h>
+#include <qb/qblog.h>
+
+#define MY_TAG_ONE (1)
+#define MY_TAG_TWO (1 << 1)
+#define MY_TAG_THREE (1 << 2)
+
+static void func_one(void)
+{
+ FILE* fd;
+
+ qb_enter();
+ qb_logt(LOG_DEBUG, MY_TAG_TWO, "arf arf?");
+ qb_logt(LOG_CRIT, MY_TAG_THREE, "arrrg!");
+ qb_logt(134, MY_TAG_THREE, "big priority");
+ qb_logt(LOG_ERR, MY_TAG_THREE, "oops, I did it again");
+ qb_log(LOG_INFO, "are you aware ...");
+
+ fd = fopen("/nothing.txt", "r+");
+ if (fd == NULL) {
+ qb_perror(LOG_ERR, "can't open(\"/nothing.txt\")");
+ } else {
+ fclose(fd);
+ }
+ qb_leave();
+}
+
+static void func_two(void)
+{
+ qb_enter();
+ qb_logt(LOG_DEBUG, 0, "arf arf?");
+ qb_logt(LOG_CRIT, MY_TAG_ONE, "arrrg!");
+ qb_log(LOG_ERR, "oops, I did it again");
+ qb_logt(LOG_INFO, MY_TAG_THREE, "are you aware ...");
+ qb_leave();
+}
+
+static void show_usage(const char *name)
+{
+ printf("usage: \n");
+ printf("%s <options>\n", name);
+ printf("\n");
+ printf(" options:\n");
+ printf("\n");
+ printf(" -v verbose\n");
+ printf(" -t threaded logging\n");
+ printf(" -e log to stderr\n");
+ printf(" -b log to blackbox\n");
+ printf(" -f <filename> log to a file\n");
+ printf(" -h show this help text\n");
+ printf("\n");
+}
+
+static int32_t do_blackbox = QB_FALSE;
+static int32_t do_threaded = QB_FALSE;
+
+static void sigsegv_handler(int sig)
+{
+ (void)signal (SIGSEGV, SIG_DFL);
+ qb_log_fini();
+ if (do_blackbox) {
+ qb_log_blackbox_write_to_file("simple-log.fdata");
+ }
+ raise(SIGSEGV);
+}
+
+static const char *my_tags_stringify(uint32_t tags)
+{
+ if (qb_bit_is_set(tags, QB_LOG_TAG_LIBQB_MSG_BIT)) {
+ return "libqb";
+ } else if (qb_bit_is_set(tags, 0)) {
+ return "ONE";
+ } else if (qb_bit_is_set(tags, 1)) {
+ return "TWO";
+ } else if (qb_bit_is_set(tags, 2)) {
+ return "THREE";
+ } else {
+ return "MAIN";
+ }
+}
+
+static void
+trace_logger(int32_t t,
+ struct qb_log_callsite *cs,
+ time_t timestamp,
+ const char *msg)
+{
+ char output_buffer[QB_LOG_MAX_LEN];
+ qb_log_target_format(t, cs, timestamp, msg, output_buffer);
+ fprintf(stderr, "%s\n", output_buffer);
+}
+
+int32_t main(int32_t argc, char *argv[])
+{
+ const char *options = "vhtebdf:";
+ int32_t opt;
+ int32_t tracer;
+ int32_t priority = LOG_WARNING;
+ int32_t do_stderr = QB_FALSE;
+ int32_t do_dump_blackbox = QB_FALSE;
+ char *logfile = NULL;
+ int32_t log_fd = -1;
+
+ while ((opt = getopt(argc, argv, options)) != -1) {
+ switch (opt) {
+ case 'd':
+ do_dump_blackbox = QB_TRUE;
+ break;
+ case 't':
+ do_threaded = QB_TRUE;
+ break;
+ case 'e':
+ do_stderr = QB_TRUE;
+ break;
+ case 'b':
+ do_blackbox = QB_TRUE;
+ break;
+ case 'f':
+ logfile = optarg;
+ break;
+ case 'v':
+ priority++;
+ break;
+ case 'h':
+ default:
+ show_usage(argv[0]);
+ exit(0);
+ break;
+ }
+ }
+
+ if (do_dump_blackbox) {
+ qb_log_blackbox_print_from_file("simple-log.fdata");
+ exit(0);
+ }
+
+ signal(SIGSEGV, sigsegv_handler);
+
+ qb_log_init("simple-log", LOG_USER, LOG_INFO);
+ qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_THREADED, do_threaded);
+ qb_log_tags_stringify_fn_set(my_tags_stringify);
+
+ tracer = qb_log_custom_open(trace_logger, NULL, NULL, NULL);
+
+ if (do_stderr) {
+ qb_log_filter_ctl2(QB_LOG_STDERR, QB_LOG_FILTER_ADD,
+ QB_LOG_FILTER_FILE, __FILE__,
+ LOG_ALERT, QB_MIN(LOG_DEBUG, priority));
+ qb_log_format_set(QB_LOG_STDERR, "%4g: %f:%l [%p] %b");
+ qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE);
+
+ qb_log_ctl(tracer, QB_LOG_CONF_ENABLED, QB_TRUE);
+ qb_log_format_set(tracer, "%4g: %n() %b");
+ qb_log_filter_ctl2(tracer, QB_LOG_FILTER_ADD,
+ QB_LOG_FILTER_FILE, __FILE__,
+ LOG_TRACE, 200);
+ }
+ if (do_blackbox) {
+ qb_log_filter_ctl(QB_LOG_BLACKBOX, QB_LOG_FILTER_ADD,
+ QB_LOG_FILTER_FILE, "*", LOG_DEBUG);
+ qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_SIZE, 4096);
+ qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_THREADED, QB_FALSE);
+ qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_TRUE);
+ }
+ if (logfile) {
+ log_fd = qb_log_file_open(logfile);
+ qb_log_filter_ctl(log_fd, QB_LOG_FILTER_ADD,
+ QB_LOG_FILTER_FILE, __FILE__, priority);
+ qb_log_format_set(log_fd, "%t %n() [%p] %b");
+ qb_log_ctl(log_fd, QB_LOG_CONF_THREADED, do_threaded);
+ qb_log_ctl(log_fd, QB_LOG_CONF_ENABLED, QB_TRUE);
+ }
+ if (do_threaded) {
+ qb_log_thread_start();
+ }
+ qb_log(LOG_DEBUG, "hello");
+ qb_log(LOG_INFO, "this is an info");
+ qb_log(LOG_NOTICE, "hello - notice?");
+ func_one();
+ func_two();
+
+ qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_FALSE);
+
+ qb_log(LOG_WARNING, "no syslog");
+ qb_log(LOG_ERR, "no syslog");
+
+#if 0
+ // test blackbox
+ logfile = NULL;
+ logfile[5] = 'a';
+#endif
+ if (do_blackbox) {
+ qb_log_blackbox_write_to_file("simple-log.fdata");
+ qb_log_blackbox_print_from_file("simple-log.fdata");
+ qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_FALSE);
+ }
+ qb_log_fini();
+ return 0;
+}
+
diff --git a/tests/.gitignore b/tests/.gitignore
index aac425f..4b117ca 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -6,5 +6,4 @@ bms
loop
rbreader
rbwriter
-simple-log
write_logs.c
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a89bf26..fbe1ba0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,7 +21,7 @@ MAINTAINERCLEANFILES = Makefiles.in
EXTRA_DIST =
CLEANFILES =
-noinst_PROGRAMS = bmc bmcpt bms rbwriter rbreader loop simple-log bench-log
+noinst_PROGRAMS = bmc bmcpt bms rbwriter rbreader loop bench-log
bmc_SOURCES = bmc.c $(top_builddir)/include/qb/qbipcc.h
bmc_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
@@ -47,11 +47,6 @@ loop_SOURCES = loop.c $(top_builddir)/include/qb/qbloop.h
loop_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
loop_LDADD = -lrt $(top_builddir)/lib/libqb.la
-simple_log_SOURCES = simple-log.c $(top_builddir)/include/qb/qblog.h
-simple_log_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
-simple_log_LDADD = -lrt $(top_builddir)/lib/libqb.la
-
-
if HAVE_DICT_WORDS
EXTRA_DIST += make-log-test
CLEANFILES += write_logs.c
diff --git a/tests/simple-log.c b/tests/simple-log.c
deleted file mode 100644
index ef57503..0000000
--- a/tests/simple-log.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (c) 2011 Red Hat, Inc.
- *
- * All rights reserved.
- *
- * Author: Angus Salkeld <asalkeld(a)redhat.com>
- *
- * 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 "os_base.h"
-#include <signal.h>
-#include <syslog.h>
-
-#include <qb/qbdefs.h>
-#include <qb/qblog.h>
-
-#define MY_TAG_ONE (1)
-#define MY_TAG_TWO (1 << 1)
-#define MY_TAG_THREE (1 << 2)
-
-static void func_one(void)
-{
- FILE* fd;
-
- qb_enter();
- qb_logt(LOG_DEBUG, MY_TAG_TWO, "arf arf?");
- qb_logt(LOG_CRIT, MY_TAG_THREE, "arrrg!");
- qb_logt(134, MY_TAG_THREE, "big priority");
- qb_logt(LOG_ERR, MY_TAG_THREE, "oops, I did it again");
- qb_log(LOG_INFO, "are you aware ...");
-
- fd = fopen("/nothing.txt", "r+");
- if (fd == NULL) {
- qb_perror(LOG_ERR, "can't open(\"/nothing.txt\")");
- } else {
- fclose(fd);
- }
- qb_leave();
-}
-
-static void func_two(void)
-{
- qb_enter();
- qb_logt(LOG_DEBUG, 0, "arf arf?");
- qb_logt(LOG_CRIT, MY_TAG_ONE, "arrrg!");
- qb_log(LOG_ERR, "oops, I did it again");
- qb_logt(LOG_INFO, MY_TAG_THREE, "are you aware ...");
- qb_leave();
-}
-
-static void show_usage(const char *name)
-{
- printf("usage: \n");
- printf("%s <options>\n", name);
- printf("\n");
- printf(" options:\n");
- printf("\n");
- printf(" -v verbose\n");
- printf(" -t threaded logging\n");
- printf(" -e log to stderr\n");
- printf(" -b log to blackbox\n");
- printf(" -f <filename> log to a file\n");
- printf(" -h show this help text\n");
- printf("\n");
-}
-
-static int32_t do_blackbox = QB_FALSE;
-static int32_t do_threaded = QB_FALSE;
-
-static void sigsegv_handler(int sig)
-{
- (void)signal (SIGSEGV, SIG_DFL);
- qb_log_fini();
- if (do_blackbox) {
- qb_log_blackbox_write_to_file("simple-log.fdata");
- }
- raise(SIGSEGV);
-}
-
-static const char *my_tags_stringify(uint32_t tags)
-{
- if (qb_bit_is_set(tags, QB_LOG_TAG_LIBQB_MSG_BIT)) {
- return "libqb";
- } else if (qb_bit_is_set(tags, 0)) {
- return "ONE";
- } else if (qb_bit_is_set(tags, 1)) {
- return "TWO";
- } else if (qb_bit_is_set(tags, 2)) {
- return "THREE";
- } else {
- return "MAIN";
- }
-}
-
-static void
-trace_logger(int32_t t,
- struct qb_log_callsite *cs,
- time_t timestamp,
- const char *msg)
-{
- char output_buffer[QB_LOG_MAX_LEN];
- qb_log_target_format(t, cs, timestamp, msg, output_buffer);
- fprintf(stderr, "%s\n", output_buffer);
-}
-
-int32_t main(int32_t argc, char *argv[])
-{
- const char *options = "vhtebdf:";
- int32_t opt;
- int32_t tracer;
- int32_t priority = LOG_WARNING;
- int32_t do_stderr = QB_FALSE;
- int32_t do_dump_blackbox = QB_FALSE;
- char *logfile = NULL;
- int32_t log_fd = -1;
-
- while ((opt = getopt(argc, argv, options)) != -1) {
- switch (opt) {
- case 'd':
- do_dump_blackbox = QB_TRUE;
- break;
- case 't':
- do_threaded = QB_TRUE;
- break;
- case 'e':
- do_stderr = QB_TRUE;
- break;
- case 'b':
- do_blackbox = QB_TRUE;
- break;
- case 'f':
- logfile = optarg;
- break;
- case 'v':
- priority++;
- break;
- case 'h':
- default:
- show_usage(argv[0]);
- exit(0);
- break;
- }
- }
-
- if (do_dump_blackbox) {
- qb_log_blackbox_print_from_file("simple-log.fdata");
- exit(0);
- }
-
- signal(SIGSEGV, sigsegv_handler);
-
- qb_log_init("simple-log", LOG_USER, LOG_INFO);
- qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_THREADED, do_threaded);
- qb_log_tags_stringify_fn_set(my_tags_stringify);
-
- tracer = qb_log_custom_open(trace_logger, NULL, NULL, NULL);
-
- if (do_stderr) {
- qb_log_filter_ctl2(QB_LOG_STDERR, QB_LOG_FILTER_ADD,
- QB_LOG_FILTER_FILE, __FILE__,
- LOG_ALERT, QB_MIN(LOG_DEBUG, priority));
- qb_log_format_set(QB_LOG_STDERR, "%4g: %f:%l [%p] %b");
- qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE);
-
- qb_log_ctl(tracer, QB_LOG_CONF_ENABLED, QB_TRUE);
- qb_log_format_set(tracer, "%4g: %n() %b");
- qb_log_filter_ctl2(tracer, QB_LOG_FILTER_ADD,
- QB_LOG_FILTER_FILE, __FILE__,
- LOG_TRACE, 200);
- }
- if (do_blackbox) {
- qb_log_filter_ctl(QB_LOG_BLACKBOX, QB_LOG_FILTER_ADD,
- QB_LOG_FILTER_FILE, "*", LOG_DEBUG);
- qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_SIZE, 4096);
- qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_THREADED, QB_FALSE);
- qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_TRUE);
- }
- if (logfile) {
- log_fd = qb_log_file_open(logfile);
- qb_log_filter_ctl(log_fd, QB_LOG_FILTER_ADD,
- QB_LOG_FILTER_FILE, __FILE__, priority);
- qb_log_format_set(log_fd, "%t %n() [%p] %b");
- qb_log_ctl(log_fd, QB_LOG_CONF_THREADED, do_threaded);
- qb_log_ctl(log_fd, QB_LOG_CONF_ENABLED, QB_TRUE);
- }
- if (do_threaded) {
- qb_log_thread_start();
- }
- qb_log(LOG_DEBUG, "hello");
- qb_log(LOG_INFO, "this is an info");
- qb_log(LOG_NOTICE, "hello - notice?");
- func_one();
- func_two();
-
- qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_FALSE);
-
- qb_log(LOG_WARNING, "no syslog");
- qb_log(LOG_ERR, "no syslog");
-
-#if 0
- // test blackbox
- logfile = NULL;
- logfile[5] = 'a';
-#endif
- if (do_blackbox) {
- qb_log_blackbox_write_to_file("simple-log.fdata");
- qb_log_blackbox_print_from_file("simple-log.fdata");
- qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_FALSE);
- }
- qb_log_fini();
- return 0;
-}
-
--
1.7.6.4
12 years, 6 months
[PATCH 1/5] Add a ./check mock
by Angus Salkeld
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
check | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/check b/check
index f5ac1af..e0ec7c3 100755
--- a/check
+++ b/check
@@ -136,6 +136,18 @@ check_rpm() {
set -e
}
+
+check_mock() {
+ echo "checking mock building"
+ set +e
+ make maintainer-clean
+ rm -f *.rpm
+ ./autogen.sh
+ ./configure --quiet
+ make srpm
+ mock --no-clean --rebuild *.src.rpm
+}
+
check_coverity() {
make clean
cov-build --dir=cov make
@@ -181,6 +193,9 @@ case $command in
rpm)
check_rpm
;;
+ mock)
+ check_mock
+ ;;
dist)
check_dist
;;
--
1.7.6.4
12 years, 6 months
qb_rb_chunk_check: Assertion `0' failed
by Dietmar Maurer
I sometime get the following crash:
size: 7
magic: 0
Ringbuffer:
->NORMAL
->write_pt [88]
->read_pt [52]
->size [262144 words]
=>free [1048428 bytes]
=>used [144 bytes]
pmxcfs: ringbuffer.c:547: qb_rb_chunk_check: Assertion `0' failed.
Aborted
Any ideas (libqb 0.5.1)?
- Dietmar
12 years, 6 months
[PATCH] LOG: only range check "t" when filtering else tags are not applied.
by Angus Salkeld
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
lib/log.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/log.c b/lib/log.c
index 13996b4..885751e 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -547,10 +547,16 @@ qb_log_filter_ctl2(int32_t t, enum qb_log_filter_conf c,
if (!logger_inited) {
return -EINVAL;
}
- if (t < 0 || t >= QB_LOG_TARGET_MAX ||
- conf[t].state == QB_LOG_STATE_UNUSED) {
- return -EBADF;
+
+ if (t == QB_LOG_FILTER_ADD ||
+ t == QB_LOG_FILTER_CLEAR_ALL ||
+ t == QB_LOG_FILTER_REMOVE) {
+ if (t < 0 || t >= QB_LOG_TARGET_MAX ||
+ conf[t].state == QB_LOG_STATE_UNUSED) {
+ return -EBADF;
+ }
}
+
if (text == NULL ||
low_priority < high_priority ||
type > QB_LOG_FILTER_FORMAT ||
--
1.7.6.4
12 years, 6 months
[PATCH 1/2] check: add a handy coverity check
by Angus Salkeld
./check coverity
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
check | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/check b/check
index c9bfa70..f5ac1af 100755
--- a/check
+++ b/check
@@ -136,6 +136,13 @@ check_rpm() {
set -e
}
+check_coverity() {
+ make clean
+ cov-build --dir=cov make
+ cov-analyze --dir cov --concurrency --wait-for-license
+ cov-format-errors --dir cov
+}
+
check_all() {
check_ansi
check_nosection
@@ -180,6 +187,9 @@ case $command in
notimerfd)
check_notimerfd
;;
+ coverity)
+ check_coverity
+ ;;
all)
check_all
;;
--
1.7.6.4
12 years, 6 months
[PATCH] Fixed segment fault bug when use logging API at i386 platform
by Yunkai Zhang
This bug cause by qb_vsprintf_serialize function. It parse "%llx" format
as _long_ other than _long long_.
At x86_64 platform, both sizeof(long) and sizeof(long long) is 8, this
issue would not be triggered, so we could only catch it at i386.
Signed-off-by: Yunkai Zhang <qiushu.zyk(a)taobao.com>
---
lib/log_format.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/log_format.c b/lib/log_format.c
index b4032d9..534edc8 100644
--- a/lib/log_format.c
+++ b/lib/log_format.c
@@ -314,6 +314,7 @@ reprocess:
if (*format == 'l') {
type_long = 0;
type_longlong = 1;
+ format++;
}
goto reprocess;
case 'd': /* int argument */
--
1.7.6.4
12 years, 6 months
[PATCH] TEST: add a simple test for right-aligned text in format strings
by Angus Salkeld
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
tests/check_log.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/tests/check_log.c b/tests/check_log.c
index b9efd03..142384a 100644
--- a/tests/check_log.c
+++ b/tests/check_log.c
@@ -302,6 +302,10 @@ START_TEST(test_log_format)
ck_assert_str_eq(test_buf, "ANY Angus");
qb_logt(LOG_INFO, 8, "Angus");
ck_assert_str_eq(test_buf, "ATE Angus");
+
+ qb_log_format_set(t, "%-15f %b");
+ qb_log(LOG_WARNING, "Andrew");
+ ck_assert_str_eq(test_buf, " check_log.c Andrew");
}
END_TEST
--
1.7.6.4
12 years, 6 months