Skip to contentSkip to conversation

mesh: Up-rev ELL dependancies to >= 0.14

PATCH Superseded Brian Gix 3 participants 4 messages Nov 21, 2018 – Nov 22, 2018 Bluetooth drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Brian Gix

author
#0 lore raw

PATCH 1/1 mesh: Up-rev ELL dependancies to >= 0.14

---
 configure.ac |  4 ++--
 mesh/dbus.c  |  4 ++--
 mesh/main.c  | 27 ++++++++++-----------------
 3 files changed, 14 insertions(+), 21 deletions(-)
configure.ac +2 -2
index cbc854d62..d22f9d539 100644
@@ -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
mesh/dbus.c +2 -2
index a94ba067d..0df664f2b 100644
@@ -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)
mesh/main.c +10 -17
index 0722f3af8..96a013510 100644
@@ -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);
 
Signature · 1 line
2.14.5
maintainer
#1 lore raw

Hi Brian,

Quoted 89 lines

---

configure.ac |  4 ++--
mesh/dbus.c  |  4 ++--
mesh/main.c  | 27 ++++++++++-----------------
3 files changed, 14 insertions(+), 21 deletions(-)
configure.ac +0 -0
index cbc854d62..d22f9d539 100644
@@ -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

configure.ac +2 -2
-	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

mesh/dbus.c +2 -2
index a94ba067d..0df664f2b 100644
@@ -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)
mesh/main.c +8 -13
index 0722f3af8..96a013510 100644
@@ -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;
 

mesh/main.c int main(int argc, char *argv[]) · line 180

Quoted 9 lines
mesh/main.c +2 -4
@@ -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

#2 lore raw
In reply to Brian Gix

Hi Brian,

Quoted 91 lines · 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(-)
configure.ac +0 -0
index cbc854d62..d22f9d539 100644
@@ -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,

configure.ac +2 -1
-			  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
mesh/dbus.c +2 -2
index a94ba067d..0df664f2b 100644
@@ -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)
mesh/main.c +8 -13
index 0722f3af8..96a013510 100644
@@ -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;

mesh/main.c int main(int argc, char *argv[]) · line 182

Quoted 10 lines
mesh/main.c +2 -4
 	}
 
-	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?

Signature · 2 lines
pozdrawiam
Szymon Janc
maintainer
#3 lore raw

Hi Szymon,

Quoted 100 lines
Quoted 100 lines

---

configure.ac |  4 ++--
mesh/dbus.c  |  4 ++--
mesh/main.c  | 27 ++++++++++-----------------
3 files changed, 14 insertions(+), 21 deletions(-)
configure.ac +0 -0
index cbc854d62..d22f9d539 100644
@@ -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,

configure.ac +2 -1
-			  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

mesh/dbus.c +2 -2
index a94ba067d..0df664f2b 100644
@@ -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)
mesh/main.c +10 -17
index 0722f3af8..96a013510 100644
@@ -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);
 
Quoted 3 lines

mesh/main.c int main(int argc, char *argv[]) · line 182

Quoted 1 line
mesh/main.c +0 -0
 	umask(0077);

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

yes, please.

Regards

Marcel