SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-ADD_SUBDIRECTORY(src/systemd-user-helper)
+ADD_SUBDIRECTORY(src/dbus-activation-stop-test)
%description -n g_debug_fatal_warnings
This package provices the configuration file that enable glib debugging.
+
+###############################################################################
+%package -n dbus-activation-stop-test
+Summary: dbus activation stop test.
+
+%description -n dbus-activation-stop-test
+This package provices the test code of dbus activation stopping.
+
+
###############################################################################
%prep
%setup -q
install -m 644 units/g_debug_fatal_warnings.conf %{buildroot}/etc/systemd/system.conf.d/
mkdir -p %{buildroot}%{_unitdir}
-cp systemd-user-helper.service %{buildroot}%{_unitdir}/
+mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
+install -m 644 units/dbus-activation-stop-test.service %{buildroot}%{_unitdir}/
+install -m 644 units/dbus-activation-stop-test.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/
###############################################################################
%files
%license LICENSE.Apache-2.0
%manifest session-utils.manifest
-%{_bindir}/systemd-user-helper
-%{_unitdir}/systemd-user-helper.service
+
+
+###############################################################################
+%files -n dbus-activation-stop-test
+%license LICENSE.Apache-2.0
+%manifest session-utils.manifest
+%config %{_sysconfdir}/dbus-1/system.d/dbus-activation-stop-test.conf
+%{_bindir}/dbus-activation-stop-test
+%{_unitdir}/dbus-activation-stop-test.service
###############################################################################
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(dbus-activation-stop-test C)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED
+ glib-2.0
+ gio-2.0
+ libsystemd
+)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
+
+ADD_EXECUTABLE(${PROJECT_NAME} dbus-activation-stop-test.c)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -pie)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdio.h>
+#include <signal.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <glib-unix.h>
+
+#include <systemd/sd-daemon.h>
+
+int owner_id;
+static GMainLoop *mainloop;
+
+static void sig_term(int signo)
+{
+ fprintf (stderr, "sig term\n");
+}
+
+static void sig_abort(int signo)
+{
+ fprintf (stderr, "sig abort\n");
+
+ sd_notify(0, "STOPPING=1");
+ g_bus_unown_name (owner_id);
+}
+
+static void sig_quit(int signo)
+{
+ fprintf (stderr, "sig quit\n");
+
+ g_main_loop_quit(mainloop);
+}
+
+static void name_acquire(GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+ fprintf (stderr, "name acquire : %s\n", name);
+}
+
+static void name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+ fprintf (stderr, "name lost : %s\n", name);
+}
+
+int main(int argc, char *argv[])
+{
+ GError *err = NULL;
+ GDBusConnection *conn = NULL;
+
+ conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+ if (!conn || err) {
+ fprintf (stderr, "failed to get system bus\n");
+ return -1;
+ }
+
+ owner_id = g_bus_own_name_on_connection(conn, "org.tizen.dbus-activation-stop-test", G_BUS_NAME_OWNER_FLAGS_NONE,
+ name_acquire, name_lost, NULL, NULL);
+
+ if (owner_id == 0) {
+ fprintf (stderr, "g_bus_own_name_on_connection fails\n");
+ return -1;
+ }
+
+ signal(SIGQUIT, sig_quit);
+ signal(SIGABRT, sig_abort);
+ signal(SIGTERM, sig_term);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return 0;
+}
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(systemd-user-helper C)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED
- glib-2.0
- gio-2.0
- libsystemd
-)
-
-FOREACH(flag ${pkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
-
-ADD_EXECUTABLE(${PROJECT_NAME} systemd-user-helper.c)
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -pie)
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <stdio.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <glib.h>
-#include <gio/gio.h>
-#include <glib-unix.h>
-
-#include <systemd/sd-daemon.h>
-
-int id;
-static GMainLoop *mainloop;
-
-static void sig_term(int signo)
-{
- fprintf (stderr, "sig term\n");
-}
-
-static void sig_abort(int signo)
-{
- fprintf (stderr, "sig abort\n");
-
- sd_notify(0, "STOPPING=1");
- g_bus_unown_name (id);
-}
-
-static void sig_quit(int signo)
-{
- fprintf (stderr, "sig quit\n");
-
- g_main_loop_quit(mainloop);
-}
-
-static void name_acquire(GDBusConnection *connection, const gchar *name, gpointer user_data)
-{
- fprintf (stderr, "name acquire : %s\n", name);
-}
-
-static void name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data)
-{
- fprintf (stderr, "name lost : %s\n", name);
-}
-
-int main(int argc, char *argv[])
-{
- GError *err = NULL;
- GDBusConnection *conn = NULL;
-
- conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
- if (!conn || err) {
- fprintf (stderr, "failed to get system bus\n");
- return -1;
- }
-
- id = g_bus_own_name_on_connection(conn, "org.tizen.myname", G_BUS_NAME_OWNER_FLAGS_NONE,
- name_acquire, name_lost, NULL, NULL);
-
- if (id == 0) {
- fprintf (stderr, "g_bus_own_name_on_connection fails\n");
- return -1;
- }
-
- signal(SIGQUIT, sig_quit);
- signal(SIGABRT, sig_abort);
- signal(SIGTERM, sig_term);
-
- mainloop = g_main_loop_new(NULL, FALSE);
- g_main_loop_run(mainloop);
-
- return 0;
-}
+++ /dev/null
-[Unit]
-Description=systemd user helper
-
-[Service]
-SmackProcessLabel=System
-Type=dbus
-BusName=org.tizen.myname
-ExecStart=/usr/bin/systemd-user-helper
-NotifyAccess=main
--- /dev/null
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <policy user="root">
+ <allow own="org.tizen.dbus-activation-stop-test"/>
+ <allow send_destination="org.tizen.dbus-activation-stop-test"/>
+ </policy>
+ <policy context="default">
+ <deny own="org.tizen.dbus-activation-stop-test"/>
+ <deny send_destination="org.tizen.dbus-activation-stop-test"/>
+ </policy>
+</busconfig>
--- /dev/null
+[Unit]
+Description=dbus activation stop test
+
+[Service]
+Type=dbus
+BusName=org.tizen.dbus-activation-stop-test
+ExecStart=/usr/bin/dbus-activation-stop-test
+NotifyAccess=main
+SmackProcessLabel=System
\ No newline at end of file