Coverage report for dbus/dbus-connection.c.gcov

        -:    0:Source:dbus-connection.c
        -:    0:Graph:.libs/dbus-connection.gcno
        -:    0:Data:.libs/dbus-connection.gcda
        -:    0:Runs:11813
        -:    0:Programs:5
        -:    1:/* -*- mode: C; c-file-style: "gnu" -*- */
        -:    2:/* dbus-connection.c DBusConnection object
        -:    3: *
        -:    4: * Copyright (C) 2002, 2003, 2004, 2005  Red Hat Inc.
        -:    5: *
        -:    6: * Licensed under the Academic Free License version 2.1
        -:    7: * 
        -:    8: * This program is free software; you can redistribute it and/or modify
        -:    9: * it under the terms of the GNU General Public License as published by
        -:   10: * the Free Software Foundation; either version 2 of the License, or
        -:   11: * (at your option) any later version.
        -:   12: *
        -:   13: * This program is distributed in the hope that it will be useful,
        -:   14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
        -:   15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        -:   16: * GNU General Public License for more details.
        -:   17: * 
        -:   18: * You should have received a copy of the GNU General Public License
        -:   19: * along with this program; if not, write to the Free Software
        -:   20: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
        -:   21: *
        -:   22: */
        -:   23:
        -:   24:#include <config.h>
        -:   25:#include "dbus-shared.h"
        -:   26:#include "dbus-connection.h"
        -:   27:#include "dbus-list.h"
        -:   28:#include "dbus-timeout.h"
        -:   29:#include "dbus-transport.h"
        -:   30:#include "dbus-watch.h"
        -:   31:#include "dbus-connection-internal.h"
        -:   32:#include "dbus-list.h"
        -:   33:#include "dbus-hash.h"
        -:   34:#include "dbus-message-internal.h"
        -:   35:#include "dbus-threads.h"
        -:   36:#include "dbus-protocol.h"
        -:   37:#include "dbus-dataslot.h"
        -:   38:#include "dbus-string.h"
        -:   39:#include "dbus-pending-call.h"
        -:   40:#include "dbus-object-tree.h"
        -:   41:#include "dbus-threads-internal.h"
        -:   42:
        -:   43:#ifdef DBUS_DISABLE_CHECKS
        -:   44:#define TOOK_LOCK_CHECK(connection)
        -:   45:#define RELEASING_LOCK_CHECK(connection)
        -:   46:#define HAVE_LOCK_CHECK(connection)
        -:   47:#else
        -:   48:#define TOOK_LOCK_CHECK(connection) do {                \
        -:   49:    _dbus_assert (!(connection)->have_connection_lock); \
        -:   50:    (connection)->have_connection_lock = TRUE;          \
        -:   51:  } while (0)
        -:   52:#define RELEASING_LOCK_CHECK(connection) do {            \
        -:   53:    _dbus_assert ((connection)->have_connection_lock);   \
        -:   54:    (connection)->have_connection_lock = FALSE;          \
        -:   55:  } while (0)
        -:   56:#define HAVE_LOCK_CHECK(connection)        _dbus_assert ((connection)->have_connection_lock)
        -:   57:/* A "DO_NOT_HAVE_LOCK_CHECK" is impossible since we need the lock to check the flag */
        -:   58:#endif
        -:   59:
        -:   60:#define TRACE_LOCKS 1
        -:   61:
        -:   62:#define CONNECTION_LOCK(connection)   do {                                      \
        -:   63:    if (TRACE_LOCKS) { _dbus_verbose ("  LOCK: %s\n", _DBUS_FUNCTION_NAME); }   \
        -:   64:    _dbus_mutex_lock ((connection)->mutex);                                      \
        -:   65:    TOOK_LOCK_CHECK (connection);                                               \
        -:   66:  } while (0)
        -:   67:
        -:   68:#define CONNECTION_UNLOCK(connection) do {                                              \
        -:   69:    if (TRACE_LOCKS) { _dbus_verbose ("  UNLOCK: %s\n", _DBUS_FUNCTION_NAME);  }        \
        -:   70:    RELEASING_LOCK_CHECK (connection);                                                  \
        -:   71:    _dbus_mutex_unlock ((connection)->mutex);                                            \
        -:   72:  } while (0)
        -:   73:
        -:   74:#define DISPATCH_STATUS_NAME(s)                                            \
        -:   75:                     ((s) == DBUS_DISPATCH_COMPLETE ? "complete" :         \
        -:   76:                      (s) == DBUS_DISPATCH_DATA_REMAINS ? "data remains" : \
        -:   77:                      (s) == DBUS_DISPATCH_NEED_MEMORY ? "need memory" :   \
        -:   78:                      "???")
        -:   79:
        -:   80:/**
        -:   81: * @defgroup DBusConnection DBusConnection
        -:   82: * @ingroup  DBus
        -:   83: * @brief Connection to another application
        -:   84: *
        -:   85: * A DBusConnection represents a connection to another
        -:   86: * application. Messages can be sent and received via this connection.
        -:   87: * The other application may be a message bus; for convenience, the
        -:   88: * function dbus_bus_get() is provided to automatically open a
        -:   89: * connection to the well-known message buses.
        -:   90: * 
        -:   91: * In brief a DBusConnection is a message queue associated with some
        -:   92: * message transport mechanism such as a socket.  The connection
        -:   93: * maintains a queue of incoming messages and a queue of outgoing
        -:   94: * messages.
        -:   95: *
        -:   96: * Incoming messages are normally processed by calling
        -:   97: * dbus_connection_dispatch(). dbus_connection_dispatch() runs any
        -:   98: * handlers registered for the topmost message in the message queue,
        -:   99: * then discards the message, then returns.
        -:  100: * 
        -:  101: * dbus_connection_get_dispatch_status() indicates whether
        -:  102: * messages are currently in the queue that need dispatching.
        -:  103: * dbus_connection_set_dispatch_status_function() allows
        -:  104: * you to set a function to be used to monitor the dispatch status.
        -:  105: *
        -:  106: * If you're using GLib or Qt add-on libraries for D-BUS, there are
        -:  107: * special convenience APIs in those libraries that hide
        -:  108: * all the details of dispatch and watch/timeout monitoring.
        -:  109: * For example, dbus_connection_setup_with_g_main().
        -:  110: *
        -:  111: * If you aren't using these add-on libraries, you have to manually
        -:  112: * call dbus_connection_set_dispatch_status_function(),
        -:  113: * dbus_connection_set_watch_functions(),
        -:  114: * dbus_connection_set_timeout_functions() providing appropriate
        -:  115: * functions to integrate the connection with your application's main
        -:  116: * loop.
        -:  117: *
        -:  118: * When you use dbus_connection_send() or one of its variants to send
        -:  119: * a message, the message is added to the outgoing queue.  It's
        -:  120: * actually written to the network later; either in
        -:  121: * dbus_watch_handle() invoked by your main loop, or in
        -:  122: * dbus_connection_flush() which blocks until it can write out the
        -:  123: * entire outgoing queue. The GLib/Qt add-on libraries again
        -:  124: * handle the details here for you by setting up watch functions.
        -:  125: *
        -:  126: * When a connection is disconnected, you are guaranteed to get a
        -:  127: * signal "Disconnected" from the interface
        -:  128: * #DBUS_INTERFACE_LOCAL, path
        -:  129: * #DBUS_PATH_LOCAL.
        -:  130: *
        -:  131: * You may not drop the last reference to a #DBusConnection
        -:  132: * until that connection has been disconnected.
        -:  133: *
        -:  134: * You may dispatch the unprocessed incoming message queue even if the
        -:  135: * connection is disconnected. However, "Disconnected" will always be
        -:  136: * the last message in the queue (obviously no messages are received
        -:  137: * after disconnection).
        -:  138: *
        -:  139: * #DBusConnection has thread locks and drops them when invoking user
        -:  140: * callbacks, so in general is transparently threadsafe. However,
        -:  141: * #DBusMessage does NOT have thread locks; you must not send the same
        -:  142: * message to multiple #DBusConnection that will be used from
        -:  143: * different threads.
        -:  144: */
        -:  145:
        -:  146:/**
        -:  147: * @defgroup DBusConnectionInternals DBusConnection implementation details
        -:  148: * @ingroup  DBusInternals
        -:  149: * @brief Implementation details of DBusConnection
        -:  150: *
        -:  151: * @{
        -:  152: */
        -:  153:
        -:  154:/**
        -:  155: * Internal struct representing a message filter function 
        -:  156: */
        -:  157:typedef struct DBusMessageFilter DBusMessageFilter;
        -:  158:
        -:  159:/**
        -:  160: * Internal struct representing a message filter function 
        -:  161: */
        -:  162:struct DBusMessageFilter
        -:  163:{
        -:  164:  DBusAtomic refcount; /**< Reference count */
        -:  165:  DBusHandleMessageFunction function; /**< Function to call to filter */
        -:  166:  void *user_data; /**< User data for the function */
        -:  167:  DBusFreeFunction free_user_data_function; /**< Function to free the user data */
        -:  168:};
        -:  169:
        -:  170:
        -:  171:/**
        -:  172: * Internals of DBusPreallocatedSend
        -:  173: */
        -:  174:struct DBusPreallocatedSend
        -:  175:{
        -:  176:  DBusConnection *connection; /**< Connection we'd send the message to */
        -:  177:  DBusList *queue_link;       /**< Preallocated link in the queue */
        -:  178:  DBusList *counter_link;     /**< Preallocated link in the resource counter */
        -:  179:};
        -:  180:
        -:  181:static dbus_bool_t _dbus_modify_sigpipe = TRUE;
        -:  182:
        -:  183:/**
        -:  184: * Implementation details of DBusConnection. All fields are private.
        -:  185: */
        -:  186:struct DBusConnection
        -:  187:{
        -:  188:  DBusAtomic refcount; /**< Reference count. */
        -:  189:
        -:  190:  DBusMutex *mutex; /**< Lock on the entire DBusConnection */
        -:  191:
        -:  192:  DBusMutex *dispatch_mutex;     /**< Protects dispatch_acquired */
        -:  193:  DBusCondVar *dispatch_cond;    /**< Notify when dispatch_acquired is available */
        -:  194:  DBusMutex *io_path_mutex;      /**< Protects io_path_acquired */
        -:  195:  DBusCondVar *io_path_cond;     /**< Notify when io_path_acquired is available */
        -:  196:  
        -:  197:  DBusList *outgoing_messages; /**< Queue of messages we need to send, send the end of the list first. */
        -:  198:  DBusList *incoming_messages; /**< Queue of messages we have received, end of the list received most recently. */
        -:  199:
        -:  200:  DBusMessage *message_borrowed; /**< Filled in if the first incoming message has been borrowed;
        -:  201:                                  *   dispatch_acquired will be set by the borrower
        -:  202:                                  */
        -:  203:  
        -:  204:  int n_outgoing;              /**< Length of outgoing queue. */
        -:  205:  int n_incoming;              /**< Length of incoming queue. */
        -:  206:
        -:  207:  DBusCounter *outgoing_counter; /**< Counts size of outgoing messages. */
        -:  208:  
        -:  209:  DBusTransport *transport;    /**< Object that sends/receives messages over network. */
        -:  210:  DBusWatchList *watches;      /**< Stores active watches. */
        -:  211:  DBusTimeoutList *timeouts;   /**< Stores active timeouts. */
        -:  212:  
        -:  213:  DBusList *filter_list;        /**< List of filters. */
        -:  214:
        -:  215:  DBusDataSlotList slot_list;   /**< Data stored by allocated integer ID */
        -:  216:
        -:  217:  DBusHashTable *pending_replies;  /**< Hash of message serials to #DBusPendingCall. */  
        -:  218:  
        -:  219:  dbus_uint32_t client_serial;       /**< Client serial. Increments each time a message is sent  */
        -:  220:  DBusList *disconnect_message_link; /**< Preallocated list node for queueing the disconnection message */
        -:  221:
        -:  222:  DBusWakeupMainFunction wakeup_main_function; /**< Function to wake up the mainloop  */
        -:  223:  void *wakeup_main_data; /**< Application data for wakeup_main_function */
        -:  224:  DBusFreeFunction free_wakeup_main_data; /**< free wakeup_main_data */
        -:  225:
        -:  226:  DBusDispatchStatusFunction dispatch_status_function; /**< Function on dispatch status changes  */
        -:  227:  void *dispatch_status_data; /**< Application data for dispatch_status_function */
        -:  228:  DBusFreeFunction free_dispatch_status_data; /**< free dispatch_status_data */
        -:  229:
        -:  230:  DBusDispatchStatus last_dispatch_status; /**< The last dispatch status we reported to the application. */
        -:  231:
        -:  232:  DBusList *link_cache; /**< A cache of linked list links to prevent contention
        -:  233:                         *   for the global linked list mempool lock
        -:  234:                         */
        -:  235:  DBusObjectTree *objects; /**< Object path handlers registered with this connection */
        -:  236:
        -:  237:  char *server_guid; /**< GUID of server if we are in shared_connections, #NULL if server GUID is unknown or connection is private */
        -:  238:
        -:  239:  unsigned int shareable : 1; /**< #TRUE if connection can go in shared_connections once we know the GUID */
        -:  240:  
        -:  241:  unsigned int dispatch_acquired : 1; /**< Someone has dispatch path (can drain incoming queue) */
        -:  242:  unsigned int io_path_acquired : 1;  /**< Someone has transport io path (can use the transport to read/write messages) */
        -:  243:  
        -:  244:  unsigned int exit_on_disconnect : 1; /**< If #TRUE, exit after handling disconnect signal */
        -:  245:  
        -:  246:#ifndef DBUS_DISABLE_CHECKS
        -:  247:  unsigned int have_connection_lock : 1; /**< Used to check locking */
        -:  248:#endif
        -:  249:  
        -:  250:#ifndef DBUS_DISABLE_CHECKS
        -:  251:  int generation; /**< _dbus_current_generation that should correspond to this connection */
        -:  252:#endif 
        -:  253:};
        -:  254:
        -:  255:static DBusDispatchStatus _dbus_connection_get_dispatch_status_unlocked      (DBusConnection     *connection);
        -:  256:static void               _dbus_connection_update_dispatch_status_and_unlock (DBusConnection     *connection,
        -:  257:                                                                              DBusDispatchStatus  new_status);
        -:  258:static void               _dbus_connection_last_unref                        (DBusConnection     *connection);
        -:  259:static void               _dbus_connection_acquire_dispatch                  (DBusConnection     *connection);
        -:  260:static void               _dbus_connection_release_dispatch                  (DBusConnection     *connection);
        -:  261:
        -:  262:static DBusMessageFilter *
        -:  263:_dbus_message_filter_ref (DBusMessageFilter *filter)
function _dbus_message_filter_ref called 31535 returned 100% blocks executed 100%
    31535:  264:{
    31535:  265:  _dbus_assert (filter->refcount.value > 0);
call    0 returned 100%
    31535:  266:  _dbus_atomic_inc (&filter->refcount);
call    0 returned 100%
        -:  267:
    31535:  268:  return filter;
        -:  269:}
        -:  270:
        -:  271:static void
        -:  272:_dbus_message_filter_unref (DBusMessageFilter *filter)
function _dbus_message_filter_unref called 44782 returned 100% blocks executed 86%
    44782:  273:{
    44782:  274:  _dbus_assert (filter->refcount.value > 0);
call    0 returned 100%
        -:  275:
    44782:  276:  if (_dbus_atomic_dec (&filter->refcount) == 1)
call    0 returned 100%
branch  1 taken 30% (fallthrough)
branch  2 taken 70%
        -:  277:    {
    13247:  278:      if (filter->free_user_data_function)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  279:        (* filter->free_user_data_function) (filter->user_data);
call    0 never executed
        -:  280:      
    13247:  281:      dbus_free (filter);
call    0 returned 100%
        -:  282:    }
    44782:  283:}
        -:  284:
        -:  285:/**
        -:  286: * Acquires the connection lock.
        -:  287: *
        -:  288: * @param connection the connection.
        -:  289: */
        -:  290:void
        -:  291:_dbus_connection_lock (DBusConnection *connection)
function _dbus_connection_lock called 9893 returned 100% blocks executed 100%
     9893:  292:{
     9893:  293:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
     9893:  294:}
        -:  295:
        -:  296:/**
        -:  297: * Releases the connection lock.
        -:  298: *
        -:  299: * @param connection the connection.
        -:  300: */
        -:  301:void
        -:  302:_dbus_connection_unlock (DBusConnection *connection)
function _dbus_connection_unlock called 9893 returned 100% blocks executed 100%
     9893:  303:{
     9893:  304:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
     9893:  305:}
        -:  306:
        -:  307:/**
        -:  308: * Wakes up the main loop if it is sleeping
        -:  309: * Needed if we're e.g. queueing outgoing messages
        -:  310: * on a thread while the mainloop sleeps.
        -:  311: *
        -:  312: * @param connection the connection.
        -:  313: */
        -:  314:static void
        -:  315:_dbus_connection_wakeup_mainloop (DBusConnection *connection)
function _dbus_connection_wakeup_mainloop called 85638 returned 100% blocks executed 67%
    85638:  316:{
    85638:  317:  if (connection->wakeup_main_function)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  318:    (*connection->wakeup_main_function) (connection->wakeup_main_data);
call    0 never executed
    85638:  319:}
        -:  320:
        -:  321:#ifdef DBUS_BUILD_TESTS
        -:  322:/* For now this function isn't used */
        -:  323:/**
        -:  324: * Adds a message to the incoming message queue, returning #FALSE
        -:  325: * if there's insufficient memory to queue the message.
        -:  326: * Does not take over refcount of the message.
        -:  327: *
        -:  328: * @param connection the connection.
        -:  329: * @param message the message to queue.
        -:  330: * @returns #TRUE on success.
        -:  331: */
        -:  332:dbus_bool_t
        -:  333:_dbus_connection_queue_received_message (DBusConnection *connection,
        -:  334:                                         DBusMessage    *message)
function _dbus_connection_queue_received_message called 0 returned 0% blocks executed 0%
    #####:  335:{
        -:  336:  DBusList *link;
        -:  337:
    #####:  338:  link = _dbus_list_alloc_link (message);
call    0 never executed
    #####:  339:  if (link == NULL)
branch  0 never executed
branch  1 never executed
    #####:  340:    return FALSE;
        -:  341:
    #####:  342:  dbus_message_ref (message);
call    0 never executed
    #####:  343:  _dbus_connection_queue_received_message_link (connection, link);
call    0 never executed
        -:  344:
    #####:  345:  return TRUE;
        -:  346:}
        -:  347:#endif
        -:  348:
        -:  349:/**
        -:  350: * Adds a message-containing list link to the incoming message queue,
        -:  351: * taking ownership of the link and the message's current refcount.
        -:  352: * Cannot fail due to lack of memory.
        -:  353: *
        -:  354: * @param connection the connection.
        -:  355: * @param link the message link to queue.
        -:  356: */
        -:  357:void
        -:  358:_dbus_connection_queue_received_message_link (DBusConnection  *connection,
        -:  359:                                              DBusList        *link)
function _dbus_connection_queue_received_message_link called 69327 returned 100% blocks executed 100%
    69327:  360:{
        -:  361:  DBusPendingCall *pending;
        -:  362:  dbus_int32_t reply_serial;
        -:  363:  DBusMessage *message;
        -:  364:  
    69327:  365:  _dbus_assert (_dbus_transport_get_is_authenticated (connection->transport));
call    0 returned 100%
call    1 returned 100%
        -:  366:  
    69327:  367:  _dbus_list_append_link (&connection->incoming_messages,
call    0 returned 100%
        -:  368:                          link);
    69327:  369:  message = link->data;
        -:  370:
        -:  371:  /* If this is a reply we're waiting on, remove timeout for it */
    69327:  372:  reply_serial = dbus_message_get_reply_serial (message);
call    0 returned 100%
    69327:  373:  if (reply_serial != -1)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -:  374:    {
    69327:  375:      pending = _dbus_hash_table_lookup_int (connection->pending_replies,
call    0 returned 100%
        -:  376:                                             reply_serial);
    69327:  377:      if (pending != NULL)
branch  0 taken 2% (fallthrough)
branch  1 taken 98%
        -:  378:	{
     1230:  379:	  if (pending->timeout_added)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
     1230:  380:            _dbus_connection_remove_timeout_unlocked (connection,
call    0 returned 100%
        -:  381:                                                      pending->timeout);
        -:  382:
     1230:  383:	  pending->timeout_added = FALSE;
        -:  384:	}
        -:  385:    }
        -:  386:  
    69327:  387:  connection->n_incoming += 1;
        -:  388:
    69327:  389:  _dbus_connection_wakeup_mainloop (connection);
call    0 returned 100%
        -:  390:  
    69327:  391:  _dbus_verbose ("Message %p (%d %s %s %s '%s' reply to %u) added to incoming queue %p, %d incoming\n",
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
branch  3 taken 78% (fallthrough)
branch  4 taken 22%
call    5 returned 100%
call    6 returned 100%
branch  7 taken 78% (fallthrough)
branch  8 taken 22%
call    9 returned 100%
call   10 returned 100%
branch 11 taken 78% (fallthrough)
branch 12 taken 22%
call   13 returned 100%
call   14 returned 100%
call   15 returned 100%
        -:  392:                 message,
        -:  393:                 dbus_message_get_type (message),
        -:  394:                 dbus_message_get_path (message) ?
        -:  395:                 dbus_message_get_path (message) :
        -:  396:                 "no path",
        -:  397:                 dbus_message_get_interface (message) ?
        -:  398:                 dbus_message_get_interface (message) :
        -:  399:                 "no interface",
        -:  400:                 dbus_message_get_member (message) ?
        -:  401:                 dbus_message_get_member (message) :
        -:  402:                 "no member",
        -:  403:                 dbus_message_get_signature (message),
        -:  404:                 dbus_message_get_reply_serial (message),
        -:  405:                 connection,
        -:  406:                 connection->n_incoming);
    69327:  407:}
        -:  408:
        -:  409:/**
        -:  410: * Adds a link + message to the incoming message queue.
        -:  411: * Can't fail. Takes ownership of both link and message.
        -:  412: *
        -:  413: * @param connection the connection.
        -:  414: * @param link the list node and message to queue.
        -:  415: *
        -:  416: * @todo This needs to wake up the mainloop if it is in
        -:  417: * a poll/select and this is a multithreaded app.
        -:  418: */
        -:  419:static void
        -:  420:_dbus_connection_queue_synthesized_message_link (DBusConnection *connection,
        -:  421:						 DBusList *link)
function _dbus_connection_queue_synthesized_message_link called 13837 returned 100% blocks executed 100%
    13837:  422:{
    13837:  423:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -:  424:  
    13837:  425:  _dbus_list_append_link (&connection->incoming_messages, link);
call    0 returned 100%
        -:  426:
    13837:  427:  connection->n_incoming += 1;
        -:  428:
    13837:  429:  _dbus_connection_wakeup_mainloop (connection);
call    0 returned 100%
        -:  430:  
    13837:  431:  _dbus_verbose ("Synthesized message %p added to incoming queue %p, %d incoming\n",
call    0 returned 100%
        -:  432:                 link->data, connection, connection->n_incoming);
    13837:  433:}
        -:  434:
        -:  435:
        -:  436:/**
        -:  437: * Checks whether there are messages in the outgoing message queue.
        -:  438: * Called with connection lock held.
        -:  439: *
        -:  440: * @param connection the connection.
        -:  441: * @returns #TRUE if the outgoing queue is non-empty.
        -:  442: */
        -:  443:dbus_bool_t
        -:  444:_dbus_connection_has_messages_to_send_unlocked (DBusConnection *connection)
function _dbus_connection_has_messages_to_send_unlocked called 694808 returned 100% blocks executed 100%
   694808:  445:{
   694808:  446:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
   694808:  447:  return connection->outgoing_messages != NULL;
        -:  448:}
        -:  449:
        -:  450:/**
        -:  451: * Checks whether there are messages in the outgoing message queue.
        -:  452: *
        -:  453: * @param connection the connection.
        -:  454: * @returns #TRUE if the outgoing queue is non-empty.
        -:  455: */
        -:  456:dbus_bool_t
        -:  457:dbus_connection_has_messages_to_send (DBusConnection *connection)
function dbus_connection_has_messages_to_send called 8766 returned 100% blocks executed 79%
     8766:  458:{
        -:  459:  dbus_bool_t v;
        -:  460:  
     8766:  461:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -:  462:
     8766:  463:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
     8766:  464:  v = _dbus_connection_has_messages_to_send_unlocked (connection);
call    0 returned 100%
     8766:  465:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -:  466:
     8766:  467:  return v;
        -:  468:}
        -:  469:
        -:  470:/**
        -:  471: * Gets the next outgoing message. The message remains in the
        -:  472: * queue, and the caller does not own a reference to it.
        -:  473: *
        -:  474: * @param connection the connection.
        -:  475: * @returns the message to be sent.
        -:  476: */ 
        -:  477:DBusMessage*
        -:  478:_dbus_connection_get_message_to_send (DBusConnection *connection)
function _dbus_connection_get_message_to_send called 73947 returned 100% blocks executed 100%
    73947:  479:{
    73947:  480:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -:  481:  
    73947:  482:  return _dbus_list_get_last (&connection->outgoing_messages);
call    0 returned 100%
        -:  483:}
        -:  484:
        -:  485:/**
        -:  486: * Notifies the connection that a message has been sent, so the
        -:  487: * message can be removed from the outgoing queue.
        -:  488: * Called with the connection lock held.
        -:  489: *
        -:  490: * @param connection the connection.
        -:  491: * @param message the message that was sent.
        -:  492: */
        -:  493:void
        -:  494:_dbus_connection_message_sent (DBusConnection *connection,
        -:  495:                               DBusMessage    *message)
function _dbus_connection_message_sent called 75606 returned 100% blocks executed 100%
    75606:  496:{
        -:  497:  DBusList *link;
        -:  498:
    75606:  499:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -:  500:  
        -:  501:  /* This can be called before we even complete authentication, since
        -:  502:   * it's called on disconnect to clean up the outgoing queue.
        -:  503:   * It's also called as we successfully send each message.
        -:  504:   */
        -:  505:  
    75606:  506:  link = _dbus_list_get_last_link (&connection->outgoing_messages);
call    0 returned 100%
    75606:  507:  _dbus_assert (link != NULL);
call    0 returned 100%
    75606:  508:  _dbus_assert (link->data == message);
call    0 returned 100%
        -:  509:
        -:  510:  /* Save this link in the link cache */
    75606:  511:  _dbus_list_unlink (&connection->outgoing_messages,
call    0 returned 100%
        -:  512:                     link);
    75606:  513:  _dbus_list_prepend_link (&connection->link_cache, link);
call    0 returned 100%
        -:  514:  
    75606:  515:  connection->n_outgoing -= 1;
        -:  516:
    75606:  517:  _dbus_verbose ("Message %p (%d %s %s %s '%s') removed from outgoing queue %p, %d left to send\n",
call    0 returned 100%
call    1 returned 100%
branch  2 taken 76% (fallthrough)
branch  3 taken 24%
call    4 returned 100%
call    5 returned 100%
branch  6 taken 76% (fallthrough)
branch  7 taken 24%
call    8 returned 100%
call    9 returned 100%
branch 10 taken 76% (fallthrough)
branch 11 taken 24%
call   12 returned 100%
call   13 returned 100%
call   14 returned 100%
        -:  518:                 message,
        -:  519:                 dbus_message_get_type (message),
        -:  520:                 dbus_message_get_path (message) ?
        -:  521:                 dbus_message_get_path (message) :
        -:  522:                 "no path",
        -:  523:                 dbus_message_get_interface (message) ?
        -:  524:                 dbus_message_get_interface (message) :
        -:  525:                 "no interface",
        -:  526:                 dbus_message_get_member (message) ?
        -:  527:                 dbus_message_get_member (message) :
        -:  528:                 "no member",
        -:  529:                 dbus_message_get_signature (message),
        -:  530:                 connection, connection->n_outgoing);
        -:  531:
        -:  532:  /* Save this link in the link cache also */
    75606:  533:  _dbus_message_remove_size_counter (message, connection->outgoing_counter,
call    0 returned 100%
        -:  534:                                     &link);
    75606:  535:  _dbus_list_prepend_link (&connection->link_cache, link);
call    0 returned 100%
        -:  536:  
    75606:  537:  dbus_message_unref (message);
call    0 returned 100%
    75606:  538:}
        -:  539:
        -:  540:typedef dbus_bool_t (* DBusWatchAddFunction)     (DBusWatchList *list,
        -:  541:                                                  DBusWatch     *watch);
        -:  542:typedef void        (* DBusWatchRemoveFunction)  (DBusWatchList *list,
        -:  543:                                                  DBusWatch     *watch);
        -:  544:typedef void        (* DBusWatchToggleFunction)  (DBusWatchList *list,
        -:  545:                                                  DBusWatch     *watch,
        -:  546:                                                  dbus_bool_t    enabled);
        -:  547:
        -:  548:static dbus_bool_t
        -:  549:protected_change_watch (DBusConnection         *connection,
        -:  550:                        DBusWatch              *watch,
        -:  551:                        DBusWatchAddFunction    add_function,
        -:  552:                        DBusWatchRemoveFunction remove_function,
        -:  553:                        DBusWatchToggleFunction toggle_function,
        -:  554:                        dbus_bool_t             enabled)
function protected_change_watch called 436359 returned 100% blocks executed 95%
   436359:  555:{
        -:  556:  DBusWatchList *watches;
        -:  557:  dbus_bool_t retval;
        -:  558:  
   436359:  559:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -:  560:
        -:  561:  /* This isn't really safe or reasonable; a better pattern is the "do everything, then
        -:  562:   * drop lock and call out" one; but it has to be propagated up through all callers
        -:  563:   */
        -:  564:  
   436359:  565:  watches = connection->watches;
   436359:  566:  if (watches)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -:  567:    {
   436359:  568:      connection->watches = NULL;
   436359:  569:      _dbus_connection_ref_unlocked (connection);
call    0 returned 100%
   436359:  570:      CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -:  571:
   436359:  572:      if (add_function)
branch  0 taken 7% (fallthrough)
branch  1 taken 93%
    28543:  573:        retval = (* add_function) (watches, watch);
call    0 returned 100%
   407816:  574:      else if (remove_function)
branch  0 taken 7% (fallthrough)
branch  1 taken 93%
        -:  575:        {
    27687:  576:          retval = TRUE;
    27687:  577:          (* remove_function) (watches, watch);
call    0 returned 100%
        -:  578:        }
        -:  579:      else
        -:  580:        {
   380129:  581:          retval = TRUE;
   380129:  582:          (* toggle_function) (watches, watch, enabled);
call    0 returned 100%
        -:  583:        }
        -:  584:      
   436359:  585:      CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
   436359:  586:      connection->watches = watches;
   436359:  587:      _dbus_connection_unref_unlocked (connection);
call    0 returned 100%
        -:  588:
   436359:  589:      return retval;
        -:  590:    }
        -:  591:  else
    #####:  592:    return FALSE;
        -:  593:}
        -:  594:     
        -:  595:
        -:  596:/**
        -:  597: * Adds a watch using the connection's DBusAddWatchFunction if
        -:  598: * available. Otherwise records the watch to be added when said
        -:  599: * function is available. Also re-adds the watch if the
        -:  600: * DBusAddWatchFunction changes. May fail due to lack of memory.
        -:  601: * Connection lock should be held when calling this.
        -:  602: *
        -:  603: * @param connection the connection.
        -:  604: * @param watch the watch to add.
        -:  605: * @returns #TRUE on success.
        -:  606: */
        -:  607:dbus_bool_t
        -:  608:_dbus_connection_add_watch_unlocked (DBusConnection *connection,
        -:  609:                                     DBusWatch      *watch)
