linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] mesh: Up-rev ELL dependancies to >= 0.14
@ 2018-11-21 20:46 Brian Gix
  2018-11-22  7:13 ` Marcel Holtmann
  2018-11-22  8:19 ` Szymon Janc
  0 siblings, 2 replies; 4+ messages in thread
From: Brian Gix @ 2018-11-21 20:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: johan.hedberg, inga.stotland, Brian Gix

---
 configure.ac |  4 ++--
 mesh/dbus.c  |  4 ++--
 mesh/main.c  | 27 ++++++++++-----------------
 3 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/configure.ac b/configure.ac
index cbc854d62..d22f9d539 100644
--- a/configure.ac
+++ b/configure.ac
@@ -249,8 +249,8 @@ AC_ARG_ENABLE(btpclient, AC_HELP_STRING([--enable-btpclient],
 AM_CONDITIONAL(BTPCLIENT, test "${enable_btpclient}" = "yes")
 
 if (test "${enable_btpclient}" = "yes" || test "${enable_mesh}" = "yes"); then
-	PKG_CHECK_MODULES(ELL, ell >= 0.3, enable_ell=yes,
-			  AC_MSG_ERROR(ell library >= 0.3 is required))
+	PKG_CHECK_MODULES(ELL, ell >= 0.14, enable_ell=yes,
+			  AC_MSG_ERROR(ell library >= 0.14 is required))
 	AC_SUBST(ELL_CFLAGS)
 	AC_SUBST(ELL_LIBS)
 fi
diff --git a/mesh/dbus.c b/mesh/dbus.c
index a94ba067d..0df664f2b 100644
--- a/mesh/dbus.c
+++ b/mesh/dbus.c
@@ -76,11 +76,11 @@ struct l_dbus_message *dbus_error(struct l_dbus_message *msg, int err,
 	if (description)
 		return l_dbus_message_new_error(msg,
 				error_table[err].dbus_err,
-				description);
+				"%s", description);
 	else
 		return l_dbus_message_new_error(msg,
 				error_table[err].dbus_err,
-				error_table[err].default_desc);
+				"%s", error_table[err].default_desc);
 }
 
 struct l_dbus *dbus_get_bus(void)
diff --git a/mesh/main.c b/mesh/main.c
index 0722f3af8..96a013510 100644
--- a/mesh/main.c
+++ b/mesh/main.c
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <ctype.h>
+#include <signal.h>
 
 #include <sys/stat.h>
 #include <ell/ell.h>
@@ -96,21 +97,16 @@ static void disconnect_callback(void *user_data)
 	l_main_quit();
 }
 
-static void signal_handler(struct l_signal *signal, uint32_t signo,
-							void *user_data)
+static void signal_handler(void *user_data)
 {
 	static bool terminated;
 
-	switch (signo) {
-	case SIGINT:
-	case SIGTERM:
-		if (terminated)
-			return;
-		l_info("Terminating");
-		l_main_quit();
-		terminated = true;
-		break;
-	}
+	if (terminated)
+		return;
+
+	l_info("Terminating");
+	l_main_quit();
+	terminated = true;
 }
 
 int main(int argc, char *argv[])
@@ -120,7 +116,6 @@ int main(int argc, char *argv[])
 	bool dbus_debug = false;
 	struct l_dbus *dbus = NULL;
 	struct l_signal *signal = NULL;
-	sigset_t mask;
 	const char *config_dir = NULL;
 	int index = MGMT_INDEX_NONE;
 
@@ -181,10 +176,8 @@ int main(int argc, char *argv[])
 		goto done;
 	}
 
-	sigemptyset(&mask);
-	sigaddset(&mask, SIGINT);
-	sigaddset(&mask, SIGTERM);
-	signal = l_signal_create(&mask, signal_handler, NULL, NULL);
+	signal = l_signal_create(SIGINT, signal_handler, NULL, NULL);
+	signal = l_signal_create(SIGTERM, signal_handler, NULL, NULL);
 
 	umask(0077);
 
-- 
2.14.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ] mesh: Up-rev ELL dependancies to >= 0.14
  2018-11-21 20:46 [PATCH BlueZ] mesh: Up-rev ELL dependancies to >= 0.14 Brian Gix
@ 2018-11-22  7:13 ` Marcel Holtmann
  2018-11-22  8:19 ` Szymon Janc
  1 sibling, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2018-11-22  7:13 UTC (permalink / raw)
  To: Brian Gix; +Cc: Bluez mailing list, Johan Hedberg, inga.stotland

