~jjohansen/+junk/apparmor-dbus

« back to all changes in this revision

Viewing changes to .pc/0001-activation-allow-for-more-variation-than-just-system.patch/bus/activation.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-07-07 12:23:51 UTC
  • mfrom: (1.1.27 upstream) (1.3.18 sid)
  • Revision ID: james.westby@ubuntu.com-20110707122351-v9trnw2yt9g1xjux
Tags: 1.4.12-4ubuntu1
* Merge with Debian unstable. Remaining changes:
  - Install binaries into / rather than /usr:
    + debian/rules: Set --exec-prefix=/
    + debian/dbus.install, debian/dbus-x11.install: Install from /bin
  - Use upstart to start:
    + Add debian/dbus.upstart.
    + debian/control: Add upstart dependency.
    + debian/dbus.postinst: Use upstart call instead of invoking the init.d
      script for checking if we are already running. 
    + debian/control: versioned dependency on netbase that emits the new
      deconfiguring-networking event used in upstart script.
  - 20_system_conf_limit.patch: Increase max_match_rules_per_connection for
    the system bus to 5000 (LP #454093)
  - 81-session.conf-timeout.patch: Raise the service startup timeout from 25
    to 60 seconds. It may be too short on the live CD with slow machines.
  - Add 0001-activation-allow-for-more-variation-than-just-system.patch,
    0002-bus-change-systemd-activation-to-activation-systemd.patch,
    0003-upstart-add-upstart-as-a-possible-activation-type.patch,
    0004-upstart-add-UpstartJob-to-service-desktop-files.patch,
    0005-activation-implement-upstart-activation.patch: Patches from Scott
    James Remnant to implement Upstart service activation. Not upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1106
1106
  if (!pending_activation)
1107
1107
    return TRUE;
1108
1108
 
 
1109
  bus_context_log (activation->context,
 
1110
                   DBUS_SYSTEM_LOG_INFO, "Successfully activated service '%s'",
 
1111
                   service_name);
 
1112
 
1109
1113
  link = _dbus_list_get_first_link (&pending_activation->entries);
1110
1114
  while (link != NULL)
1111
1115
    {
1400
1404
 
1401
1405
      if (activation_failed)
1402
1406
        {
 
1407
          bus_context_log (pending_activation->activation->context,
 
1408
                           DBUS_SYSTEM_LOG_INFO, "Activated service '%s' failed: %s",
 
1409
                           pending_activation->service_name,
 
1410
                           error.message);
 
1411
 
1403
1412
          /* Destroy all pending activations with the same exec */
1404
1413
          _dbus_hash_iter_init (pending_activation->activation->pending_activations,
1405
1414
                                &iter);
1462
1471
  dbus_set_error (&error, DBUS_ERROR_TIMED_OUT,
1463
1472
                  "Activation of %s timed out",
1464
1473
                  pending_activation->service_name);
 
1474
  bus_context_log (pending_activation->activation->context,
 
1475
                   DBUS_SYSTEM_LOG_INFO,
 
1476
                   "Failed to activate service '%s': timed out",
 
1477
                   pending_activation->service_name);
1465
1478
 
1466
1479
  pending_activation_failed (pending_activation, &error);
1467
1480
 
1674
1687
                                 const char     *service_name,
1675
1688
                                 DBusError      *error)
1676
1689
{
 
1690
  DBusError tmp_error;
1677
1691
  BusActivationEntry *entry;
1678
1692
  BusPendingActivation *pending_activation;
1679
1693
  BusPendingActivationEntry *pending_activation_entry;
1962
1976
          service = bus_registry_lookup (registry, &service_string);
1963
1977
 
1964
1978
          if (service != NULL)
1965
 
            /* Wonderful, systemd is connected, let's just send the msg */
1966
 
            retval = bus_dispatch_matches (activation_transaction, NULL, bus_service_get_primary_owners_connection (service),
1967
 
                                           message, error);
 
1979
            {
 
1980
              bus_context_log (activation->context,
 
1981
                               DBUS_SYSTEM_LOG_INFO, "Activating via systemd: service name='%s' unit='%s'",
 
1982
                               service_name,
 
1983
                               entry->systemd_service);
 
1984
              /* Wonderful, systemd is connected, let's just send the msg */
 
1985
              retval = bus_dispatch_matches (activation_transaction, NULL, bus_service_get_primary_owners_connection (service),
 
1986
                                             message, error);
 
1987
            }
1968
1988
          else
1969
 
            /* systemd is not around, let's "activate" it. */
1970
 
            retval = bus_activation_activate_service (activation, connection, activation_transaction, TRUE,
1971
 
                                                      message, "org.freedesktop.systemd1", error);
 
1989
            {
 
1990
              bus_context_log (activation->context,
 
1991
                               DBUS_SYSTEM_LOG_INFO, "Activating systemd to hand-off: service name='%s' unit='%s'",
 
1992
                               service_name,
 
1993
                               entry->systemd_service);
 
1994
              /* systemd is not around, let's "activate" it. */
 
1995
              retval = bus_activation_activate_service (activation, connection, activation_transaction, TRUE,
 
1996
                                                        message, "org.freedesktop.systemd1", error);
 
1997
            }
1972
1998
 
1973
1999
          dbus_message_unref (message);
1974
2000
 
1975
2001
          if (!retval)
1976
2002
            {
 
2003
              bus_context_log (activation->context,
 
2004
                               DBUS_SYSTEM_LOG_INFO, "Failed to activate via systemd: service name='%s' unit='%s'",
 
2005
                               service_name,
 
2006
                               entry->systemd_service);
1977
2007
              _DBUS_ASSERT_ERROR_IS_SET (error);
1978
2008
              _dbus_verbose ("failed to send activation message: %s\n", error->name);
1979
2009
              bus_transaction_cancel_and_free (activation_transaction);
2069
2099
    }
2070
2100
 
2071
2101
  _dbus_verbose ("Spawning %s ...\n", argv[0]);
 
2102
  if (servicehelper != NULL)
 
2103
    bus_context_log (activation->context,
 
2104
                     DBUS_SYSTEM_LOG_INFO, "Activating service name='%s' (using servicehelper)",
 
2105
                     service_name);
 
2106
  else
 
2107
    bus_context_log (activation->context,
 
2108
                     DBUS_SYSTEM_LOG_INFO, "Activating service name='%s'",
 
2109
                     service_name);
 
2110
 
 
2111
  dbus_error_init (&tmp_error);
 
2112
 
2072
2113
  if (!_dbus_spawn_async_with_babysitter (&pending_activation->babysitter, argv,
2073
2114
                                          envp,
2074
2115
                                          NULL, activation,
2075
 
                                          error))
 
2116
                                          &tmp_error))
2076
2117
    {
2077
2118
      _dbus_verbose ("Failed to spawn child\n");
2078
 
      _DBUS_ASSERT_ERROR_IS_SET (error);
 
2119
      bus_context_log (activation->context,
 
2120
                       DBUS_SYSTEM_LOG_INFO, "Failed to activate service %s: %s",
 
2121
                       service_name,
 
2122
                       tmp_error.message);
 
2123
      _DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
 
2124
      dbus_move_error (&tmp_error, error);
2079
2125
      dbus_free_string_array (argv);
2080
2126
      dbus_free_string_array (envp);
2081
2127
 
2166
2212
                             DBUS_TYPE_INVALID))
2167
2213
    dbus_set_error(&error, code, str);
2168
2214
 
 
2215
 
2169
2216
  if (unit)
2170
2217
    {
2171
2218
      DBusHashIter iter;
2172
2219
 
 
2220
      bus_context_log (activation->context,
 
2221
                       DBUS_SYSTEM_LOG_INFO, "Activation via systemd failed for unit '%s': %s",
 
2222
                       unit,
 
2223
                       str);
 
2224
 
2173
2225
      _dbus_hash_iter_init (activation->pending_activations,
2174
2226
                            &iter);
2175
2227