Diff between ffb795a2e7061039eb549cddc0c5e7c381739562 and 41b411a39152e39b4fa150d42ee33dda028e2267

Changed Files

File Additions Deletions Status
Makefile.am +1 -0 modified
src/main.c +8 -0 modified
src/systemd.c +38 -0 added
src/systemd.h +28 -0 added

Full Patch

diff --git a/Makefile.am b/Makefile.am
index 5e0a5be..9902ac7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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 \
diff --git a/src/main.c b/src/main.c
index 0b2809a..f985332 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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();
diff --git a/src/systemd.c b/src/systemd.c
new file mode 100644
index 0000000..4bb2f1c
--- /dev/null
+++ b/src/systemd.c
@@ -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;
+}
diff --git a/src/systemd.h b/src/systemd.h
new file mode 100644
index 0000000..0ef7c82
--- /dev/null
+++ b/src/systemd.h
@@ -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);