Hi Brian,

> ---
> configure.ac |  4 ++--
> mesh/dbus.c  |  4 ++--
> mesh/main.c  | 27 ++++++++++-----------------
> 3 files changed, 14 insertions(+), 21 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index cbc854d62..d22f9d539 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -249,8 +249,8 @@ AC_ARG_ENABLE(btpclient, AC_HELP_STRING([--enable-btpclient],
> AM_CONDITIONAL(BTPCLIENT, test "${enable_btpclient}" = "yes")
> 
> if (test "${enable_btpclient}" = "yes" || test "${enable_mesh}" = "yes"); then
> -	PKG_CHECK_MODULES(ELL, ell >= 0.3, enable_ell=yes,
> -			  AC_MSG_ERROR(ell library >= 0.3 is required))
> +	PKG_CHECK_MODULES(ELL, ell >= 0.14, enable_ell=yes,
> +			  AC_MSG_ERROR(ell library >= 0.14 is required))
> 	AC_SUBST(ELL_CFLAGS)
> 	AC_SUBST(ELL_LIBS)
> fi
> diff --git a/mesh/dbus.c b/mesh/dbus.c
> index a94ba067d..0df664f2b 100644
> --- a/mesh/dbus.c
> +++ b/mesh/dbus.c
> @@ -76,11 +76,11 @@ struct l_dbus_message *dbus_error(struct l_dbus_message *msg, int err,
> 	if (description)
> 		return l_dbus_message_new_error(msg,
> 				error_table[err].dbus_err,
> -				description);
> +				"%s", description);
> 	else
> 		return l_dbus_message_new_error(msg,
> 				error_table[err].dbus_err,
> -				error_table[err].default_desc);
> +				"%s", error_table[err].default_desc);
> }
> 
> struct l_dbus *dbus_get_bus(void)
> diff --git a/mesh/main.c b/mesh/main.c
> index 0722f3af8..96a013510 100644
> --- a/mesh/main.c
> +++ b/mesh/main.c
> @@ -26,6 +26,7 @@
> #include <stdio.h>
> #include <unistd.h>
> #include <ctype.h>
> +#include <signal.h>
> 
> #include <sys/stat.h>
> #include <ell/ell.h>
> @@ -96,21 +97,16 @@ static void disconnect_callback(void *user_data)
> 	l_main_quit();
> }
> 
> -static void signal_handler(struct l_signal *signal, uint32_t signo,
> -							void *user_data)
> +static void signal_handler(void *user_data)
> {
> 	static bool terminated;
> 
> -	switch (signo) {
> -	case SIGINT:
> -	case SIGTERM:
> -		if (terminated)
> -			return;
> -		l_info("Terminating");
> -		l_main_quit();
> -		terminated = true;
> -		break;
> -	}
> +	if (terminated)
> +		return;
> +
> +	l_info("Terminating");
> +	l_main_quit();
> +	terminated = true;
> }
> 
> int main(int argc, char *argv[])
> @@ -120,7 +116,6 @@ int main(int argc, char *argv[])
> 	bool dbus_debug = false;
> 	struct l_dbus *dbus = NULL;
> 	struct l_signal *signal = NULL;
> -	sigset_t mask;
> 	const char *config_dir = NULL;
> 	int index = MGMT_INDEX_NONE;
> 
> @@ -181,10 +176,8 @@ int main(int argc, char *argv[])
> 		goto done;
> 	}
> 
> -	sigemptyset(&mask);
> -	sigaddset(&mask, SIGINT);
> -	sigaddset(&mask, SIGTERM);
> -	signal = l_signal_create(&mask, signal_handler, NULL, NULL);
> +	signal = l_signal_create(SIGINT, signal_handler, NULL, NULL);
> +	signal = l_signal_create(SIGTERM, signal_handler, NULL, NULL);

