mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
core: Add skeleton for main daemon
This commit is contained in:
parent
4639adb1e1
commit
050539e2e3
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,3 +18,4 @@ stamp-h1
|
|||||||
build-aux
|
build-aux
|
||||||
autom4te.cache
|
autom4te.cache
|
||||||
ell
|
ell
|
||||||
|
src/iwd
|
||||||
|
@ -27,6 +27,11 @@ ell_sources = ell/ell.h ell/private.h \
|
|||||||
|
|
||||||
ell_libell_internal_la_SOURCES = $(ell_sources)
|
ell_libell_internal_la_SOURCES = $(ell_sources)
|
||||||
|
|
||||||
|
bin_PROGRAMS = src/iwd
|
||||||
|
|
||||||
|
src_iwd_SOURCES = src/main.c
|
||||||
|
src_iwd_LDADD = ell/libell-internal.la
|
||||||
|
|
||||||
AM_CFLAGS = -fvisibility=hidden
|
AM_CFLAGS = -fvisibility=hidden
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = Makefile.in configure config.h.in aclocal.m4
|
MAINTAINERCLEANFILES = Makefile.in configure config.h.in aclocal.m4
|
||||||
|
64
src/main.c
Normal file
64
src/main.c
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Wireless daemon for Linux
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013-2014 Intel Corporation. All rights reserved.
|
||||||
|
*
|
||||||
|
* This library 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.
|
||||||
|
*
|
||||||
|
* This library 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 this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <ell/ell.h>
|
||||||
|
|
||||||
|
static void signal_handler(struct l_signal *signal, uint32_t signo,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
switch (signo) {
|
||||||
|
case SIGINT:
|
||||||
|
case SIGTERM:
|
||||||
|
l_info("Terminate");
|
||||||
|
l_main_quit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
struct l_signal *signal;
|
||||||
|
sigset_t mask;
|
||||||
|
|
||||||
|
sigemptyset(&mask);
|
||||||
|
sigaddset(&mask, SIGINT);
|
||||||
|
sigaddset(&mask, SIGTERM);
|
||||||
|
|
||||||
|
signal = l_signal_create(&mask, signal_handler, NULL, NULL);
|
||||||
|
|
||||||
|
l_log_set_stderr();
|
||||||
|
|
||||||
|
l_info("Wireless daemon version %s", VERSION);
|
||||||
|
|
||||||
|
l_debug_enable("*");
|
||||||
|
|
||||||
|
l_main_run();
|
||||||
|
|
||||||
|
l_signal_remove(signal);
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user