function _dbus_connection_add_watch_unlocked called 28543 returned 100% blocks executed 100%
    28543:  610:{
    28543:  611:  return protected_change_watch (connection, watch,
call    0 returned 100%
        -:  612:                                 _dbus_watch_list_add_watch,
        -:  613:                                 NULL, NULL, FALSE);
        -:  614:}
        -:  615:
        -:  616:/**
        -:  617: * Removes a watch using the connection's DBusRemoveWatchFunction
        -:  618: * if available. It's an error to call this function on a watch
        -:  619: * that was not previously added.
        -:  620: * Connection lock should be held when calling this.
        -:  621: *
        -:  622: * @param connection the connection.
        -:  623: * @param watch the watch to remove.
        -:  624: */
        -:  625:void
        -:  626:_dbus_connection_remove_watch_unlocked (DBusConnection *connection,
        -:  627:                                        DBusWatch      *watch)
function _dbus_connection_remove_watch_unlocked called 27687 returned 100% blocks executed 100%
    27687:  628:{
    27687:  629:  protected_change_watch (connection, watch,
call    0 returned 100%
        -:  630:                          NULL,
        -:  631:                          _dbus_watch_list_remove_watch,
        -:  632:                          NULL, FALSE);
    27687:  633:}
        -:  634:
        -:  635:/**
        -:  636: * Toggles a watch and notifies app via connection's
        -:  637: * DBusWatchToggledFunction if available. It's an error to call this
        -:  638: * function on a watch that was not previously added.
        -:  639: * Connection lock should be held when calling this.
        -:  640: *
        -:  641: * @param connection the connection.
        -:  642: * @param watch the watch to toggle.
        -:  643: * @param enabled whether to enable or disable
        -:  644: */
        -:  645:void
        -:  646:_dbus_connection_toggle_watch_unlocked (DBusConnection *connection,
        -:  647:                                        DBusWatch      *watch,
        -:  648:                                        dbus_bool_t     enabled)
function _dbus_connection_toggle_watch_unlocked called 380129 returned 100% blocks executed 100%
   380129:  649:{
   380129:  650:  _dbus_assert (watch != NULL);
call    0 returned 100%
        -:  651:
   380129:  652:  protected_change_watch (connection, watch,
call    0 returned 100%
        -:  653:                          NULL, NULL,
        -:  654:                          _dbus_watch_list_toggle_watch,
        -:  655:                          enabled);
   380129:  656:}
        -:  657:
        -:  658:typedef dbus_bool_t (* DBusTimeoutAddFunction)    (DBusTimeoutList *list,
        -:  659:                                                   DBusTimeout     *timeout);
        -:  660:typedef void        (* DBusTimeoutRemoveFunction) (DBusTimeoutList *list,
        -:  661:                                                   DBusTimeout     *timeout);
        -:  662:typedef void        (* DBusTimeoutToggleFunction) (DBusTimeoutList *list,
        -:  663:                                                   DBusTimeout     *timeout,
        -:  664:                                                   dbus_bool_t      enabled);
        -:  665:
        -:  666:static dbus_bool_t
        -:  667:protected_change_timeout (DBusConnection           *connection,
        -:  668:                          DBusTimeout              *timeout,
        -:  669:                          DBusTimeoutAddFunction    add_function,
        -:  670:                          DBusTimeoutRemoveFunction remove_function,
        -:  671:                          DBusTimeoutToggleFunction toggle_function,
        -:  672:                          dbus_bool_t               enabled)
function protected_change_timeout called 2692 returned 100% blocks executed 89%
     2692:  673:{
        -:  674:  DBusTimeoutList *timeouts;
        -:  675:  dbus_bool_t retval;
        -:  676:  
     2692:  677:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -:  678:
        -:  679:  /* This isn't really safe or reasonable; a better pattern is the "do everything, then
        -:  680:   * drop lock and call out" one; but it has to be propagated up through all callers
        -:  681:   */
        -:  682:  
     2692:  683:  timeouts = connection->timeouts;
     2692:  684:  if (timeouts)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -:  685:    {
     2692:  686:      connection->timeouts = NULL;
     2692:  687:      _dbus_connection_ref_unlocked (connection);
call    0 returned 100%
     2692:  688:      CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -:  689:
     2692:  690:      if (add_function)
branch  0 taken 50% (fallthrough)
branch  1 taken 50%
     1346:  691:        retval = (* add_function) (timeouts, timeout);
call    0 returned 100%
     1346:  692:      else if (remove_function)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -:  693:        {
     1346:  694:          retval = TRUE;
     1346:  695:          (* remove_function) (timeouts, timeout);
call    0 returned 100%
        -:  696:        }
        -:  697:      else
        -:  698:        {
    #####:  699:          retval = TRUE;
    #####:  700:          (* toggle_function) (timeouts, timeout, enabled);
call    0 never executed
        -:  701:        }
        -:  702:      
     2692:  703:      CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
     2692:  704:      connection->timeouts = timeouts;
     2692:  705:      _dbus_connection_unref_unlocked (connection);
call    0 returned 100%
        -:  706:
     2692:  707:      return retval;
        -:  708:    }
        -:  709:  else
    #####:  710:    return FALSE;
        -:  711:}
        -:  712:
        -:  713:/**
        -:  714: * Adds a timeout using the connection's DBusAddTimeoutFunction if
        -:  715: * available. Otherwise records the timeout to be added when said
        -:  716: * function is available. Also re-adds the timeout if the
        -:  717: * DBusAddTimeoutFunction changes. May fail due to lack of memory.
        -:  718: * The timeout will fire repeatedly until removed.
        -:  719: * Connection lock should be held when calling this.
        -:  720: *
        -:  721: * @param connection the connection.
        -:  722: * @param timeout the timeout to add.
        -:  723: * @returns #TRUE on success.
        -:  724: */
        -:  725:dbus_bool_t
        -:  726:_dbus_connection_add_timeout_unlocked (DBusConnection *connection,
        -:  727:                                       DBusTimeout    *timeout)
function _dbus_connection_add_timeout_unlocked called 1346 returned 100% blocks executed 100%
     1346:  728:{
     1346:  729:  return protected_change_timeout (connection, timeout,
call    0 returned 100%
        -:  730:                                   _dbus_timeout_list_add_timeout,
        -:  731:                                   NULL, NULL, FALSE);
        -:  732:}
        -:  733:
        -:  734:/**
        -:  735: * Removes a timeout using the connection's DBusRemoveTimeoutFunction
        -:  736: * if available. It's an error to call this function on a timeout
        -:  737: * that was not previously added.
        -:  738: * Connection lock should be held when calling this.
        -:  739: *
        -:  740: * @param connection the connection.
        -:  741: * @param timeout the timeout to remove.
        -:  742: */
        -:  743:void
        -:  744:_dbus_connection_remove_timeout_unlocked (DBusConnection *connection,
        -:  745:                                          DBusTimeout    *timeout)
function _dbus_connection_remove_timeout_unlocked called 1346 returned 100% blocks executed 100%
     1346:  746:{
     1346:  747:  protected_change_timeout (connection, timeout,
call    0 returned 100%
        -:  748:                            NULL,
        -:  749:                            _dbus_timeout_list_remove_timeout,
        -:  750:                            NULL, FALSE);
     1346:  751:}
        -:  752:
        -:  753:/**
        -:  754: * Toggles a timeout and notifies app via connection's
        -:  755: * DBusTimeoutToggledFunction if available. It's an error to call this
        -:  756: * function on a timeout that was not previously added.
        -:  757: * Connection lock should be held when calling this.
        -:  758: *
        -:  759: * @param connection the connection.
        -:  760: * @param timeout the timeout to toggle.
        -:  761: * @param enabled whether to enable or disable
        -:  762: */
        -:  763:void
        -:  764:_dbus_connection_toggle_timeout_unlocked (DBusConnection   *connection,
        -:  765:                                          DBusTimeout      *timeout,
        -:  766:                                          dbus_bool_t       enabled)
function _dbus_connection_toggle_timeout_unlocked called 0 returned 0% blocks executed 0%
    #####:  767:{
    #####:  768:  protected_change_timeout (connection, timeout,
call    0 never executed
        -:  769:                            NULL, NULL,
        -:  770:                            _dbus_timeout_list_toggle_timeout,
        -:  771:                            enabled);
    #####:  772:}
        -:  773:
        -:  774:static dbus_bool_t
        -:  775:_dbus_connection_attach_pending_call_unlocked (DBusConnection  *connection,
        -:  776:                                               DBusPendingCall *pending)
function _dbus_connection_attach_pending_call_unlocked called 1346 returned 100% blocks executed 71%
     1346:  777:{
     1346:  778:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -:  779:  
     1346:  780:  _dbus_assert (pending->reply_serial != 0);
call    0 returned 100%
        -:  781:
     1346:  782:  if (!_dbus_connection_add_timeout_unlocked (connection, pending->timeout))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  783:    return FALSE;
        -:  784:  
     1346:  785:  if (!_dbus_hash_table_insert_int (connection->pending_replies,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  786:                                    pending->reply_serial,
        -:  787:                                    pending))
        -:  788:    {
    #####:  789:      _dbus_connection_remove_timeout_unlocked (connection, pending->timeout);
call    0 never executed
        -:  790:
    #####:  791:      HAVE_LOCK_CHECK (connection);
call    0 never executed
    #####:  792:      return FALSE;
        -:  793:    }
        -:  794:  
     1346:  795:  pending->timeout_added = TRUE;
     1346:  796:  pending->connection = connection;
        -:  797:
     1346:  798:  dbus_pending_call_ref (pending);
call    0 returned 100%
        -:  799:
     1346:  800:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -:  801:  
     1346:  802:  return TRUE;
        -:  803:}
        -:  804:
        -:  805:static void
        -:  806:free_pending_call_on_hash_removal (void *data)
function free_pending_call_on_hash_removal called 2692 returned 100% blocks executed 100%
     2692:  807:{
        -:  808:  DBusPendingCall *pending;
        -:  809:  
     2692:  810:  if (data == NULL)
branch  0 taken 50% (fallthrough)
branch  1 taken 50%
     1346:  811:    return;
        -:  812:
     1346:  813:  pending = data;
        -:  814:
     1346:  815:  if (pending->connection)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -:  816:    {
     1346:  817:      if (pending->timeout_added)
branch  0 taken 9% (fallthrough)
branch  1 taken 91%
        -:  818:        {
      116:  819:          _dbus_connection_remove_timeout_unlocked (pending->connection,
call    0 returned 100%
        -:  820:                                                    pending->timeout);
      116:  821:          pending->timeout_added = FALSE;
        -:  822:        }
        -:  823:
     1346:  824:      pending->connection = NULL;
        -:  825:      
     1346:  826:      dbus_pending_call_unref (pending);
call    0 returned 100%
        -:  827:    }
        -:  828:}
        -:  829:
        -:  830:static void
        -:  831:_dbus_connection_detach_pending_call_unlocked (DBusConnection  *connection,
        -:  832:                                               DBusPendingCall *pending)
function _dbus_connection_detach_pending_call_unlocked called 0 returned 0% blocks executed 0%
    #####:  833:{
        -:  834:  /* Can't have a destroy notifier on the pending call if we're going to do this */
        -:  835:
    #####:  836:  dbus_pending_call_ref (pending);
call    0 never executed
    #####:  837:  _dbus_hash_table_remove_int (connection->pending_replies,
call    0 never executed
        -:  838:                               pending->reply_serial);
    #####:  839:  _dbus_assert (pending->connection == NULL);
call    0 never executed
    #####:  840:  dbus_pending_call_unref (pending);
call    0 never executed
    #####:  841:}
        -:  842:
        -:  843:static void
        -:  844:_dbus_connection_detach_pending_call_and_unlock (DBusConnection  *connection,
        -:  845:                                                 DBusPendingCall *pending)
function _dbus_connection_detach_pending_call_and_unlock called 1346 returned 100% blocks executed 100%
     1346:  846:{
        -:  847:  /* The idea here is to avoid finalizing the pending call
        -:  848:   * with the lock held, since there's a destroy notifier
        -:  849:   * in pending call that goes out to application code.
        -:  850:   */
     1346:  851:  dbus_pending_call_ref (pending);
call    0 returned 100%
     1346:  852:  _dbus_hash_table_remove_int (connection->pending_replies,
call    0 returned 100%
        -:  853:                               pending->reply_serial);
     1346:  854:  _dbus_assert (pending->connection == NULL);
call    0 returned 100%
     1346:  855:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
     1346:  856:  dbus_pending_call_unref (pending);
call    0 returned 100%
     1346:  857:}
        -:  858:
        -:  859:/**
        -:  860: * Removes a pending call from the connection, such that
        -:  861: * the pending reply will be ignored. May drop the last
        -:  862: * reference to the pending call.
        -:  863: *
        -:  864: * @param connection the connection
        -:  865: * @param pending the pending call
        -:  866: */
        -:  867:void
        -:  868:_dbus_connection_remove_pending_call (DBusConnection  *connection,
        -:  869:                                      DBusPendingCall *pending)
function _dbus_connection_remove_pending_call called 0 returned 0% blocks executed 0%
    #####:  870:{
    #####:  871:  CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
    #####:  872:  _dbus_connection_detach_pending_call_and_unlock (connection, pending);
call    0 never executed
    #####:  873:}
        -:  874:
        -:  875:/**
        -:  876: * Completes a pending call with the given message,
        -:  877: * or if the message is #NULL, by timing out the pending call.
        -:  878: * 
        -:  879: * @param pending the pending call
        -:  880: * @param message the message to complete the call with, or #NULL
        -:  881: *  to time out the call
        -:  882: */
        -:  883:void
        -:  884:_dbus_pending_call_complete_and_unlock (DBusPendingCall *pending,
        -:  885:                                        DBusMessage     *message)
function _dbus_pending_call_complete_and_unlock called 1346 returned 100% blocks executed 95%
     1346:  886:{
     1346:  887:  if (message == NULL)
branch  0 taken 9% (fallthrough)
branch  1 taken 91%
        -:  888:    {
      116:  889:      message = pending->timeout_link->data;
      116:  890:      _dbus_list_clear (&pending->timeout_link);
call    0 returned 100%
        -:  891:    }
        -:  892:  else
     1230:  893:    dbus_message_ref (message);
call    0 returned 100%
        -:  894:
     1346:  895:  _dbus_verbose ("  handing message %p (%s) to pending call serial %u\n",
call    0 returned 100%
branch  1 taken 69% (fallthrough)
branch  2 taken 31%
call    3 returned 100%
branch  4 taken 100% (fallthrough)
branch  5 taken 0%
call    6 returned 100%
        -:  896:                 message,
        -:  897:                 dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_METHOD_RETURN ?
        -:  898:                 "method return" :
        -:  899:                 dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR ?
        -:  900:                 "error" : "other type",
        -:  901:                 pending->reply_serial);
        -:  902:  
     1346:  903:  _dbus_assert (pending->reply == NULL);
call    0 returned 100%
     1346:  904:  _dbus_assert (pending->reply_serial == dbus_message_get_reply_serial (message));
call    0 returned 100%
call    1 returned 100%
     1346:  905:  pending->reply = message;
        -:  906:  
     1346:  907:  dbus_pending_call_ref (pending); /* in case there's no app with a ref held */
call    0 returned 100%
     1346:  908:  _dbus_connection_detach_pending_call_and_unlock (pending->connection, pending);
call    0 returned 100%
        -:  909:  
        -:  910:  /* Must be called unlocked since it invokes app callback */
     1346:  911:  _dbus_pending_call_notify (pending);
call    0 returned 100%
     1346:  912:  dbus_pending_call_unref (pending);
call    0 returned 100%
     1346:  913:}
        -:  914:
        -:  915:/**
        -:  916: * Acquire the transporter I/O path. This must be done before
        -:  917: * doing any I/O in the transporter. May sleep and drop the
        -:  918: * IO path mutex while waiting for the I/O path.
        -:  919: *
        -:  920: * @param connection the connection.
        -:  921: * @param timeout_milliseconds maximum blocking time, or -1 for no limit.
        -:  922: * @returns TRUE if the I/O path was acquired.
        -:  923: */
        -:  924:static dbus_bool_t
        -:  925:_dbus_connection_acquire_io_path (DBusConnection *connection,
        -:  926:				  int timeout_milliseconds)
function _dbus_connection_acquire_io_path called 205520 returned 100% blocks executed 74%
   205520:  927:{
        -:  928:  dbus_bool_t we_acquired;
        -:  929:  
   205520:  930:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -:  931:
        -:  932:  /* We don't want the connection to vanish */
   205520:  933:  _dbus_connection_ref_unlocked (connection);
call    0 returned 100%
        -:  934:
        -:  935:  /* We will only touch io_path_acquired which is protected by our mutex */
   205520:  936:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -:  937:  
   205520:  938:  _dbus_verbose ("%s locking io_path_mutex\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
   205520:  939:  _dbus_mutex_lock (connection->io_path_mutex);
call    0 returned 100%
        -:  940:
   205520:  941:  _dbus_verbose ("%s start connection->io_path_acquired = %d timeout = %d\n",
call    0 returned 100%
        -:  942:                 _DBUS_FUNCTION_NAME, connection->io_path_acquired, timeout_milliseconds);
        -:  943:
   205520:  944:  we_acquired = FALSE;
        -:  945:  
   205520:  946:  if (connection->io_path_acquired)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  947:    {
    #####:  948:      if (timeout_milliseconds != -1)
branch  0 never executed
branch  1 never executed
        -:  949:        {
    #####:  950:          _dbus_verbose ("%s waiting %d for IO path to be acquirable\n",
call    0 never executed
        -:  951:                         _DBUS_FUNCTION_NAME, timeout_milliseconds);
    #####:  952:          _dbus_condvar_wait_timeout (connection->io_path_cond,
call    0 never executed
        -:  953:                                      connection->io_path_mutex,
        -:  954:                                      timeout_milliseconds);
        -:  955:        }
        -:  956:      else
        -:  957:        {
    #####:  958:          while (connection->io_path_acquired)
branch  0 never executed
branch  1 never executed
        -:  959:            {
    #####:  960:              _dbus_verbose ("%s waiting for IO path to be acquirable\n", _DBUS_FUNCTION_NAME);
call    0 never executed
    #####:  961:              _dbus_condvar_wait (connection->io_path_cond, connection->io_path_mutex);
call    0 never executed
        -:  962:            }
        -:  963:        }
        -:  964:    }
        -:  965:  
   205520:  966:  if (!connection->io_path_acquired)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -:  967:    {
   205520:  968:      we_acquired = TRUE;
   205520:  969:      connection->io_path_acquired = TRUE;
        -:  970:    }
        -:  971:  
   205520:  972:  _dbus_verbose ("%s end connection->io_path_acquired = %d we_acquired = %d\n",
call    0 returned 100%
        -:  973:                 _DBUS_FUNCTION_NAME, connection->io_path_acquired, we_acquired);
        -:  974:
   205520:  975:  _dbus_verbose ("%s unlocking io_path_mutex\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
   205520:  976:  _dbus_mutex_unlock (connection->io_path_mutex);
call    0 returned 100%
        -:  977:
   205520:  978:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -:  979:  
   205520:  980:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -:  981:
   205520:  982:  _dbus_connection_unref_unlocked (connection);
call    0 returned 100%
        -:  983:  
   205520:  984:  return we_acquired;
        -:  985:}
        -:  986:
        -:  987:/**
        -:  988: * Release the I/O path when you're done with it. Only call
        -:  989: * after you've acquired the I/O. Wakes up at most one thread
        -:  990: * currently waiting to acquire the I/O path.
        -:  991: *
        -:  992: * @param connection the connection.
        -:  993: */
        -:  994:static void
        -:  995:_dbus_connection_release_io_path (DBusConnection *connection)