why not switch to l_main_run_with_signal() instead. We will be hiding the whole signal handling eventually anyway.

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ] mesh: Up-rev ELL dependancies to >= 0.14
  2018-11-21 20:46 [PATCH BlueZ] mesh: Up-rev ELL dependancies to >= 0.14 Brian Gix
  2018-11-22  7:13 ` Marcel Holtmann
@ 2018-11-22  8:19 ` Szymon Janc
  2018-11-22  9:27   ` Marcel Holtmann
  1 sibling, 1 reply; 4+ messages in thread
From: Szymon Janc @ 2018-11-22  8:19 UTC (permalink / raw)
  To: Brian Gix; +Cc: linux-bluetooth, johan.hedberg, inga.stotland

Hi Brian,

On Wednesday, 21 November 2018 21:46:41 CET Brian Gix wrote:
> ---
>  configure.ac |  4 ++--
>  mesh/dbus.c  |  4 ++--
>  mesh/main.c  | 27 ++++++++++-----------------
>  3 files changed, 14 insertions(+), 21 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index cbc854d62..d22f9d539 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -249,8 +249,8 @@ AC_ARG_ENABLE(btpclient,
> AC_HELP_STRING([--enable-btpclient], AM_CONDITIONAL(BTPCLIENT, test
> "${enable_btpclient}" = "yes")
> 
>  if (test "${enable_btpclient}" = "yes" || test "${enable_mesh}" = "yes");
> then -	PKG_CHECK_MODULES(ELL, ell >= 0.3, enable_ell=yes,
> -			  AC_MSG_ERROR(ell library >= 0.3 is required))
> +	PKG_CHECK_MODULES(ELL, ell >= 0.14, enable_ell=yes,
> +			  AC_MSG_ERROR(ell library >= 0.14 is required))
>  	AC_SUBST(ELL_CFLAGS)
>  	AC_SUBST(ELL_LIBS)
>  fi
> diff --git a/mesh/dbus.c b/mesh/dbus.c
> index a94ba067d..0df664f2b 100644
> --- a/mesh/dbus.c
> +++ b/mesh/dbus.c
> @@ -76,11 +76,11 @@ struct l_dbus_message *dbus_error(struct l_dbus_message
> *msg, int err, if (description)
>  		return l_dbus_message_new_error(msg,
>  				error_table[err].dbus_err,
> -				description);
> +				"%s", description);
>  	else
>  		return l_dbus_message_new_error(msg,
>  				error_table[err].dbus_err,
> -				error_table[err].default_desc);
> +				"%s", error_table[err].default_desc);
>  }
> 
>  struct l_dbus *dbus_get_bus(void)
> diff --git a/mesh/main.c b/mesh/main.c
> index 0722f3af8..96a013510 100644
> --- a/mesh/main.c
> +++ b/mesh/main.c
> @@ -26,6 +26,7 @@
>  #include <stdio.h>
>  #include <unistd.h>
>  #include <ctype.h>
> +#include <signal.h>
> 
>  #include <sys/stat.h>
>  #include <ell/ell.h>
> @@ -96,21 +97,16 @@ static void disconnect_callback(void *user_data)
>  	l_main_quit();
>  }
> 
> -static void signal_handler(struct l_signal *signal, uint32_t signo,
> -							void *user_data)
> +static void signal_handler(void *user_data)
>  {
>  	static bool terminated;
> 
> -	switch (signo) {
> -	case SIGINT:
> -	case SIGTERM:
> -		if (terminated)
> -			return;
> -		l_info("Terminating");
> -		l_main_quit();
> -		terminated = true;
> -		break;
> -	}
> +	if (terminated)
> +		return;
> +
> +	l_info("Terminating");
> +	l_main_quit();
> +	terminated = true;
>  }
> 
>  int main(int argc, char *argv[])
> @@ -120,7 +116,6 @@ int main(int argc, char *argv[])
>  	bool dbus_debug = false;
>  	struct l_dbus *dbus = NULL;
>  	struct l_signal *signal = NULL;
> -	sigset_t mask;
>  	const char *config_dir = NULL;
>  	int index = MGMT_INDEX_NONE;
> 
> @@ -181,10 +176,8 @@ int main(int argc, char *argv[])
>  		goto done;
>  	}
> 
> -	sigemptyset(&mask);
> -	sigaddset(&mask, SIGINT);
> -	sigaddset(&mask, SIGTERM);
> -	signal = l_signal_create(&mask, signal_handler, NULL, NULL);
> +	signal = l_signal_create(SIGINT, signal_handler, NULL, NULL);
> +	signal = l_signal_create(SIGTERM, signal_handler, NULL, NULL);
> 
>  	umask(0077);

btpclient is also using ELL, should it be updated too?

-- 
pozdrawiam
Szymon Janc



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ] mesh: Up-rev ELL dependancies to >= 0.14
  2018-11-22  8:19 ` Szymon Janc
@ 2018-11-22  9:27   ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2018-11-22  9:27 UTC (permalink / raw)
  To: Szymon Janc; +Cc: Brian Gix, linux-bluetooth, Johan Hedberg, inga.stotland

Hi Szymon,

