Commit d8155bf5 authored by Havoc Pennington's avatar Havoc Pennington

2006-09-30 Havoc Pennington <hp@redhat.com>

	* configure.in (LT_CURRENT, LT_AGE): increment current and age to
	reflect addition of interfaces.

	* doc/dbus-specification.xml: describe a new
	org.freedesktop.DBus.Peer.GetMachineId method

	* dbus/dbus-string.c (_dbus_string_skip_white_reverse): new function
	(_dbus_string_skip_white, _dbus_string_skip_blank): use new
	DBUS_IS_ASCII_BLANK, DBUS_IS_ASCII_WHITE macros and fix assertion
	at end of skip_white
	(_dbus_string_chop_white): new function

	* bus/connection.c (bus_connections_setup_connection): call
	dbus_connection_set_route_peer_messages.

	* dbus/dbus-connection.c
	(_dbus_connection_peer_filter_unlocked_no_update): modify to
	support a GetMachineId method.

	Also, support a new flag to let the bus pass peer methods through
	to apps on the bus, which can be set with
	dbus_connection_set_route_peer_messages.

	Finally, handle and return an error for anything unknown on the
	Peer interface, which will allow us to extend the Peer interface
	in the future without fear that we're now intercepting something
	apps were wanting to see.

	* tools/dbus-uuidgen.c: a thin wrapper around the functions in
	dbus/dbus-uuidgen.c

	* dbus/dbus-uuidgen.c: implement the bulk of the dbus-uuidgen
	binary here, since most of the code is already in libdbus

	* dbus/dbus-sysdeps.c (_dbus_read_local_machine_uuid): read the
	uuid from the system config file

	* dbus/dbus-internals.c (_dbus_generate_uuid, _dbus_uuid_encode)
	(_dbus_read_uuid_file_without_creating)
	(_dbus_create_uuid_file_exclusively, _dbus_read_uuid_file): new
	uuid-related functions, partly factored out from dbus-server.c

	* dbus/dbus-sysdeps.c (_dbus_error_from_errno): convert EEXIST to
	DBUS_ERROR_FILE_EXISTS instead of EEXIST

	* dbus/dbus-protocol.h (DBUS_ERROR_FILE_EXISTS): add file exists error

	* tools/dbus-cleanup-sockets.1: explain what the point of this
	thing is a bit more

	* autogen.sh (run_configure): add --config-cache to default
	configure args

	* dbus/dbus-internals.h (_DBUS_ASSERT_ERROR_IS_SET): disable the
	error set/clear assertions when DBUS_DISABLE_CHECKS is defined

	* tools/dbus-launch.c (main): if xdisplay hasn't been opened,
	don't try to save address, fixes crash in make check
