Ted Gould has proposed merging lp:~ted/upstart/dbus-arguments into lp:upstart
with lp:~ted/upstart/session-jobs as a prerequisite.
Commit message:
Add DBus signal arguments to the Upstart event.
Requested reviews:
Upstart Reviewers (upstart-reviewers)
For more details, see:
https://code.launchpad.net/~ted/upstart/dbus-arguments/+merge/172385
Takes the dbus message and if it has any string arguments adds them to the
Upstart event so that other jobs can filter and use them directly.
--
https://code.launchpad.net/~ted/upstart/dbus-arguments/+merge/172385
Your team Upstart Reviewers is requested to review the proposed merge of
lp:~ted/upstart/dbus-arguments into lp:upstart.
=== modified file 'extra/upstart-dbus-bridge.c'
--- extra/upstart-dbus-bridge.c 2013-07-01 17:57:23 +0000
+++ extra/upstart-dbus-bridge.c 2013-07-01 17:57:23 +0000
@@ -438,6 +438,7 @@
int emit = FALSE;
DBusPendingCall *pending_call;
DBusError error;
+ DBusMessageIter message_iter;
nih_local char **env = NULL;
const char *sender;
const char *destination;
@@ -516,6 +517,31 @@
NIH_MUST (nih_str_array_addp (&env, NULL, &env_len, var));
}
+ if (dbus_message_iter_init (message, &message_iter)) {
+ int current_type = DBUS_TYPE_INVALID;
+ int arg_num = 0;
+
+ while ((current_type = dbus_message_iter_get_arg_type(&message_iter)) != DBUS_TYPE_INVALID) {
+ nih_local char *var = NULL;
+
+ switch (current_type) {
+ case DBUS_TYPE_STRING: {
+ const char * arg = NULL;
+ dbus_message_iter_get_basic(&message_iter, &arg);
+
+ var = NIH_MUST (nih_sprintf (NULL, "ARG%d=%s", arg_num, arg));
+ NIH_MUST (nih_str_array_addp (&env, NULL, &env_len, var));
+ break;
+ }
+ /* NOTE: Only supporting strings for now, we can consider other
+ types in the future by extending this switch */
+ }
+
+ dbus_message_iter_next(&message_iter);
+ arg_num++;
+ }
+ }
+
nih_debug ("Received D-Bus signal: %s "
"(sender=%s, destination=%s, interface=%s, path=%s)",
signal ? signal : "",
--
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/upstart-devel