core: Add stub for systemd notification integration

This commit is contained in:
Marcel Holtmann 2012-12-09 23:58:51 +01:00
parent ffb795a2e7
commit 41b411a391
4 changed files with 75 additions and 0 deletions

View File

@ -137,6 +137,7 @@ src_bluetoothd_SOURCES = $(gdbus_sources) $(builtin_sources) \
$(attrib_sources) $(btio_sources) \
src/bluetooth.ver \
src/main.c src/log.h src/log.c \
src/systemd.h src/systemd.c \
src/rfkill.c src/hcid.h src/sdpd.h \
src/sdpd-server.c src/sdpd-request.c \
src/sdpd-service.c src/sdpd-database.c \

View File

@ -55,6 +55,7 @@
#include "agent.h"
#include "manager.h"
#include "mgmt.h"
#include "systemd.h"
#define BLUEZ_NAME "org.bluez"
@ -471,6 +472,8 @@ int main(int argc, char *argv[])
__btd_log_init(option_debug, option_detach);
sd_notify(0, "STATUS=Starting up");
config = load_config(CONFIGDIR "/main.conf");
parse_config(config);
@ -506,8 +509,13 @@ int main(int argc, char *argv[])
DBG("Entering main loop");
sd_notify(0, "STATUS=Running");
sd_notify(0, "READY=1");
g_main_loop_run(event_loop);
sd_notify(0, "STATUS=Quitting");
g_source_remove(signal);
plugin_cleanup();

38
src/systemd.c Normal file
View File

@ -0,0 +1,38 @@
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2012 Intel Corporation. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; 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 "systemd.h"
int sd_listen_fds(int unset_environment)
{
return 0;
}
int sd_notify(int unset_environment, const char *state)
{
return 0;
}

28
src/systemd.h Normal file
View File

@ -0,0 +1,28 @@
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2012 Intel Corporation. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#define SD_LISTEN_FDS_START 3
int sd_listen_fds(int unset_environment);
int sd_notify(int unset_environment, const char *state);