Merge authors:
  Ted Gould (ted)
Related merge proposals:
  https://code.launchpad.net/~ted/upstart/dbus-configure-event/+merge/172381
  proposed by: Ted Gould (ted)
  review: Approve - James Hunt (jamesodhunt)
------------------------------------------------------------
revno: 1511 [merge]
committer: James Hunt <[email protected]>
branch nick: upstart
timestamp: Wed 2013-07-24 09:47:33 +0100
message:
  * Merge of lp:~ted/upstart/dbus-configure-event.
modified:
  extra/man/dbus-event.7
  extra/man/upstart-dbus-bridge.8
  extra/upstart-dbus-bridge.c


--
lp:upstart
https://code.launchpad.net/~upstart-devel/upstart/trunk

Your team Upstart Reviewers is subscribed to branch lp:upstart.
To unsubscribe from this branch go to 
https://code.launchpad.net/~upstart-devel/upstart/trunk/+edit-subscription
=== modified file 'extra/man/dbus-event.7'
--- extra/man/dbus-event.7	2013-05-01 04:33:35 +0000
+++ extra/man/dbus-event.7	2013-07-24 04:37:34 +0000
@@ -5,6 +5,7 @@
 .\"
 .SH SYNOPSIS
 .B dbus
+.BI BUS\fR= BUS_NAME
 .BI SIGNAL\fR= SIGNAL
 .BI INTERFACE\fR= INTERFACE
 .BI PATH\fR= PATH
@@ -25,6 +26,16 @@
 .B stop on
 stanza is modified.
 
+The
+.B BUS
+parameter is optional and only set if the
+.BR upstart\-dbus\-bridge (8)
+daemon is started with the
+.B --bus-name
+parameter.  The value of
+.B BUS
+will be the same as the value passed as the parameter.
+
 .\"
 .SH EXAMPLES
 .\"

=== modified file 'extra/man/upstart-dbus-bridge.8'
--- extra/man/upstart-dbus-bridge.8	2013-05-01 04:57:37 +0000
+++ extra/man/upstart-dbus-bridge.8	2013-07-24 04:33:15 +0000
@@ -57,6 +57,11 @@
 over the D\-Bus system bus.
 .\"
 .TP
+.B \-\-bus-name
+Set a name for the bus to be passed as an additional argument to the event
+under the property BUS.  Used to distinguish multiple D\-Bus bridges.
+.\"
+.TP
 .B \-\-verbose
 Enable verbose output.
 .\"

=== modified file 'extra/upstart-dbus-bridge.c'
--- extra/upstart-dbus-bridge.c	2013-07-03 08:26:23 +0000
+++ extra/upstart-dbus-bridge.c	2013-07-24 04:37:59 +0000
@@ -52,6 +52,7 @@
 #define DBUS_EVENT "dbus"
 
 /* Prototypes for static functions */
+static int               bus_name_setter      (NihOption *option, const char *arg);
 static int               dbus_bus_setter      (NihOption *option, const char *arg);
 static void              dbus_disconnected    (DBusConnection *connection);
 static void              upstart_disconnected (DBusConnection *connection);
@@ -93,6 +94,13 @@
 DBusBusType dbus_bus = (DBusBusType)-1;
 
 /**
+ * bus_name:
+ *
+ * type of event to emit.
+ **/
+static const char * bus_name = NULL;
+
+/**
  * Structure we use for tracking jobs
  *
  * @entry: list header, 
@@ -128,6 +136,8 @@
 	  NULL, NULL, &always, NULL },
 	{ 0, "daemon", N_("Detach and run in the background"),
 	  NULL, NULL, &daemonise, NULL },
+	{ 0, "bus-name", N_("Bus name to emit to Upstart Jobs"),
+	  NULL, "bus name", NULL, bus_name_setter },
 	{ 0, "user", N_("Connect to user session"),
 	  NULL, NULL, &user_mode, NULL },
 	{ 0, "session", N_("Use D-Bus session bus"),
@@ -377,6 +387,24 @@
 }
 
 /**  
+ * NihOption setter function to handle bus name
+ *
+ * Returns: 0 on success
+ **/
+static int
+bus_name_setter (NihOption *option, const char *arg)
+{
+	nih_assert (option);
+
+	if (arg == NULL || arg[0] == '\0' || arg[0] == ' ') {
+		return -1;
+	}
+
+	bus_name = arg;
+	return 0;
+}
+
+/**  
  * NihOption setter function to handle selection of D-Bus bus type.
  *
  * Returns: 0 on success, -1 on invalid console type.
@@ -469,6 +497,12 @@
 		goto out;
 	}
 
+	if (bus_name) {
+		nih_local char *var = NULL;
+		var = NIH_MUST (nih_sprintf (NULL, "BUS=%s", bus_name));
+		NIH_MUST (nih_str_array_addp (&env, NULL, &env_len, var));
+	}
+
 	if (interface) {
 		nih_local char *var = NULL;
 		var = NIH_MUST (nih_sprintf (NULL, "INTERFACE=%s", interface));

-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to