mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
core: Add support for creating private bus
This commit is contained in:
parent
632be0730a
commit
bf7c041b47
@ -34,6 +34,7 @@ ell_libell_internal_la_SOURCES = $(ell_sources)
|
||||
bin_PROGRAMS = src/iwd client/iwctl
|
||||
|
||||
src_iwd_SOURCES = src/main.c linux/nl80211.h linux/kdbus.h \
|
||||
src/kdbus.h src/kdbus.c \
|
||||
src/sha1.h src/sha1.c
|
||||
src_iwd_LDADD = ell/libell-internal.la
|
||||
|
||||
|
28
src/main.c
28
src/main.c
@ -27,6 +27,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <ell/ell.h>
|
||||
|
||||
#include "src/kdbus.h"
|
||||
|
||||
static void signal_handler(struct l_signal *signal, uint32_t signo,
|
||||
void *user_data)
|
||||
{
|
||||
@ -43,6 +45,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
struct l_signal *signal;
|
||||
sigset_t mask;
|
||||
char *bus_name;
|
||||
int exit_status;
|
||||
|
||||
sigemptyset(&mask);
|
||||
sigaddset(&mask, SIGINT);
|
||||
@ -51,14 +55,34 @@ int main(int argc, char *argv[])
|
||||
signal = l_signal_create(&mask, signal_handler, NULL, NULL);
|
||||
|
||||
l_log_set_stderr();
|
||||
l_debug_enable("*");
|
||||
|
||||
l_info("Wireless daemon version %s", VERSION);
|
||||
|
||||
l_debug_enable("*");
|
||||
if (!kdbus_create_bus()) {
|
||||
exit_status = EXIT_FAILURE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
bus_name = kdbus_lookup_bus();
|
||||
if (!bus_name) {
|
||||
exit_status = EXIT_FAILURE;
|
||||
goto destroy;
|
||||
}
|
||||
|
||||
l_debug("Bus location: %s", bus_name);
|
||||
|
||||
l_main_run();
|
||||
|
||||
exit_status = EXIT_SUCCESS;
|
||||
|
||||
l_free(bus_name);
|
||||
|
||||
destroy:
|
||||
kdbus_destroy_bus();
|
||||
|
||||
done:
|
||||
l_signal_remove(signal);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return exit_status;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user