>> ---
>> configure.ac |  4 ++--
>> mesh/dbus.c  |  4 ++--
>> mesh/main.c  | 27 ++++++++++-----------------
>> 3 files changed, 14 insertions(+), 21 deletions(-)
>> 
>> diff --git a/configure.ac b/configure.ac
>> index cbc854d62..d22f9d539 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -249,8 +249,8 @@ AC_ARG_ENABLE(btpclient,
>> AC_HELP_STRING([--enable-btpclient], AM_CONDITIONAL(BTPCLIENT, test
>> "${enable_btpclient}" = "yes")
>> 
>> if (test "${enable_btpclient}" = "yes" || test "${enable_mesh}" = "yes");
>> then -	PKG_CHECK_MODULES(ELL, ell >= 0.3, enable_ell=yes,
>> -			  AC_MSG_ERROR(ell library >= 0.3 is required))
>> +	PKG_CHECK_MODULES(ELL, ell >= 0.14, enable_ell=yes,
>> +			  AC_MSG_ERROR(ell library >= 0.14 is required))
>> 	AC_SUBST(ELL_CFLAGS)
>> 	AC_SUBST(ELL_LIBS)
>> fi
>> diff --git a/mesh/dbus.c b/mesh/dbus.c
>> index a94ba067d..0df664f2b 100644
>> --- a/mesh/dbus.c
>> +++ b/mesh/dbus.c
>> @@ -76,11 +76,11 @@ struct l_dbus_message *dbus_error(struct l_dbus_message
>> *msg, int err, if (description)
>> 		return l_dbus_message_new_error(msg,
>> 				error_table[err].dbus_err,
>> -				description);
>> +				"%s", description);
>> 	else
>> 		return l_dbus_message_new_error(msg,
>> 				error_table[err].dbus_err,
>> -				error_table[err].default_desc);
>> +				"%s", error_table[err].default_desc);
>> }
>> 
>> struct l_dbus *dbus_get_bus(void)
>> diff --git a/mesh/main.c b/mesh/main.c
>> index 0722f3af8..96a013510 100644
>> --- a/mesh/main.c
>> +++ b/mesh/main.c
>> @@ -26,6 +26,7 @@
>> #include <stdio.h>
>> #include <unistd.h>
>> #include <ctype.h>
>> +#include <signal.h>
>> 
>> #include <sys/stat.h>
>> #include <ell/ell.h>
>> @@ -96,21 +97,16 @@ static void disconnect_callback(void *user_data)
>> 	l_main_quit();
>> }
>> 
>> -static void signal_handler(struct l_signal *signal, uint32_t signo,
>> -							void *user_data)
>> +static void signal_handler(void *user_data)
>> {
>> 	static bool terminated;
>> 
>> -	switch (signo) {
>> -	case SIGINT:
>> -	case SIGTERM:
>> -		if (terminated)
>> -			return;
>> -		l_info("Terminating");
>> -		l_main_quit();
>> -		terminated = true;
>> -		break;
>> -	}
>> +	if (terminated)
>> +		return;
>> +
>> +	l_info("Terminating");
>> +	l_main_quit();
>> +	terminated = true;
>> }
>> 
>> int main(int argc, char *argv[])
>> @@ -120,7 +116,6 @@ int main(int argc, char *argv[])
>> 	bool dbus_debug = false;
>> 	struct l_dbus *dbus = NULL;
>> 	struct l_signal *signal = NULL;
>> -	sigset_t mask;
>> 	const char *config_dir = NULL;
>> 	int index = MGMT_INDEX_NONE;
>> 
>> @@ -181,10 +176,8 @@ int main(int argc, char *argv[])
>> 		goto done;
>> 	}
>> 
>> -	sigemptyset(&mask);
>> -	sigaddset(&mask, SIGINT);
>> -	sigaddset(&mask, SIGTERM);
>> -	signal = l_signal_create(&mask, signal_handler, NULL, NULL);
>> +	signal = l_signal_create(SIGINT, signal_handler, NULL, NULL);
>> +	signal = l_signal_create(SIGTERM, signal_handler, NULL, NULL);
>> 
>> 	umask(0077);
> 
> btpclient is also using ELL, should it be updated too?

yes, please.

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-22  9:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21 20:46 [PATCH BlueZ] mesh: Up-rev ELL dependancies to >= 0.14 Brian Gix
2018-11-22  7:13 ` Marcel Holtmann
2018-11-22  8:19 ` Szymon Janc
2018-11-22  9:27   ` 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).