From: Lukasz Stempien Date: Wed, 16 Oct 2013 11:29:33 +0000 (+0200) Subject: [daemon-dev] Update kdbus starters for dbus activatable service names functionality... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0c005b3e354d302cc92e1b82b896571d0f963dca;p=platform%2Fupstream%2Fdbus.git [daemon-dev] Update kdbus starters for dbus activatable service names functionality added. Change-Id: If3225a6795467392cedeac3a791871f1c984a836 Signed-off-by: Lukasz Stempien --- diff --git a/bus/bus.c b/bus/bus.c index f3ef668..b97a047 100644 --- a/bus/bus.c +++ b/bus/bus.c @@ -1042,6 +1042,16 @@ bus_context_reload_config (BusContext *context, _DBUS_ASSERT_ERROR_IS_SET (error); goto failed; } + + if(context->myKdbusConnection) + { + if(!update_kdbus_starters(context->myKdbusConnection)) + { + _dbus_verbose ("Update kdbus starters for dbus activatable names failed.\n"); + _DBUS_ASSERT_ERROR_IS_SET (error); + goto failed; + } + } ret = TRUE; bus_context_log (context, DBUS_SYSTEM_LOG_INFO, "Reloaded configuration"); diff --git a/bus/connection.c b/bus/connection.c index 925626e..534ef6f 100644 --- a/bus/connection.c +++ b/bus/connection.c @@ -1377,6 +1377,16 @@ bus_connection_get_n_services_owned (DBusConnection *connection) return d->n_services_owned; } +DBusList** +bus_connection_get_services_owned (DBusConnection *connection) +{ + BusConnectionData *d; + d = BUS_CONNECTION_DATA (connection); + _dbus_assert (d != NULL); + + return &d->services_owned; +} + dbus_bool_t bus_connection_complete (DBusConnection *connection, const DBusString *name, diff --git a/bus/connection.h b/bus/connection.h index 8a24ed5..3684ba0 100644 --- a/bus/connection.h +++ b/bus/connection.h @@ -81,6 +81,8 @@ dbus_bool_t bus_connection_preallocate_oom_error (DBusConnection *connection); void bus_connection_send_oom_error (DBusConnection *connection, DBusMessage *in_reply_to); +DBusList** bus_connection_get_services_owned (DBusConnection *connection); + /* called by signals.c */ dbus_bool_t bus_connection_add_match_rule (DBusConnection *connection, BusMatchRule *rule); diff --git a/bus/kdbus-d.c b/bus/kdbus-d.c index d42ed19..789730e 100644 --- a/bus/kdbus-d.c +++ b/bus/kdbus-d.c @@ -381,6 +381,58 @@ out: return retval; } +dbus_bool_t update_kdbus_starters(DBusConnection* connection) +{ + dbus_bool_t retval = FALSE; + DBusList **services_old; + DBusList *link; + BusService *service = NULL; + BusTransaction *transaction; + int fd; + + transaction = bus_transaction_new (bus_connection_get_context(connection)); + if (transaction == NULL) + return FALSE; + + if(!_dbus_transport_get_socket_fd(dbus_connection_get_transport(connection), &fd)) + goto out; + + services_old = bus_connection_get_services_owned(connection); + link = _dbus_list_get_first_link(services_old); + + while (link != NULL) + { + int ret; + + service = (BusService*) link->data; + if(service == NULL) + goto out; + + ret = release_kdbus_name(fd, bus_service_get_name(service), 0); + + if (ret == DBUS_RELEASE_NAME_REPLY_RELEASED) + { + if(!bus_service_remove_owner(service, connection, transaction, NULL)) + _dbus_verbose ("Unable to remove\n"); + } + else if(ret < 0) + goto out; + + link = _dbus_list_get_next_link (services_old, link); + } + + if(!register_kdbus_starters(connection)) + { + _dbus_verbose ("Registering kdbus starters for dbus activatable names failed!\n"); + goto out; + } + retval = TRUE; + +out: + bus_transaction_free(transaction); + return retval; +} + /* static dbus_bool_t remove_conn_if_name_match (DBusConnection *connection, void *data) { diff --git a/bus/kdbus-d.h b/bus/kdbus-d.h index 4254db9..c6f9bd6 100644 --- a/bus/kdbus-d.h +++ b/bus/kdbus-d.h @@ -34,5 +34,6 @@ dbus_bool_t kdbus_get_connection_unix_selinux_security_context(DBusConnection* c DBusConnection* create_phantom_connection(DBusConnection* connection, const char* unique_name, DBusError* error); dbus_bool_t register_kdbus_starters(DBusConnection* connection); +dbus_bool_t update_kdbus_starters(DBusConnection* connection); void handleNameOwnerChanged(DBusMessage *msg, BusTransaction *transaction, DBusConnection *connection); #endif /* KDBUS_H_ */