parent f6fa0104
2006-09-30 Havoc Pennington <hp@redhat.com>
* configure.in (LT_CURRENT, LT_AGE): increment current and age to
reflect addition of interfaces.
* doc/dbus-specification.xml: describe a new
org.freedesktop.DBus.Peer.GetMachineId method
* dbus/dbus-string.c (_dbus_string_skip_white_reverse): new function
(_dbus_string_skip_white, _dbus_string_skip_blank): use new
DBUS_IS_ASCII_BLANK, DBUS_IS_ASCII_WHITE macros and fix assertion
at end of skip_white
(_dbus_string_chop_white): new function
* bus/connection.c (bus_connections_setup_connection): call
dbus_connection_set_route_peer_messages.
* dbus/dbus-connection.c
(_dbus_connection_peer_filter_unlocked_no_update): modify to
support a GetMachineId method.
Also, support a new flag to let the bus pass peer methods through
to apps on the bus, which can be set with
dbus_connection_set_route_peer_messages.
Finally, handle and return an error for anything unknown on the
Peer interface, which will allow us to extend the Peer interface
in the future without fear that we're now intercepting something
apps were wanting to see.
* tools/dbus-uuidgen.c: a thin wrapper around the functions in
dbus/dbus-uuidgen.c
* dbus/dbus-uuidgen.c: implement the bulk of the dbus-uuidgen
binary here, since most of the code is already in libdbus
* dbus/dbus-sysdeps.c (_dbus_read_local_machine_uuid): read the
uuid from the system config file
* dbus/dbus-internals.c (_dbus_generate_uuid, _dbus_uuid_encode)
(_dbus_read_uuid_file_without_creating)
(_dbus_create_uuid_file_exclusively, _dbus_read_uuid_file): new
uuid-related functions, partly factored out from dbus-server.c
* dbus/dbus-sysdeps.c (_dbus_error_from_errno): convert EEXIST to
DBUS_ERROR_FILE_EXISTS instead of EEXIST
* dbus/dbus-protocol.h (DBUS_ERROR_FILE_EXISTS): add file exists error
* tools/dbus-cleanup-sockets.1: explain what the point of this
thing is a bit more
* autogen.sh (run_configure): add --config-cache to default
configure args
* dbus/dbus-internals.h (_DBUS_ASSERT_ERROR_IS_SET): disable the
error set/clear assertions when DBUS_DISABLE_CHECKS is defined
* tools/dbus-launch.c (main): if xdisplay hasn't been opened,
don't try to save address, fixes crash in make check
2006-09-30 Thiago Macieira <thiago@kde.org>
* configure.in: add DBUS_BINDIR as a #define to C source code.
......
......@@ -83,7 +83,7 @@ for arg in $*; do
done
if $run_configure; then
$srcdir/configure --enable-maintainer-mode "$@"
$srcdir/configure --enable-maintainer-mode --config-cache "$@"
echo
echo "Now type 'make' to compile $PROJECT."
else
......
......@@ -564,6 +564,8 @@ bus_connections_setup_connection (BusConnections *connections,
return FALSE;
}
dbus_connection_set_route_peer_messages (connection, TRUE);
retval = FALSE;
dbus_error_init (&error);
......
......@@ -2937,6 +2937,87 @@ check_existent_ping (BusContext *context,
return TRUE;
}
/* returns TRUE if the correct thing happens,
* but the correct thing may include OOM errors.
*/
static dbus_bool_t
check_existent_get_machine_id (BusContext *context,
DBusConnection *connection)
{
DBusMessage *message;
dbus_uint32_t serial;
const char *machine_id;
message = dbus_message_new_method_call (EXISTENT_SERVICE_NAME,
"/org/freedesktop/TestSuite",
"org.freedesktop.DBus.Peer",
"GetMachineId");
if (message == NULL)
return TRUE;
if (!dbus_connection_send (connection, message, &serial))
{
dbus_message_unref (message);
return TRUE;
}
dbus_message_unref (message);
message = NULL;
bus_test_run_everything (context);
/* Note: if this test is run in OOM mode, it will block when the bus
* doesn't send a reply due to OOM.
*/
block_connection_until_message_from_bus (context, connection, "reply from running GetMachineId");
message = pop_message_waiting_for_memory (connection);
if (message == NULL)
{
_dbus_warn ("Failed to pop message! Should have been reply from GetMachineId message\n");
return FALSE;
}
if (dbus_message_get_reply_serial (message) != serial)
{
_dbus_warn ("Wrong reply serial\n");
dbus_message_unref (message);
return FALSE;
}
if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_RETURN)
{
_dbus_warn ("Unexpected message return during GetMachineId\n");
dbus_message_unref (message);
return FALSE;
}
machine_id = NULL;
if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &machine_id, DBUS_TYPE_INVALID))
{
_dbus_warn ("Did not get a machine ID in reply to GetMachineId\n");
dbus_message_unref (message);
return FALSE;
}
if (machine_id == NULL || strlen (machine_id) != 32)
{
_dbus_warn ("Machine id looks bogus: '%s'\n", machine_id ? machine_id : "null");
dbus_message_unref (message);
return FALSE;
}
/* We can't check that the machine id is correct because during make check it is
* just made up for each process separately
*/
dbus_message_unref (message);
message = NULL;
return TRUE;
}
/* returns TRUE if the correct thing happens,
* but the correct thing may include OOM errors.
*/
......@@ -3115,6 +3196,9 @@ check_existent_service_auto_start (BusContext *context,
if (!check_existent_ping (context, connection))
goto out;
if (!check_existent_get_machine_id (context, connection))
goto out;
if (!check_existent_hello_from_self (context, connection))
goto out;
......
......@@ -25,7 +25,7 @@ AM_MAINTAINER_MODE
#
## increment if the interface has additions, changes, removals.
LT_CURRENT=4
LT_CURRENT=5
## increment any time the source changes; set to
## 0 if you increment CURRENT
......@@ -34,7 +34,7 @@ LT_REVISION=0
## increment if any interfaces have been added; set to 0
## if any interfaces have been changed or removed. removal has
## precedence over adding, so set to 0 if both happened.
LT_AGE=1
LT_AGE=2
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
......
INCLUDES=-I$(top_builddir) -I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) -DDBUS_COMPILATION
configdir=$(sysconfdir)/dbus-1
INCLUDES=-I$(top_builddir) -I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) -DDBUS_COMPILATION -DDBUS_MACHINE_UUID_FILE=\""$(configdir)/machine-id"\"
dbusincludedir=$(includedir)/dbus-1.0/dbus
dbusarchincludedir=$(libdir)/dbus-1.0/include/dbus
......@@ -80,6 +82,8 @@ DBUS_LIB_SOURCES= \
dbus-transport-socket.h \
dbus-transport-unix.c \
dbus-transport-unix.h \
dbus-uuidgen.c \
dbus-uuidgen.h \
dbus-watch.c \
dbus-watch.h
......
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-connection.c DBusConnection object
*
* Copyright (C) 2002, 2003, 2004, 2005 Red Hat Inc.
* Copyright (C) 2002-2006 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.1
*
......@@ -246,6 +246,8 @@ struct DBusConnection
unsigned int io_path_acquired : 1; /**< Someone has transport io path (can use the transport to read/write messages) */
unsigned int exit_on_disconnect : 1; /**< If #TRUE, exit after handling disconnect signal */
unsigned int route_peer_messages : 1; /**< If #TRUE, if org.freedesktop.DBus.Peer messages have a bus name, don't handle them automatically */
#ifndef DBUS_DISABLE_CHECKS
unsigned int have_connection_lock : 1; /**< Used to check locking */
......@@ -1175,6 +1177,8 @@ _dbus_connection_new_for_transport (DBusTransport *transport)
connection->objects = objects;
connection->exit_on_disconnect = FALSE;
connection->shareable = FALSE;
connection->route_peer_messages = FALSE;
#ifndef DBUS_DISABLE_CHECKS
connection->generation = _dbus_current_generation;
#endif
......@@ -3575,15 +3579,20 @@ dbus_connection_get_dispatch_status (DBusConnection *connection)
}
/**
* Filter funtion for handling the Peer standard interface
**/
* Filter funtion for handling the Peer standard interface.
*/
static DBusHandlerResult
_dbus_connection_peer_filter_unlocked_no_update (DBusConnection *connection,
DBusMessage *message)
{
if (dbus_message_is_method_call (message,
DBUS_INTERFACE_PEER,
"Ping"))
if (connection->route_peer_messages && dbus_message_get_destination (message) != NULL)
{
/* This means we're letting the bus route this message */
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
else if (dbus_message_is_method_call (message,
DBUS_INTERFACE_PEER,
"Ping"))
{
DBusMessage *ret;
dbus_bool_t sent;
......@@ -3601,9 +3610,68 @@ _dbus_connection_peer_filter_unlocked_no_update (DBusConnection *connection,
return DBUS_HANDLER_RESULT_HANDLED;
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
else if (dbus_message_is_method_call (message,
DBUS_INTERFACE_PEER,
"GetMachineId"))
{
DBusMessage *ret;
dbus_bool_t sent;
DBusString uuid;
ret = dbus_message_new_method_return (message);
if (ret == NULL)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
sent = FALSE;
_dbus_string_init (&uuid);
if (_dbus_get_local_machine_uuid_encoded (&uuid))
{
const char *v_STRING = _dbus_string_get_const_data (&uuid);
if (dbus_message_append_args (ret,
DBUS_TYPE_STRING, &v_STRING,
DBUS_TYPE_INVALID))
{
sent = _dbus_connection_send_unlocked_no_update (connection, ret, NULL);
}
}
_dbus_string_free (&uuid);
dbus_message_unref (ret);
if (!sent)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
return DBUS_HANDLER_RESULT_HANDLED;
}
else if (dbus_message_has_interface (message, DBUS_INTERFACE_PEER))
{
/* We need to bounce anything else with this interface, otherwise apps
* could start extending the interface and when we added extensions
* here to DBusConnection we'd break those apps.
*/
DBusMessage *ret;
dbus_bool_t sent;
ret = dbus_message_new_error (message,
DBUS_ERROR_UNKNOWN_METHOD,
"Unknown method invoked on org.freedesktop.DBus.Peer interface");
if (ret == NULL)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
sent = _dbus_connection_send_unlocked_no_update (connection, ret, NULL);
dbus_message_unref (ret);
if (!sent)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
return DBUS_HANDLER_RESULT_HANDLED;
}
else
{
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
}
/**
......@@ -4408,6 +4476,35 @@ dbus_connection_set_unix_user_function (DBusConnection *connection,
(* old_free_function) (old_data);
}
/**
*
* Normally #DBusConnection automatically handles all messages to the
* org.freedesktop.DBus.Peer interface. However, the message bus wants
* to be able to route methods on that interface through the bus and
* to other applications. If routing peer messages is enabled, then
* messages with the org.freedesktop.DBus.Peer interface that also
* have a bus destination name set will not be automatically
* handled by the #DBusConnection and instead will be dispatched
* normally to the application.
*
*
* If a normal application sets this flag, it can break things badly.
* So don't set this unless you are the message bus.
*
* @param connection the connection
* @param value #TRUE to pass through org.freedesktop.DBus.Peer messages with a bus name set
*/
void
dbus_connection_set_route_peer_messages (DBusConnection *connection,
dbus_bool_t value)
{
_dbus_return_if_fail (connection != NULL);
CONNECTION_LOCK (connection);
connection->route_peer_messages = TRUE;
CONNECTION_UNLOCK (connection);
}
/**
* Adds a message filter. Filters are handlers that are run on all
* incoming messages, prior to the objects registered with
......@@ -4968,4 +5065,58 @@ dbus_connection_get_outgoing_size (DBusConnection *connection)
return res;
}
/**
* Obtains the machine UUID of the machine this process is running on.
*
* The returned string must be freed with dbus_free().
*
* This UUID is guaranteed to remain the same until the next reboot
* (unless the sysadmin foolishly changes it and screws themselves).
* It will usually remain the same across reboots also, but hardware
* configuration changes or rebuilding the machine could break that.
*
* The idea is that two processes with the same machine ID should be
* able to use shared memory, UNIX domain sockets, process IDs, and other
* features of the OS that require both processes to be running
* on the same OS kernel instance.
*
* The machine ID can also be used to create unique per-machine
* instances. For example, you could use it in bus names or
* X selection names.
*
* The machine ID is preferred over the machine hostname, because
* the hostname is frequently set to "localhost.localdomain" and
* may also change at runtime.
*
* You can get the machine ID of a remote application by invoking the
* method GetMachineId from interface org.freedesktop.DBus.Peer.
*
* If the remote application has the same machine ID as the one
* returned by this function, then the remote application is on the
* same machine as your application.
*
* @returns a 32-byte-long hex-encoded UUID string, or #NULL if insufficient memory
*/
char*
dbus_get_local_machine_id (void)
{
DBusString uuid;
char *s;
s = NULL;
_dbus_string_init (&uuid);
if (!_dbus_get_local_machine_uuid_encoded (&uuid) ||
!_dbus_string_steal_data (&uuid, &s))
{
_dbus_string_free (&uuid);
return FALSE;
}
else
{
_dbus_string_free (&uuid);
return s;
}
}
/** @} */
......@@ -151,6 +151,8 @@ void dbus_connection_set_unix_user_function (DBusConnection
DBusAllowUnixUserFunction function,
void *data,
DBusFreeFunction free_data_function);
void dbus_connection_set_route_peer_messages (DBusConnection *connection,
dbus_bool_t value);
int dbus_watch_get_fd (DBusWatch *watch);
......@@ -258,6 +260,8 @@ dbus_bool_t dbus_connection_get_unix_fd (DBusConnection
dbus_bool_t dbus_connection_get_socket (DBusConnection *connection,
int *fd);
char* dbus_get_local_machine_id (void);
DBUS_END_DECLS
#endif /* DBUS_CONNECTION_H */
......@@ -413,6 +413,258 @@ _dbus_string_array_contains (const char **array,
return FALSE;
}
/**
* Generates a new UUID. If you change how this is done,
* there's some text about it in the spec that should also change.
*
* @param uuid the uuid to initialize
*/
void
_dbus_generate_uuid (DBusGUID *uuid)
{
long now;
char *p;
int ts_size;
_dbus_get_current_time (&now, NULL);
uuid->as_uint32s[0] = now;
ts_size = sizeof (uuid->as_uint32s[0]);
p = ((char*)uuid->as_bytes) + ts_size;
_dbus_generate_random_bytes_buffer (p,
sizeof (uuid->as_bytes) - ts_size);
}
/**
* Hex-encode a UUID.
*
* @param uuid the uuid
* @param encoded string to append hex uuid to
* @returns #FALSE if no memory
*/
dbus_bool_t
_dbus_uuid_encode (const DBusGUID *uuid,
DBusString *encoded)
{
DBusString binary;
_dbus_string_init_const_len (&binary, uuid->as_bytes, DBUS_UUID_LENGTH_BYTES);
return _dbus_string_hex_encode (&binary, 0, encoded, _dbus_string_get_length (encoded));
}
static dbus_bool_t
_dbus_read_uuid_file_without_creating (const DBusString *filename,
DBusGUID *uuid,
DBusError *error)
{
DBusString contents;
DBusString decoded;
int end;
_dbus_string_init (&contents);
_dbus_string_init (&decoded);
if (!_dbus_file_get_contents (&contents, filename, error))
goto error;
_dbus_string_chop_white (&contents);
if (_dbus_string_get_length (&contents) != DBUS_UUID_LENGTH_HEX)
{
dbus_set_error (error, DBUS_ERROR_INVALID_FILE_CONTENT,
"UUID file '%s' should contain a hex string of length %d, not length %d, with no other text",
_dbus_string_get_const_data (filename),
DBUS_UUID_LENGTH_HEX,
_dbus_string_get_length (&contents));
goto error;
}
if (!_dbus_string_hex_decode (&contents, 0, &end, &decoded, 0))
{
_DBUS_SET_OOM (error);
goto error;
}
if (end == 0)
{
dbus_set_error (error, DBUS_ERROR_INVALID_FILE_CONTENT,
"UUID file '%s' contains invalid hex data",
_dbus_string_get_const_data (filename));
goto error;
}
if (_dbus_string_get_length (&decoded) != DBUS_UUID_LENGTH_BYTES)
{
dbus_set_error (error, DBUS_ERROR_INVALID_FILE_CONTENT,
"UUID file '%s' contains %d bytes of hex-encoded data instead of %d",
_dbus_string_get_const_data (filename),
_dbus_string_get_length (&decoded),
DBUS_UUID_LENGTH_BYTES);
goto error;
}
_dbus_string_copy_to_buffer (&decoded, uuid->as_bytes, DBUS_UUID_LENGTH_BYTES);
_dbus_string_free (&decoded);
_dbus_string_free (&contents);
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
return TRUE;
error:
_DBUS_ASSERT_ERROR_IS_SET (error);
_dbus_string_free (&contents);
_dbus_string_free (&decoded);
return FALSE;
}
static dbus_bool_t
_dbus_create_uuid_file_exclusively (const DBusString *filename,
DBusGUID *uuid,
DBusError *error)
{
DBusString encoded;
_dbus_string_init (&encoded);
_dbus_generate_uuid (uuid);
if (!_dbus_uuid_encode (uuid, &encoded))
{
_DBUS_SET_OOM (error);
goto error;
}
/* FIXME this is racy; we need a save_file_exclusively
* function. But in practice this should be fine for now.
*
* - first be sure we can create the file and it
* doesn't exist by creating it empty with O_EXCL
* - then create it by creating a temporary file and
* overwriting atomically with rename()
*/
if (!_dbus_create_file_exclusively (filename, error))
goto error;
if (!_dbus_string_append_byte (&encoded, '\n'))
{
_DBUS_SET_OOM (error);
goto error;
}
if (!_dbus_string_save_to_file (&encoded, filename, error))
goto error;
_dbus_string_free (&encoded);
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
return TRUE;
error:
_DBUS_ASSERT_ERROR_IS_SET (error);
_dbus_string_free (&encoded);
return FALSE;
}
/**
* Reads (and optionally writes) a uuid to a file. Initializes the uuid
* unless an error is returned.
*
* @param filename the name of the file
* @param uuid uuid to be initialized with the loaded uuid
* @param create_if_not_found #TRUE to create a new uuid and save it if the file doesn't exist
* @param error the error return
* @returns #FALSE if the error is set
*/
dbus_bool_t
_dbus_read_uuid_file (const DBusString *filename,
DBusGUID *uuid,
dbus_bool_t create_if_not_found,
DBusError *error)
{
DBusError read_error;
dbus_error_init (&read_error);
if (_dbus_read_uuid_file_without_creating (filename, uuid, &read_error))
return TRUE;
if (!create_if_not_found)
{
dbus_move_error (&read_error, error);
return FALSE;
}
/* If the file exists and contains junk, we want to keep that error
* message instead of overwriting it with a "file exists" error
* message when we try to write
*/
if (dbus_error_has_name (&read_error, DBUS_ERROR_INVALID_FILE_CONTENT))
{
dbus_move_error (&read_error, error);
return FALSE;
}
else
{
dbus_error_free (&read_error);
return _dbus_create_uuid_file_exclusively (filename, uuid, error);
}
}
_DBUS_DEFINE_GLOBAL_LOCK (machine_uuid);
static int machine_uuid_initialized_generation = 0;
static DBusGUID machine_uuid;
/**
* Gets the hex-encoded UUID of the machine this function is
* executed on. This UUID is guaranteed to be the same for a given
* machine at least until it next reboots, though it also
* makes some effort to be the same forever, it may change if the
* machine is reconfigured or its hardware is modified.
*
* @param uuid_str string to append hex-encoded machine uuid to
* @returns #FALSE if no memory
*/
dbus_bool_t
_dbus_get_local_machine_uuid_encoded (DBusString *uuid_str)
{
dbus_bool_t ok;
_DBUS_LOCK (machine_uuid);
if (machine_uuid_initialized_generation != _dbus_current_generation)
{
DBusError error;
dbus_error_init (&error);
if (!_dbus_read_local_machine_uuid (&machine_uuid, FALSE,
&error))
{
#ifndef DBUS_BUILD_TESTS
/* For the test suite, we may not be installed so just continue silently
* here. But in a production build, we want to be nice and loud about
* this.
*/
_dbus_warn ("D-Bus library appears to be incorrectly set up; failed to read machine uuid: %s\n",
error.message);
_dbus_warn ("See the manual page for dbus-uuidgen to correct this issue.\n");
_dbus_warn ("Continuing with a bogus made-up machine UUID, which may cause problems.");
#endif
dbus_error_free (&error);
_dbus_generate_uuid (&machine_uuid);
}
}
ok = _dbus_uuid_encode (&machine_uuid, uuid_str);
_DBUS_UNLOCK (machine_uuid);
return ok;
}
#ifdef DBUS_BUILD_TESTS
/**
* Returns a string describing the given name.
......
......@@ -157,8 +157,16 @@ extern const char _dbus_return_if_fail_warning_format[];
#define _DBUS_STRUCT_OFFSET(struct_type, member) \
((long) ((unsigned char*) &((struct_type*) 0)->member))
#ifdef DBUS_DISABLE_CHECKS
/* this is an assert and not an error, but in the typical --disable-checks case (you're trying
* to really minimize code size), disabling these assertions makes sense.
*/
#define _DBUS_ASSERT_ERROR_IS_SET(error)
#define _DBUS_ASSERT_ERROR_IS_CLEAR(error)
#else
#define _DBUS_ASSERT_ERROR_IS_SET(error) _dbus_assert ((error) == NULL || dbus_error_is_set ((error)))
#define _DBUS_ASSERT_ERROR_IS_CLEAR(error) _dbus_assert ((error) == NULL || !dbus_error_is_set ((error)))
#endif
#define _dbus_return_if_error_is_set(error) _dbus_return_if_fail ((error) == NULL || !dbus_error_is_set ((error)))
#define _dbus_return_val_if_error_is_set(error, val) _dbus_return_val_if_fail ((error) == NULL || !dbus_error_is_set ((error)), (val))
......@@ -288,7 +296,8 @@ _DBUS_DECLARE_GLOBAL_LOCK (message_cache);
_DBUS_DECLARE_GLOBAL_LOCK (shared_connections);
_DBUS_DECLARE_GLOBAL_LOCK (win_fds);
_DBUS_DECLARE_GLOBAL_LOCK (sid_atom_cache);
#define _DBUS_N_GLOBAL_LOCKS (13)
_DBUS_DECLARE_GLOBAL_LOCK (machine_uuid);
#define _DBUS_N_GLOBAL_LOCKS (14)
dbus_bool_t _dbus_threads_init_debug (void);
......@@ -300,6 +309,28 @@ void _dbus_set_bad_address (DBusError *error,
const char *address_problem_field,
const char *address_problem_other);
#define DBUS_UUID_LENGTH_BYTES 16
#define DBUS_UUID_LENGTH_HEX (DBUS_UUID_LENGTH_BYTES * 2)