function _dbus_connection_release_io_path called 205520 returned 100% blocks executed 100%
   205520:  996:{
   205520:  997:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -:  998:  
   205520:  999:  _dbus_verbose ("%s locking io_path_mutex\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
   205520: 1000:  _dbus_mutex_lock (connection->io_path_mutex);
call    0 returned 100%
        -: 1001:  
   205520: 1002:  _dbus_assert (connection->io_path_acquired);
call    0 returned 100%
        -: 1003:
   205520: 1004:  _dbus_verbose ("%s start connection->io_path_acquired = %d\n",
call    0 returned 100%
        -: 1005:                 _DBUS_FUNCTION_NAME, connection->io_path_acquired);
        -: 1006:  
   205520: 1007:  connection->io_path_acquired = FALSE;
   205520: 1008:  _dbus_condvar_wake_one (connection->io_path_cond);
call    0 returned 100%
        -: 1009:
   205520: 1010:  _dbus_verbose ("%s unlocking io_path_mutex\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
   205520: 1011:  _dbus_mutex_unlock (connection->io_path_mutex);
call    0 returned 100%
   205520: 1012:}
        -: 1013:
        -: 1014:/**
        -: 1015: * Queues incoming messages and sends outgoing messages for this
        -: 1016: * connection, optionally blocking in the process. Each call to
        -: 1017: * _dbus_connection_do_iteration_unlocked() will call select() or poll() one
        -: 1018: * time and then read or write data if possible.
        -: 1019: *
        -: 1020: * The purpose of this function is to be able to flush outgoing
        -: 1021: * messages or queue up incoming messages without returning
        -: 1022: * control to the application and causing reentrancy weirdness.
        -: 1023: *
        -: 1024: * The flags parameter allows you to specify whether to
        -: 1025: * read incoming messages, write outgoing messages, or both,
        -: 1026: * and whether to block if no immediate action is possible.
        -: 1027: *
        -: 1028: * The timeout_milliseconds parameter does nothing unless the
        -: 1029: * iteration is blocking.
        -: 1030: *
        -: 1031: * If there are no outgoing messages and DBUS_ITERATION_DO_READING
        -: 1032: * wasn't specified, then it's impossible to block, even if
        -: 1033: * you specify DBUS_ITERATION_BLOCK; in that case the function
        -: 1034: * returns immediately.
        -: 1035: *
        -: 1036: * Called with connection lock held.
        -: 1037: * 
        -: 1038: * @param connection the connection.
        -: 1039: * @param flags iteration flags.
        -: 1040: * @param timeout_milliseconds maximum blocking time, or -1 for no limit.
        -: 1041: */
        -: 1042:void
        -: 1043:_dbus_connection_do_iteration_unlocked (DBusConnection *connection,
        -: 1044:                                        unsigned int    flags,
        -: 1045:                                        int             timeout_milliseconds)
function _dbus_connection_do_iteration_unlocked called 79405 returned 100% blocks executed 100%
    79405: 1046:{
    79405: 1047:  _dbus_verbose ("%s start\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
        -: 1048:  
    79405: 1049:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 1050:  
    79405: 1051:  if (connection->n_outgoing == 0)
branch  0 taken 2% (fallthrough)
branch  1 taken 98%
     1347: 1052:    flags &= ~DBUS_ITERATION_DO_WRITING;
        -: 1053:
    79405: 1054:  if (_dbus_connection_acquire_io_path (connection,
branch  0 taken 5% (fallthrough)
branch  1 taken 95%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
        -: 1055:					(flags & DBUS_ITERATION_BLOCK) ? timeout_milliseconds : 0))
        -: 1056:    {
    79405: 1057:      HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 1058:      
    79405: 1059:      _dbus_transport_do_iteration (connection->transport,
call    0 returned 100%
        -: 1060:				    flags, timeout_milliseconds);
    79405: 1061:      _dbus_connection_release_io_path (connection);
call    0 returned 100%
        -: 1062:    }
        -: 1063:
    79405: 1064:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 1065:
    79405: 1066:  _dbus_verbose ("%s end\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
    79405: 1067:}
        -: 1068:
        -: 1069:/**
        -: 1070: * Creates a new connection for the given transport.  A transport
        -: 1071: * represents a message stream that uses some concrete mechanism, such
        -: 1072: * as UNIX domain sockets. May return #NULL if insufficient
        -: 1073: * memory exists to create the connection.
        -: 1074: *
        -: 1075: * @param transport the transport.
        -: 1076: * @returns the new connection, or #NULL on failure.
        -: 1077: */
        -: 1078:DBusConnection*
        -: 1079:_dbus_connection_new_for_transport (DBusTransport *transport)
function _dbus_connection_new_for_transport called 14455 returned 100% blocks executed 94%
    14455: 1080:{
        -: 1081:  DBusConnection *connection;
        -: 1082:  DBusWatchList *watch_list;
        -: 1083:  DBusTimeoutList *timeout_list;
        -: 1084:  DBusHashTable *pending_replies;
        -: 1085:  DBusMutex *mutex;
        -: 1086:  DBusMutex *io_path_mutex;
        -: 1087:  DBusMutex *dispatch_mutex;
        -: 1088:  DBusCondVar *dispatch_cond;
        -: 1089:  DBusCondVar *io_path_cond;
        -: 1090:  DBusList *disconnect_link;
        -: 1091:  DBusMessage *disconnect_message;
        -: 1092:  DBusCounter *outgoing_counter;
        -: 1093:  DBusObjectTree *objects;
        -: 1094:  
    14455: 1095:  watch_list = NULL;
    14455: 1096:  connection = NULL;
    14455: 1097:  pending_replies = NULL;
    14455: 1098:  timeout_list = NULL;
    14455: 1099:  mutex = NULL;
    14455: 1100:  io_path_mutex = NULL;
    14455: 1101:  dispatch_mutex = NULL;
    14455: 1102:  dispatch_cond = NULL;
    14455: 1103:  io_path_cond = NULL;
    14455: 1104:  disconnect_link = NULL;
    14455: 1105:  disconnect_message = NULL;
    14455: 1106:  outgoing_counter = NULL;
    14455: 1107:  objects = NULL;
        -: 1108:  
    14455: 1109:  watch_list = _dbus_watch_list_new ();
call    0 returned 100%
    14455: 1110:  if (watch_list == NULL)
branch  0 taken 99% (fallthrough)
branch  1 taken 1%
       43: 1111:    goto error;
        -: 1112:
    14412: 1113:  timeout_list = _dbus_timeout_list_new ();
call    0 returned 100%
    14412: 1114:  if (timeout_list == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
       15: 1115:    goto error;  
        -: 1116:
    14397: 1117:  pending_replies =
call    0 returned 100%
        -: 1118:    _dbus_hash_table_new (DBUS_HASH_INT,
        -: 1119:			  NULL,
        -: 1120:                          (DBusFreeFunction)free_pending_call_on_hash_removal);
    14397: 1121:  if (pending_replies == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
       30: 1122:    goto error;
        -: 1123:  
    14367: 1124:  connection = dbus_new0 (DBusConnection, 1);
call    0 returned 100%
    14367: 1125:  if (connection == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
       17: 1126:    goto error;
        -: 1127:
    14350: 1128:  mutex = _dbus_mutex_new ();
call    0 returned 100%
    14350: 1129:  if (mutex == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1130:    goto error;
        -: 1131:
    14350: 1132:  io_path_mutex = _dbus_mutex_new ();
call    0 returned 100%
    14350: 1133:  if (io_path_mutex == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1134:    goto error;
        -: 1135:
    14350: 1136:  dispatch_mutex = _dbus_mutex_new ();
call    0 returned 100%
    14350: 1137:  if (dispatch_mutex == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1138:    goto error;
        -: 1139:  
    14350: 1140:  dispatch_cond = _dbus_condvar_new ();
call    0 returned 100%
    14350: 1141:  if (dispatch_cond == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1142:    goto error;
        -: 1143:  
    14350: 1144:  io_path_cond = _dbus_condvar_new ();
call    0 returned 100%
    14350: 1145:  if (io_path_cond == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1146:    goto error;
        -: 1147:
    14350: 1148:  disconnect_message = dbus_message_new_signal (DBUS_PATH_LOCAL,
call    0 returned 100%
        -: 1149:                                                DBUS_INTERFACE_LOCAL,
        -: 1150:                                                "Disconnected");
        -: 1151:  
    14350: 1152:  if (disconnect_message == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
       18: 1153:    goto error;
        -: 1154:
    14332: 1155:  disconnect_link = _dbus_list_alloc_link (disconnect_message);
call    0 returned 100%
    14332: 1156:  if (disconnect_link == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
       11: 1157:    goto error;
        -: 1158:
    14321: 1159:  outgoing_counter = _dbus_counter_new ();
call    0 returned 100%
    14321: 1160:  if (outgoing_counter == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
       15: 1161:    goto error;
        -: 1162:
    14306: 1163:  objects = _dbus_object_tree_new (connection);
call    0 returned 100%
    14306: 1164:  if (objects == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
       28: 1165:    goto error;
        -: 1166:  
    14278: 1167:  if (_dbus_modify_sigpipe)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
    14278: 1168:    _dbus_disable_sigpipe ();
call    0 returned 100%
        -: 1169:  
    14278: 1170:  connection->refcount.value = 1;
    14278: 1171:  connection->mutex = mutex;
    14278: 1172:  connection->dispatch_cond = dispatch_cond;
    14278: 1173:  connection->dispatch_mutex = dispatch_mutex;
    14278: 1174:  connection->io_path_cond = io_path_cond;
    14278: 1175:  connection->io_path_mutex = io_path_mutex;
    14278: 1176:  connection->transport = transport;
    14278: 1177:  connection->watches = watch_list;
    14278: 1178:  connection->timeouts = timeout_list;
    14278: 1179:  connection->pending_replies = pending_replies;
    14278: 1180:  connection->outgoing_counter = outgoing_counter;
    14278: 1181:  connection->filter_list = NULL;
    14278: 1182:  connection->last_dispatch_status = DBUS_DISPATCH_COMPLETE; /* so we're notified first time there's data */
    14278: 1183:  connection->objects = objects;
    14278: 1184:  connection->exit_on_disconnect = FALSE;
    14278: 1185:  connection->shareable = FALSE;
        -: 1186:#ifndef DBUS_DISABLE_CHECKS
    14278: 1187:  connection->generation = _dbus_current_generation;
        -: 1188:#endif
        -: 1189:  
    14278: 1190:  _dbus_data_slot_list_init (&connection->slot_list);
call    0 returned 100%
        -: 1191:
    14278: 1192:  connection->client_serial = 1;
        -: 1193:
    14278: 1194:  connection->disconnect_message_link = disconnect_link;
        -: 1195:
    14278: 1196:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1197:  
    14278: 1198:  if (!_dbus_transport_set_connection (transport, connection))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
       24: 1199:    goto error;
        -: 1200:
    14254: 1201:  _dbus_transport_ref (transport);
call    0 returned 100%
        -: 1202:
    14254: 1203:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1204:  
    14254: 1205:  return connection;
        -: 1206:  
      201: 1207: error:
      201: 1208:  if (disconnect_message != NULL)
branch  0 taken 39% (fallthrough)
branch  1 taken 61%
       78: 1209:    dbus_message_unref (disconnect_message);
call    0 returned 100%
        -: 1210:  
      201: 1211:  if (disconnect_link != NULL)
branch  0 taken 33% (fallthrough)
branch  1 taken 67%
       67: 1212:    _dbus_list_free_link (disconnect_link);
call    0 returned 100%
        -: 1213:  
      201: 1214:  if (io_path_cond != NULL)
branch  0 taken 48% (fallthrough)
branch  1 taken 52%
       96: 1215:    _dbus_condvar_free (io_path_cond);
call    0 returned 100%
        -: 1216:  
      201: 1217:  if (dispatch_cond != NULL)
branch  0 taken 48% (fallthrough)
branch  1 taken 52%
       96: 1218:    _dbus_condvar_free (dispatch_cond);
call    0 returned 100%
        -: 1219:  
      201: 1220:  if (mutex != NULL)
branch  0 taken 48% (fallthrough)
branch  1 taken 52%
       96: 1221:    _dbus_mutex_free (mutex);
call    0 returned 100%
        -: 1222:
      201: 1223:  if (io_path_mutex != NULL)
branch  0 taken 48% (fallthrough)
branch  1 taken 52%
       96: 1224:    _dbus_mutex_free (io_path_mutex);
call    0 returned 100%
        -: 1225:
      201: 1226:  if (dispatch_mutex != NULL)
branch  0 taken 48% (fallthrough)
branch  1 taken 52%
       96: 1227:    _dbus_mutex_free (dispatch_mutex);
call    0 returned 100%
        -: 1228:  
      201: 1229:  if (connection != NULL)
branch  0 taken 48% (fallthrough)
branch  1 taken 52%
       96: 1230:    dbus_free (connection);
call    0 returned 100%
        -: 1231:
      201: 1232:  if (pending_replies)
branch  0 taken 56% (fallthrough)
branch  1 taken 44%
      113: 1233:    _dbus_hash_table_unref (pending_replies);
call    0 returned 100%
        -: 1234:  
      201: 1235:  if (watch_list)
branch  0 taken 79% (fallthrough)
branch  1 taken 21%
      158: 1236:    _dbus_watch_list_free (watch_list);
call    0 returned 100%
        -: 1237:
      201: 1238:  if (timeout_list)
branch  0 taken 71% (fallthrough)
branch  1 taken 29%
      143: 1239:    _dbus_timeout_list_free (timeout_list);
call    0 returned 100%
        -: 1240:
      201: 1241:  if (outgoing_counter)
branch  0 taken 26% (fallthrough)
branch  1 taken 74%
       52: 1242:    _dbus_counter_unref (outgoing_counter);
call    0 returned 100%
        -: 1243:
      201: 1244:  if (objects)
branch  0 taken 12% (fallthrough)
branch  1 taken 88%
       24: 1245:    _dbus_object_tree_unref (objects);
call    0 returned 100%
        -: 1246:  
      201: 1247:  return NULL;
        -: 1248:}
        -: 1249:
        -: 1250:/**
        -: 1251: * Increments the reference count of a DBusConnection.
        -: 1252: * Requires that the caller already holds the connection lock.
        -: 1253: *
        -: 1254: * @param connection the connection.
        -: 1255: * @returns the connection.
        -: 1256: */
        -: 1257:DBusConnection *
        -: 1258:_dbus_connection_ref_unlocked (DBusConnection *connection)
function _dbus_connection_ref_unlocked called 1769904 returned 100% blocks executed 100%
  1769904: 1259:{  
  1769904: 1260:  _dbus_assert (connection != NULL);
call    0 returned 100%
  1769904: 1261:  _dbus_assert (connection->generation == _dbus_current_generation);
call    0 returned 100%
        -: 1262:
  1769904: 1263:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 1264:  
        -: 1265:#ifdef DBUS_HAVE_ATOMIC_INT
        -: 1266:  _dbus_atomic_inc (&connection->refcount);
        -: 1267:#else
  1769904: 1268:  _dbus_assert (connection->refcount.value > 0);
call    0 returned 100%
  1769904: 1269:  connection->refcount.value += 1;
        -: 1270:#endif
        -: 1271:
  1769904: 1272:  return connection;
        -: 1273:}
        -: 1274:
        -: 1275:/**
        -: 1276: * Decrements the reference count of a DBusConnection.
        -: 1277: * Requires that the caller already holds the connection lock.
        -: 1278: *
        -: 1279: * @param connection the connection.
        -: 1280: */
        -: 1281:void
        -: 1282:_dbus_connection_unref_unlocked (DBusConnection *connection)
function _dbus_connection_unref_unlocked called 1453128 returned 100% blocks executed 83%
  1453128: 1283:{
        -: 1284:  dbus_bool_t last_unref;
        -: 1285:
  1453128: 1286:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 1287:  
  1453128: 1288:  _dbus_assert (connection != NULL);
call    0 returned 100%
        -: 1289:
        -: 1290:  /* The connection lock is better than the global
        -: 1291:   * lock in the atomic increment fallback
        -: 1292:   */
        -: 1293:  
        -: 1294:#ifdef DBUS_HAVE_ATOMIC_INT
        -: 1295:  last_unref = (_dbus_atomic_dec (&connection->refcount) == 1);
        -: 1296:#else
  1453128: 1297:  _dbus_assert (connection->refcount.value > 0);
call    0 returned 100%
        -: 1298:
  1453128: 1299:  connection->refcount.value -= 1;
  1453128: 1300:  last_unref = (connection->refcount.value == 0);  
        -: 1301:#if 0
        -: 1302:  printf ("unref_unlocked() connection %p count = %d\n", connection, connection->refcount.value);
        -: 1303:#endif
        -: 1304:#endif
        -: 1305:  
  1453128: 1306:  if (last_unref)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1307:    _dbus_connection_last_unref (connection);
call    0 never executed
  1453128: 1308:}
        -: 1309:
        -: 1310:static dbus_uint32_t
        -: 1311:_dbus_connection_get_next_client_serial (DBusConnection *connection)
function _dbus_connection_get_next_client_serial called 55750 returned 100% blocks executed 100%
    55750: 1312:{
        -: 1313:  int serial;
        -: 1314:
    55750: 1315:  serial = connection->client_serial++;
        -: 1316:
        -: 1317:  if (connection->client_serial < 0)
        -: 1318:    connection->client_serial = 1;
        -: 1319:  
    55750: 1320:  return serial;
        -: 1321:}
        -: 1322:
        -: 1323:/**
        -: 1324: * A callback for use with dbus_watch_new() to create a DBusWatch.
        -: 1325: * 
        -: 1326: * @todo This is basically a hack - we could delete _dbus_transport_handle_watch()
        -: 1327: * and the virtual handle_watch in DBusTransport if we got rid of it.
        -: 1328: * The reason this is some work is threading, see the _dbus_connection_handle_watch()
        -: 1329: * implementation.
        -: 1330: *
        -: 1331: * @param watch the watch.
        -: 1332: * @param condition the current condition of the file descriptors being watched.
        -: 1333: * @param data must be a pointer to a #DBusConnection
        -: 1334: * @returns #FALSE if the IO condition may not have been fully handled due to lack of memory
        -: 1335: */
        -: 1336:dbus_bool_t
        -: 1337:_dbus_connection_handle_watch (DBusWatch                   *watch,
        -: 1338:                               unsigned int                 condition,
        -: 1339:                               void                        *data)
function _dbus_connection_handle_watch called 126115 returned 100% blocks executed 100%
   126115: 1340:{
        -: 1341:  DBusConnection *connection;
        -: 1342:  dbus_bool_t retval;
        -: 1343:  DBusDispatchStatus status;
        -: 1344:
   126115: 1345:  connection = data;
        -: 1346:
   126115: 1347:  _dbus_verbose ("%s start\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
        -: 1348:  
   126115: 1349:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
   126115: 1350:  _dbus_connection_acquire_io_path (connection, -1);
call    0 returned 100%
   126115: 1351:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
   126115: 1352:  retval = _dbus_transport_handle_watch (connection->transport,
call    0 returned 100%
        -: 1353:                                         watch, condition);
        -: 1354:
   126115: 1355:  _dbus_connection_release_io_path (connection);
call    0 returned 100%
        -: 1356:
   126115: 1357:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 1358:
   126115: 1359:  _dbus_verbose ("%s middle\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
        -: 1360:  
   126115: 1361:  status = _dbus_connection_get_dispatch_status_unlocked (connection);
call    0 returned 100%
        -: 1362:
        -: 1363:  /* this calls out to user code */
   126115: 1364:  _dbus_connection_update_dispatch_status_and_unlock (connection, status);
call    0 returned 100%
        -: 1365:
   126115: 1366:  _dbus_verbose ("%s end\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
        -: 1367:  
   126115: 1368:  return retval;
        -: 1369:}
        -: 1370:
        -: 1371:_DBUS_DEFINE_GLOBAL_LOCK (shared_connections);
        -: 1372:static DBusHashTable *shared_connections = NULL;
        -: 1373:
        -: 1374:static void
        -: 1375:shared_connections_shutdown (void *data)
function shared_connections_shutdown called 2 returned 100% blocks executed 100%
        2: 1376:{
        2: 1377:  _DBUS_LOCK (shared_connections);
call    0 returned 100%
        -: 1378:
        2: 1379:  _dbus_assert (_dbus_hash_table_get_n_entries (shared_connections) == 0);
call    0 returned 100%
call    1 returned 100%
        2: 1380:  _dbus_hash_table_unref (shared_connections);
call    0 returned 100%
        2: 1381:  shared_connections = NULL;
        -: 1382:  
        2: 1383:  _DBUS_UNLOCK (shared_connections);
call    0 returned 100%
        2: 1384:}
        -: 1385:
        -: 1386:static dbus_bool_t
        -: 1387:connection_lookup_shared (DBusAddressEntry  *entry,
        -: 1388:                          DBusConnection   **result)
function connection_lookup_shared called 6848 returned 100% blocks executed 64%
     6848: 1389:{
     6848: 1390:  _dbus_verbose ("checking for existing connection\n");
call    0 returned 100%
        -: 1391:  
     6848: 1392:  *result = NULL;
        -: 1393:  
     6848: 1394:  _DBUS_LOCK (shared_connections);
call    0 returned 100%
        -: 1395:
     6848: 1396:  if (shared_connections == NULL)
branch  0 taken 14% (fallthrough)
branch  1 taken 86%
        -: 1397:    {
      931: 1398:      _dbus_verbose ("creating shared_connections hash table\n");
call    0 returned 100%
        -: 1399:      
      931: 1400:      shared_connections = _dbus_hash_table_new (DBUS_HASH_STRING,
call    0 returned 100%
        -: 1401:                                                 dbus_free,
        -: 1402:                                                 NULL);
      931: 1403:      if (shared_connections == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1404:        {
    #####: 1405:          _DBUS_UNLOCK (shared_connections);
call    0 never executed
    #####: 1406:          return FALSE;
        -: 1407:        }
        -: 1408:
      931: 1409:      if (!_dbus_register_shutdown_func (shared_connections_shutdown, NULL))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1410:        {
    #####: 1411:          _dbus_hash_table_unref (shared_connections);
call    0 never executed
    #####: 1412:          shared_connections = NULL;
    #####: 1413:          _DBUS_UNLOCK (shared_connections);
call    0 never executed
    #####: 1414:          return FALSE;
        -: 1415:        }
        -: 1416:
      931: 1417:      _dbus_verbose ("  successfully created shared_connections\n");
call    0 returned 100%
        -: 1418:      
      931: 1419:      _DBUS_UNLOCK (shared_connections);
call    0 returned 100%
      931: 1420:      return TRUE; /* no point looking up in the hash we just made */
        -: 1421:    }
        -: 1422:  else
        -: 1423:    {
        -: 1424:      const char *guid;
        -: 1425:
     5917: 1426:      guid = dbus_address_entry_get_value (entry, "guid");
call    0 returned 100%
        -: 1427:      
     5917: 1428:      if (guid != NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1429:        {
    #####: 1430:          *result = _dbus_hash_table_lookup_string (shared_connections,
call    0 never executed
        -: 1431:                                                    guid);
        -: 1432:
    #####: 1433:          if (*result)
branch  0 never executed
branch  1 never executed
        -: 1434:            {
        -: 1435:              /* The DBusConnection can't have been disconnected
        -: 1436:               * between the lookup and this code, because the
        -: 1437:               * disconnection will take the shared_connections lock to
        -: 1438:               * remove the connection. It can't have been finalized
        -: 1439:               * since you have to disconnect prior to finalize.
        -: 1440:               *
        -: 1441:               * Thus it's safe to ref the connection.
        -: 1442:               */
    #####: 1443:              dbus_connection_ref (*result);
call    0 never executed
        -: 1444:
    #####: 1445:              _dbus_verbose ("looked up existing connection to server guid %s\n",
call    0 never executed
        -: 1446:                             guid);
        -: 1447:            }
        -: 1448:        }
        -: 1449:      
     5917: 1450:      _DBUS_UNLOCK (shared_connections);
call    0 returned 100%
     5917: 1451:      return TRUE;
        -: 1452:    }
        -: 1453:}
        -: 1454:
        -: 1455:static dbus_bool_t
        -: 1456:connection_record_shared_unlocked (DBusConnection *connection,
        -: 1457:                                   const char     *guid)
function connection_record_shared_unlocked called 929 returned 100% blocks executed 68%
      929: 1458:{
        -: 1459:  char *guid_key;
        -: 1460:  char *guid_in_connection;
        -: 1461:
        -: 1462:  /* A separate copy of the key is required in the hash table, because
        -: 1463:   * we don't have a lock on the connection when we are doing a hash
        -: 1464:   * lookup.
        -: 1465:   */
        -: 1466:  
      929: 1467:  _dbus_assert (connection->server_guid == NULL);
call    0 returned 100%
      929: 1468:  _dbus_assert (connection->shareable);
call    0 returned 100%
        -: 1469:  
      929: 1470:  guid_key = _dbus_strdup (guid);
call    0 returned 100%
      929: 1471:  if (guid_key == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1472:    return FALSE;
        -: 1473:
      929: 1474:  guid_in_connection = _dbus_strdup (guid);
call    0 returned 100%
      929: 1475:  if (guid_in_connection == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1476:    {
    #####: 1477:      dbus_free (guid_key);
call    0 never executed
    #####: 1478:      return FALSE;
        -: 1479:    }
        -: 1480:  
      929: 1481:  _DBUS_LOCK (shared_connections);
call    0 returned 100%
      929: 1482:  _dbus_assert (shared_connections != NULL);
call    0 returned 100%
        -: 1483:  
      929: 1484:  if (!_dbus_hash_table_insert_string (shared_connections,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1485:                                       guid_key, connection))
        -: 1486:    {
    #####: 1487:      dbus_free (guid_key);
call    0 never executed
    #####: 1488:      dbus_free (guid_in_connection);
call    0 never executed
    #####: 1489:      _DBUS_UNLOCK (shared_connections);
call    0 never executed
    #####: 1490:      return FALSE;
        -: 1491:    }
        -: 1492:
      929: 1493:  connection->server_guid = guid_in_connection;
        -: 1494:
      929: 1495:  _dbus_verbose ("stored connection to %s to be shared\n",
call    0 returned 100%
        -: 1496:                 connection->server_guid);
        -: 1497:  
      929: 1498:  _DBUS_UNLOCK (shared_connections);
call    0 returned 100%
        -: 1499:
      929: 1500:  _dbus_assert (connection->server_guid != NULL);
call    0 returned 100%
        -: 1501:  
      929: 1502:  return TRUE;
        -: 1503:}
        -: 1504:
        -: 1505:static void
        -: 1506:connection_forget_shared_unlocked (DBusConnection *connection)
function connection_forget_shared_unlocked called 13837 returned 100% blocks executed 91%
    13837: 1507:{
    13837: 1508:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 1509:  
    13837: 1510:  if (connection->server_guid == NULL)
branch  0 taken 96% (fallthrough)
branch  1 taken 4%
    13325: 1511:    return;
        -: 1512:
      512: 1513:  _dbus_verbose ("dropping connection to %s out of the shared table\n",
call    0 returned 100%
        -: 1514:                 connection->server_guid);
        -: 1515:  
      512: 1516:  _DBUS_LOCK (shared_connections);
call    0 returned 100%
        -: 1517:
      512: 1518:  if (!_dbus_hash_table_remove_string (shared_connections,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1519:                                       connection->server_guid))
    #####: 1520:    _dbus_assert_not_reached ("connection was not in the shared table");
call    0 never executed
        -: 1521:  
      512: 1522:  dbus_free (connection->server_guid);
call    0 returned 100%
      512: 1523:  connection->server_guid = NULL;
        -: 1524:
      512: 1525:  _DBUS_UNLOCK (shared_connections);
call    0 returned 100%
        -: 1526:}
        -: 1527:
        -: 1528:static DBusConnection*
        -: 1529:connection_try_from_address_entry (DBusAddressEntry *entry,
        -: 1530:                                   DBusError        *error)
function connection_try_from_address_entry called 6848 returned 100% blocks executed 94%
     6848: 1531:{
        -: 1532:  DBusTransport *transport;
        -: 1533:  DBusConnection *connection;
        -: 1534:
     6848: 1535:  transport = _dbus_transport_open (entry, error);
call    0 returned 100%
        -: 1536:
     6848: 1537:  if (transport == NULL)
branch  0 taken 6% (fallthrough)
branch  1 taken 94%
        -: 1538:    {
      398: 1539:      _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
      398: 1540:      return NULL;
        -: 1541:    }
        -: 1542:
     6450: 1543:  connection = _dbus_connection_new_for_transport (transport);
call    0 returned 100%
        -: 1544:
     6450: 1545:  _dbus_transport_unref (transport);
call    0 returned 100%
        -: 1546:  
     6450: 1547:  if (connection == NULL)
branch  0 taken 2% (fallthrough)
branch  1 taken 98%
        -: 1548:    {
       98: 1549:      _DBUS_SET_OOM (error);
call    0 returned 100%
       98: 1550:      return NULL;
        -: 1551:    }
        -: 1552:
        -: 1553:#ifndef DBUS_DISABLE_CHECKS
     6352: 1554:  _dbus_assert (!connection->have_connection_lock);
call    0 returned 100%
        -: 1555:#endif
     6352: 1556:  return connection;
        -: 1557:}
        -: 1558:
        -: 1559:/*
        -: 1560: * If the shared parameter is true, then any existing connection will
        -: 1561: * be used (and if a new connection is created, it will be available
        -: 1562: * for use by others). If the shared parameter is false, a new
        -: 1563: * connection will always be created, and the new connection will
        -: 1564: * never be returned to other callers.
        -: 1565: *
        -: 1566: * @param address the address
        -: 1567: * @param shared whether the connection is shared or private
        -: 1568: * @param error error return
        -: 1569: * @returns the connection or #NULL on error
        -: 1570: */
        -: 1571:static DBusConnection*
        -: 1572:_dbus_connection_open_internal (const char     *address,
        -: 1573:                                dbus_bool_t     shared,
        -: 1574:                                DBusError      *error)
function _dbus_connection_open_internal called 6986 returned 100% blocks executed 84%
     6986: 1575:{
        -: 1576:  DBusConnection *connection;
        -: 1577:  DBusAddressEntry **entries;
        -: 1578:  DBusError tmp_error;
        -: 1579:  DBusError first_error;
        -: 1580:  int len, i;
        -: 1581:
     6986: 1582:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -: 1583:
     6986: 1584:  _dbus_verbose ("opening %s connection to: %s\n",
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
        -: 1585:                 shared ? "shared" : "private", address);
        -: 1586:  
     6986: 1587:  if (!dbus_parse_address (address, &entries, &len, error))
call    0 returned 100%
branch  1 taken 2% (fallthrough)
branch  2 taken 98%
      138: 1588:    return NULL;
        -: 1589:
     6848: 1590:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -: 1591:  
     6848: 1592:  connection = NULL;
        -: 1593:
     6848: 1594:  dbus_error_init (&tmp_error);
call    0 returned 100%
     6848: 1595:  dbus_error_init (&first_error);
call    0 returned 100%
     7344: 1596:  for (i = 0; i < len; i++)
branch  0 taken 93%
branch  1 taken 7% (fallthrough)
        -: 1597:    {
     6848: 1598:      if (shared)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -: 1599:        {
     6848: 1600:          if (!connection_lookup_shared (entries[i], &connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1601:            _DBUS_SET_OOM (&tmp_error);
call    0 never executed
        -: 1602:        }
        -: 1603:
     6848: 1604:      if (connection == NULL)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -: 1605:        {
     6848: 1606:          connection = connection_try_from_address_entry (entries[i],
call    0 returned 100%
        -: 1607:                                                          &tmp_error);
        -: 1608:          
     6848: 1609:          if (connection != NULL && shared)
branch  0 taken 93% (fallthrough)
branch  1 taken 7%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
        -: 1610:            {
        -: 1611:              const char *guid;
        -: 1612:
     6352: 1613:              connection->shareable = TRUE;
        -: 1614:              
     6352: 1615:              guid = dbus_address_entry_get_value (entries[i], "guid");
call    0 returned 100%
        -: 1616:
        -: 1617:              /* we don't have a connection lock but we know nobody
        -: 1618:               * else has a handle to the connection
        -: 1619:               */
        -: 1620:              
     6352: 1621:              if (guid &&
branch  0 taken 15% (fallthrough)
branch  1 taken 85%
call    2 returned 100%
branch  3 taken 0% (fallthrough)
branch  4 taken 100%
        -: 1622:                  !connection_record_shared_unlocked (connection, guid))
        -: 1623:                {
    #####: 1624:                  _DBUS_SET_OOM (&tmp_error);
call    0 never executed
    #####: 1625:                  dbus_connection_close (connection);
call    0 never executed
    #####: 1626:                  dbus_connection_unref (connection);
call    0 never executed
    #####: 1627:                  connection = NULL;
        -: 1628:                }
        -: 1629:
        -: 1630:              /* but as of now the connection is possibly shared
        -: 1631:               * since another thread could have pulled it from the table
        -: 1632:               */
        -: 1633:            }
        -: 1634:        }
        -: 1635:      
     6848: 1636:      if (connection)
branch  0 taken 93% (fallthrough)
branch  1 taken 7%
     6352: 1637:	break;
        -: 1638:
      496: 1639:      _DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
call    0 returned 100%
call    1 returned 100%
        -: 1640:      
      496: 1641:      if (i == 0)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
      496: 1642:        dbus_move_error (&tmp_error, &first_error);
call    0 returned 100%
        -: 1643:      else
    #####: 1644:        dbus_error_free (&tmp_error);
call    0 never executed
        -: 1645:    }
        -: 1646:
        -: 1647:  /* NOTE we don't have a lock on a possibly-shared connection object */
        -: 1648:  
     6848: 1649:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
     6848: 1650:  _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
call    0 returned 100%
call    1 returned 100%
        -: 1651:  
     6848: 1652:  if (connection == NULL)
branch  0 taken 7% (fallthrough)
branch  1 taken 93%
        -: 1653:    {
      496: 1654:      _DBUS_ASSERT_ERROR_IS_SET (&first_error);
call    0 returned 100%
call    1 returned 100%
      496: 1655:      dbus_move_error (&first_error, error);
call    0 returned 100%
        -: 1656:    }
        -: 1657:  else
        -: 1658:    {
     6352: 1659:      dbus_error_free (&first_error);
call    0 returned 100%
        -: 1660:    }
        -: 1661:  
     6848: 1662:  dbus_address_entries_free (entries);
call    0 returned 100%
     6848: 1663:  return connection;
        -: 1664:}
        -: 1665:
        -: 1666:/** @} */
        -: 1667:
        -: 1668:/**
        -: 1669: * @addtogroup DBusConnection
        -: 1670: *
        -: 1671: * @{
        -: 1672: */
        -: 1673:
        -: 1674:/**
        -: 1675: * Gets a connection to a remote address. If a connection to the given
        -: 1676: * address already exists, returns the existing connection with its
        -: 1677: * reference count incremented.  Otherwise, returns a new connection
        -: 1678: * and saves the new connection for possible re-use if a future call
        -: 1679: * to dbus_connection_open() asks to connect to the same server.
        -: 1680: *
        -: 1681: * Use dbus_connection_open_private() to get a dedicated connection
        -: 1682: * not shared with other callers of dbus_connection_open().
        -: 1683: *
        -: 1684: * If the open fails, the function returns #NULL, and provides a
        -: 1685: * reason for the failure in the error parameter. Pass #NULL for the
        -: 1686: * error parameter if you aren't interested in the reason for
        -: 1687: * failure.
        -: 1688: * 
        -: 1689: * @param address the address.
        -: 1690: * @param error address where an error can be returned.
        -: 1691: * @returns new connection, or #NULL on failure.
        -: 1692: */
        -: 1693:DBusConnection*
        -: 1694:dbus_connection_open (const char     *address,
        -: 1695:                      DBusError      *error)
function dbus_connection_open called 6986 returned 100% blocks executed 60%
     6986: 1696:{
        -: 1697:  DBusConnection *connection;
        -: 1698:
     6986: 1699:  _dbus_return_val_if_fail (address != NULL, NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
     6986: 1700:  _dbus_return_val_if_error_is_set (error, NULL);
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
call    3 returned 100%
branch  4 taken 0% (fallthrough)
branch  5 taken 100%
call    6 never executed
call    7 never executed
        -: 1701:
     6986: 1702:  connection = _dbus_connection_open_internal (address,
call    0 returned 100%
        -: 1703:                                               TRUE,
        -: 1704:                                               error);
        -: 1705:
     6986: 1706:  return connection;
        -: 1707:}
        -: 1708:
        -: 1709:/**
        -: 1710: * Opens a new, dedicated connection to a remote address. Unlike
        -: 1711: * dbus_connection_open(), always creates a new connection.
        -: 1712: * This connection will not be saved or recycled by libdbus.
        -: 1713: *
        -: 1714: * If the open fails, the function returns #NULL, and provides a
        -: 1715: * reason for the failure in the error parameter. Pass #NULL for the
        -: 1716: * error parameter if you aren't interested in the reason for
        -: 1717: * failure.
        -: 1718: * 
        -: 1719: * @param address the address.
        -: 1720: * @param error address where an error can be returned.
        -: 1721: * @returns new connection, or #NULL on failure.
        -: 1722: */
        -: 1723:DBusConnection*
        -: 1724:dbus_connection_open_private (const char     *address,
        -: 1725:                              DBusError      *error)
function dbus_connection_open_private called 0 returned 0% blocks executed 0%
    #####: 1726:{
        -: 1727:  DBusConnection *connection;
        -: 1728:
    #####: 1729:  _dbus_return_val_if_fail (address != NULL, NULL);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 1730:  _dbus_return_val_if_error_is_set (error, NULL);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
branch  4 never executed
branch  5 never executed
call    6 never executed
call    7 never executed
        -: 1731:
    #####: 1732:  connection = _dbus_connection_open_internal (address,
call    0 never executed
        -: 1733:                                               FALSE,
        -: 1734:                                               error);
        -: 1735:
    #####: 1736:  return connection;
        -: 1737:}
        -: 1738:
        -: 1739:/**
        -: 1740: * Increments the reference count of a DBusConnection.
        -: 1741: *
        -: 1742: * @param connection the connection.
        -: 1743: * @returns the connection.
        -: 1744: */
        -: 1745:DBusConnection *
        -: 1746:dbus_connection_ref (DBusConnection *connection)
function dbus_connection_ref called 93987 returned 100% blocks executed 68%
    93987: 1747:{
    93987: 1748:  _dbus_return_val_if_fail (connection != NULL, NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
    93987: 1749:  _dbus_return_val_if_fail (connection->generation == _dbus_current_generation, NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 1750:  
        -: 1751:  /* The connection lock is better than the global
        -: 1752:   * lock in the atomic increment fallback
        -: 1753:   */
        -: 1754:  
        -: 1755:#ifdef DBUS_HAVE_ATOMIC_INT
        -: 1756:  _dbus_atomic_inc (&connection->refcount);
        -: 1757:#else
    93987: 1758:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    93987: 1759:  _dbus_assert (connection->refcount.value > 0);
call    0 returned 100%
        -: 1760:
    93987: 1761:  connection->refcount.value += 1;
    93987: 1762:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1763:#endif
        -: 1764:
    93987: 1765:  return connection;
        -: 1766:}
        -: 1767:
        -: 1768:static void
        -: 1769:free_outgoing_message (void *element,
        -: 1770:                       void *data)
function free_outgoing_message called 0 returned 0% blocks executed 0%
    #####: 1771:{
    #####: 1772:  DBusMessage *message = element;
    #####: 1773:  DBusConnection *connection = data;
        -: 1774:
    #####: 1775:  _dbus_message_remove_size_counter (message,
call    0 never executed
        -: 1776:                                     connection->outgoing_counter,
        -: 1777:                                     NULL);
    #####: 1778:  dbus_message_unref (message);
call    0 never executed
    #####: 1779:}
        -: 1780:
        -: 1781:/* This is run without the mutex held, but after the last reference
        -: 1782: * to the connection has been dropped we should have no thread-related
        -: 1783: * problems
        -: 1784: */
        -: 1785:static void
        -: 1786:_dbus_connection_last_unref (DBusConnection *connection)
function _dbus_connection_last_unref called 13837 returned 100% blocks executed 93%
    13837: 1787:{
        -: 1788:  DBusList *link;
        -: 1789:
    13837: 1790:  _dbus_verbose ("Finalizing connection %p\n", connection);
call    0 returned 100%
        -: 1791:  
    13837: 1792:  _dbus_assert (connection->refcount.value == 0);
call    0 returned 100%
        -: 1793:  
        -: 1794:  /* You have to disconnect the connection before unref:ing it. Otherwise
        -: 1795:   * you won't get the disconnected message.
        -: 1796:   */
    13837: 1797:  _dbus_assert (!_dbus_transport_get_is_connected (connection->transport));
call    0 returned 100%
call    1 returned 100%
    13837: 1798:  _dbus_assert (connection->server_guid == NULL);
call    0 returned 100%
        -: 1799:  
        -: 1800:  /* ---- We're going to call various application callbacks here, hope it doesn't break anything... */
    13837: 1801:  _dbus_object_tree_free_all_unlocked (connection->objects);
call    0 returned 100%
        -: 1802:  
    13837: 1803:  dbus_connection_set_dispatch_status_function (connection, NULL, NULL, NULL);
call    0 returned 100%
    13837: 1804:  dbus_connection_set_wakeup_main_function (connection, NULL, NULL, NULL);
call    0 returned 100%
    13837: 1805:  dbus_connection_set_unix_user_function (connection, NULL, NULL, NULL);
call    0 returned 100%
        -: 1806:  
    13837: 1807:  _dbus_watch_list_free (connection->watches);
call    0 returned 100%
    13837: 1808:  connection->watches = NULL;
        -: 1809:  
    13837: 1810:  _dbus_timeout_list_free (connection->timeouts);
call    0 returned 100%
    13837: 1811:  connection->timeouts = NULL;
        -: 1812:
    13837: 1813:  _dbus_data_slot_list_free (&connection->slot_list);
call    0 returned 100%
        -: 1814:  
    13837: 1815:  link = _dbus_list_get_first_link (&connection->filter_list);
call    0 returned 100%
    33073: 1816:  while (link != NULL)
branch  0 taken 28%
branch  1 taken 72% (fallthrough)
        -: 1817:    {
     5399: 1818:      DBusMessageFilter *filter = link->data;
     5399: 1819:      DBusList *next = _dbus_list_get_next_link (&connection->filter_list, link);
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1820:
     5399: 1821:      filter->function = NULL;
     5399: 1822:      _dbus_message_filter_unref (filter); /* calls app callback */
call    0 returned 100%
     5399: 1823:      link->data = NULL;
        -: 1824:      
     5399: 1825:      link = next;
        -: 1826:    }
    13837: 1827:  _dbus_list_clear (&connection->filter_list);
call    0 returned 100%
        -: 1828:  
        -: 1829:  /* ---- Done with stuff that invokes application callbacks */
        -: 1830:
    13837: 1831:  _dbus_object_tree_unref (connection->objects);  
call    0 returned 100%
        -: 1832:
    13837: 1833:  _dbus_hash_table_unref (connection->pending_replies);
call    0 returned 100%
    13837: 1834:  connection->pending_replies = NULL;
        -: 1835:  
    13837: 1836:  _dbus_list_clear (&connection->filter_list);
call    0 returned 100%
        -: 1837:  
    13837: 1838:  _dbus_list_foreach (&connection->outgoing_messages,
call    0 returned 100%
        -: 1839:                      free_outgoing_message,
        -: 1840:		      connection);
    13837: 1841:  _dbus_list_clear (&connection->outgoing_messages);
call    0 returned 100%
        -: 1842:  
    13837: 1843:  _dbus_list_foreach (&connection->incoming_messages,
call    0 returned 100%
        -: 1844:		      (DBusForeachFunction) dbus_message_unref,
        -: 1845:		      NULL);
    13837: 1846:  _dbus_list_clear (&connection->incoming_messages);
call    0 returned 100%
        -: 1847:
    13837: 1848:  _dbus_counter_unref (connection->outgoing_counter);
call    0 returned 100%
        -: 1849:
    13837: 1850:  _dbus_transport_unref (connection->transport);
call    0 returned 100%
        -: 1851:
    13837: 1852:  if (connection->disconnect_message_link)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1853:    {
    #####: 1854:      DBusMessage *message = connection->disconnect_message_link->data;
    #####: 1855:      dbus_message_unref (message);
call    0 never executed
    #####: 1856:      _dbus_list_free_link (connection->disconnect_message_link);
call    0 never executed
        -: 1857:    }
        -: 1858:
    13837: 1859:  _dbus_list_clear (&connection->link_cache);
call    0 returned 100%
        -: 1860:  
    13837: 1861:  _dbus_condvar_free (connection->dispatch_cond);
call    0 returned 100%
    13837: 1862:  _dbus_condvar_free (connection->io_path_cond);
call    0 returned 100%
        -: 1863:
    13837: 1864:  _dbus_mutex_free (connection->io_path_mutex);
call    0 returned 100%
    13837: 1865:  _dbus_mutex_free (connection->dispatch_mutex);
call    0 returned 100%
        -: 1866:
    13837: 1867:  _dbus_mutex_free (connection->mutex);
call    0 returned 100%
        -: 1868:  
    13837: 1869:  dbus_free (connection);
call    0 returned 100%
    13837: 1870:}
        -: 1871:
        -: 1872:/**
        -: 1873: * Decrements the reference count of a DBusConnection, and finalizes
        -: 1874: * it if the count reaches zero.  It is a bug to drop the last reference
        -: 1875: * to a connection that has not been disconnected.
        -: 1876: *
        -: 1877: * @todo in practice it can be quite tricky to never unref a connection
        -: 1878: * that's still connected; maybe there's some way we could avoid
        -: 1879: * the requirement.
        -: 1880: *
        -: 1881: * @param connection the connection.
        -: 1882: */
        -: 1883:void
        -: 1884:dbus_connection_unref (DBusConnection *connection)
function dbus_connection_unref called 423352 returned 100% blocks executed 78%
   423352: 1885:{
        -: 1886:  dbus_bool_t last_unref;
        -: 1887:
   423352: 1888:  _dbus_return_if_fail (connection != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
   423352: 1889:  _dbus_return_if_fail (connection->generation == _dbus_current_generation);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 1890:  
        -: 1891:  /* The connection lock is better than the global
        -: 1892:   * lock in the atomic increment fallback
        -: 1893:   */
        -: 1894:  
        -: 1895:#ifdef DBUS_HAVE_ATOMIC_INT
        -: 1896:  last_unref = (_dbus_atomic_dec (&connection->refcount) == 1);
        -: 1897:#else
   423352: 1898:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1899:  
   423352: 1900:  _dbus_assert (connection->refcount.value > 0);
call    0 returned 100%
        -: 1901:
   423352: 1902:  connection->refcount.value -= 1;
   423352: 1903:  last_unref = (connection->refcount.value == 0);
        -: 1904:
        -: 1905:#if 0
        -: 1906:  printf ("unref() connection %p count = %d\n", connection, connection->refcount.value);
        -: 1907:#endif
        -: 1908:  
   423352: 1909:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1910:#endif
        -: 1911:  
   423352: 1912:  if (last_unref)
branch  0 taken 3% (fallthrough)
branch  1 taken 97%
    13837: 1913:    _dbus_connection_last_unref (connection);
call    0 returned 100%
        -: 1914:}
        -: 1915:
        -: 1916:/**
        -: 1917: * Closes the connection, so no further data can be sent or received.
        -: 1918: * Any further attempts to send data will result in errors.  This
        -: 1919: * function does not affect the connection's reference count.  It's
        -: 1920: * safe to disconnect a connection more than once; all calls after the
        -: 1921: * first do nothing. It's impossible to "reopen" a connection, a
        -: 1922: * new connection must be created. This function may result in a call
        -: 1923: * to the DBusDispatchStatusFunction set with
        -: 1924: * dbus_connection_set_dispatch_status_function(), as the disconnect
        -: 1925: * message it generates needs to be dispatched.
        -: 1926: *
        -: 1927: * @param connection the connection.
        -: 1928: */
        -: 1929:void
        -: 1930:dbus_connection_close (DBusConnection *connection)
function dbus_connection_close called 6031 returned 100% blocks executed 76%
     6031: 1931:{
        -: 1932:  DBusDispatchStatus status;
        -: 1933:  
     6031: 1934:  _dbus_return_if_fail (connection != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
     6031: 1935:  _dbus_return_if_fail (connection->generation == _dbus_current_generation);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 1936:
     6031: 1937:  _dbus_verbose ("Disconnecting %p\n", connection);
call    0 returned 100%
        -: 1938:  
     6031: 1939:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1940:  
     6031: 1941:  _dbus_transport_disconnect (connection->transport);
call    0 returned 100%
        -: 1942:
     6031: 1943:  _dbus_verbose ("%s middle\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
     6031: 1944:  status = _dbus_connection_get_dispatch_status_unlocked (connection);
call    0 returned 100%
        -: 1945:
        -: 1946:  /* this calls out to user code */
     6031: 1947:  _dbus_connection_update_dispatch_status_and_unlock (connection, status);
call    0 returned 100%
        -: 1948:}
        -: 1949:
        -: 1950:/** Alias for dbus_connection_close(). This method is DEPRECATED and will be
        -: 1951: *  removed for 1.0. Change your code to use dbus_connection_close() instead.
        -: 1952: *
        -: 1953: * @param connection the connection.
        -: 1954: * @deprecated
        -: 1955: */
        -: 1956:void
        -: 1957:dbus_connection_disconnect (DBusConnection *connection)
function dbus_connection_disconnect called 0 returned 0% blocks executed 0%
    #####: 1958:{
    #####: 1959:  dbus_connection_close (connection);
call    0 never executed
    #####: 1960:}
        -: 1961:
        -: 1962:static dbus_bool_t
        -: 1963:_dbus_connection_get_is_connected_unlocked (DBusConnection *connection)
function _dbus_connection_get_is_connected_unlocked called 557994 returned 100% blocks executed 100%
   557994: 1964:{
   557994: 1965:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
   557994: 1966:  return _dbus_transport_get_is_connected (connection->transport);
call    0 returned 100%
        -: 1967:}
        -: 1968:
        -: 1969:/**
        -: 1970: * Gets whether the connection is currently connected.  All
        -: 1971: * connections are connected when they are opened.  A connection may
        -: 1972: * become disconnected when the remote application closes its end, or
        -: 1973: * exits; a connection may also be disconnected with
        -: 1974: * dbus_connection_close().
        -: 1975: *
        -: 1976: * @param connection the connection.
        -: 1977: * @returns #TRUE if the connection is still alive.
        -: 1978: */
        -: 1979:dbus_bool_t
        -: 1980:dbus_connection_get_is_connected (DBusConnection *connection)
function dbus_connection_get_is_connected called 555418 returned 100% blocks executed 79%
   555418: 1981:{
        -: 1982:  dbus_bool_t res;
        -: 1983:
   555418: 1984:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 1985:  
   555418: 1986:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
   555418: 1987:  res = _dbus_connection_get_is_connected_unlocked (connection);
call    0 returned 100%
   555418: 1988:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1989:  
   555418: 1990:  return res;
        -: 1991:}
        -: 1992:
        -: 1993:/**
        -: 1994: * Gets whether the connection was authenticated. (Note that
        -: 1995: * if the connection was authenticated then disconnected,
        -: 1996: * this function still returns #TRUE)
        -: 1997: *
        -: 1998: * @param connection the connection
        -: 1999: * @returns #TRUE if the connection was ever authenticated
        -: 2000: */
        -: 2001:dbus_bool_t
        -: 2002:dbus_connection_get_is_authenticated (DBusConnection *connection)
function dbus_connection_get_is_authenticated called 29150 returned 100% blocks executed 79%
    29150: 2003:{
        -: 2004:  dbus_bool_t res;
        -: 2005:
    29150: 2006:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 2007:  
    29150: 2008:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    29150: 2009:  res = _dbus_transport_get_is_authenticated (connection->transport);
call    0 returned 100%
    29150: 2010:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 2011:  
    29150: 2012:  return res;
        -: 2013:}
        -: 2014:
        -: 2015:/**
        -: 2016: * Set whether _exit() should be called when the connection receives a
        -: 2017: * disconnect signal. The call to _exit() comes after any handlers for
        -: 2018: * the disconnect signal run; handlers can cancel the exit by calling
        -: 2019: * this function.
        -: 2020: *
        -: 2021: * By default, exit_on_disconnect is #FALSE; but for message bus
        -: 2022: * connections returned from dbus_bus_get() it will be toggled on
        -: 2023: * by default.
        -: 2024: *
        -: 2025: * @param connection the connection
        -: 2026: * @param exit_on_disconnect #TRUE if _exit() should be called after a disconnect signal
        -: 2027: */
        -: 2028:void
        -: 2029:dbus_connection_set_exit_on_disconnect (DBusConnection *connection,
        -: 2030:                                        dbus_bool_t     exit_on_disconnect)
function dbus_connection_set_exit_on_disconnect called 929 returned 100% blocks executed 82%
      929: 2031:{
      929: 2032:  _dbus_return_if_fail (connection != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 2033:
      929: 2034:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
      929: 2035:  connection->exit_on_disconnect = exit_on_disconnect != FALSE;
      929: 2036:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 2037:}
        -: 2038:
        -: 2039:static DBusPreallocatedSend*
        -: 2040:_dbus_connection_preallocate_send_unlocked (DBusConnection *connection)
function _dbus_connection_preallocate_send_unlocked called 87210 returned 100% blocks executed 100%
    87210: 2041:{
        -: 2042:  DBusPreallocatedSend *preallocated;
        -: 2043:
    87210: 2044:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 2045:  
    87210: 2046:  _dbus_assert (connection != NULL);
call    0 returned 100%
        -: 2047:  
    87210: 2048:  preallocated = dbus_new (DBusPreallocatedSend, 1);
call    0 returned 100%
    87210: 2049:  if (preallocated == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
      197: 2050:    return NULL;
        -: 2051:
    87013: 2052:  if (connection->link_cache != NULL)
branch  0 taken 68% (fallthrough)
branch  1 taken 32%
        -: 2053:    {
    58873: 2054:      preallocated->queue_link =
call    0 returned 100%
        -: 2055:        _dbus_list_pop_first_link (&connection->link_cache);
    58873: 2056:      preallocated->queue_link->data = NULL;
        -: 2057:    }
        -: 2058:  else
        -: 2059:    {
    28140: 2060:      preallocated->queue_link = _dbus_list_alloc_link (NULL);
call    0 returned 100%
    28140: 2061:      if (preallocated->queue_link == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
       42: 2062:        goto failed_0;
        -: 2063:    }
        -: 2064:  
    86971: 2065:  if (connection->link_cache != NULL)
branch  0 taken 68% (fallthrough)
branch  1 taken 32%
        -: 2066:    {
    58873: 2067:      preallocated->counter_link =
call    0 returned 100%
        -: 2068:        _dbus_list_pop_first_link (&connection->link_cache);
    58873: 2069:      preallocated->counter_link->data = connection->outgoing_counter;
        -: 2070:    }
        -: 2071:  else
        -: 2072:    {
    28098: 2073:      preallocated->counter_link = _dbus_list_alloc_link (connection->outgoing_counter);
call    0 returned 100%
    28098: 2074:      if (preallocated->counter_link == NULL)
branch  0 taken 99% (fallthrough)
branch  1 taken 1%
       45: 2075:        goto failed_1;
        -: 2076:    }
        -: 2077:
    86926: 2078:  _dbus_counter_ref (preallocated->counter_link->data);
call    0 returned 100%
        -: 2079:
    86926: 2080:  preallocated->connection = connection;
        -: 2081:  
    86926: 2082:  return preallocated;
        -: 2083:  
       45: 2084: failed_1:
       45: 2085:  _dbus_list_free_link (preallocated->queue_link);
call    0 returned 100%
       87: 2086: failed_0:
       87: 2087:  dbus_free (preallocated);
call    0 returned 100%
        -: 2088:  
       87: 2089:  return NULL;
        -: 2090:}
        -: 2091:
        -: 2092:/**
        -: 2093: * Preallocates resources needed to send a message, allowing the message 
        -: 2094: * to be sent without the possibility of memory allocation failure.
        -: 2095: * Allows apps to create a future guarantee that they can send
        -: 2096: * a message regardless of memory shortages.
        -: 2097: *
        -: 2098: * @param connection the connection we're preallocating for.
        -: 2099: * @returns the preallocated resources, or #NULL
        -: 2100: */
        -: 2101:DBusPreallocatedSend*
        -: 2102:dbus_connection_preallocate_send (DBusConnection *connection)
function dbus_connection_preallocate_send called 70261 returned 100% blocks executed 79%
    70261: 2103:{
        -: 2104:  DBusPreallocatedSend *preallocated;
        -: 2105:
    70261: 2106:  _dbus_return_val_if_fail (connection != NULL, NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 2107:
    70261: 2108:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 2109:  
    70261: 2110:  preallocated =
call    0 returned 100%
        -: 2111:    _dbus_connection_preallocate_send_unlocked (connection);
        -: 2112:
    70261: 2113:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 2114:
    70261: 2115:  return preallocated;
        -: 2116:}
        -: 2117:
        -: 2118:/**
        -: 2119: * Frees preallocated message-sending resources from
        -: 2120: * dbus_connection_preallocate_send(). Should only
        -: 2121: * be called if the preallocated resources are not used
        -: 2122: * to send a message.
        -: 2123: *
        -: 2124: * @param connection the connection
        -: 2125: * @param preallocated the resources
        -: 2126: */
        -: 2127:void
        -: 2128:dbus_connection_free_preallocated_send (DBusConnection       *connection,
        -: 2129:                                        DBusPreallocatedSend *preallocated)
function dbus_connection_free_preallocated_send called 11320 returned 100% blocks executed 65%
    11320: 2130:{
    11320: 2131:  _dbus_return_if_fail (connection != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
    11320: 2132:  _dbus_return_if_fail (preallocated != NULL);  
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
    11320: 2133:  _dbus_return_if_fail (connection == preallocated->connection);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 2134:
    11320: 2135:  _dbus_list_free_link (preallocated->queue_link);
call    0 returned 100%
    11320: 2136:  _dbus_counter_unref (preallocated->counter_link->data);
call    0 returned 100%
    11320: 2137:  _dbus_list_free_link (preallocated->counter_link);
call    0 returned 100%
    11320: 2138:  dbus_free (preallocated);
call    0 returned 100%
        -: 2139:}
        -: 2140:
        -: 2141:/* Called with lock held, does not update dispatch status */
        -: 2142:static void
        -: 2143:_dbus_connection_send_preallocated_unlocked_no_update (DBusConnection       *connection,
        -: 2144:                                                       DBusPreallocatedSend *preallocated,
        -: 2145:                                                       DBusMessage          *message,
        -: 2146:                                                       dbus_uint32_t        *client_serial)
function _dbus_connection_send_preallocated_unlocked_no_update called 75606 returned 100% blocks executed 95%
    75606: 2147:{
        -: 2148:  dbus_uint32_t serial;
        -: 2149:  const char *sig;
        -: 2150:
    75606: 2151:  preallocated->queue_link->data = message;
    75606: 2152:  _dbus_list_prepend_link (&connection->outgoing_messages,
call    0 returned 100%
        -: 2153:                           preallocated->queue_link);
        -: 2154:
    75606: 2155:  _dbus_message_add_size_counter_link (message,
call    0 returned 100%
        -: 2156:                                       preallocated->counter_link);
        -: 2157:
    75606: 2158:  dbus_free (preallocated);
call    0 returned 100%
    75606: 2159:  preallocated = NULL;
        -: 2160:  
    75606: 2161:  dbus_message_ref (message);
call    0 returned 100%
        -: 2162:  
    75606: 2163:  connection->n_outgoing += 1;
        -: 2164:
    75606: 2165:  sig = dbus_message_get_signature (message);
call    0 returned 100%
        -: 2166:  
    75606: 2167:  _dbus_verbose ("Message %p (%d %s %s %s '%s') for %s added to outgoing queue %p, %d pending to send\n",
call    0 returned 100%
branch  1 taken 56% (fallthrough)
branch  2 taken 44%
call    3 returned 100%
call    4 returned 100%
branch  5 taken 76% (fallthrough)
branch  6 taken 24%
call    7 returned 100%
call    8 returned 100%
branch  9 taken 76% (fallthrough)
branch 10 taken 24%
call   11 returned 100%
call   12 returned 100%
branch 13 taken 76% (fallthrough)
branch 14 taken 24%
call   15 returned 100%
call   16 returned 100%
call   17 returned 100%
        -: 2168:                 message,
        -: 2169:                 dbus_message_get_type (message),
        -: 2170:                 dbus_message_get_path (message) ?
        -: 2171:                 dbus_message_get_path (message) :
        -: 2172:                 "no path",
        -: 2173:                 dbus_message_get_interface (message) ?
        -: 2174:                 dbus_message_get_interface (message) :
        -: 2175:                 "no interface",
        -: 2176:                 dbus_message_get_member (message) ?
        -: 2177:                 dbus_message_get_member (message) :
        -: 2178:                 "no member",
        -: 2179:                 sig,
        -: 2180:                 dbus_message_get_destination (message) ?
        -: 2181:                 dbus_message_get_destination (message) :
        -: 2182:                 "null",
        -: 2183:                 connection,
        -: 2184:                 connection->n_outgoing);
        -: 2185:
    75606: 2186:  if (dbus_message_get_serial (message) == 0)
call    0 returned 100%
branch  1 taken 72% (fallthrough)
branch  2 taken 28%
        -: 2187:    {
    54404: 2188:      serial = _dbus_connection_get_next_client_serial (connection);
call    0 returned 100%
    54404: 2189:      _dbus_message_set_serial (message, serial);
call    0 returned 100%
    54404: 2190:      if (client_serial)
branch  0 taken 29% (fallthrough)
branch  1 taken 71%
    15566: 2191:        *client_serial = serial;
        -: 2192:    }
        -: 2193:  else
        -: 2194:    {
    21202: 2195:      if (client_serial)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2196:        *client_serial = dbus_message_get_serial (message);
call    0 never executed
        -: 2197:    }
        -: 2198:
    75606: 2199:  _dbus_verbose ("Message %p serial is %u\n",
call    0 returned 100%
call    1 returned 100%
        -: 2200:                 message, dbus_message_get_serial (message));
        -: 2201:  
    75606: 2202:  _dbus_message_lock (message);
call    0 returned 100%
        -: 2203:
        -: 2204:  /* Now we need to run an iteration to hopefully just write the messages
        -: 2205:   * out immediately, and otherwise get them queued up
        -: 2206:   */
    75606: 2207:  _dbus_connection_do_iteration_unlocked (connection,
call    0 returned 100%
        -: 2208:                                          DBUS_ITERATION_DO_WRITING,
        -: 2209:                                          -1);
        -: 2210:
        -: 2211:  /* If stuff is still queued up, be sure we wake up the main loop */
    75606: 2212:  if (connection->n_outgoing > 0)
branch  0 taken 3% (fallthrough)
branch  1 taken 97%
     2474: 2213:    _dbus_connection_wakeup_mainloop (connection);
call    0 returned 100%
    75606: 2214:}
        -: 2215:
        -: 2216:static void
        -: 2217:_dbus_connection_send_preallocated_and_unlock (DBusConnection       *connection,
        -: 2218:					       DBusPreallocatedSend *preallocated,
        -: 2219:					       DBusMessage          *message,
        -: 2220:					       dbus_uint32_t        *client_serial)
function _dbus_connection_send_preallocated_and_unlock called 74259 returned 100% blocks executed 100%
    74259: 2221:{
        -: 2222:  DBusDispatchStatus status;
        -: 2223:
    74259: 2224:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 2225:  
    74259: 2226:  _dbus_connection_send_preallocated_unlocked_no_update (connection,
call    0 returned 100%
        -: 2227:                                                         preallocated,
        -: 2228:                                                         message, client_serial);
        -: 2229:
    74259: 2230:  _dbus_verbose ("%s middle\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
    74259: 2231:  status = _dbus_connection_get_dispatch_status_unlocked (connection);
call    0 returned 100%
        -: 2232:
        -: 2233:  /* this calls out to user code */
    74259: 2234:  _dbus_connection_update_dispatch_status_and_unlock (connection, status);
call    0 returned 100%
    74259: 2235:}
        -: 2236:
        -: 2237:/**
        -: 2238: * Sends a message using preallocated resources. This function cannot fail.
        -: 2239: * It works identically to dbus_connection_send() in other respects.
        -: 2240: * Preallocated resources comes from dbus_connection_preallocate_send().
        -: 2241: * This function "consumes" the preallocated resources, they need not
        -: 2242: * be freed separately.
        -: 2243: *
        -: 2244: * @param connection the connection
        -: 2245: * @param preallocated the preallocated resources
        -: 2246: * @param message the message to send
        -: 2247: * @param client_serial return location for client serial assigned to the message
        -: 2248: */
        -: 2249:void
        -: 2250:dbus_connection_send_preallocated (DBusConnection       *connection,
        -: 2251:                                   DBusPreallocatedSend *preallocated,
        -: 2252:                                   DBusMessage          *message,
        -: 2253:                                   dbus_uint32_t        *client_serial)
function dbus_connection_send_preallocated called 58693 returned 100% blocks executed 68%
    58693: 2254:{
    58693: 2255:  _dbus_return_if_fail (connection != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
    58693: 2256:  _dbus_return_if_fail (preallocated != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
    58693: 2257:  _dbus_return_if_fail (message != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
    58693: 2258:  _dbus_return_if_fail (preallocated->connection == connection);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
    58693: 2259:  _dbus_return_if_fail (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_CALL ||
call    0 returned 100%
call    1 returned 100%
branch  2 taken 3% (fallthrough)
branch  3 taken 97%
call    4 returned 100%
branch  5 taken 0% (fallthrough)
branch  6 taken 100%
call    7 never executed
call    8 never executed
        -: 2260:                        dbus_message_get_member (message) != NULL);
    58693: 2261:  _dbus_return_if_fail (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_SIGNAL ||
call    0 returned 100%
call    1 returned 100%
branch  2 taken 66% (fallthrough)
branch  3 taken 34%
call    4 returned 100%
branch  5 taken 100% (fallthrough)
branch  6 taken 0%
call    7 returned 100%
branch  8 taken 0% (fallthrough)
branch  9 taken 100%
call   10 never executed
call   11 never executed
        -: 2262:                        (dbus_message_get_interface (message) != NULL &&
        -: 2263:                         dbus_message_get_member (message) != NULL));
        -: 2264:  
    58693: 2265:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    58693: 2266:  _dbus_connection_send_preallocated_and_unlock (connection,
call    0 returned 100%
        -: 2267:						 preallocated,
        -: 2268:						 message, client_serial);
        -: 2269:}
        -: 2270:
        -: 2271:static dbus_bool_t
        -: 2272:_dbus_connection_send_unlocked_no_update (DBusConnection *connection,
        -: 2273:                                          DBusMessage    *message,
        -: 2274:                                          dbus_uint32_t  *client_serial)
function _dbus_connection_send_unlocked_no_update called 1347 returned 100% blocks executed 88%
     1347: 2275:{
        -: 2276:  DBusPreallocatedSend *preallocated;
        -: 2277:
     1347: 2278:  _dbus_assert (connection != NULL);
call    0 returned 100%
     1347: 2279:  _dbus_assert (message != NULL);
call    0 returned 100%
        -: 2280:  
     1347: 2281:  preallocated = _dbus_connection_preallocate_send_unlocked (connection);
call    0 returned 100%
     1347: 2282:  if (preallocated == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2283:    return FALSE;
        -: 2284:
     1347: 2285:  _dbus_connection_send_preallocated_unlocked_no_update (connection,
call    0 returned 100%
        -: 2286:                                                         preallocated,
        -: 2287:                                                         message,
        -: 2288:                                                         client_serial);
     1347: 2289:  return TRUE;
        -: 2290:}
        -: 2291:
        -: 2292:dbus_bool_t
        -: 2293:_dbus_connection_send_and_unlock (DBusConnection *connection,
        -: 2294:				  DBusMessage    *message,
        -: 2295:				  dbus_uint32_t  *client_serial)
function _dbus_connection_send_and_unlock called 15602 returned 100% blocks executed 100%
    15602: 2296:{
        -: 2297:  DBusPreallocatedSend *preallocated;
        -: 2298:
    15602: 2299:  _dbus_assert (connection != NULL);
call    0 returned 100%
    15602: 2300:  _dbus_assert (message != NULL);
call    0 returned 100%
        -: 2301:  
    15602: 2302:  preallocated = _dbus_connection_preallocate_send_unlocked (connection);
call    0 returned 100%
    15602: 2303:  if (preallocated == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
        -: 2304:    {
       36: 2305:      CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
       36: 2306:      return FALSE;
        -: 2307:    }
        -: 2308:
    15566: 2309:  _dbus_connection_send_preallocated_and_unlock (connection,
call    0 returned 100%
        -: 2310:						 preallocated,
        -: 2311:						 message,
        -: 2312:						 client_serial);
    15566: 2313:  return TRUE;
        -: 2314:}
        -: 2315:
        -: 2316:/**
        -: 2317: * Adds a message to the outgoing message queue. Does not block to
        -: 2318: * write the message to the network; that happens asynchronously. To
        -: 2319: * force the message to be written, call dbus_connection_flush().
        -: 2320: * Because this only queues the message, the only reason it can
        -: 2321: * fail is lack of memory. Even if the connection is disconnected,
        -: 2322: * no error will be returned.
        -: 2323: *
        -: 2324: * If the function fails due to lack of memory, it returns #FALSE.
        -: 2325: * The function will never fail for other reasons; even if the
        -: 2326: * connection is disconnected, you can queue an outgoing message,
        -: 2327: * though obviously it won't be sent.
        -: 2328: * 
        -: 2329: * @param connection the connection.
        -: 2330: * @param message the message to write.
        -: 2331: * @param client_serial return location for client serial.
        -: 2332: * @returns #TRUE on success.
        -: 2333: */
        -: 2334:dbus_bool_t
        -: 2335:dbus_connection_send (DBusConnection *connection,
        -: 2336:                      DBusMessage    *message,
        -: 2337:                      dbus_uint32_t  *client_serial)
function dbus_connection_send called 15602 returned 100% blocks executed 63%
    15602: 2338:{
    15602: 2339:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
    15602: 2340:  _dbus_return_val_if_fail (message != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 2341:
    15602: 2342:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 2343:
    15602: 2344:  return _dbus_connection_send_and_unlock (connection,
call    0 returned 100%
        -: 2345:					   message,
        -: 2346:					   client_serial);
        -: 2347:}
        -: 2348:
        -: 2349:static dbus_bool_t
        -: 2350:reply_handler_timeout (void *data)
function reply_handler_timeout called 0 returned 0% blocks executed 0%
    #####: 2351:{
        -: 2352:  DBusConnection *connection;
        -: 2353:  DBusDispatchStatus status;
    #####: 2354:  DBusPendingCall *pending = data;
        -: 2355:
    #####: 2356:  connection = pending->connection;
        -: 2357:  
    #####: 2358:  CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
    #####: 2359:  if (pending->timeout_link)
branch  0 never executed
branch  1 never executed
        -: 2360:    {
    #####: 2361:      _dbus_connection_queue_synthesized_message_link (connection,
call    0 never executed
        -: 2362:						       pending->timeout_link);
    #####: 2363:      pending->timeout_link = NULL;
        -: 2364:    }
        -: 2365:
    #####: 2366:  _dbus_connection_remove_timeout_unlocked (connection,
call    0 never executed
        -: 2367:				            pending->timeout);
    #####: 2368:  pending->timeout_added = FALSE;
        -: 2369:
    #####: 2370:  _dbus_verbose ("%s middle\n", _DBUS_FUNCTION_NAME);
call    0 never executed
    #####: 2371:  status = _dbus_connection_get_dispatch_status_unlocked (connection);
call    0 never executed
        -: 2372:
        -: 2373:  /* Unlocks, and calls out to user code */
    #####: 2374:  _dbus_connection_update_dispatch_status_and_unlock (connection, status);
call    0 never executed
        -: 2375:  
    #####: 2376:  return TRUE;
        -: 2377:}
        -: 2378:
        -: 2379:/**
        -: 2380: * Queues a message to send, as with dbus_connection_send_message(),
        -: 2381: * but also returns a #DBusPendingCall used to receive a reply to the
        -: 2382: * message. If no reply is received in the given timeout_milliseconds,
        -: 2383: * this function expires the pending reply and generates a synthetic
        -: 2384: * error reply (generated in-process, not by the remote application)
        -: 2385: * indicating that a timeout occurred.
        -: 2386: *
        -: 2387: * A #DBusPendingCall will see a reply message after any filters, but
        -: 2388: * before any object instances or other handlers. A #DBusPendingCall
        -: 2389: * will always see exactly one reply message, unless it's cancelled
        -: 2390: * with dbus_pending_call_cancel().
        -: 2391: * 
        -: 2392: * If a filter filters out the reply before the handler sees it, the
        -: 2393: * reply is immediately timed out and a timeout error reply is
        -: 2394: * generated. If a filter removes the timeout error reply then the
        -: 2395: * #DBusPendingCall will get confused. Filtering the timeout error
        -: 2396: * is thus considered a bug and will print a warning.
        -: 2397: * 
        -: 2398: * If #NULL is passed for the pending_return, the #DBusPendingCall
        -: 2399: * will still be generated internally, and used to track
        -: 2400: * the message reply timeout. This means a timeout error will
        -: 2401: * occur if no reply arrives, unlike with dbus_connection_send().
        -: 2402: *
        -: 2403: * If -1 is passed for the timeout, a sane default timeout is used. -1
        -: 2404: * is typically the best value for the timeout for this reason, unless
        -: 2405: * you want a very short or very long timeout.  There is no way to
        -: 2406: * avoid a timeout entirely, other than passing INT_MAX for the
        -: 2407: * timeout to postpone it indefinitely.
        -: 2408: * 
        -: 2409: * @param connection the connection
        -: 2410: * @param message the message to send
        -: 2411: * @param pending_return return location for a #DBusPendingCall object, or #NULL
        -: 2412: * @param timeout_milliseconds timeout in milliseconds or -1 for default
        -: 2413: * @returns #TRUE if the message is successfully queued, #FALSE if no memory.
        -: 2414: *
        -: 2415: */
        -: 2416:dbus_bool_t
        -: 2417:dbus_connection_send_with_reply (DBusConnection     *connection,
        -: 2418:                                 DBusMessage        *message,
        -: 2419:                                 DBusPendingCall   **pending_return,
        -: 2420:                                 int                 timeout_milliseconds)
function dbus_connection_send_with_reply called 1346 returned 100% blocks executed 56%
     1346: 2421:{
        -: 2422:  DBusPendingCall *pending;
        -: 2423:  DBusMessage *reply;
        -: 2424:  DBusList *reply_link;
     1346: 2425:  dbus_int32_t serial = -1;
        -: 2426:  DBusDispatchStatus status;
        -: 2427:
     1346: 2428:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
     1346: 2429:  _dbus_return_val_if_fail (message != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
     1346: 2430:  _dbus_return_val_if_fail (timeout_milliseconds >= 0 || timeout_milliseconds == -1, FALSE);
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
branch  3 taken 0% (fallthrough)
branch  4 taken 100%
call    5 never executed
call    6 never executed
        -: 2431:
     1346: 2432:  if (pending_return)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
     1346: 2433:    *pending_return = NULL;
        -: 2434:  
     1346: 2435:  pending = _dbus_pending_call_new (connection,
call    0 returned 100%
        -: 2436:                                    timeout_milliseconds,
        -: 2437:                                    reply_handler_timeout);
        -: 2438:
     1346: 2439:  if (pending == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2440:    return FALSE;
        -: 2441:
     1346: 2442:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 2443:  
        -: 2444:  /* Assign a serial to the message */
     1346: 2445:  if (dbus_message_get_serial (message) == 0)
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 2446:    {
     1346: 2447:      serial = _dbus_connection_get_next_client_serial (connection);
call    0 returned 100%
     1346: 2448:      _dbus_message_set_serial (message, serial);
call    0 returned 100%
        -: 2449:    }
        -: 2450:
     1346: 2451:  pending->reply_serial = serial;
        -: 2452:
     1346: 2453:  reply = dbus_message_new_error (message, DBUS_ERROR_NO_REPLY,
call    0 returned 100%
        -: 2454:                                  "No reply within specified time");
     1346: 2455:  if (reply == NULL)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
    #####: 2456:    goto error;
        -: 2457:
     1346: 2458:  reply_link = _dbus_list_alloc_link (reply);
call    0 returned 100%
     1346: 2459:  if (reply_link == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 2460:    {
    #####: 2461:      CONNECTION_UNLOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
    #####: 2462:      dbus_message_unref (reply);
call    0 never executed
    #####: 2463:      goto error_unlocked;
        -: 2464:    }
        -: 2465:
     1346: 2466:  pending->timeout_link = reply_link;
        -: 2467:
        -: 2468:  /* Insert the serial in the pending replies hash;
        -: 2469:   * hash takes a refcount on DBusPendingCall.
        -: 2470:   * Also, add the timeout.
        -: 2471:   */
     1346: 2472:  if (!_dbus_connection_attach_pending_call_unlocked (connection,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2473:						      pending))
    #####: 2474:    goto error;
        -: 2475: 
     1346: 2476:  if (!_dbus_connection_send_unlocked_no_update (connection, message, NULL))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2477:    {
    #####: 2478:      _dbus_connection_detach_pending_call_and_unlock (connection,
call    0 never executed
        -: 2479:						       pending);
    #####: 2480:      goto error_unlocked;
        -: 2481:    }
        -: 2482:
     1346: 2483:  if (pending_return)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
     1346: 2484:    *pending_return = pending;
        -: 2485:  else
        -: 2486:    {
    #####: 2487:      _dbus_connection_detach_pending_call_unlocked (connection, pending);
call    0 never executed
    #####: 2488:      dbus_pending_call_unref (pending);
call    0 never executed
        -: 2489:    }
        -: 2490:
     1346: 2491:  _dbus_verbose ("%s middle\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
     1346: 2492:  status = _dbus_connection_get_dispatch_status_unlocked (connection);
call    0 returned 100%
        -: 2493:
        -: 2494:  /* this calls out to user code */
     1346: 2495:  _dbus_connection_update_dispatch_status_and_unlock (connection, status);
call    0 returned 100%
        -: 2496:
     1346: 2497:  return TRUE;
        -: 2498:
    #####: 2499: error:
    #####: 2500:  CONNECTION_UNLOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
    #####: 2501: error_unlocked:
    #####: 2502:  dbus_pending_call_unref (pending);
call    0 never executed
    #####: 2503:  return FALSE;
        -: 2504:}
        -: 2505:
        -: 2506:/* This is slightly strange since we can pop a message here without
        -: 2507: * the dispatch lock.
        -: 2508: */
        -: 2509:static DBusMessage*
        -: 2510:check_for_reply_unlocked (DBusConnection *connection,
        -: 2511:                          dbus_uint32_t   client_serial)
function check_for_reply_unlocked called 2693 returned 100% blocks executed 100%
     2693: 2512:{
        -: 2513:  DBusList *link;
        -: 2514:
     2693: 2515:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 2516:  
     2693: 2517:  link = _dbus_list_get_first_link (&connection->incoming_messages);
call    0 returned 100%
        -: 2518:
     6452: 2519:  while (link != NULL)
branch  0 taken 61%
branch  1 taken 39% (fallthrough)
        -: 2520:    {
     2296: 2521:      DBusMessage *reply = link->data;
        -: 2522:
     2296: 2523:      if (dbus_message_get_reply_serial (reply) == client_serial)
call    0 returned 100%
branch  1 taken 54% (fallthrough)
branch  2 taken 46%
        -: 2524:	{
     1230: 2525:	  _dbus_list_remove_link (&connection->incoming_messages, link);
call    0 returned 100%
     1230: 2526:	  connection->n_incoming  -= 1;
     1230: 2527:	  return reply;
        -: 2528:	}
     1066: 2529:      link = _dbus_list_get_next_link (&connection->incoming_messages, link);
branch  0 taken 39% (fallthrough)
branch  1 taken 61%
        -: 2530:    }
        -: 2531:
     1463: 2532:  return NULL;
        -: 2533:}
        -: 2534:
        -: 2535:static dbus_bool_t
        -: 2536:check_for_reply_and_update_dispatch_unlocked (DBusPendingCall *pending)
function check_for_reply_and_update_dispatch_unlocked called 2693 returned 100% blocks executed 100%
     2693: 2537:{
        -: 2538:  DBusMessage *reply;
        -: 2539:  DBusDispatchStatus status;
        -: 2540:  DBusConnection *connection;
        -: 2541:
     2693: 2542:  connection = pending->connection;
        -: 2543:
     2693: 2544:  reply = check_for_reply_unlocked (connection, pending->reply_serial);
call    0 returned 100%
     2693: 2545:  if (reply != NULL)
branch  0 taken 46% (fallthrough)
branch  1 taken 54%
        -: 2546:    {
     1230: 2547:      _dbus_verbose ("%s checked for reply\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
        -: 2548:
     1230: 2549:      _dbus_verbose ("dbus_connection_send_with_reply_and_block(): got reply\n");
call    0 returned 100%
        -: 2550:
     1230: 2551:      _dbus_pending_call_complete_and_unlock (pending, reply);
call    0 returned 100%
     1230: 2552:      dbus_message_unref (reply);
call    0 returned 100%
        -: 2553:
     1230: 2554:      CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
     1230: 2555:      status = _dbus_connection_get_dispatch_status_unlocked (connection);
call    0 returned 100%
     1230: 2556:      _dbus_connection_update_dispatch_status_and_unlock (connection, status);
call    0 returned 100%
     1230: 2557:      dbus_pending_call_unref (pending);
call    0 returned 100%
        -: 2558:
     1230: 2559:      return TRUE;
        -: 2560:    }
        -: 2561:
     1463: 2562:  return FALSE;
        -: 2563:}
        -: 2564:
        -: 2565:/**
        -: 2566: * When a function that blocks has been called with a timeout, and we
        -: 2567: * run out of memory, the time to wait for memory is based on the
        -: 2568: * timeout. If the caller was willing to block a long time we wait a
        -: 2569: * relatively long time for memory, if they were only willing to block
        -: 2570: * briefly then we retry for memory at a rapid rate.
        -: 2571: *
        -: 2572: * @timeout_milliseconds the timeout requested for blocking
        -: 2573: */
        -: 2574:static void
        -: 2575:_dbus_memory_pause_based_on_timeout (int timeout_milliseconds)
function _dbus_memory_pause_based_on_timeout called 0 returned 0% blocks executed 0%
    #####: 2576:{
    #####: 2577:  if (timeout_milliseconds == -1)
branch  0 never executed
branch  1 never executed
    #####: 2578:    _dbus_sleep_milliseconds (1000);
call    0 never executed
    #####: 2579:  else if (timeout_milliseconds < 100)
branch  0 never executed
branch  1 never executed
        -: 2580:    ; /* just busy loop */
    #####: 2581:  else if (timeout_milliseconds <= 1000)
branch  0 never executed
branch  1 never executed
    #####: 2582:    _dbus_sleep_milliseconds (timeout_milliseconds / 3);
call    0 never executed
        -: 2583:  else
    #####: 2584:    _dbus_sleep_milliseconds (1000);
call    0 never executed
    #####: 2585:}
        -: 2586:
        -: 2587:/**
        -: 2588: * Blocks until a pending call times out or gets a reply.
        -: 2589: *
        -: 2590: * Does not re-enter the main loop or run filter/path-registered
        -: 2591: * callbacks. The reply to the message will not be seen by
        -: 2592: * filter callbacks.
        -: 2593: *
        -: 2594: * Returns immediately if pending call already got a reply.
        -: 2595: * 
        -: 2596: * @todo could use performance improvements (it keeps scanning
        -: 2597: * the whole message queue for example)
        -: 2598: *
        -: 2599: * @param pending the pending call we block for a reply on
        -: 2600: */
        -: 2601:void
        -: 2602:_dbus_connection_block_pending_call (DBusPendingCall *pending)
function _dbus_connection_block_pending_call called 1346 returned 100% blocks executed 63%
     1346: 2603:{
        -: 2604:  long start_tv_sec, start_tv_usec;
        -: 2605:  long end_tv_sec, end_tv_usec;
        -: 2606:  long tv_sec, tv_usec;
        -: 2607:  DBusDispatchStatus status;
        -: 2608:  DBusConnection *connection;
        -: 2609:  dbus_uint32_t client_serial;
        -: 2610:  int timeout_milliseconds;
        -: 2611:
     1346: 2612:  _dbus_assert (pending != NULL);
call    0 returned 100%
        -: 2613:
     1346: 2614:  if (dbus_pending_call_get_completed (pending))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 2615:    return;
        -: 2616:
     1346: 2617:  if (pending->connection == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2618:    return; /* call already detached */
        -: 2619:
     1346: 2620:  dbus_pending_call_ref (pending); /* necessary because the call could be canceled */
call    0 returned 100%
        -: 2621:  
     1346: 2622:  connection = pending->connection;
     1346: 2623:  client_serial = pending->reply_serial;
        -: 2624:
        -: 2625:  /* note that timeout_milliseconds is limited to a smallish value
        -: 2626:   * in _dbus_pending_call_new() so overflows aren't possible
        -: 2627:   * below
        -: 2628:   */
     1346: 2629:  timeout_milliseconds = dbus_timeout_get_interval (pending->timeout);
call    0 returned 100%
        -: 2630:
        -: 2631:  /* Flush message queue */
     1346: 2632:  dbus_connection_flush (connection);
call    0 returned 100%
        -: 2633:
     1346: 2634:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 2635:
     1346: 2636:  _dbus_get_current_time (&start_tv_sec, &start_tv_usec);
call    0 returned 100%
     1346: 2637:  end_tv_sec = start_tv_sec + timeout_milliseconds / 1000;
     1346: 2638:  end_tv_usec = start_tv_usec + (timeout_milliseconds % 1000) * 1000;
     1346: 2639:  end_tv_sec += end_tv_usec / _DBUS_USEC_PER_SECOND;
     1346: 2640:  end_tv_usec = end_tv_usec % _DBUS_USEC_PER_SECOND;
        -: 2641:
     1346: 2642:  _dbus_verbose ("dbus_connection_send_with_reply_and_block(): will block %d milliseconds for reply serial %u from %ld sec %ld usec to %ld sec %ld usec\n",
call    0 returned 100%
        -: 2643:                 timeout_milliseconds,
        -: 2644:                 client_serial,
        -: 2645:                 start_tv_sec, start_tv_usec,
        -: 2646:                 end_tv_sec, end_tv_usec);
        -: 2647:
        -: 2648:  /* check to see if we already got the data off the socket */
        -: 2649:  /* from another blocked pending call */
     1346: 2650:  if (check_for_reply_and_update_dispatch_unlocked (pending))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 2651:    return;
        -: 2652:
        -: 2653:  /* Now we wait... */
        -: 2654:  /* always block at least once as we know we don't have the reply yet */
     1346: 2655:  _dbus_connection_do_iteration_unlocked (connection,
call    0 returned 100%
        -: 2656:                                          DBUS_ITERATION_DO_READING |
        -: 2657:                                          DBUS_ITERATION_BLOCK,
        -: 2658:                                          timeout_milliseconds);
        -: 2659:
     1347: 2660: recheck_status:
        -: 2661:
     1347: 2662:  _dbus_verbose ("%s top of recheck\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
        -: 2663:  
     1347: 2664:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 2665:  
        -: 2666:  /* queue messages and get status */
        -: 2667:
     1347: 2668:  status = _dbus_connection_get_dispatch_status_unlocked (connection);
call    0 returned 100%
        -: 2669:
        -: 2670:  /* the get_completed() is in case a dispatch() while we were blocking
        -: 2671:   * got the reply instead of us.
        -: 2672:   */
     1347: 2673:  if (dbus_pending_call_get_completed (pending))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2674:    {
    #####: 2675:      _dbus_verbose ("Pending call completed by dispatch in %s\n", _DBUS_FUNCTION_NAME);
call    0 never executed
    #####: 2676:      _dbus_connection_update_dispatch_status_and_unlock (connection, status);
call    0 never executed
    #####: 2677:      dbus_pending_call_unref (pending);
call    0 never executed
    #####: 2678:      return;
        -: 2679:    }
        -: 2680:  
     1347: 2681:  if (status == DBUS_DISPATCH_DATA_REMAINS)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
     1347: 2682:    if (check_for_reply_and_update_dispatch_unlocked (pending))
call    0 returned 100%
branch  1 taken 91% (fallthrough)
branch  2 taken 9%
     1230: 2683:      return;  
        -: 2684:  
      117: 2685:  _dbus_get_current_time (&tv_sec, &tv_usec);
call    0 returned 100%
        -: 2686:  
      117: 2687:  if (!_dbus_connection_get_is_connected_unlocked (connection))
call    0 returned 100%
branch  1 taken 99% (fallthrough)
branch  2 taken 1%
        -: 2688:    {
        -: 2689:      /* FIXME send a "DBUS_ERROR_DISCONNECTED" instead, just to help
        -: 2690:       * programmers understand what went wrong since the timeout is
        -: 2691:       * confusing
        -: 2692:       */
        -: 2693:      
      116: 2694:      _dbus_pending_call_complete_and_unlock (pending, NULL);
call    0 returned 100%
      116: 2695:      dbus_pending_call_unref (pending);
call    0 returned 100%
      116: 2696:      return;
        -: 2697:    }
        1: 2698:  else if (tv_sec < start_tv_sec)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2699:    _dbus_verbose ("dbus_connection_send_with_reply_and_block(): clock set backward\n");
call    0 never executed
        1: 2700:  else if (connection->disconnect_message_link == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2701:    _dbus_verbose ("dbus_connection_send_with_reply_and_block(): disconnected\n");
call    0 never executed
        1: 2702:  else if (tv_sec < end_tv_sec ||
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
branch  2 never executed
branch  3 never executed
branch  4 never executed
branch  5 never executed
        -: 2703:           (tv_sec == end_tv_sec && tv_usec < end_tv_usec))
        -: 2704:    {
        1: 2705:      timeout_milliseconds = (end_tv_sec - tv_sec) * 1000 +
        -: 2706:        (end_tv_usec - tv_usec) / 1000;
        1: 2707:      _dbus_verbose ("dbus_connection_send_with_reply_and_block(): %d milliseconds remain\n", timeout_milliseconds);
call    0 returned 100%
        1: 2708:      _dbus_assert (timeout_milliseconds >= 0);
call    0 returned 100%
        -: 2709:      
        1: 2710:      if (status == DBUS_DISPATCH_NEED_MEMORY)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 2711:        {
        -: 2712:          /* Try sleeping a bit, as we aren't sure we need to block for reading,
        -: 2713:           * we may already have a reply in the buffer and just can't process
        -: 2714:           * it.
        -: 2715:           */
    #####: 2716:          _dbus_verbose ("dbus_connection_send_with_reply_and_block() waiting for more memory\n");
call    0 never executed
        -: 2717:
    #####: 2718:          _dbus_memory_pause_based_on_timeout (timeout_milliseconds);
call    0 never executed
        -: 2719:        }
        -: 2720:      else
        -: 2721:        {          
        -: 2722:          /* block again, we don't have the reply buffered yet. */
        1: 2723:          _dbus_connection_do_iteration_unlocked (connection,
call    0 returned 100%
        -: 2724:                                                  DBUS_ITERATION_DO_READING |
        -: 2725:                                                  DBUS_ITERATION_BLOCK,
        -: 2726:                                                  timeout_milliseconds);
        -: 2727:        }
        -: 2728:
        1: 2729:      goto recheck_status;
        -: 2730:    }
        -: 2731:
    #####: 2732:  _dbus_verbose ("dbus_connection_send_with_reply_and_block(): Waited %ld milliseconds and got no reply\n",
call    0 never executed
        -: 2733:                 (tv_sec - start_tv_sec) * 1000 + (tv_usec - start_tv_usec) / 1000);
        -: 2734:
    #####: 2735:  _dbus_assert (!dbus_pending_call_get_completed (pending));
call    0 never executed
call    1 never executed
        -: 2736:  
        -: 2737:  /* unlock and call user code */
    #####: 2738:  _dbus_pending_call_complete_and_unlock (pending, NULL);
call    0 never executed
        -: 2739:
        -: 2740:  /* update user code on dispatch status */
    #####: 2741:  CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
    #####: 2742:  status = _dbus_connection_get_dispatch_status_unlocked (connection);
call    0 never executed
    #####: 2743:  _dbus_connection_update_dispatch_status_and_unlock (connection, status);
call    0 never executed
    #####: 2744:  dbus_pending_call_unref (pending);
call    0 never executed
        -: 2745:}
        -: 2746:
        -: 2747:/**
        -: 2748: * Sends a message and blocks a certain time period while waiting for
        -: 2749: * a reply.  This function does not reenter the main loop,
        -: 2750: * i.e. messages other than the reply are queued up but not
        -: 2751: * processed. This function is used to do non-reentrant "method
        -: 2752: * calls."
        -: 2753: * 
        -: 2754: * If a normal reply is received, it is returned, and removed from the
        -: 2755: * incoming message queue. If it is not received, #NULL is returned
        -: 2756: * and the error is set to #DBUS_ERROR_NO_REPLY.  If an error reply is
        -: 2757: * received, it is converted to a #DBusError and returned as an error,
        -: 2758: * then the reply message is deleted. If something else goes wrong,
        -: 2759: * result is set to whatever is appropriate, such as
        -: 2760: * #DBUS_ERROR_NO_MEMORY or #DBUS_ERROR_DISCONNECTED.
        -: 2761: *
        -: 2762: * @param connection the connection
        -: 2763: * @param message the message to send
        -: 2764: * @param timeout_milliseconds timeout in milliseconds or -1 for default
        -: 2765: * @param error return location for error message
        -: 2766: * @returns the message that is the reply or #NULL with an error code if the
        -: 2767: * function fails.
        -: 2768: */
        -: 2769:DBusMessage*
        -: 2770:dbus_connection_send_with_reply_and_block (DBusConnection     *connection,
        -: 2771:                                           DBusMessage        *message,
        -: 2772:                                           int                 timeout_milliseconds,
        -: 2773:                                           DBusError          *error)
function dbus_connection_send_with_reply_and_block called 1346 returned 100% blocks executed 63%
     1346: 2774:{
        -: 2775:  DBusMessage *reply;
        -: 2776:  DBusPendingCall *pending;
        -: 2777:  
     1346: 2778:  _dbus_return_val_if_fail (connection != NULL, NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
     1346: 2779:  _dbus_return_val_if_fail (message != NULL, NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
     1346: 2780:  _dbus_return_val_if_fail (timeout_milliseconds >= 0 || timeout_milliseconds == -1, NULL);
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
branch  3 taken 0% (fallthrough)
branch  4 taken 100%
call    5 never executed
call    6 never executed
     1346: 2781:  _dbus_return_val_if_error_is_set (error, NULL);
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
call    3 returned 100%
branch  4 taken 0% (fallthrough)
branch  5 taken 100%
call    6 never executed
call    7 never executed
        -: 2782:  
     1346: 2783:  if (!dbus_connection_send_with_reply (connection, message,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2784:                                        &pending, timeout_milliseconds))
        -: 2785:    {
    #####: 2786:      _DBUS_SET_OOM (error);
call    0 never executed
    #####: 2787:      return NULL;
        -: 2788:    }
        -: 2789:
     1346: 2790:  _dbus_assert (pending != NULL);
call    0 returned 100%
        -: 2791:  
     1346: 2792:  dbus_pending_call_block (pending);
call    0 returned 100%
        -: 2793:
     1346: 2794:  reply = dbus_pending_call_steal_reply (pending);
call    0 returned 100%
     1346: 2795:  dbus_pending_call_unref (pending);
call    0 returned 100%
        -: 2796:
        -: 2797:  /* call_complete_and_unlock() called from pending_call_block() should
        -: 2798:   * always fill this in.
        -: 2799:   */
     1346: 2800:  _dbus_assert (reply != NULL);
call    0 returned 100%
        -: 2801:  
     1346: 2802:   if (dbus_set_error_from_message (error, reply))
call    0 returned 100%
branch  1 taken 69% (fallthrough)
branch  2 taken 31%
        -: 2803:    {
      928: 2804:      dbus_message_unref (reply);
call    0 returned 100%
      928: 2805:      return NULL;
        -: 2806:    }
        -: 2807:  else
      418: 2808:    return reply;
        -: 2809:}
        -: 2810:
        -: 2811:/**
        -: 2812: * Blocks until the outgoing message queue is empty.
        -: 2813: *
        -: 2814: * @param connection the connection.
        -: 2815: */
        -: 2816:void
        -: 2817:dbus_connection_flush (DBusConnection *connection)
function dbus_connection_flush called 1346 returned 100% blocks executed 90%
     1346: 2818:{
        -: 2819:  /* We have to specify DBUS_ITERATION_DO_READING here because
        -: 2820:   * otherwise we could have two apps deadlock if they are both doing
        -: 2821:   * a flush(), and the kernel buffers fill up. This could change the
        -: 2822:   * dispatch status.
        -: 2823:   */
        -: 2824:  DBusDispatchStatus status;
        -: 2825:
     1346: 2826:  _dbus_return_if_fail (connection != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 2827:  
     1346: 2828:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
     5144: 2829:  while (connection->n_outgoing > 0 &&
branch  0 taken 65% (fallthrough)
branch  1 taken 35%
call    2 returned 100%
branch  3 taken 99%
branch  4 taken 1% (fallthrough)
        -: 2830:         _dbus_connection_get_is_connected_unlocked (connection))
        -: 2831:    {
     2452: 2832:      _dbus_verbose ("doing iteration in %s\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
     2452: 2833:      HAVE_LOCK_CHECK (connection);
call    0 returned 100%
     2452: 2834:      _dbus_connection_do_iteration_unlocked (connection,
call    0 returned 100%
        -: 2835:                                              DBUS_ITERATION_DO_READING |
        -: 2836:                                              DBUS_ITERATION_DO_WRITING |
        -: 2837:                                              DBUS_ITERATION_BLOCK,
        -: 2838:                                              -1);
        -: 2839:    }
        -: 2840:
     1346: 2841:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
     1346: 2842:  _dbus_verbose ("%s middle\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
     1346: 2843:  status = _dbus_connection_get_dispatch_status_unlocked (connection);
call    0 returned 100%
        -: 2844:
     1346: 2845:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 2846:  /* Unlocks and calls out to user code */
     1346: 2847:  _dbus_connection_update_dispatch_status_and_unlock (connection, status);
call    0 returned 100%
        -: 2848:
     1346: 2849:  _dbus_verbose ("%s end\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
        -: 2850:}
        -: 2851:
        -: 2852:/**
        -: 2853: * This function is intended for use with applications that don't want
        -: 2854: * to write a main loop and deal with #DBusWatch and #DBusTimeout. An
        -: 2855: * example usage would be:
        -: 2856: * 
        -: 2857: * @code
        -: 2858: *   while (dbus_connection_read_write_dispatch (connection, -1))
        -: 2859: *     ; // empty loop body
        -: 2860: * @endcode
        -: 2861: * 
        -: 2862: * In this usage you would normally have set up a filter function to look
        -: 2863: * at each message as it is dispatched. The loop terminates when the last
        -: 2864: * message from the connection (the disconnected signal) is processed.
        -: 2865: *
        -: 2866: * If there are messages to dispatch and the dispatch flag is set, this
        -: 2867: * function will dbus_connection_dispatch() once, and return. If there are no
        -: 2868: * messages to dispatch, this function will block until it can read or write,
        -: 2869: * then read or write, then return.
        -: 2870: *
        -: 2871: * The way to think of this function is that it either makes some sort
        -: 2872: * of progress, or it blocks.
        -: 2873: *
        -: 2874: * The return value indicates whether the disconnect message has been
        -: 2875: * processed, NOT whether the connection is connected. This is
        -: 2876: * important because even after disconnecting, you want to process any
        -: 2877: * messages you received prior to the disconnect.
        -: 2878: *
        -: 2879: * @param connection the connection
        -: 2880: * @param timeout_milliseconds max time to block or -1 for infinite
        -: 2881: * @param dispatch dispatch new messages or leave them on the incoming queue
        -: 2882: * @returns #TRUE if the disconnect message has not been processed
        -: 2883: */
        -: 2884:dbus_bool_t
        -: 2885:_dbus_connection_read_write_dispatch (DBusConnection *connection,
        -: 2886:                                     int             timeout_milliseconds, 
        -: 2887:                                     dbus_bool_t     dispatch)
function _dbus_connection_read_write_dispatch called 0 returned 0% blocks executed 0%
    #####: 2888:{
        -: 2889:  DBusDispatchStatus dstatus;
        -: 2890:  dbus_bool_t dispatched_disconnected;
        -: 2891:  
    #####: 2892:  dstatus = dbus_connection_get_dispatch_status (connection);
call    0 never executed
        -: 2893:
    #####: 2894:  if (dispatch && dstatus == DBUS_DISPATCH_DATA_REMAINS)
branch  0 never executed
branch  1 never executed
branch  2 never executed
branch  3 never executed
        -: 2895:    {
    #####: 2896:      _dbus_verbose ("doing dispatch in %s\n", _DBUS_FUNCTION_NAME);
call    0 never executed
    #####: 2897:      dbus_connection_dispatch (connection);
call    0 never executed
    #####: 2898:      CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
        -: 2899:    }
    #####: 2900:  else if (dstatus == DBUS_DISPATCH_NEED_MEMORY)
branch  0 never executed
branch  1 never executed
        -: 2901:    {
    #####: 2902:      _dbus_verbose ("pausing for memory in %s\n", _DBUS_FUNCTION_NAME);
call    0 never executed
    #####: 2903:      _dbus_memory_pause_based_on_timeout (timeout_milliseconds);
call    0 never executed
    #####: 2904:      CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
        -: 2905:    }
        -: 2906:  else
        -: 2907:    {
    #####: 2908:      CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
    #####: 2909:      if (_dbus_connection_get_is_connected_unlocked (connection))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 2910:        {
    #####: 2911:          _dbus_verbose ("doing iteration in %s\n", _DBUS_FUNCTION_NAME);
call    0 never executed
    #####: 2912:          _dbus_connection_do_iteration_unlocked (connection,
call    0 never executed
        -: 2913:                                                  DBUS_ITERATION_DO_READING |
        -: 2914:                                                  DBUS_ITERATION_DO_WRITING |
        -: 2915:                                                  DBUS_ITERATION_BLOCK,
        -: 2916:                                                  timeout_milliseconds);
        -: 2917:        }
        -: 2918:    }
        -: 2919:  
    #####: 2920:  HAVE_LOCK_CHECK (connection);
call    0 never executed
    #####: 2921:  dispatched_disconnected = connection->n_incoming == 0 &&
branch  0 never executed
branch  1 never executed
branch  2 never executed
branch  3 never executed
        -: 2922:    connection->disconnect_message_link == NULL;
    #####: 2923:  CONNECTION_UNLOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
    #####: 2924:  return !dispatched_disconnected; /* TRUE if we have not processed disconnected */
        -: 2925:}
        -: 2926:
        -: 2927:
        -: 2928:/**
        -: 2929: * This function is intended for use with applications that don't want
        -: 2930: * to write a main loop and deal with #DBusWatch and #DBusTimeout. An
        -: 2931: * example usage would be:
        -: 2932: * 
        -: 2933: * @code
        -: 2934: *   while (dbus_connection_read_write_dispatch (connection, -1))
        -: 2935: *     ; // empty loop body
        -: 2936: * @endcode
        -: 2937: * 
        -: 2938: * In this usage you would normally have set up a filter function to look
        -: 2939: * at each message as it is dispatched. The loop terminates when the last
        -: 2940: * message from the connection (the disconnected signal) is processed.
        -: 2941: * 
        -: 2942: * If there are messages to dispatch, this function will
        -: 2943: * dbus_connection_dispatch() once, and return. If there are no
        -: 2944: * messages to dispatch, this function will block until it can read or
        -: 2945: * write, then read or write, then return.
        -: 2946: *
        -: 2947: * The way to think of this function is that it either makes some sort
        -: 2948: * of progress, or it blocks.
        -: 2949: *
        -: 2950: * The return value indicates whether the disconnect message has been
        -: 2951: * processed, NOT whether the connection is connected. This is
        -: 2952: * important because even after disconnecting, you want to process any
        -: 2953: * messages you received prior to the disconnect.
        -: 2954: *
        -: 2955: * @param connection the connection
        -: 2956: * @param timeout_milliseconds max time to block or -1 for infinite
        -: 2957: * @returns #TRUE if the disconnect message has not been processed
        -: 2958: */
        -: 2959:dbus_bool_t
        -: 2960:dbus_connection_read_write_dispatch (DBusConnection *connection,
        -: 2961:                                     int             timeout_milliseconds)
function dbus_connection_read_write_dispatch called 0 returned 0% blocks executed 0%
    #####: 2962:{
    #####: 2963:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 2964:  _dbus_return_val_if_fail (timeout_milliseconds >= 0 || timeout_milliseconds == -1, FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
call    6 never executed
    #####: 2965:   return _dbus_connection_read_write_dispatch(connection, timeout_milliseconds, TRUE);
call    0 never executed
        -: 2966:}
        -: 2967:
        -: 2968:/** 
        -: 2969: * This function is intended for use with applications that don't want to
        -: 2970: * write a main loop and deal with #DBusWatch and #DBusTimeout.
        -: 2971: * 
        -: 2972: * If there are no messages to dispatch, this function will block until it can
        -: 2973: * read or write, then read or write, then return.
        -: 2974: *
        -: 2975: * The return value indicates whether the disconnect message has been
        -: 2976: * processed, NOT whether the connection is connected. This is important
        -: 2977: * because even after disconnecting, you want to process any messages you
        -: 2978: * received prior to the disconnect.
        -: 2979: *
        -: 2980: * @param connection the connection 
        -: 2981: * @param timeout_milliseconds max time to block or -1 for infinite 
        -: 2982: * @returns #TRUE if the disconnect message has not been processed
        -: 2983: */
        -: 2984:dbus_bool_t 
        -: 2985:dbus_connection_read_write (DBusConnection *connection, 
        -: 2986:                            int             timeout_milliseconds) 
function dbus_connection_read_write called 0 returned 0% blocks executed 0%
    #####: 2987:{ 
    #####: 2988:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 2989:  _dbus_return_val_if_fail (timeout_milliseconds >= 0 || timeout_milliseconds == -1, FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
call    6 never executed
    #####: 2990:   return _dbus_connection_read_write_dispatch(connection, timeout_milliseconds, FALSE);
call    0 never executed
        -: 2991:}
        -: 2992:
        -: 2993:/**
        -: 2994: * Returns the first-received message from the incoming message queue,
        -: 2995: * leaving it in the queue. If the queue is empty, returns #NULL.
        -: 2996: * 
        -: 2997: * The caller does not own a reference to the returned message, and
        -: 2998: * must either return it using dbus_connection_return_message() or
        -: 2999: * keep it after calling dbus_connection_steal_borrowed_message(). No
        -: 3000: * one can get at the message while its borrowed, so return it as
        -: 3001: * quickly as possible and don't keep a reference to it after
        -: 3002: * returning it. If you need to keep the message, make a copy of it.
        -: 3003: *
        -: 3004: * dbus_connection_dispatch() will block if called while a borrowed
        -: 3005: * message is outstanding; only one piece of code can be playing with
        -: 3006: * the incoming queue at a time. This function will block if called
        -: 3007: * during a dbus_connection_dispatch().
        -: 3008: *
        -: 3009: * @param connection the connection.
        -: 3010: * @returns next message in the incoming queue.
        -: 3011: */
        -: 3012:DBusMessage*
        -: 3013:dbus_connection_borrow_message (DBusConnection *connection)
function dbus_connection_borrow_message called 3533 returned 100% blocks executed 82%
     3533: 3014:{
        -: 3015:  DBusDispatchStatus status;
        -: 3016:  DBusMessage *message;
        -: 3017:
     3533: 3018:  _dbus_return_val_if_fail (connection != NULL, NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 3019:
     3533: 3020:  _dbus_verbose ("%s start\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
        -: 3021:  
        -: 3022:  /* this is called for the side effect that it queues
        -: 3023:   * up any messages from the transport
        -: 3024:   */
     3533: 3025:  status = dbus_connection_get_dispatch_status (connection);
call    0 returned 100%
     3533: 3026:  if (status != DBUS_DISPATCH_DATA_REMAINS)
branch  0 taken 43% (fallthrough)
branch  1 taken 57%
     1516: 3027:    return NULL;
        -: 3028:  
     2017: 3029:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3030:
     2017: 3031:  _dbus_connection_acquire_dispatch (connection);
call    0 returned 100%
        -: 3032:
        -: 3033:  /* While a message is outstanding, the dispatch lock is held */
     2017: 3034:  _dbus_assert (connection->message_borrowed == NULL);
call    0 returned 100%
        -: 3035:
     2017: 3036:  connection->message_borrowed = _dbus_list_get_first (&connection->incoming_messages);
call    0 returned 100%
        -: 3037:  
     2017: 3038:  message = connection->message_borrowed;
        -: 3039:
        -: 3040:  /* Note that we KEEP the dispatch lock until the message is returned */
     2017: 3041:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3042:    _dbus_connection_release_dispatch (connection);
call    0 never executed
        -: 3043:
     2017: 3044:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3045:  
     2017: 3046:  return message;
        -: 3047:}
        -: 3048:
        -: 3049:/**
        -: 3050: * Used to return a message after peeking at it using
        -: 3051: * dbus_connection_borrow_message(). Only called if
        -: 3052: * message from dbus_connection_borrow_message() was non-#NULL.
        -: 3053: *
        -: 3054: * @param connection the connection
        -: 3055: * @param message the message from dbus_connection_borrow_message()
        -: 3056: */
        -: 3057:void
        -: 3058:dbus_connection_return_message (DBusConnection *connection,
        -: 3059:				DBusMessage    *message)
function dbus_connection_return_message called 2017 returned 100% blocks executed 68%
     2017: 3060:{
     2017: 3061:  _dbus_return_if_fail (connection != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
     2017: 3062:  _dbus_return_if_fail (message != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
     2017: 3063:  _dbus_return_if_fail (message == connection->message_borrowed);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
     2017: 3064:  _dbus_return_if_fail (connection->dispatch_acquired);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 3065:  
     2017: 3066:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3067:  
     2017: 3068:  _dbus_assert (message == connection->message_borrowed);
call    0 returned 100%
        -: 3069:  
     2017: 3070:  connection->message_borrowed = NULL;
        -: 3071:
     2017: 3072:  _dbus_connection_release_dispatch (connection);
call    0 returned 100%
        -: 3073:  
     2017: 3074:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3075:}
        -: 3076:
        -: 3077:/**
        -: 3078: * Used to keep a message after peeking at it using
        -: 3079: * dbus_connection_borrow_message(). Before using this function, see
        -: 3080: * the caveats/warnings in the documentation for
        -: 3081: * dbus_connection_pop_message().
        -: 3082: *
        -: 3083: * @param connection the connection
        -: 3084: * @param message the message from dbus_connection_borrow_message()
        -: 3085: */
        -: 3086:void
        -: 3087:dbus_connection_steal_borrowed_message (DBusConnection *connection,
        -: 3088:					DBusMessage    *message)
function dbus_connection_steal_borrowed_message called 0 returned 0% blocks executed 0%
    #####: 3089:{
        -: 3090:  DBusMessage *pop_message;
        -: 3091:
    #####: 3092:  _dbus_return_if_fail (connection != NULL);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 3093:  _dbus_return_if_fail (message != NULL);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 3094:  _dbus_return_if_fail (message == connection->message_borrowed);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 3095:  _dbus_return_if_fail (connection->dispatch_acquired);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 3096:  
    #####: 3097:  CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
        -: 3098: 
    #####: 3099:  _dbus_assert (message == connection->message_borrowed);
call    0 never executed
        -: 3100:
    #####: 3101:  pop_message = _dbus_list_pop_first (&connection->incoming_messages);
call    0 never executed
    #####: 3102:  _dbus_assert (message == pop_message);
call    0 never executed
        -: 3103:  
    #####: 3104:  connection->n_incoming -= 1;
        -: 3105: 
    #####: 3106:  _dbus_verbose ("Incoming message %p stolen from queue, %d incoming\n",
call    0 never executed
        -: 3107:		 message, connection->n_incoming);
        -: 3108: 
    #####: 3109:  connection->message_borrowed = NULL;
        -: 3110:
    #####: 3111:  _dbus_connection_release_dispatch (connection);
call    0 never executed
        -: 3112:  
    #####: 3113:  CONNECTION_UNLOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
        -: 3114:}
        -: 3115:
        -: 3116:/* See dbus_connection_pop_message, but requires the caller to own
        -: 3117: * the lock before calling. May drop the lock while running.
        -: 3118: */
        -: 3119:static DBusList*
        -: 3120:_dbus_connection_pop_message_link_unlocked (DBusConnection *connection)
function _dbus_connection_pop_message_link_unlocked called 80953 returned 100% blocks executed 96%
    80953: 3121:{
    80953: 3122:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 3123:  
    80953: 3124:  _dbus_assert (connection->message_borrowed == NULL);
call    0 returned 100%
        -: 3125:  
    80953: 3126:  if (connection->n_incoming > 0)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -: 3127:    {
        -: 3128:      DBusList *link;
        -: 3129:
    80953: 3130:      link = _dbus_list_pop_first_link (&connection->incoming_messages);
call    0 returned 100%
    80953: 3131:      connection->n_incoming -= 1;
        -: 3132:
    80953: 3133:      _dbus_verbose ("Message %p (%d %s %s %s '%s') removed from incoming queue %p, %d incoming\n",
call    0 returned 100%
call    1 returned 100%
branch  2 taken 83% (fallthrough)
branch  3 taken 17%
call    4 returned 100%
call    5 returned 100%
branch  6 taken 83% (fallthrough)
branch  7 taken 17%
call    8 returned 100%
call    9 returned 100%
branch 10 taken 83% (fallthrough)
branch 11 taken 17%
call   12 returned 100%
call   13 returned 100%
call   14 returned 100%
        -: 3134:                     link->data,
        -: 3135:                     dbus_message_get_type (link->data),
        -: 3136:                     dbus_message_get_path (link->data) ?
        -: 3137:                     dbus_message_get_path (link->data) :
        -: 3138:                     "no path",
        -: 3139:                     dbus_message_get_interface (link->data) ?
        -: 3140:                     dbus_message_get_interface (link->data) :
        -: 3141:                     "no interface",
        -: 3142:                     dbus_message_get_member (link->data) ?
        -: 3143:                     dbus_message_get_member (link->data) :
        -: 3144:                     "no member",
        -: 3145:                     dbus_message_get_signature (link->data),
        -: 3146:                     connection, connection->n_incoming);
        -: 3147:
    80953: 3148:      return link;
        -: 3149:    }
        -: 3150:  else
    #####: 3151:    return NULL;
        -: 3152:}
        -: 3153:
        -: 3154:/* See dbus_connection_pop_message, but requires the caller to own
        -: 3155: * the lock before calling. May drop the lock while running.
        -: 3156: */
        -: 3157:static DBusMessage*
        -: 3158:_dbus_connection_pop_message_unlocked (DBusConnection *connection)
function _dbus_connection_pop_message_unlocked called 49350 returned 100% blocks executed 86%
    49350: 3159:{
        -: 3160:  DBusList *link;
        -: 3161:
    49350: 3162:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 3163:  
    49350: 3164:  link = _dbus_connection_pop_message_link_unlocked (connection);
call    0 returned 100%
        -: 3165:
    49350: 3166:  if (link != NULL)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -: 3167:    {
        -: 3168:      DBusMessage *message;
        -: 3169:      
    49350: 3170:      message = link->data;
        -: 3171:      
    49350: 3172:      _dbus_list_free_link (link);
call    0 returned 100%
        -: 3173:      
    49350: 3174:      return message;
        -: 3175:    }
        -: 3176:  else
    #####: 3177:    return NULL;
        -: 3178:}
        -: 3179:
        -: 3180:static void
        -: 3181:_dbus_connection_putback_message_link_unlocked (DBusConnection *connection,
        -: 3182:                                                DBusList       *message_link)
function _dbus_connection_putback_message_link_unlocked called 0 returned 0% blocks executed 0%
    #####: 3183:{
    #####: 3184:  HAVE_LOCK_CHECK (connection);
call    0 never executed
        -: 3185:  
    #####: 3186:  _dbus_assert (message_link != NULL);
call    0 never executed
        -: 3187:  /* You can't borrow a message while a link is outstanding */
    #####: 3188:  _dbus_assert (connection->message_borrowed == NULL);
call    0 never executed
        -: 3189:  /* We had to have the dispatch lock across the pop/putback */
    #####: 3190:  _dbus_assert (connection->dispatch_acquired);
call    0 never executed
        -: 3191:
    #####: 3192:  _dbus_list_prepend_link (&connection->incoming_messages,
call    0 never executed
        -: 3193:                           message_link);
    #####: 3194:  connection->n_incoming += 1;
        -: 3195:
    #####: 3196:  _dbus_verbose ("Message %p (%d %s %s '%s') put back into queue %p, %d incoming\n",
call    0 never executed
call    1 never executed
branch  2 never executed
branch  3 never executed
call    4 never executed
call    5 never executed
branch  6 never executed
branch  7 never executed
call    8 never executed
call    9 never executed
call   10 never executed
        -: 3197:                 message_link->data,
        -: 3198:                 dbus_message_get_type (message_link->data),
        -: 3199:                 dbus_message_get_interface (message_link->data) ?
        -: 3200:                 dbus_message_get_interface (message_link->data) :
        -: 3201:                 "no interface",
        -: 3202:                 dbus_message_get_member (message_link->data) ?
        -: 3203:                 dbus_message_get_member (message_link->data) :
        -: 3204:                 "no member",
        -: 3205:                 dbus_message_get_signature (message_link->data),
        -: 3206:                 connection, connection->n_incoming);
    #####: 3207:}
        -: 3208:
        -: 3209:/**
        -: 3210: * Returns the first-received message from the incoming message queue,
        -: 3211: * removing it from the queue. The caller owns a reference to the
        -: 3212: * returned message. If the queue is empty, returns #NULL.
        -: 3213: *
        -: 3214: * This function bypasses any message handlers that are registered,
        -: 3215: * and so using it is usually wrong. Instead, let the main loop invoke
        -: 3216: * dbus_connection_dispatch(). Popping messages manually is only
        -: 3217: * useful in very simple programs that don't share a #DBusConnection
        -: 3218: * with any libraries or other modules.
        -: 3219: *
        -: 3220: * There is a lock that covers all ways of accessing the incoming message
        -: 3221: * queue, so dbus_connection_dispatch(), dbus_connection_pop_message(),
        -: 3222: * dbus_connection_borrow_message(), etc. will all block while one of the others
        -: 3223: * in the group is running.
        -: 3224: * 
        -: 3225: * @param connection the connection.
        -: 3226: * @returns next message in the incoming queue.
        -: 3227: */
        -: 3228:DBusMessage*
        -: 3229:dbus_connection_pop_message (DBusConnection *connection)
function dbus_connection_pop_message called 113933 returned 100% blocks executed 100%
   113933: 3230:{
        -: 3231:  DBusMessage *message;
        -: 3232:  DBusDispatchStatus status;
        -: 3233:
   113933: 3234:  _dbus_verbose ("%s start\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
        -: 3235:  
        -: 3236:  /* this is called for the side effect that it queues
        -: 3237:   * up any messages from the transport
        -: 3238:   */
   113933: 3239:  status = dbus_connection_get_dispatch_status (connection);
call    0 returned 100%
   113933: 3240:  if (status != DBUS_DISPATCH_DATA_REMAINS)
branch  0 taken 57% (fallthrough)
branch  1 taken 43%
    64583: 3241:    return NULL;
        -: 3242:  
    49350: 3243:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    49350: 3244:  _dbus_connection_acquire_dispatch (connection);
call    0 returned 100%
    49350: 3245:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 3246:  
    49350: 3247:  message = _dbus_connection_pop_message_unlocked (connection);
call    0 returned 100%
        -: 3248:
    49350: 3249:  _dbus_verbose ("Returning popped message %p\n", message);    
call    0 returned 100%
        -: 3250:
    49350: 3251:  _dbus_connection_release_dispatch (connection);
call    0 returned 100%
    49350: 3252:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3253:  
    49350: 3254:  return message;
        -: 3255:}
        -: 3256:
        -: 3257:/**
        -: 3258: * Acquire the dispatcher. This is a separate lock so the main
        -: 3259: * connection lock can be dropped to call out to application dispatch
        -: 3260: * handlers.
        -: 3261: *
        -: 3262: * @param connection the connection.
        -: 3263: */
        -: 3264:static void
        -: 3265:_dbus_connection_acquire_dispatch (DBusConnection *connection)
function _dbus_connection_acquire_dispatch called 82970 returned 100% blocks executed 89%
    82970: 3266:{
    82970: 3267:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 3268:
    82970: 3269:  _dbus_connection_ref_unlocked (connection);
call    0 returned 100%
    82970: 3270:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3271:  
    82970: 3272:  _dbus_verbose ("%s locking dispatch_mutex\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
    82970: 3273:  _dbus_mutex_lock (connection->dispatch_mutex);
call    0 returned 100%
        -: 3274:
   165940: 3275:  while (connection->dispatch_acquired)
branch  0 taken 0%
branch  1 taken 100% (fallthrough)
        -: 3276:    {
    #####: 3277:      _dbus_verbose ("%s waiting for dispatch to be acquirable\n", _DBUS_FUNCTION_NAME);
call    0 never executed
    #####: 3278:      _dbus_condvar_wait (connection->dispatch_cond, connection->dispatch_mutex);
call    0 never executed
        -: 3279:    }
        -: 3280:  
    82970: 3281:  _dbus_assert (!connection->dispatch_acquired);
call    0 returned 100%
        -: 3282:
    82970: 3283:  connection->dispatch_acquired = TRUE;
        -: 3284:
    82970: 3285:  _dbus_verbose ("%s unlocking dispatch_mutex\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
    82970: 3286:  _dbus_mutex_unlock (connection->dispatch_mutex);
call    0 returned 100%
        -: 3287:  
    82970: 3288:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    82970: 3289:  _dbus_connection_unref_unlocked (connection);
call    0 returned 100%
    82970: 3290:}
        -: 3291:
        -: 3292:/**
        -: 3293: * Release the dispatcher when you're done with it. Only call
        -: 3294: * after you've acquired the dispatcher. Wakes up at most one
        -: 3295: * thread currently waiting to acquire the dispatcher.
        -: 3296: *
        -: 3297: * @param connection the connection.
        -: 3298: */
        -: 3299:static void
        -: 3300:_dbus_connection_release_dispatch (DBusConnection *connection)
function _dbus_connection_release_dispatch called 82970 returned 100% blocks executed 100%
    82970: 3301:{
    82970: 3302:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 3303:  
    82970: 3304:  _dbus_verbose ("%s locking dispatch_mutex\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
    82970: 3305:  _dbus_mutex_lock (connection->dispatch_mutex);
call    0 returned 100%
        -: 3306:  
    82970: 3307:  _dbus_assert (connection->dispatch_acquired);
call    0 returned 100%
        -: 3308:
    82970: 3309:  connection->dispatch_acquired = FALSE;
    82970: 3310:  _dbus_condvar_wake_one (connection->dispatch_cond);
call    0 returned 100%
        -: 3311:
    82970: 3312:  _dbus_verbose ("%s unlocking dispatch_mutex\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
    82970: 3313:  _dbus_mutex_unlock (connection->dispatch_mutex);
call    0 returned 100%
    82970: 3314:}
        -: 3315:
        -: 3316:static void
        -: 3317:_dbus_connection_failed_pop (DBusConnection *connection,
        -: 3318:			     DBusList       *message_link)
function _dbus_connection_failed_pop called 67 returned 100% blocks executed 100%
       67: 3319:{
       67: 3320:  _dbus_list_prepend_link (&connection->incoming_messages,
call    0 returned 100%
        -: 3321:			   message_link);
       67: 3322:  connection->n_incoming += 1;
       67: 3323:}
        -: 3324:
        -: 3325:static DBusDispatchStatus
        -: 3326:_dbus_connection_get_dispatch_status_unlocked (DBusConnection *connection)
function _dbus_connection_get_dispatch_status_unlocked called 900778 returned 100% blocks executed 81%
   900778: 3327:{
   900778: 3328:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 3329:  
   900778: 3330:  if (connection->n_incoming > 0)
branch  0 taken 22% (fallthrough)
branch  1 taken 78%
   202596: 3331:    return DBUS_DISPATCH_DATA_REMAINS;
   698182: 3332:  else if (!_dbus_transport_queue_messages (connection->transport))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
     1998: 3333:    return DBUS_DISPATCH_NEED_MEMORY;
        -: 3334:  else
        -: 3335:    {
        -: 3336:      DBusDispatchStatus status;
        -: 3337:      dbus_bool_t is_connected;
        -: 3338:      
   696184: 3339:      status = _dbus_transport_get_dispatch_status (connection->transport);
call    0 returned 100%
   696184: 3340:      is_connected = _dbus_transport_get_is_connected (connection->transport);
call    0 returned 100%
        -: 3341:
   696184: 3342:      _dbus_verbose ("dispatch status = %s is_connected = %d\n",
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
branch  2 never executed
branch  3 never executed
branch  4 never executed
branch  5 never executed
call    6 returned 100%
        -: 3343:                     DISPATCH_STATUS_NAME (status), is_connected);
        -: 3344:      
   696184: 3345:      if (!is_connected)
branch  0 taken 4% (fallthrough)
branch  1 taken 96%
        -: 3346:        {
    27050: 3347:          if (status == DBUS_DISPATCH_COMPLETE &&
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 51% (fallthrough)
branch  3 taken 49%
        -: 3348:              connection->disconnect_message_link)
        -: 3349:            {
    13837: 3350:              _dbus_verbose ("Sending disconnect message from %s\n",
call    0 returned 100%
        -: 3351:                             _DBUS_FUNCTION_NAME);
        -: 3352:
    13837: 3353:              connection_forget_shared_unlocked (connection);
call    0 returned 100%
        -: 3354:              
        -: 3355:              /* We haven't sent the disconnect message already,
        -: 3356:               * and all real messages have been queued up.
        -: 3357:               */
    13837: 3358:              _dbus_connection_queue_synthesized_message_link (connection,
call    0 returned 100%
        -: 3359:                                                               connection->disconnect_message_link);
    13837: 3360:              connection->disconnect_message_link = NULL;
        -: 3361:
    13837: 3362:              status = DBUS_DISPATCH_DATA_REMAINS;
        -: 3363:            }
        -: 3364:
        -: 3365:          /* Dump the outgoing queue, we aren't going to be able to
        -: 3366:           * send it now, and we'd like accessors like
        -: 3367:           * dbus_connection_get_outgoing_size() to be accurate.
        -: 3368:           */
    27050: 3369:          if (connection->n_outgoing > 0)
branch  0 taken 6% (fallthrough)
branch  1 taken 94%
        -: 3370:            {
        -: 3371:              DBusList *link;
        -: 3372:              
     1661: 3373:              _dbus_verbose ("Dropping %d outgoing messages since we're disconnected\n",
call    0 returned 100%
        -: 3374:                             connection->n_outgoing);
        -: 3375:              
     4983: 3376:              while ((link = _dbus_list_get_last_link (&connection->outgoing_messages)))
call    0 returned 100%
branch  1 taken 50%
branch  2 taken 50% (fallthrough)
        -: 3377:                {
     1661: 3378:                  _dbus_connection_message_sent (connection, link->data);
call    0 returned 100%
        -: 3379:                }
        -: 3380:            }
        -: 3381:        }
        -: 3382:      
   696184: 3383:      if (status != DBUS_DISPATCH_COMPLETE)
branch  0 taken 2% (fallthrough)
branch  1 taken 98%
    13837: 3384:        return status;
   682347: 3385:      else if (connection->n_incoming > 0)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
     7480: 3386:        return DBUS_DISPATCH_DATA_REMAINS;
        -: 3387:      else
   674867: 3388:        return DBUS_DISPATCH_COMPLETE;
        -: 3389:    }
        -: 3390:}
        -: 3391:
        -: 3392:static void
        -: 3393:_dbus_connection_update_dispatch_status_and_unlock (DBusConnection    *connection,
        -: 3394:                                                    DBusDispatchStatus new_status)
function _dbus_connection_update_dispatch_status_and_unlock called 241971 returned 100% blocks executed 95%
   241971: 3395:{
        -: 3396:  dbus_bool_t changed;
        -: 3397:  DBusDispatchStatusFunction function;
        -: 3398:  void *data;
        -: 3399:
   241971: 3400:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 3401:
   241971: 3402:  _dbus_connection_ref_unlocked (connection);
call    0 returned 100%
        -: 3403:
   241971: 3404:  changed = new_status != connection->last_dispatch_status;
        -: 3405:
   241971: 3406:  connection->last_dispatch_status = new_status;
        -: 3407:
   241971: 3408:  function = connection->dispatch_status_function;
   241971: 3409:  data = connection->dispatch_status_data;
        -: 3410:
        -: 3411:  /* We drop the lock */
   241971: 3412:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3413:  
   241971: 3414:  if (changed && function)
branch  0 taken 35% (fallthrough)
branch  1 taken 65%
branch  2 taken 52% (fallthrough)
branch  3 taken 48%
        -: 3415:    {
    44513: 3416:      _dbus_verbose ("Notifying of change to dispatch status of %p now %d (%s)\n",
branch  0 taken 59% (fallthrough)
branch  1 taken 41%
branch  2 taken 1% (fallthrough)
branch  3 taken 99%
branch  4 taken 100% (fallthrough)
branch  5 taken 0%
call    6 returned 100%
        -: 3417:                     connection, new_status,
        -: 3418:                     DISPATCH_STATUS_NAME (new_status));
    44513: 3419:      (* function) (connection, new_status, data);      
call    0 returned 100%
        -: 3420:    }
        -: 3421:  
   241971: 3422:  dbus_connection_unref (connection);
call    0 returned 100%
   241971: 3423:}
        -: 3424:
        -: 3425:/**
        -: 3426: * Gets the current state (what we would currently return
        -: 3427: * from dbus_connection_dispatch()) but doesn't actually
        -: 3428: * dispatch any messages.
        -: 3429: * 
        -: 3430: * @param connection the connection.
        -: 3431: * @returns current dispatch status
        -: 3432: */
        -: 3433:DBusDispatchStatus
        -: 3434:dbus_connection_get_dispatch_status (DBusConnection *connection)
function dbus_connection_get_dispatch_status called 625924 returned 100% blocks executed 80%
   625924: 3435:{
        -: 3436:  DBusDispatchStatus status;
        -: 3437:
   625924: 3438:  _dbus_return_val_if_fail (connection != NULL, DBUS_DISPATCH_COMPLETE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 3439:
   625924: 3440:  _dbus_verbose ("%s start\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
        -: 3441:  
   625924: 3442:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3443:
   625924: 3444:  status = _dbus_connection_get_dispatch_status_unlocked (connection);
call    0 returned 100%
        -: 3445:  
   625924: 3446:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3447:
   625924: 3448:  return status;
        -: 3449:}
        -: 3450:
        -: 3451:/**
        -: 3452:* Filter funtion for handling the Peer standard interface
        -: 3453:**/
        -: 3454:static DBusHandlerResult
        -: 3455:_dbus_connection_peer_filter_unlocked_no_update (DBusConnection *connection,
        -: 3456:                                                 DBusMessage    *message)
function _dbus_connection_peer_filter_unlocked_no_update called 31603 returned 100% blocks executed 83%
    31603: 3457:{
    31603: 3458:  if (dbus_message_is_method_call (message,
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 3459:                                   DBUS_INTERFACE_PEER,
        -: 3460:                                   "Ping"))
        -: 3461:    {
        -: 3462:      DBusMessage *ret;
        -: 3463:      dbus_bool_t sent;
        -: 3464:      
        1: 3465:      ret = dbus_message_new_method_return (message);
call    0 returned 100%
        1: 3466:      if (ret == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3467:        return DBUS_HANDLER_RESULT_NEED_MEMORY;
        -: 3468:     
        1: 3469:      sent = _dbus_connection_send_unlocked_no_update (connection, ret, NULL);
call    0 returned 100%
        -: 3470:
        1: 3471:      dbus_message_unref (ret);
call    0 returned 100%
        -: 3472:
        1: 3473:      if (!sent)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3474:        return DBUS_HANDLER_RESULT_NEED_MEMORY;
        -: 3475:      
        1: 3476:      return DBUS_HANDLER_RESULT_HANDLED;
        -: 3477:    }
        -: 3478:                                   
        -: 3479:  
    31602: 3480:  return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
        -: 3481:}
        -: 3482:
        -: 3483:/**
        -: 3484:* Processes all builtin filter functions
        -: 3485:*
        -: 3486:* If the spec specifies a standard interface
        -: 3487:* they should be processed from this method
        -: 3488:**/
        -: 3489:static DBusHandlerResult
        -: 3490:_dbus_connection_run_builtin_filters_unlocked_no_update (DBusConnection *connection,
        -: 3491:                                                           DBusMessage    *message)
function _dbus_connection_run_builtin_filters_unlocked_no_update called 31603 returned 100% blocks executed 100%
    31603: 3492:{
        -: 3493:  /* We just run one filter for now but have the option to run more
        -: 3494:     if the spec calls for it in the future */
        -: 3495:
    31603: 3496:  return _dbus_connection_peer_filter_unlocked_no_update (connection, message);
call    0 returned 100%
        -: 3497:}
        -: 3498:
        -: 3499:/**
        -: 3500: * Processes data buffered while handling watches, queueing zero or
        -: 3501: * more incoming messages. Then pops the first-received message from
        -: 3502: * the current incoming message queue, runs any handlers for it, and
        -: 3503: * unrefs the message. Returns a status indicating whether messages/data
        -: 3504: * remain, more memory is needed, or all data has been processed.
        -: 3505: * 
        -: 3506: * Even if the dispatch status is #DBUS_DISPATCH_DATA_REMAINS,
        -: 3507: * does not necessarily dispatch a message, as the data may
        -: 3508: * be part of authentication or the like.
        -: 3509: *
        -: 3510: * @todo some FIXME in here about handling DBUS_HANDLER_RESULT_NEED_MEMORY
        -: 3511: *
        -: 3512: * @todo FIXME what if we call out to application code to handle a
        -: 3513: * message, holding the dispatch lock, and the application code runs
        -: 3514: * the main loop and dispatches again? Probably deadlocks at the
        -: 3515: * moment. Maybe we want a dispatch status of DBUS_DISPATCH_IN_PROGRESS,
        -: 3516: * and then the GSource etc. could handle the situation? Right now
        -: 3517: * our GSource is NO_RECURSE
        -: 3518: * 
        -: 3519: * @param connection the connection
        -: 3520: * @returns dispatch status
        -: 3521: */
        -: 3522:DBusDispatchStatus
        -: 3523:dbus_connection_dispatch (DBusConnection *connection)
function dbus_connection_dispatch called 31644 returned 100% blocks executed 46%
    31644: 3524:{
        -: 3525:  DBusMessage *message;
        -: 3526:  DBusList *link, *filter_list_copy, *message_link;
        -: 3527:  DBusHandlerResult result;
        -: 3528:  DBusPendingCall *pending;
        -: 3529:  dbus_int32_t reply_serial;
        -: 3530:  DBusDispatchStatus status;
        -: 3531:
    31644: 3532:  _dbus_return_val_if_fail (connection != NULL, DBUS_DISPATCH_COMPLETE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 3533:
    31644: 3534:  _dbus_verbose ("%s\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
        -: 3535:  
    31644: 3536:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    31644: 3537:  status = _dbus_connection_get_dispatch_status_unlocked (connection);
call    0 returned 100%
    31644: 3538:  if (status != DBUS_DISPATCH_DATA_REMAINS)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
        -: 3539:    {
        -: 3540:      /* unlocks and calls out to user code */
       41: 3541:      _dbus_connection_update_dispatch_status_and_unlock (connection, status);
call    0 returned 100%
       41: 3542:      return status;
        -: 3543:    }
        -: 3544:  
        -: 3545:  /* We need to ref the connection since the callback could potentially
        -: 3546:   * drop the last ref to it
        -: 3547:   */
    31603: 3548:  _dbus_connection_ref_unlocked (connection);
call    0 returned 100%
        -: 3549:
    31603: 3550:  _dbus_connection_acquire_dispatch (connection);
call    0 returned 100%
    31603: 3551:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 3552:
    31603: 3553:  message_link = _dbus_connection_pop_message_link_unlocked (connection);
call    0 returned 100%
    31603: 3554:  if (message_link == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3555:    {
        -: 3556:      /* another thread dispatched our stuff */
        -: 3557:
    #####: 3558:      _dbus_verbose ("another thread dispatched message (during acquire_dispatch above)\n");
call    0 never executed
        -: 3559:      
    #####: 3560:      _dbus_connection_release_dispatch (connection);
call    0 never executed
        -: 3561:
    #####: 3562:      status = _dbus_connection_get_dispatch_status_unlocked (connection);
call    0 never executed
        -: 3563:
    #####: 3564:      _dbus_connection_update_dispatch_status_and_unlock (connection, status);
call    0 never executed
        -: 3565:      
    #####: 3566:      dbus_connection_unref (connection);
call    0 never executed
        -: 3567:      
    #####: 3568:      return status;
        -: 3569:    }
        -: 3570:
    31603: 3571:  message = message_link->data;
        -: 3572:
    31603: 3573:  _dbus_verbose (" dispatching message %p (%d %s %s '%s')\n",
call    0 returned 100%
call    1 returned 100%
branch  2 taken 99% (fallthrough)
branch  3 taken 1%
call    4 returned 100%
call    5 returned 100%
branch  6 taken 99% (fallthrough)
branch  7 taken 1%
call    8 returned 100%
call    9 returned 100%
call   10 returned 100%
        -: 3574:                 message,
        -: 3575:                 dbus_message_get_type (message),
        -: 3576:                 dbus_message_get_interface (message) ?
        -: 3577:                 dbus_message_get_interface (message) :
        -: 3578:                 "no interface",
        -: 3579:                 dbus_message_get_member (message) ?
        -: 3580:                 dbus_message_get_member (message) :
        -: 3581:                 "no member",
        -: 3582:                 dbus_message_get_signature (message));
        -: 3583:
    31603: 3584:  result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
        -: 3585:  
        -: 3586:  /* Pending call handling must be first, because if you do
        -: 3587:   * dbus_connection_send_with_reply_and_block() or
        -: 3588:   * dbus_pending_call_block() then no handlers/filters will be run on
        -: 3589:   * the reply. We want consistent semantics in the case where we
        -: 3590:   * dbus_connection_dispatch() the reply.
        -: 3591:   */
        -: 3592:  
    31603: 3593:  reply_serial = dbus_message_get_reply_serial (message);
call    0 returned 100%
    31603: 3594:  pending = _dbus_hash_table_lookup_int (connection->pending_replies,
call    0 returned 100%
        -: 3595:                                         reply_serial);
    31603: 3596:  if (pending)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3597:    {
    #####: 3598:      _dbus_verbose ("Dispatching a pending reply\n");
call    0 never executed
    #####: 3599:      _dbus_pending_call_complete_and_unlock (pending, message);
call    0 never executed
    #####: 3600:      pending = NULL; /* it's probably unref'd */
        -: 3601:      
    #####: 3602:      CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
    #####: 3603:      _dbus_verbose ("pending call completed in dispatch\n");
call    0 never executed
    #####: 3604:      result = DBUS_HANDLER_RESULT_HANDLED;
    #####: 3605:      goto out;
        -: 3606:    }
        -: 3607:
    31603: 3608:  result = _dbus_connection_run_builtin_filters_unlocked_no_update (connection, message);
call    0 returned 100%
    31603: 3609:  if (result != DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
        1: 3610:    goto out;
        -: 3611: 
    31602: 3612:  if (!_dbus_list_copy (&connection->filter_list, &filter_list_copy))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 3613:    {
       67: 3614:      _dbus_connection_release_dispatch (connection);
call    0 returned 100%
       67: 3615:      HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 3616:      
       67: 3617:      _dbus_connection_failed_pop (connection, message_link);
call    0 returned 100%
        -: 3618:
        -: 3619:      /* unlocks and calls user code */
       67: 3620:      _dbus_connection_update_dispatch_status_and_unlock (connection,
call    0 returned 100%
        -: 3621:                                                          DBUS_DISPATCH_NEED_MEMORY);
        -: 3622:
       67: 3623:      if (pending)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3624:        dbus_pending_call_unref (pending);
call    0 never executed
       67: 3625:      dbus_connection_unref (connection);
call    0 returned 100%
        -: 3626:      
       67: 3627:      return DBUS_DISPATCH_NEED_MEMORY;
        -: 3628:    }
        -: 3629:  
    31535: 3630:  _dbus_list_foreach (&filter_list_copy,
call    0 returned 100%
        -: 3631:		      (DBusForeachFunction)_dbus_message_filter_ref,
        -: 3632:		      NULL);
        -: 3633:
        -: 3634:  /* We're still protected from dispatch() reentrancy here
        -: 3635:   * since we acquired the dispatcher
        -: 3636:   */
    31535: 3637:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3638:  
    31535: 3639:  link = _dbus_list_get_first_link (&filter_list_copy);
call    0 returned 100%
    63070: 3640:  while (link != NULL)
branch  0 taken 100%
branch  1 taken 0% (fallthrough)
        -: 3641:    {
    31535: 3642:      DBusMessageFilter *filter = link->data;
    31535: 3643:      DBusList *next = _dbus_list_get_next_link (&filter_list_copy, link);
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3644:
    31535: 3645:      _dbus_verbose ("  running filter on message %p\n", message);
call    0 returned 100%
    31535: 3646:      result = (* filter->function) (connection, message, filter->user_data);
call    0 returned 100%
        -: 3647:
    31535: 3648:      if (result != DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
    31535: 3649:	break;
        -: 3650:
    #####: 3651:      link = next;
        -: 3652:    }
        -: 3653:
    31535: 3654:  _dbus_list_foreach (&filter_list_copy,
call    0 returned 100%
        -: 3655:		      (DBusForeachFunction)_dbus_message_filter_unref,
        -: 3656:		      NULL);
    31535: 3657:  _dbus_list_clear (&filter_list_copy);
call    0 returned 100%
        -: 3658:  
    31535: 3659:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3660:
    31535: 3661:  if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3662:    {
    #####: 3663:      _dbus_verbose ("No memory in %s\n", _DBUS_FUNCTION_NAME);
call    0 never executed
    #####: 3664:      goto out;
        -: 3665:    }
    31535: 3666:  else if (result == DBUS_HANDLER_RESULT_HANDLED)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -: 3667:    {
    31535: 3668:      _dbus_verbose ("filter handled message in dispatch\n");
call    0 returned 100%
    31535: 3669:      goto out;
        -: 3670:    }
        -: 3671:
        -: 3672:  /* We're still protected from dispatch() reentrancy here
        -: 3673:   * since we acquired the dispatcher
        -: 3674:   */
    #####: 3675:  _dbus_verbose ("  running object path dispatch on message %p (%d %s %s '%s')\n",
call    0 never executed
call    1 never executed
branch  2 never executed
branch  3 never executed
call    4 never executed
call    5 never executed
branch  6 never executed
branch  7 never executed
call    8 never executed
call    9 never executed
call   10 never executed
        -: 3676:                 message,
        -: 3677:                 dbus_message_get_type (message),
        -: 3678:                 dbus_message_get_interface (message) ?
        -: 3679:                 dbus_message_get_interface (message) :
        -: 3680:                 "no interface",
        -: 3681:                 dbus_message_get_member (message) ?
        -: 3682:                 dbus_message_get_member (message) :
        -: 3683:                 "no member",
        -: 3684:                 dbus_message_get_signature (message));
        -: 3685:
    #####: 3686:  HAVE_LOCK_CHECK (connection);
call    0 never executed
    #####: 3687:  result = _dbus_object_tree_dispatch_and_unlock (connection->objects,
call    0 never executed
        -: 3688:                                                  message);
        -: 3689:  
    #####: 3690:  CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
        -: 3691:
    #####: 3692:  if (result != DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
branch  0 never executed
branch  1 never executed
        -: 3693:    {
    #####: 3694:      _dbus_verbose ("object tree handled message in dispatch\n");
call    0 never executed
    #####: 3695:      goto out;
        -: 3696:    }
        -: 3697:
    #####: 3698:  if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_METHOD_CALL)
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 3699:    {
        -: 3700:      DBusMessage *reply;
        -: 3701:      DBusString str;
        -: 3702:      DBusPreallocatedSend *preallocated;
        -: 3703:
    #####: 3704:      _dbus_verbose ("  sending error %s\n",
call    0 never executed
        -: 3705:                     DBUS_ERROR_UNKNOWN_METHOD);
        -: 3706:      
    #####: 3707:      if (!_dbus_string_init (&str))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 3708:        {
    #####: 3709:          result = DBUS_HANDLER_RESULT_NEED_MEMORY;
    #####: 3710:          _dbus_verbose ("no memory for error string in dispatch\n");
call    0 never executed
    #####: 3711:          goto out;
        -: 3712:        }
        -: 3713:              
    #####: 3714:      if (!_dbus_string_append_printf (&str,
call    0 never executed
call    1 never executed
call    2 never executed
call    3 never executed
branch  4 never executed
branch  5 never executed
        -: 3715:                                       "Method \"%s\" with signature \"%s\" on interface \"%s\" doesn't exist\n",
        -: 3716:                                       dbus_message_get_member (message),
        -: 3717:                                       dbus_message_get_signature (message),
        -: 3718:                                       dbus_message_get_interface (message)))
        -: 3719:        {
    #####: 3720:          _dbus_string_free (&str);
call    0 never executed
    #####: 3721:          result = DBUS_HANDLER_RESULT_NEED_MEMORY;
    #####: 3722:          _dbus_verbose ("no memory for error string in dispatch\n");
call    0 never executed
    #####: 3723:          goto out;
        -: 3724:        }
        -: 3725:      
    #####: 3726:      reply = dbus_message_new_error (message,
call    0 never executed
call    1 never executed
        -: 3727:                                      DBUS_ERROR_UNKNOWN_METHOD,
        -: 3728:                                      _dbus_string_get_const_data (&str));
    #####: 3729:      _dbus_string_free (&str);
call    0 never executed
        -: 3730:
    #####: 3731:      if (reply == NULL)
branch  0 never executed
branch  1 never executed
        -: 3732:        {
    #####: 3733:          result = DBUS_HANDLER_RESULT_NEED_MEMORY;
    #####: 3734:          _dbus_verbose ("no memory for error reply in dispatch\n");
call    0 never executed
    #####: 3735:          goto out;
        -: 3736:        }
        -: 3737:      
    #####: 3738:      preallocated = _dbus_connection_preallocate_send_unlocked (connection);
call    0 never executed
        -: 3739:
    #####: 3740:      if (preallocated == NULL)
branch  0 never executed
branch  1 never executed
        -: 3741:        {
    #####: 3742:          dbus_message_unref (reply);
call    0 never executed
    #####: 3743:          result = DBUS_HANDLER_RESULT_NEED_MEMORY;
    #####: 3744:          _dbus_verbose ("no memory for error send in dispatch\n");
call    0 never executed
    #####: 3745:          goto out;
        -: 3746:        }
        -: 3747:
    #####: 3748:      _dbus_connection_send_preallocated_unlocked_no_update (connection, preallocated,
call    0 never executed
        -: 3749:                                                             reply, NULL);
        -: 3750:
    #####: 3751:      dbus_message_unref (reply);
call    0 never executed
        -: 3752:      
    #####: 3753:      result = DBUS_HANDLER_RESULT_HANDLED;
        -: 3754:    }
        -: 3755:  
    #####: 3756:  _dbus_verbose ("  done dispatching %p (%d %s %s '%s') on connection %p\n", message,
call    0 never executed
call    1 never executed
branch  2 never executed
branch  3 never executed
call    4 never executed
call    5 never executed
branch  6 never executed
branch  7 never executed
call    8 never executed
call    9 never executed
call   10 never executed
        -: 3757:                 dbus_message_get_type (message),
        -: 3758:                 dbus_message_get_interface (message) ?
        -: 3759:                 dbus_message_get_interface (message) :
        -: 3760:                 "no interface",
        -: 3761:                 dbus_message_get_member (message) ?
        -: 3762:                 dbus_message_get_member (message) :
        -: 3763:                 "no member",
        -: 3764:                 dbus_message_get_signature (message),
        -: 3765:                 connection);
        -: 3766:  
    31536: 3767: out:
    31536: 3768:  if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3769:    {
    #####: 3770:      _dbus_verbose ("out of memory in %s\n", _DBUS_FUNCTION_NAME);
call    0 never executed
        -: 3771:      
        -: 3772:      /* Put message back, and we'll start over.
        -: 3773:       * Yes this means handlers must be idempotent if they
        -: 3774:       * don't return HANDLED; c'est la vie.
        -: 3775:       */
    #####: 3776:      _dbus_connection_putback_message_link_unlocked (connection,
call    0 never executed
        -: 3777:                                                      message_link);
        -: 3778:    }
        -: 3779:  else
        -: 3780:    {
    31536: 3781:      _dbus_verbose (" ... done dispatching in %s\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
        -: 3782:      
    31536: 3783:      if (connection->exit_on_disconnect &&
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
call    2 never executed
branch  3 never executed
branch  4 never executed
        -: 3784:          dbus_message_is_signal (message,
        -: 3785:                                  DBUS_INTERFACE_LOCAL,
        -: 3786:                                  "Disconnected"))
        -: 3787:        {
    #####: 3788:          _dbus_verbose ("Exiting on Disconnected signal\n");
call    0 never executed
    #####: 3789:          CONNECTION_UNLOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
    #####: 3790:          _dbus_exit (1);
call    0 never executed
        -: 3791:          _dbus_assert_not_reached ("Call to exit() returned");
        -: 3792:        }
        -: 3793:      
    31536: 3794:      _dbus_list_free_link (message_link);
call    0 returned 100%
    31536: 3795:      dbus_message_unref (message); /* don't want the message to count in max message limits
call    0 returned 100%
        -: 3796:                                     * in computing dispatch status below
        -: 3797:                                     */
        -: 3798:    }
        -: 3799:  
    31536: 3800:  _dbus_connection_release_dispatch (connection);
call    0 returned 100%
    31536: 3801:  HAVE_LOCK_CHECK (connection);
call    0 returned 100%
        -: 3802:
    31536: 3803:  _dbus_verbose ("%s before final status update\n", _DBUS_FUNCTION_NAME);
call    0 returned 100%
    31536: 3804:  status = _dbus_connection_get_dispatch_status_unlocked (connection);
call    0 returned 100%
        -: 3805:
        -: 3806:  /* unlocks and calls user code */
    31536: 3807:  _dbus_connection_update_dispatch_status_and_unlock (connection, status);
call    0 returned 100%
        -: 3808:  
    31536: 3809:  dbus_connection_unref (connection);
call    0 returned 100%
        -: 3810:  
    31536: 3811:  return status;
        -: 3812:}
        -: 3813:
        -: 3814:/**
        -: 3815: * Sets the watch functions for the connection. These functions are
        -: 3816: * responsible for making the application's main loop aware of file
        -: 3817: * descriptors that need to be monitored for events, using select() or
        -: 3818: * poll(). When using Qt, typically the DBusAddWatchFunction would
        -: 3819: * create a QSocketNotifier. When using GLib, the DBusAddWatchFunction
        -: 3820: * could call g_io_add_watch(), or could be used as part of a more
        -: 3821: * elaborate GSource. Note that when a watch is added, it may
        -: 3822: * not be enabled.
        -: 3823: *
        -: 3824: * The DBusWatchToggledFunction notifies the application that the
        -: 3825: * watch has been enabled or disabled. Call dbus_watch_get_enabled()
        -: 3826: * to check this. A disabled watch should have no effect, and enabled
        -: 3827: * watch should be added to the main loop. This feature is used
        -: 3828: * instead of simply adding/removing the watch because
        -: 3829: * enabling/disabling can be done without memory allocation.  The
        -: 3830: * toggled function may be NULL if a main loop re-queries
        -: 3831: * dbus_watch_get_enabled() every time anyway.
        -: 3832: * 
        -: 3833: * The DBusWatch can be queried for the file descriptor to watch using
        -: 3834: * dbus_watch_get_fd(), and for the events to watch for using
        -: 3835: * dbus_watch_get_flags(). The flags returned by
        -: 3836: * dbus_watch_get_flags() will only contain DBUS_WATCH_READABLE and
        -: 3837: * DBUS_WATCH_WRITABLE, never DBUS_WATCH_HANGUP or DBUS_WATCH_ERROR;
        -: 3838: * all watches implicitly include a watch for hangups, errors, and
        -: 3839: * other exceptional conditions.
        -: 3840: *
        -: 3841: * Once a file descriptor becomes readable or writable, or an exception
        -: 3842: * occurs, dbus_watch_handle() should be called to
        -: 3843: * notify the connection of the file descriptor's condition.
        -: 3844: *
        -: 3845: * dbus_watch_handle() cannot be called during the
        -: 3846: * DBusAddWatchFunction, as the connection will not be ready to handle
        -: 3847: * that watch yet.
        -: 3848: * 
        -: 3849: * It is not allowed to reference a DBusWatch after it has been passed
        -: 3850: * to remove_function.
        -: 3851: *
        -: 3852: * If #FALSE is returned due to lack of memory, the failure may be due
        -: 3853: * to a #FALSE return from the new add_function. If so, the
        -: 3854: * add_function may have been called successfully one or more times,
        -: 3855: * but the remove_function will also have been called to remove any
        -: 3856: * successful adds. i.e. if #FALSE is returned the net result
        -: 3857: * should be that dbus_connection_set_watch_functions() has no effect,
        -: 3858: * but the add_function and remove_function may have been called.
        -: 3859: *
        -: 3860: * @todo We need to drop the lock when we call the
        -: 3861: * add/remove/toggled functions which can be a side effect
        -: 3862: * of setting the watch functions.
        -: 3863: * 
        -: 3864: * @param connection the connection.
        -: 3865: * @param add_function function to begin monitoring a new descriptor.
        -: 3866: * @param remove_function function to stop monitoring a descriptor.
        -: 3867: * @param toggled_function function to notify of enable/disable
        -: 3868: * @param data data to pass to add_function and remove_function.
        -: 3869: * @param free_data_function function to be called to free the data.
        -: 3870: * @returns #FALSE on failure (no memory)
        -: 3871: */
        -: 3872:dbus_bool_t
        -: 3873:dbus_connection_set_watch_functions (DBusConnection              *connection,
        -: 3874:                                     DBusAddWatchFunction         add_function,
        -: 3875:                                     DBusRemoveWatchFunction      remove_function,
        -: 3876:                                     DBusWatchToggledFunction     toggled_function,
        -: 3877:                                     void                        *data,
        -: 3878:                                     DBusFreeFunction             free_data_function)
function dbus_connection_set_watch_functions called 21631 returned 100% blocks executed 80%
    21631: 3879:{
        -: 3880:  dbus_bool_t retval;
        -: 3881:  DBusWatchList *watches;
        -: 3882:
    21631: 3883:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 3884:  
    21631: 3885:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3886:
        -: 3887:#ifndef DBUS_DISABLE_CHECKS
    21631: 3888:  if (connection->watches == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3889:    {
    #####: 3890:      _dbus_warn ("Re-entrant call to %s is not allowed\n",
call    0 never executed
        -: 3891:                  _DBUS_FUNCTION_NAME);
    #####: 3892:      return FALSE;
        -: 3893:    }
        -: 3894:#endif
        -: 3895:  
        -: 3896:  /* ref connection for slightly better reentrancy */
    21631: 3897:  _dbus_connection_ref_unlocked (connection);
call    0 returned 100%
        -: 3898:
        -: 3899:  /* This can call back into user code, and we need to drop the
        -: 3900:   * connection lock when it does. This is kind of a lame
        -: 3901:   * way to do it.
        -: 3902:   */
    21631: 3903:  watches = connection->watches;
    21631: 3904:  connection->watches = NULL;
    21631: 3905:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3906:
    21631: 3907:  retval = _dbus_watch_list_set_functions (watches,
call    0 returned 100%
        -: 3908:                                           add_function, remove_function,
        -: 3909:                                           toggled_function,
        -: 3910:                                           data, free_data_function);
    21631: 3911:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    21631: 3912:  connection->watches = watches;
        -: 3913:  
    21631: 3914:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3915:  /* drop our paranoid refcount */
    21631: 3916:  dbus_connection_unref (connection);
call    0 returned 100%
        -: 3917:  
    21631: 3918:  return retval;
        -: 3919:}
        -: 3920:
        -: 3921:/**
        -: 3922: * Sets the timeout functions for the connection. These functions are
        -: 3923: * responsible for making the application's main loop aware of timeouts.
        -: 3924: * When using Qt, typically the DBusAddTimeoutFunction would create a
        -: 3925: * QTimer. When using GLib, the DBusAddTimeoutFunction would call
        -: 3926: * g_timeout_add.
        -: 3927: * 
        -: 3928: * The DBusTimeoutToggledFunction notifies the application that the
        -: 3929: * timeout has been enabled or disabled. Call
        -: 3930: * dbus_timeout_get_enabled() to check this. A disabled timeout should
        -: 3931: * have no effect, and enabled timeout should be added to the main
        -: 3932: * loop. This feature is used instead of simply adding/removing the
        -: 3933: * timeout because enabling/disabling can be done without memory
        -: 3934: * allocation. With Qt, QTimer::start() and QTimer::stop() can be used
        -: 3935: * to enable and disable. The toggled function may be NULL if a main
        -: 3936: * loop re-queries dbus_timeout_get_enabled() every time anyway.
        -: 3937: * Whenever a timeout is toggled, its interval may change.
        -: 3938: *
        -: 3939: * The DBusTimeout can be queried for the timer interval using
        -: 3940: * dbus_timeout_get_interval(). dbus_timeout_handle() should be called
        -: 3941: * repeatedly, each time the interval elapses, starting after it has
        -: 3942: * elapsed once. The timeout stops firing when it is removed with the
        -: 3943: * given remove_function.  The timer interval may change whenever the
        -: 3944: * timeout is added, removed, or toggled.
        -: 3945: *
        -: 3946: * @param connection the connection.
        -: 3947: * @param add_function function to add a timeout.
        -: 3948: * @param remove_function function to remove a timeout.
        -: 3949: * @param toggled_function function to notify of enable/disable
        -: 3950: * @param data data to pass to add_function and remove_function.
        -: 3951: * @param free_data_function function to be called to free the data.
        -: 3952: * @returns #FALSE on failure (no memory)
        -: 3953: */
        -: 3954:dbus_bool_t
        -: 3955:dbus_connection_set_timeout_functions   (DBusConnection            *connection,
        -: 3956:					 DBusAddTimeoutFunction     add_function,
        -: 3957:					 DBusRemoveTimeoutFunction  remove_function,
        -: 3958:                                         DBusTimeoutToggledFunction toggled_function,
        -: 3959:					 void                      *data,
        -: 3960:					 DBusFreeFunction           free_data_function)
function dbus_connection_set_timeout_functions called 21571 returned 100% blocks executed 80%
    21571: 3961:{
        -: 3962:  dbus_bool_t retval;
        -: 3963:  DBusTimeoutList *timeouts;
        -: 3964:
    21571: 3965:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 3966:  
    21571: 3967:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3968:
        -: 3969:#ifndef DBUS_DISABLE_CHECKS
    21571: 3970:  if (connection->timeouts == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3971:    {
    #####: 3972:      _dbus_warn ("Re-entrant call to %s is not allowed\n",
call    0 never executed
        -: 3973:                  _DBUS_FUNCTION_NAME);
    #####: 3974:      return FALSE;
        -: 3975:    }
        -: 3976:#endif
        -: 3977:  
        -: 3978:  /* ref connection for slightly better reentrancy */
    21571: 3979:  _dbus_connection_ref_unlocked (connection);
call    0 returned 100%
        -: 3980:
    21571: 3981:  timeouts = connection->timeouts;
    21571: 3982:  connection->timeouts = NULL;
    21571: 3983:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3984:  
    21571: 3985:  retval = _dbus_timeout_list_set_functions (timeouts,
call    0 returned 100%
        -: 3986:                                             add_function, remove_function,
        -: 3987:                                             toggled_function,
        -: 3988:                                             data, free_data_function);
    21571: 3989:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    21571: 3990:  connection->timeouts = timeouts;
        -: 3991:  
    21571: 3992:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 3993:  /* drop our paranoid refcount */
    21571: 3994:  dbus_connection_unref (connection);
call    0 returned 100%
        -: 3995:
    21571: 3996:  return retval;
        -: 3997:}
        -: 3998:
        -: 3999:/**
        -: 4000: * Sets the mainloop wakeup function for the connection. This function is
        -: 4001: * responsible for waking up the main loop (if its sleeping) when some some
        -: 4002: * change has happened to the connection that the mainloop needs to reconsider
        -: 4003: * (e.g. a message has been queued for writing).
        -: 4004: * When using Qt, this typically results in a call to QEventLoop::wakeUp().
        -: 4005: * When using GLib, it would call g_main_context_wakeup().
        -: 4006: *
        -: 4007: *
        -: 4008: * @param connection the connection.
        -: 4009: * @param wakeup_main_function function to wake up the mainloop
        -: 4010: * @param data data to pass wakeup_main_function
        -: 4011: * @param free_data_function function to be called to free the data.
        -: 4012: */
        -: 4013:void
        -: 4014:dbus_connection_set_wakeup_main_function (DBusConnection            *connection,
        -: 4015:					  DBusWakeupMainFunction     wakeup_main_function,
        -: 4016:					  void                      *data,
        -: 4017:					  DBusFreeFunction           free_data_function)
function dbus_connection_set_wakeup_main_function called 13837 returned 100% blocks executed 77%
    13837: 4018:{
        -: 4019:  void *old_data;
        -: 4020:  DBusFreeFunction old_free_data;
        -: 4021:
    13837: 4022:  _dbus_return_if_fail (connection != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4023:  
    13837: 4024:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    13837: 4025:  old_data = connection->wakeup_main_data;
    13837: 4026:  old_free_data = connection->free_wakeup_main_data;
        -: 4027:
    13837: 4028:  connection->wakeup_main_function = wakeup_main_function;
    13837: 4029:  connection->wakeup_main_data = data;
    13837: 4030:  connection->free_wakeup_main_data = free_data_function;
        -: 4031:  
    13837: 4032:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4033:
        -: 4034:  /* Callback outside the lock */
    13837: 4035:  if (old_free_data)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 4036:    (*old_free_data) (old_data);
call    0 never executed
        -: 4037:}
        -: 4038:
        -: 4039:/**
        -: 4040: * Set a function to be invoked when the dispatch status changes.
        -: 4041: * If the dispatch status is #DBUS_DISPATCH_DATA_REMAINS, then
        -: 4042: * dbus_connection_dispatch() needs to be called to process incoming
        -: 4043: * messages. However, dbus_connection_dispatch() MUST NOT BE CALLED
        -: 4044: * from inside the DBusDispatchStatusFunction. Indeed, almost
        -: 4045: * any reentrancy in this function is a bad idea. Instead,
        -: 4046: * the DBusDispatchStatusFunction should simply save an indication
        -: 4047: * that messages should be dispatched later, when the main loop
        -: 4048: * is re-entered.
        -: 4049: *
        -: 4050: * @param connection the connection
        -: 4051: * @param function function to call on dispatch status changes
        -: 4052: * @param data data for function
        -: 4053: * @param free_data_function free the function data
        -: 4054: */
        -: 4055:void
        -: 4056:dbus_connection_set_dispatch_status_function (DBusConnection             *connection,
        -: 4057:                                              DBusDispatchStatusFunction  function,
        -: 4058:                                              void                       *data,
        -: 4059:                                              DBusFreeFunction            free_data_function)
function dbus_connection_set_dispatch_status_function called 29979 returned 100% blocks executed 77%
    29979: 4060:{
        -: 4061:  void *old_data;
        -: 4062:  DBusFreeFunction old_free_data;
        -: 4063:
    29979: 4064:  _dbus_return_if_fail (connection != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4065:  
    29979: 4066:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    29979: 4067:  old_data = connection->dispatch_status_data;
    29979: 4068:  old_free_data = connection->free_dispatch_status_data;
        -: 4069:
    29979: 4070:  connection->dispatch_status_function = function;
    29979: 4071:  connection->dispatch_status_data = data;
    29979: 4072:  connection->free_dispatch_status_data = free_data_function;
        -: 4073:  
    29979: 4074:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4075:
        -: 4076:  /* Callback outside the lock */
    29979: 4077:  if (old_free_data)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 4078:    (*old_free_data) (old_data);
call    0 never executed
        -: 4079:}
        -: 4080:
        -: 4081:/**
        -: 4082: * Get the UNIX file descriptor of the connection, if any.  This can
        -: 4083: * be used for SELinux access control checks with getpeercon() for
        -: 4084: * example. DO NOT read or write to the file descriptor, or try to
        -: 4085: * select() on it; use DBusWatch for main loop integration. Not all
        -: 4086: * connections will have a file descriptor. So for adding descriptors
        -: 4087: * to the main loop, use dbus_watch_get_fd() and so forth.
        -: 4088: *
        -: 4089: * @param connection the connection
        -: 4090: * @param fd return location for the file descriptor.
        -: 4091: * @returns #TRUE if fd is successfully obtained.
        -: 4092: */
        -: 4093:dbus_bool_t
        -: 4094:dbus_connection_get_unix_fd (DBusConnection *connection,
        -: 4095:                             int            *fd)
function dbus_connection_get_unix_fd called 1 returned 100% blocks executed 68%
        1: 4096:{
        -: 4097:  dbus_bool_t retval;
        -: 4098:
        1: 4099:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        1: 4100:  _dbus_return_val_if_fail (connection->transport != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4101:  
        1: 4102:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4103:  
        1: 4104:  retval = _dbus_transport_get_unix_fd (connection->transport,
call    0 returned 100%
        -: 4105:                                        fd);
        -: 4106:
        1: 4107:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4108:
        1: 4109:  return retval;
        -: 4110:}
        -: 4111:
        -: 4112:/**
        -: 4113: * Gets the UNIX user ID of the connection if any.
        -: 4114: * Returns #TRUE if the uid is filled in.
        -: 4115: * Always returns #FALSE on non-UNIX platforms.
        -: 4116: * Always returns #FALSE prior to authenticating the
        -: 4117: * connection.
        -: 4118: *
        -: 4119: * @param connection the connection
        -: 4120: * @param uid return location for the user ID
        -: 4121: * @returns #TRUE if uid is filled in with a valid user ID
        -: 4122: */
        -: 4123:dbus_bool_t
        -: 4124:dbus_connection_get_unix_user (DBusConnection *connection,
        -: 4125:                               unsigned long  *uid)
function dbus_connection_get_unix_user called 24494 returned 100% blocks executed 70%
    24494: 4126:{
        -: 4127:  dbus_bool_t result;
        -: 4128:
    24494: 4129:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
    24494: 4130:  _dbus_return_val_if_fail (uid != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4131:  
    24494: 4132:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4133:
    24494: 4134:  if (!_dbus_transport_get_is_authenticated (connection->transport))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 4135:    result = FALSE;
        -: 4136:  else
    24494: 4137:    result = _dbus_transport_get_unix_user (connection->transport,
call    0 returned 100%
        -: 4138:                                            uid);
    24494: 4139:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4140:
    24494: 4141:  return result;
        -: 4142:}
        -: 4143:
        -: 4144:/**
        -: 4145: * Gets the process ID of the connection if any.
        -: 4146: * Returns #TRUE if the uid is filled in.
        -: 4147: * Always returns #FALSE prior to authenticating the
        -: 4148: * connection.
        -: 4149: *
        -: 4150: * @param connection the connection
        -: 4151: * @param pid return location for the process ID
        -: 4152: * @returns #TRUE if uid is filled in with a valid process ID
        -: 4153: */
        -: 4154:dbus_bool_t
        -: 4155:dbus_connection_get_unix_process_id (DBusConnection *connection,
        -: 4156:				     unsigned long  *pid)
function dbus_connection_get_unix_process_id called 3 returned 100% blocks executed 70%
        3: 4157:{
        -: 4158:  dbus_bool_t result;
        -: 4159:
        3: 4160:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        3: 4161:  _dbus_return_val_if_fail (pid != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4162:  
        3: 4163:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4164:
        3: 4165:  if (!_dbus_transport_get_is_authenticated (connection->transport))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 4166:    result = FALSE;
        -: 4167:  else
        3: 4168:    result = _dbus_transport_get_unix_process_id (connection->transport,
call    0 returned 100%
        -: 4169:						  pid);
        3: 4170:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4171:
        3: 4172:  return result;
        -: 4173:}
        -: 4174:
        -: 4175:/**
        -: 4176: * Sets a predicate function used to determine whether a given user ID
        -: 4177: * is allowed to connect. When an incoming connection has
        -: 4178: * authenticated with a particular user ID, this function is called;
        -: 4179: * if it returns #TRUE, the connection is allowed to proceed,
        -: 4180: * otherwise the connection is disconnected.
        -: 4181: *
        -: 4182: * If the function is set to #NULL (as it is by default), then
        -: 4183: * only the same UID as the server process will be allowed to
        -: 4184: * connect.
        -: 4185: *
        -: 4186: * @param connection the connection
        -: 4187: * @param function the predicate
        -: 4188: * @param data data to pass to the predicate
        -: 4189: * @param free_data_function function to free the data
        -: 4190: */
        -: 4191:void
        -: 4192:dbus_connection_set_unix_user_function (DBusConnection             *connection,
        -: 4193:                                        DBusAllowUnixUserFunction   function,
        -: 4194:                                        void                       *data,
        -: 4195:                                        DBusFreeFunction            free_data_function)
function dbus_connection_set_unix_user_function called 29563 returned 100% blocks executed 79%
    29563: 4196:{
    29563: 4197:  void *old_data = NULL;
    29563: 4198:  DBusFreeFunction old_free_function = NULL;
        -: 4199:
    29563: 4200:  _dbus_return_if_fail (connection != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4201:  
    29563: 4202:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    29563: 4203:  _dbus_transport_set_unix_user_function (connection->transport,
call    0 returned 100%
        -: 4204:                                          function, data, free_data_function,
        -: 4205:                                          &old_data, &old_free_function);
    29563: 4206:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4207:
    29563: 4208:  if (old_free_function != NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 4209:    (* old_free_function) (old_data);    
call    0 never executed
        -: 4210:}
        -: 4211:
        -: 4212:/**
        -: 4213: * Adds a message filter. Filters are handlers that are run on all
        -: 4214: * incoming messages, prior to the objects registered with
        -: 4215: * dbus_connection_register_object_path().  Filters are run in the
        -: 4216: * order that they were added.  The same handler can be added as a
        -: 4217: * filter more than once, in which case it will be run more than once.
        -: 4218: * Filters added during a filter callback won't be run on the message
        -: 4219: * being processed.
        -: 4220: *
        -: 4221: * @todo we don't run filters on messages while blocking without
        -: 4222: * entering the main loop, since filters are run as part of
        -: 4223: * dbus_connection_dispatch(). This is probably a feature, as filters
        -: 4224: * could create arbitrary reentrancy. But kind of sucks if you're
        -: 4225: * trying to filter METHOD_RETURN for some reason.
        -: 4226: *
        -: 4227: * @param connection the connection
        -: 4228: * @param function function to handle messages
        -: 4229: * @param user_data user data to pass to the function
        -: 4230: * @param free_data_function function to use for freeing user data
        -: 4231: * @returns #TRUE on success, #FALSE if not enough memory.
        -: 4232: */
        -: 4233:dbus_bool_t
        -: 4234:dbus_connection_add_filter (DBusConnection            *connection,
        -: 4235:                            DBusHandleMessageFunction  function,
        -: 4236:                            void                      *user_data,
        -: 4237:                            DBusFreeFunction           free_data_function)
function dbus_connection_add_filter called 13672 returned 100% blocks executed 79%
    13672: 4238:{
        -: 4239:  DBusMessageFilter *filter;
        -: 4240:  
    13672: 4241:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
    13672: 4242:  _dbus_return_val_if_fail (function != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4243:
    13672: 4244:  filter = dbus_new0 (DBusMessageFilter, 1);
call    0 returned 100%
    13672: 4245:  if (filter == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
        9: 4246:    return FALSE;
        -: 4247:
    13663: 4248:  filter->refcount.value = 1;
        -: 4249:  
    13663: 4250:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4251:
    13663: 4252:  if (!_dbus_list_append (&connection->filter_list,
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 4253:                          filter))
        -: 4254:    {
       13: 4255:      _dbus_message_filter_unref (filter);
call    0 returned 100%
       13: 4256:      CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
       13: 4257:      return FALSE;
        -: 4258:    }
        -: 4259:
        -: 4260:  /* Fill in filter after all memory allocated,
        -: 4261:   * so we don't run the free_user_data_function
        -: 4262:   * if the add_filter() fails
        -: 4263:   */
        -: 4264:  
    13650: 4265:  filter->function = function;
    13650: 4266:  filter->user_data = user_data;
    13650: 4267:  filter->free_user_data_function = free_data_function;
        -: 4268:        
    13650: 4269:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    13650: 4270:  return TRUE;
        -: 4271:}
        -: 4272:
        -: 4273:/**
        -: 4274: * Removes a previously-added message filter. It is a programming
        -: 4275: * error to call this function for a handler that has not been added
        -: 4276: * as a filter. If the given handler was added more than once, only
        -: 4277: * one instance of it will be removed (the most recently-added
        -: 4278: * instance).
        -: 4279: *
        -: 4280: * @param connection the connection
        -: 4281: * @param function the handler to remove
        -: 4282: * @param user_data user data for the handler to remove
        -: 4283: *
        -: 4284: */
        -: 4285:void
        -: 4286:dbus_connection_remove_filter (DBusConnection            *connection,
        -: 4287:                               DBusHandleMessageFunction  function,
        -: 4288:                               void                      *user_data)
function dbus_connection_remove_filter called 7835 returned 100% blocks executed 66%
     7835: 4289:{
        -: 4290:  DBusList *link;
        -: 4291:  DBusMessageFilter *filter;
        -: 4292:  
     7835: 4293:  _dbus_return_if_fail (connection != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
     7835: 4294:  _dbus_return_if_fail (function != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4295:  
     7835: 4296:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4297:
     7835: 4298:  filter = NULL;
        -: 4299:  
     7835: 4300:  link = _dbus_list_get_last_link (&connection->filter_list);
call    0 returned 100%
    15670: 4301:  while (link != NULL)
branch  0 taken 100%
branch  1 taken 0% (fallthrough)
        -: 4302:    {
     7835: 4303:      filter = link->data;
        -: 4304:
     7835: 4305:      if (filter->function == function &&
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
        -: 4306:          filter->user_data == user_data)
        -: 4307:        {
     7835: 4308:          _dbus_list_remove_link (&connection->filter_list, link);
call    0 returned 100%
     7835: 4309:          filter->function = NULL;
        -: 4310:          
     7835: 4311:          break;
        -: 4312:        }
        -: 4313:        
    #####: 4314:      link = _dbus_list_get_prev_link (&connection->filter_list, link);
branch  0 never executed
branch  1 never executed
        -: 4315:    }
        -: 4316:  
     7835: 4317:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4318:
        -: 4319:#ifndef DBUS_DISABLE_CHECKS
     7835: 4320:  if (filter == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 4321:    {
    #####: 4322:      _dbus_warn ("Attempt to remove filter function %p user data %p, but no such filter has been added\n",
call    0 never executed
        -: 4323:                  function, user_data);
    #####: 4324:      return;
        -: 4325:    }
        -: 4326:#endif
        -: 4327:  
        -: 4328:  /* Call application code */
     7835: 4329:  if (filter->free_user_data_function)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 4330:    (* filter->free_user_data_function) (filter->user_data);
call    0 never executed
        -: 4331:
     7835: 4332:  filter->free_user_data_function = NULL;
     7835: 4333:  filter->user_data = NULL;
        -: 4334:  
     7835: 4335:  _dbus_message_filter_unref (filter);
call    0 returned 100%
        -: 4336:}
        -: 4337:
        -: 4338:/**
        -: 4339: * Registers a handler for a given path in the object hierarchy.
        -: 4340: * The given vtable handles messages sent to exactly the given path.
        -: 4341: *
        -: 4342: *
        -: 4343: * @param connection the connection
        -: 4344: * @param path a '/' delimited string of path elements
        -: 4345: * @param vtable the virtual table
        -: 4346: * @param user_data data to pass to functions in the vtable
        -: 4347: * @returns #FALSE if not enough memory
        -: 4348: */
        -: 4349:dbus_bool_t
        -: 4350:dbus_connection_register_object_path (DBusConnection              *connection,
        -: 4351:                                      const char                  *path,
        -: 4352:                                      const DBusObjectPathVTable  *vtable,
        -: 4353:                                      void                        *user_data)
function dbus_connection_register_object_path called 416 returned 100% blocks executed 62%
      416: 4354:{
        -: 4355:  char **decomposed_path;
        -: 4356:  dbus_bool_t retval;
        -: 4357:  
      416: 4358:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
      416: 4359:  _dbus_return_val_if_fail (path != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
      416: 4360:  _dbus_return_val_if_fail (path[0] == '/', FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
      416: 4361:  _dbus_return_val_if_fail (vtable != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4362:
      416: 4363:  if (!_dbus_decompose_path (path, strlen (path), &decomposed_path, NULL))
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
    #####: 4364:    return FALSE;
        -: 4365:
      416: 4366:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4367:
      416: 4368:  retval = _dbus_object_tree_register (connection->objects,
call    0 returned 100%
        -: 4369:                                       FALSE,
        -: 4370:                                       (const char **) decomposed_path, vtable,
        -: 4371:                                       user_data);
        -: 4372:
      416: 4373:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4374:
      416: 4375:  dbus_free_string_array (decomposed_path);
call    0 returned 100%
        -: 4376:
      416: 4377:  return retval;
        -: 4378:}
        -: 4379:
        -: 4380:/**
        -: 4381: * Registers a fallback handler for a given subsection of the object
        -: 4382: * hierarchy.  The given vtable handles messages at or below the given
        -: 4383: * path. You can use this to establish a default message handling
        -: 4384: * policy for a whole "subdirectory."
        -: 4385: *
        -: 4386: * @param connection the connection
        -: 4387: * @param path a '/' delimited string of path elements
        -: 4388: * @param vtable the virtual table
        -: 4389: * @param user_data data to pass to functions in the vtable
        -: 4390: * @returns #FALSE if not enough memory
        -: 4391: */
        -: 4392:dbus_bool_t
        -: 4393:dbus_connection_register_fallback (DBusConnection              *connection,
        -: 4394:                                   const char                  *path,
        -: 4395:                                   const DBusObjectPathVTable  *vtable,
        -: 4396:                                   void                        *user_data)
function dbus_connection_register_fallback called 0 returned 0% blocks executed 0%
    #####: 4397:{
        -: 4398:  char **decomposed_path;
        -: 4399:  dbus_bool_t retval;
        -: 4400:  
    #####: 4401:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 4402:  _dbus_return_val_if_fail (path != NULL, FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 4403:  _dbus_return_val_if_fail (path[0] == '/', FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 4404:  _dbus_return_val_if_fail (vtable != NULL, FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 4405:
    #####: 4406:  if (!_dbus_decompose_path (path, strlen (path), &decomposed_path, NULL))
call    0 never executed
call    1 never executed
branch  2 never executed
branch  3 never executed
    #####: 4407:    return FALSE;
        -: 4408:
    #####: 4409:  CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
        -: 4410:
    #####: 4411:  retval = _dbus_object_tree_register (connection->objects,
call    0 never executed
        -: 4412:                                       TRUE,
        -: 4413:				       (const char **) decomposed_path, vtable,
        -: 4414:                                       user_data);
        -: 4415:
    #####: 4416:  CONNECTION_UNLOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
        -: 4417:
    #####: 4418:  dbus_free_string_array (decomposed_path);
call    0 never executed
        -: 4419:
    #####: 4420:  return retval;
        -: 4421:}
        -: 4422:
        -: 4423:/**
        -: 4424: * Unregisters the handler registered with exactly the given path.
        -: 4425: * It's a bug to call this function for a path that isn't registered.
        -: 4426: * Can unregister both fallback paths and object paths.
        -: 4427: *
        -: 4428: * @param connection the connection
        -: 4429: * @param path a '/' delimited string of path elements
        -: 4430: * @returns #FALSE if not enough memory
        -: 4431: */
        -: 4432:dbus_bool_t
        -: 4433:dbus_connection_unregister_object_path (DBusConnection              *connection,
        -: 4434:                                        const char                  *path)
function dbus_connection_unregister_object_path called 0 returned 0% blocks executed 0%
    #####: 4435:{
        -: 4436:  char **decomposed_path;
        -: 4437:
    #####: 4438:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 4439:  _dbus_return_val_if_fail (path != NULL, FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 4440:  _dbus_return_val_if_fail (path[0] == '/', FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 4441:
    #####: 4442:  if (!_dbus_decompose_path (path, strlen (path), &decomposed_path, NULL))
call    0 never executed
call    1 never executed
branch  2 never executed
branch  3 never executed
    #####: 4443:      return FALSE;
        -: 4444:
    #####: 4445:  CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
        -: 4446:
    #####: 4447:  _dbus_object_tree_unregister_and_unlock (connection->objects, (const char **) decomposed_path);
call    0 never executed
        -: 4448:
    #####: 4449:  dbus_free_string_array (decomposed_path);
call    0 never executed
        -: 4450:
    #####: 4451:  return TRUE;
        -: 4452:}
        -: 4453:
        -: 4454:/**
        -: 4455: * Gets the user data passed to dbus_connection_register_object_path()
        -: 4456: * or dbus_connection_register_fallback(). If nothing was registered
        -: 4457: * at this path, the data is filled in with #NULL.
        -: 4458: *
        -: 4459: * @param connection the connection
        -: 4460: * @param path the path you registered with
        -: 4461: * @param data_p location to store the user data, or #NULL
        -: 4462: * @returns #FALSE if not enough memory
        -: 4463: */
        -: 4464:dbus_bool_t
        -: 4465:dbus_connection_get_object_path_data (DBusConnection *connection,
        -: 4466:                                      const char     *path,
        -: 4467:                                      void          **data_p)
function dbus_connection_get_object_path_data called 416 returned 100% blocks executed 66%
      416: 4468:{
        -: 4469:  char **decomposed_path;
        -: 4470:
      416: 4471:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
      416: 4472:  _dbus_return_val_if_fail (path != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
      416: 4473:  _dbus_return_val_if_fail (data_p != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4474:
      416: 4475:  *data_p = NULL;
        -: 4476:  
      416: 4477:  if (!_dbus_decompose_path (path, strlen (path), &decomposed_path, NULL))
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
    #####: 4478:    return FALSE;
        -: 4479:  
      416: 4480:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4481:
      416: 4482:  *data_p = _dbus_object_tree_get_user_data_unlocked (connection->objects, (const char**) decomposed_path);
call    0 returned 100%
        -: 4483:
      416: 4484:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4485:
      416: 4486:  dbus_free_string_array (decomposed_path);
call    0 returned 100%
        -: 4487:
      416: 4488:  return TRUE;
        -: 4489:}
        -: 4490:
        -: 4491:/**
        -: 4492: * Lists the registered fallback handlers and object path handlers at
        -: 4493: * the given parent_path. The returned array should be freed with
        -: 4494: * dbus_free_string_array().
        -: 4495: *
        -: 4496: * @param connection the connection
        -: 4497: * @param parent_path the path to list the child handlers of
        -: 4498: * @param child_entries returns #NULL-terminated array of children
        -: 4499: * @returns #FALSE if no memory to allocate the child entries
        -: 4500: */
        -: 4501:dbus_bool_t
        -: 4502:dbus_connection_list_registered (DBusConnection              *connection,
        -: 4503:                                 const char                  *parent_path,
        -: 4504:                                 char                      ***child_entries)
function dbus_connection_list_registered called 0 returned 0% blocks executed 0%
    #####: 4505:{
        -: 4506:  char **decomposed_path;
        -: 4507:  dbus_bool_t retval;
    #####: 4508:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 4509:  _dbus_return_val_if_fail (parent_path != NULL, FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 4510:  _dbus_return_val_if_fail (parent_path[0] == '/', FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
    #####: 4511:  _dbus_return_val_if_fail (child_entries != NULL, FALSE);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 4512:
    #####: 4513:  if (!_dbus_decompose_path (parent_path, strlen (parent_path), &decomposed_path, NULL))
call    0 never executed
call    1 never executed
branch  2 never executed
branch  3 never executed
    #####: 4514:    return FALSE;
        -: 4515:
    #####: 4516:  CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
        -: 4517:
    #####: 4518:  retval = _dbus_object_tree_list_registered_and_unlock (connection->objects,
call    0 never executed
        -: 4519:							 (const char **) decomposed_path,
        -: 4520:							 child_entries);
    #####: 4521:  dbus_free_string_array (decomposed_path);
call    0 never executed
        -: 4522:
    #####: 4523:  return retval;
        -: 4524:}
        -: 4525:
        -: 4526:static DBusDataSlotAllocator slot_allocator;
        -: 4527:_DBUS_DEFINE_GLOBAL_LOCK (connection_slots);
        -: 4528:
        -: 4529:/**
        -: 4530: * Allocates an integer ID to be used for storing application-specific
        -: 4531: * data on any DBusConnection. The allocated ID may then be used
        -: 4532: * with dbus_connection_set_data() and dbus_connection_get_data().
        -: 4533: * The passed-in slot must be initialized to -1, and is filled in
        -: 4534: * with the slot ID. If the passed-in slot is not -1, it's assumed
        -: 4535: * to be already allocated, and its refcount is incremented.
        -: 4536: * 
        -: 4537: * The allocated slot is global, i.e. all DBusConnection objects will
        -: 4538: * have a slot with the given integer ID reserved.
        -: 4539: *
        -: 4540: * @param slot_p address of a global variable storing the slot
        -: 4541: * @returns #FALSE on failure (no memory)
        -: 4542: */
        -: 4543:dbus_bool_t
        -: 4544:dbus_connection_allocate_data_slot (dbus_int32_t *slot_p)
function dbus_connection_allocate_data_slot called 13462 returned 100% blocks executed 100%
    13462: 4545:{
    13462: 4546:  return _dbus_data_slot_allocator_alloc (&slot_allocator,
call    0 returned 100%
        -: 4547:                                          _DBUS_LOCK_NAME (connection_slots),
        -: 4548:                                          slot_p);
        -: 4549:}
        -: 4550:
        -: 4551:/**
        -: 4552: * Deallocates a global ID for connection data slots.
        -: 4553: * dbus_connection_get_data() and dbus_connection_set_data() may no
        -: 4554: * longer be used with this slot.  Existing data stored on existing
        -: 4555: * DBusConnection objects will be freed when the connection is
        -: 4556: * finalized, but may not be retrieved (and may only be replaced if
        -: 4557: * someone else reallocates the slot).  When the refcount on the
        -: 4558: * passed-in slot reaches 0, it is set to -1.
        -: 4559: *
        -: 4560: * @param slot_p address storing the slot to deallocate
        -: 4561: */
        -: 4562:void
        -: 4563:dbus_connection_free_data_slot (dbus_int32_t *slot_p)
function dbus_connection_free_data_slot called 13045 returned 100% blocks executed 67%
    13045: 4564:{
    13045: 4565:  _dbus_return_if_fail (*slot_p >= 0);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4566:  
    13045: 4567:  _dbus_data_slot_allocator_free (&slot_allocator, slot_p);
call    0 returned 100%
        -: 4568:}
        -: 4569:
        -: 4570:/**
        -: 4571: * Stores a pointer on a DBusConnection, along
        -: 4572: * with an optional function to be used for freeing
        -: 4573: * the data when the data is set again, or when
        -: 4574: * the connection is finalized. The slot number
        -: 4575: * must have been allocated with dbus_connection_allocate_data_slot().
        -: 4576: *
        -: 4577: * @param connection the connection
        -: 4578: * @param slot the slot number
        -: 4579: * @param data the data to store
        -: 4580: * @param free_data_func finalizer function for the data
        -: 4581: * @returns #TRUE if there was enough memory to store the data
        -: 4582: */
        -: 4583:dbus_bool_t
        -: 4584:dbus_connection_set_data (DBusConnection   *connection,
        -: 4585:                          dbus_int32_t      slot,
        -: 4586:                          void             *data,
        -: 4587:                          DBusFreeFunction  free_data_func)
function dbus_connection_set_data called 22105 returned 100% blocks executed 73%
    22105: 4588:{
        -: 4589:  DBusFreeFunction old_free_func;
        -: 4590:  void *old_data;
        -: 4591:  dbus_bool_t retval;
        -: 4592:
    22105: 4593:  _dbus_return_val_if_fail (connection != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
    22105: 4594:  _dbus_return_val_if_fail (slot >= 0, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4595:  
    22105: 4596:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4597:
    22105: 4598:  retval = _dbus_data_slot_list_set (&slot_allocator,
call    0 returned 100%
        -: 4599:                                     &connection->slot_list,
        -: 4600:                                     slot, data, free_data_func,
        -: 4601:                                     &old_free_func, &old_data);
        -: 4602:  
    22105: 4603:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4604:
    22105: 4605:  if (retval)
branch  0 taken 99% (fallthrough)
branch  1 taken 1%
        -: 4606:    {
        -: 4607:      /* Do the actual free outside the connection lock */
    22092: 4608:      if (old_free_func)
branch  0 taken 36% (fallthrough)
branch  1 taken 64%
     7884: 4609:        (* old_free_func) (old_data);
call    0 returned 100%
        -: 4610:    }
        -: 4611:
    22105: 4612:  return retval;
        -: 4613:}
        -: 4614:
        -: 4615:/**
        -: 4616: * Retrieves data previously set with dbus_connection_set_data().
        -: 4617: * The slot must still be allocated (must not have been freed).
        -: 4618: *
        -: 4619: * @param connection the connection
        -: 4620: * @param slot the slot to get data from
        -: 4621: * @returns the data, or #NULL if not found
        -: 4622: */
        -: 4623:void*
        -: 4624:dbus_connection_get_data (DBusConnection   *connection,
        -: 4625:                          dbus_int32_t      slot)
function dbus_connection_get_data called 871182 returned 100% blocks executed 79%
   871182: 4626:{
        -: 4627:  void *res;
        -: 4628:
   871182: 4629:  _dbus_return_val_if_fail (connection != NULL, NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4630:  
   871182: 4631:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4632:
   871182: 4633:  res = _dbus_data_slot_list_get (&slot_allocator,
call    0 returned 100%
        -: 4634:                                  &connection->slot_list,
        -: 4635:                                  slot);
        -: 4636:  
   871182: 4637:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4638:
   871182: 4639:  return res;
        -: 4640:}
        -: 4641:
        -: 4642:/**
        -: 4643: * This function sets a global flag for whether dbus_connection_new()
        -: 4644: * will set SIGPIPE behavior to SIG_IGN.
        -: 4645: *
        -: 4646: * @param will_modify_sigpipe #TRUE to allow sigpipe to be set to SIG_IGN
        -: 4647: */
        -: 4648:void
        -: 4649:dbus_connection_set_change_sigpipe (dbus_bool_t will_modify_sigpipe)
function dbus_connection_set_change_sigpipe called 0 returned 0% blocks executed 0%
    #####: 4650:{  
    #####: 4651:  _dbus_modify_sigpipe = will_modify_sigpipe != FALSE;
    #####: 4652:}
        -: 4653:
        -: 4654:/**
        -: 4655: * Specifies the maximum size message this connection is allowed to
        -: 4656: * receive. Larger messages will result in disconnecting the
        -: 4657: * connection.
        -: 4658: * 
        -: 4659: * @param connection a #DBusConnection
        -: 4660: * @param size maximum message size the connection can receive, in bytes
        -: 4661: */
        -: 4662:void
        -: 4663:dbus_connection_set_max_message_size (DBusConnection *connection,
        -: 4664:                                      long            size)
function dbus_connection_set_max_message_size called 7902 returned 100% blocks executed 83%
     7902: 4665:{
     7902: 4666:  _dbus_return_if_fail (connection != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4667:  
     7902: 4668:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
     7902: 4669:  _dbus_transport_set_max_message_size (connection->transport,
call    0 returned 100%
        -: 4670:                                        size);
     7902: 4671:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4672:}
        -: 4673:
        -: 4674:/**
        -: 4675: * Gets the value set by dbus_connection_set_max_message_size().
        -: 4676: *
        -: 4677: * @param connection the connection
        -: 4678: * @returns the max size of a single message
        -: 4679: */
        -: 4680:long
        -: 4681:dbus_connection_get_max_message_size (DBusConnection *connection)
function dbus_connection_get_max_message_size called 0 returned 0% blocks executed 0%
    #####: 4682:{
        -: 4683:  long res;
        -: 4684:
    #####: 4685:  _dbus_return_val_if_fail (connection != NULL, 0);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 4686:  
    #####: 4687:  CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
    #####: 4688:  res = _dbus_transport_get_max_message_size (connection->transport);
call    0 never executed
    #####: 4689:  CONNECTION_UNLOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
    #####: 4690:  return res;
        -: 4691:}
        -: 4692:
        -: 4693:/**
        -: 4694: * Sets the maximum total number of bytes that can be used for all messages
        -: 4695: * received on this connection. Messages count toward the maximum until
        -: 4696: * they are finalized. When the maximum is reached, the connection will
        -: 4697: * not read more data until some messages are finalized.
        -: 4698: *
        -: 4699: * The semantics of the maximum are: if outstanding messages are
        -: 4700: * already above the maximum, additional messages will not be read.
        -: 4701: * The semantics are not: if the next message would cause us to exceed
        -: 4702: * the maximum, we don't read it. The reason is that we don't know the
        -: 4703: * size of a message until after we read it.
        -: 4704: *
        -: 4705: * Thus, the max live messages size can actually be exceeded
        -: 4706: * by up to the maximum size of a single message.
        -: 4707: * 
        -: 4708: * Also, if we read say 1024 bytes off the wire in a single read(),
        -: 4709: * and that contains a half-dozen small messages, we may exceed the
        -: 4710: * size max by that amount. But this should be inconsequential.
        -: 4711: *
        -: 4712: * This does imply that we can't call read() with a buffer larger
        -: 4713: * than we're willing to exceed this limit by.
        -: 4714: *
        -: 4715: * @param connection the connection
        -: 4716: * @param size the maximum size in bytes of all outstanding messages
        -: 4717: */
        -: 4718:void
        -: 4719:dbus_connection_set_max_received_size (DBusConnection *connection,
        -: 4720:                                       long            size)
function dbus_connection_set_max_received_size called 7902 returned 100% blocks executed 83%
     7902: 4721:{
     7902: 4722:  _dbus_return_if_fail (connection != NULL);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4723:  
     7902: 4724:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
     7902: 4725:  _dbus_transport_set_max_received_size (connection->transport,
call    0 returned 100%
        -: 4726:                                         size);
     7902: 4727:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 4728:}
        -: 4729:
        -: 4730:/**
        -: 4731: * Gets the value set by dbus_connection_set_max_received_size().
        -: 4732: *
        -: 4733: * @param connection the connection
        -: 4734: * @returns the max size of all live messages
        -: 4735: */
        -: 4736:long
        -: 4737:dbus_connection_get_max_received_size (DBusConnection *connection)
function dbus_connection_get_max_received_size called 0 returned 0% blocks executed 0%
    #####: 4738:{
        -: 4739:  long res;
        -: 4740:
    #####: 4741:  _dbus_return_val_if_fail (connection != NULL, 0);
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 4742:  
    #####: 4743:  CONNECTION_LOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
    #####: 4744:  res = _dbus_transport_get_max_received_size (connection->transport);
call    0 never executed
    #####: 4745:  CONNECTION_UNLOCK (connection);
call    0 never executed
call    1 never executed
call    2 never executed
    #####: 4746:  return res;
        -: 4747:}
        -: 4748:
        -: 4749:/**
        -: 4750: * Gets the approximate size in bytes of all messages in the outgoing
        -: 4751: * message queue. The size is approximate in that you shouldn't use
        -: 4752: * it to decide how many bytes to read off the network or anything
        -: 4753: * of that nature, as optimizations may choose to tell small white lies
        -: 4754: * to avoid performance overhead.
        -: 4755: *
        -: 4756: * @param connection the connection
        -: 4757: * @returns the number of bytes that have been queued up but not sent
        -: 4758: */
        -: 4759:long
        -: 4760:dbus_connection_get_outgoing_size (DBusConnection *connection)
function dbus_connection_get_outgoing_size called 66265 returned 100% blocks executed 79%
    66265: 4761:{
        -: 4762:  long res;
        -: 4763:
    66265: 4764:  _dbus_return_val_if_fail (connection != NULL, 0);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        -: 4765:  
    66265: 4766:  CONNECTION_LOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    66265: 4767:  res = _dbus_counter_get_value (connection->outgoing_counter);
call    0 returned 100%
    66265: 4768:  CONNECTION_UNLOCK (connection);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
    66265: 4769:  return res;
        -: 4770:}
        -: 4771:
        -: 4772:/** @} */