* [PATCH 1/3] log: Remove vinfo function
@ 2010-06-05 4:41 Gustavo F. Padovan
2010-06-05 4:41 ` [PATCH 2/3] Remove ifndef barrier from log.h and btio.h Gustavo F. Padovan
0 siblings, 1 reply; 7+ messages in thread
From: Gustavo F. Padovan @ 2010-06-05 4:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: gustavo
It was used only once.
---
src/log.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/src/log.c b/src/log.c
index 29e2d7d..cb02aad 100644
--- a/src/log.c
+++ b/src/log.c
@@ -33,18 +33,13 @@
#include "log.h"
-static inline void vinfo(const char *format, va_list ap)
-{
- vsyslog(LOG_INFO, format, ap);
-}
-
void info(const char *format, ...)
{
va_list ap;
va_start(ap, format);
- vinfo(format, ap);
+ vsyslog(LOG_INFO, format, ap);
va_end(ap);
}
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] Remove ifndef barrier from log.h and btio.h
2010-06-05 4:41 [PATCH 1/3] log: Remove vinfo function Gustavo F. Padovan
@ 2010-06-05 4:41 ` Gustavo F. Padovan
2010-06-05 4:41 ` [PATCH 3/3] Fix regression with debug via SIGUSR2 Gustavo F. Padovan
2010-06-08 6:19 ` [PATCH 2/3] Remove ifndef barrier from log.h and btio.h Johan Hedberg
0 siblings, 2 replies; 7+ messages in thread
From: Gustavo F. Padovan @ 2010-06-05 4:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: gustavo
---
src/btio.h | 3 ---
src/log.h | 4 +---
2 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/src/btio.h b/src/btio.h
index 00d743e..fa6ff69 100644
--- a/src/btio.h
+++ b/src/btio.h
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
-#ifndef BT_IO_H
-#define BT_IO_H
#include <glib.h>
@@ -93,4 +91,3 @@ GIOChannel *bt_io_listen(BtIOType type, BtIOConnect connect,
GDestroyNotify destroy, GError **err,
BtIOOption opt1, ...);
-#endif
diff --git a/src/log.h b/src/log.h
index 9af51e7..33168c7 100644
--- a/src/log.h
+++ b/src/log.h
@@ -21,8 +21,7 @@
*
*/
-#ifndef __LOGGING_H
-#define __LOGGING_H
+extern int debug_enabled;
void info(const char *format, ...) __attribute__((format(printf, 1, 2)));
void error(const char *format, ...) __attribute__((format(printf, 1, 2)));
@@ -57,4 +56,3 @@ struct btd_debug_desc {
__FILE__, __FUNCTION__ , ## arg); \
} while (0)
-#endif /* __LOGGING_H */
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] Fix regression with debug via SIGUSR2
2010-06-05 4:41 ` [PATCH 2/3] Remove ifndef barrier from log.h and btio.h Gustavo F. Padovan
@ 2010-06-05 4:41 ` Gustavo F. Padovan
2010-06-05 4:49 ` Gustavo F. Padovan
2010-06-05 4:51 ` [PATCH] " Gustavo F. Padovan
2010-06-08 6:19 ` [PATCH 2/3] Remove ifndef barrier from log.h and btio.h Johan Hedberg
1 sibling, 2 replies; 7+ messages in thread
From: Gustavo F. Padovan @ 2010-06-05 4:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: gustavo
The new dynamic debug feature was not using the SIGUSR2 signal so this was
causing bluetoothd to crash when one tries to toggle debug via SIGUSR2.
This patch brings back such compatibility andadds debug_string and
debug_enabled vars.
---
src/log.c | 17 +++++++++++++++--
src/log.h | 6 +++++-
src/main.c | 8 ++++++++
3 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/src/log.c b/src/log.c
index cb02aad..1bc0a42 100644
--- a/src/log.c
+++ b/src/log.c
@@ -71,6 +71,8 @@ extern struct btd_debug_desc __stop___debug[];
static gchar **enabled = NULL;
+int debug_enabled = FALSE;
+
static gboolean is_enabled(struct btd_debug_desc *desc)
{
int i;
@@ -90,14 +92,25 @@ static gboolean is_enabled(struct btd_debug_desc *desc)
return 0;
}
+void __btd_toggle_debug()
+{
+ debug_enabled = !debug_enabled;
+}
+
void __btd_log_init(const char *debug, int detach)
{
int option = LOG_NDELAY | LOG_PID;
struct btd_debug_desc *desc;
const char *name = NULL, *file = NULL;
- if (debug != NULL)
- enabled = g_strsplit_set(debug, ":, ", 0);
+ if (debug != NULL) {
+ debug_enabled = TRUE;
+ } else {
+ debug = g_strdup("*");
+ debug_enabled = FALSE;
+ }
+
+ enabled = g_strsplit_set(debug, ":, ", 0);
for (desc = __start___debug; desc < __stop___debug; desc++) {
if (file != NULL || name != NULL) {
diff --git a/src/log.h b/src/log.h
index 33168c7..5f742e8 100644
--- a/src/log.h
+++ b/src/log.h
@@ -23,12 +23,15 @@
extern int debug_enabled;
+extern int debug_enabled;
+
void info(const char *format, ...) __attribute__((format(printf, 1, 2)));
void error(const char *format, ...) __attribute__((format(printf, 1, 2)));
void debug(const char *format, ...) __attribute__((format(printf, 1, 2)));
void __btd_log_init(const char *debug, int detach);
void __btd_log_cleanup(void);
+void __btd_toggle_debug();
struct btd_debug_desc {
const char *name;
@@ -51,7 +54,8 @@ struct btd_debug_desc {
__attribute__((used, section("__debug"), aligned(8))) = { \
.file = __FILE__, .flags = BTD_DEBUG_FLAG_DEFAULT, \
}; \
- if (__btd_debug_desc.flags & BTD_DEBUG_FLAG_PRINT) \
+ if (debug_enabled && \
+ __btd_debug_desc.flags & BTD_DEBUG_FLAG_PRINT) \
debug("%s:%s() " fmt, \
__FILE__, __FUNCTION__ , ## arg); \
} while (0)
diff --git a/src/main.c b/src/main.c
index 3118a34..ba18523 100644
--- a/src/main.c
+++ b/src/main.c
@@ -288,6 +288,11 @@ static void sig_term(int sig)
g_main_loop_quit(event_loop);
}
+static void sig_debug(int sig)
+{
+ __btd_toggle_debug();
+}
+
static gchar *option_debug = NULL;
static gboolean option_detach = TRUE;
static gboolean option_udev = FALSE;
@@ -406,6 +411,9 @@ int main(int argc, char *argv[])
sigaction(SIGTERM, &sa, NULL);
sigaction(SIGINT, &sa, NULL);
+ sa.sa_handler = sig_debug;
+ sigaction(SIGUSR2, &sa, NULL);
+
sa.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &sa, NULL);
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] Fix regression with debug via SIGUSR2
2010-06-05 4:41 ` [PATCH 3/3] Fix regression with debug via SIGUSR2 Gustavo F. Padovan
@ 2010-06-05 4:49 ` Gustavo F. Padovan
2010-06-05 4:51 ` [PATCH] " Gustavo F. Padovan
1 sibling, 0 replies; 7+ messages in thread
From: Gustavo F. Padovan @ 2010-06-05 4:49 UTC (permalink / raw)
To: linux-bluetooth
* Gustavo F. Padovan <gustavo@padovan.org> [2010-06-05 01:41:26 -0300]:
> The new dynamic debug feature was not using the SIGUSR2 signal so this was
> causing bluetoothd to crash when one tries to toggle debug via SIGUSR2.
> This patch brings back such compatibility andadds debug_string and
> debug_enabled vars.
> ---
> src/log.c | 17 +++++++++++++++--
> src/log.h | 6 +++++-
> src/main.c | 8 ++++++++
> 3 files changed, 28 insertions(+), 3 deletions(-)
>
> diff --git a/src/log.c b/src/log.c
> index cb02aad..1bc0a42 100644
> --- a/src/log.c
> +++ b/src/log.c
> @@ -71,6 +71,8 @@ extern struct btd_debug_desc __stop___debug[];
>
> static gchar **enabled = NULL;
>
> +int debug_enabled = FALSE;
> +
> static gboolean is_enabled(struct btd_debug_desc *desc)
> {
> int i;
> @@ -90,14 +92,25 @@ static gboolean is_enabled(struct btd_debug_desc *desc)
> return 0;
> }
>
> +void __btd_toggle_debug()
> +{
> + debug_enabled = !debug_enabled;
> +}
> +
> void __btd_log_init(const char *debug, int detach)
> {
> int option = LOG_NDELAY | LOG_PID;
> struct btd_debug_desc *desc;
> const char *name = NULL, *file = NULL;
>
> - if (debug != NULL)
> - enabled = g_strsplit_set(debug, ":, ", 0);
> + if (debug != NULL) {
> + debug_enabled = TRUE;
> + } else {
> + debug = g_strdup("*");
> + debug_enabled = FALSE;
> + }
> +
> + enabled = g_strsplit_set(debug, ":, ", 0);
>
> for (desc = __start___debug; desc < __stop___debug; desc++) {
> if (file != NULL || name != NULL) {
> diff --git a/src/log.h b/src/log.h
> index 33168c7..5f742e8 100644
> --- a/src/log.h
> +++ b/src/log.h
> @@ -23,12 +23,15 @@
>
> extern int debug_enabled;
>
> +extern int debug_enabled;
3/3 It's wrong. I have screw up with git rebase -i :(
> +
> void info(const char *format, ...) __attribute__((format(printf, 1, 2)));
> void error(const char *format, ...) __attribute__((format(printf, 1, 2)));
> void debug(const char *format, ...) __attribute__((format(printf, 1, 2)));
>
> void __btd_log_init(const char *debug, int detach);
> void __btd_log_cleanup(void);
> +void __btd_toggle_debug();
>
> struct btd_debug_desc {
> const char *name;
> @@ -51,7 +54,8 @@ struct btd_debug_desc {
> __attribute__((used, section("__debug"), aligned(8))) = { \
> .file = __FILE__, .flags = BTD_DEBUG_FLAG_DEFAULT, \
> }; \
> - if (__btd_debug_desc.flags & BTD_DEBUG_FLAG_PRINT) \
> + if (debug_enabled && \
> + __btd_debug_desc.flags & BTD_DEBUG_FLAG_PRINT) \
> debug("%s:%s() " fmt, \
> __FILE__, __FUNCTION__ , ## arg); \
> } while (0)
> diff --git a/src/main.c b/src/main.c
> index 3118a34..ba18523 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -288,6 +288,11 @@ static void sig_term(int sig)
> g_main_loop_quit(event_loop);
> }
>
> +static void sig_debug(int sig)
> +{
> + __btd_toggle_debug();
> +}
> +
> static gchar *option_debug = NULL;
> static gboolean option_detach = TRUE;
> static gboolean option_udev = FALSE;
> @@ -406,6 +411,9 @@ int main(int argc, char *argv[])
> sigaction(SIGTERM, &sa, NULL);
> sigaction(SIGINT, &sa, NULL);
>
> + sa.sa_handler = sig_debug;
> + sigaction(SIGUSR2, &sa, NULL);
> +
> sa.sa_handler = SIG_IGN;
> sigaction(SIGPIPE, &sa, NULL);
>
> --
> 1.7.1
>
--
Gustavo F. Padovan
http://padovan.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Fix regression with debug via SIGUSR2
2010-06-05 4:41 ` [PATCH 3/3] Fix regression with debug via SIGUSR2 Gustavo F. Padovan
2010-06-05 4:49 ` Gustavo F. Padovan
@ 2010-06-05 4:51 ` Gustavo F. Padovan
1 sibling, 0 replies; 7+ messages in thread
From: Gustavo F. Padovan @ 2010-06-05 4:51 UTC (permalink / raw)
To: linux-bluetooth; +Cc: gustavo
The new dynamic debug feature was not using the SIGUSR2 signal so this was
causing bluetoothd to crash when one tries to toggle debug via SIGUSR2.
This patch brings back such compatibility andadds debug_string and
debug_enabled vars.
---
src/log.c | 17 +++++++++++++++--
src/log.h | 4 +++-
src/main.c | 8 ++++++++
3 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/log.c b/src/log.c
index cb02aad..1bc0a42 100644
--- a/src/log.c
+++ b/src/log.c
@@ -71,6 +71,8 @@ extern struct btd_debug_desc __stop___debug[];
static gchar **enabled = NULL;
+int debug_enabled = FALSE;
+
static gboolean is_enabled(struct btd_debug_desc *desc)
{
int i;
@@ -90,14 +92,25 @@ static gboolean is_enabled(struct btd_debug_desc *desc)
return 0;
}
+void __btd_toggle_debug()
+{
+ debug_enabled = !debug_enabled;
+}
+
void __btd_log_init(const char *debug, int detach)
{
int option = LOG_NDELAY | LOG_PID;
struct btd_debug_desc *desc;
const char *name = NULL, *file = NULL;
- if (debug != NULL)
- enabled = g_strsplit_set(debug, ":, ", 0);
+ if (debug != NULL) {
+ debug_enabled = TRUE;
+ } else {
+ debug = g_strdup("*");
+ debug_enabled = FALSE;
+ }
+
+ enabled = g_strsplit_set(debug, ":, ", 0);
for (desc = __start___debug; desc < __stop___debug; desc++) {
if (file != NULL || name != NULL) {
diff --git a/src/log.h b/src/log.h
index 33168c7..c9412c4 100644
--- a/src/log.h
+++ b/src/log.h
@@ -29,6 +29,7 @@ void debug(const char *format, ...) __attribute__((format(printf, 1, 2)));
void __btd_log_init(const char *debug, int detach);
void __btd_log_cleanup(void);
+void __btd_toggle_debug();
struct btd_debug_desc {
const char *name;
@@ -51,7 +52,8 @@ struct btd_debug_desc {
__attribute__((used, section("__debug"), aligned(8))) = { \
.file = __FILE__, .flags = BTD_DEBUG_FLAG_DEFAULT, \
}; \
- if (__btd_debug_desc.flags & BTD_DEBUG_FLAG_PRINT) \
+ if (debug_enabled && \
+ __btd_debug_desc.flags & BTD_DEBUG_FLAG_PRINT) \
debug("%s:%s() " fmt, \
__FILE__, __FUNCTION__ , ## arg); \
} while (0)
diff --git a/src/main.c b/src/main.c
index 3118a34..ba18523 100644
--- a/src/main.c
+++ b/src/main.c
@@ -288,6 +288,11 @@ static void sig_term(int sig)
g_main_loop_quit(event_loop);
}
+static void sig_debug(int sig)
+{
+ __btd_toggle_debug();
+}
+
static gchar *option_debug = NULL;
static gboolean option_detach = TRUE;
static gboolean option_udev = FALSE;
@@ -406,6 +411,9 @@ int main(int argc, char *argv[])
sigaction(SIGTERM, &sa, NULL);
sigaction(SIGINT, &sa, NULL);
+ sa.sa_handler = sig_debug;
+ sigaction(SIGUSR2, &sa, NULL);
+
sa.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &sa, NULL);
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] Remove ifndef barrier from log.h and btio.h
2010-06-05 4:41 ` [PATCH 2/3] Remove ifndef barrier from log.h and btio.h Gustavo F. Padovan
2010-06-05 4:41 ` [PATCH 3/3] Fix regression with debug via SIGUSR2 Gustavo F. Padovan
@ 2010-06-08 6:19 ` Johan Hedberg
2010-06-08 7:14 ` Marcel Holtmann
1 sibling, 1 reply; 7+ messages in thread
From: Johan Hedberg @ 2010-06-08 6:19 UTC (permalink / raw)
To: Gustavo F. Padovan; +Cc: linux-bluetooth
Hi Gustavo,
On Sat, Jun 05, 2010, Gustavo F. Padovan wrote:
> ---
> src/btio.h | 3 ---
> src/log.h | 4 +---
> 2 files changed, 1 insertions(+), 6 deletions(-)
>
> diff --git a/src/btio.h b/src/btio.h
> index 00d743e..fa6ff69 100644
> --- a/src/btio.h
> +++ b/src/btio.h
> @@ -21,8 +21,6 @@
> * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> *
> */
> -#ifndef BT_IO_H
> -#define BT_IO_H
I think it'd be good to leave this for BtIO since it might become a
public library soon.
> -#ifndef __LOGGING_H
> -#define __LOGGING_H
> +extern int debug_enabled;
This doesn't match the commit message. To me it seems like the extern
int addition should be part of the third patch and not this one. Also,
Marcel might have had a reason for putting the safeguard for log.h so
just leave these safeguards as they are (ofono and connman has them
too).
Johan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] Remove ifndef barrier from log.h and btio.h
2010-06-08 6:19 ` [PATCH 2/3] Remove ifndef barrier from log.h and btio.h Johan Hedberg
@ 2010-06-08 7:14 ` Marcel Holtmann
0 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2010-06-08 7:14 UTC (permalink / raw)
To: Johan Hedberg; +Cc: Gustavo F. Padovan, linux-bluetooth
Hi Johan,
> > src/btio.h | 3 ---
> > src/log.h | 4 +---
> > 2 files changed, 1 insertions(+), 6 deletions(-)
> >
> > diff --git a/src/btio.h b/src/btio.h
> > index 00d743e..fa6ff69 100644
> > --- a/src/btio.h
> > +++ b/src/btio.h
> > @@ -21,8 +21,6 @@
> > * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> > *
> > */
> > -#ifndef BT_IO_H
> > -#define BT_IO_H
>
> I think it'd be good to leave this for BtIO since it might become a
> public library soon.
>
> > -#ifndef __LOGGING_H
> > -#define __LOGGING_H
> > +extern int debug_enabled;
>
> This doesn't match the commit message. To me it seems like the extern
> int addition should be part of the third patch and not this one. Also,
> Marcel might have had a reason for putting the safeguard for log.h so
> just leave these safeguards as they are (ofono and connman has them
> too).
that safeguard can be removed. That was some leftover from when it
looked like a good idea to make this more generic. It never worked out
so lets just remove this.
Regards
Marcel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-06-08 7:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-05 4:41 [PATCH 1/3] log: Remove vinfo function Gustavo F. Padovan
2010-06-05 4:41 ` [PATCH 2/3] Remove ifndef barrier from log.h and btio.h Gustavo F. Padovan
2010-06-05 4:41 ` [PATCH 3/3] Fix regression with debug via SIGUSR2 Gustavo F. Padovan
2010-06-05 4:49 ` Gustavo F. Padovan
2010-06-05 4:51 ` [PATCH] " Gustavo F. Padovan
2010-06-08 6:19 ` [PATCH 2/3] Remove ifndef barrier from log.h and btio.h Johan Hedberg
2010-06-08 7:14 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).