Commit graph

2917 commits

Author SHA1 Message Date
Jiří Klimeš
ea8aabf0be DBusConnection: simplify registering object paths code
Introduce static generic _dbus_connection_register_object_path()
function to remove duplicate code for registration object paths.
Having *four* almost the same functions is error-prone and hard
to follow as well.

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38874
2011-07-11 13:23:23 +01:00
Ralf Habacker
ba9178b153 Visual Studio Professional uses a different ide starter - pointed out by Romain Pokrzywka 2011-07-08 10:53:20 +02:00
Ralf Habacker
4ee7b07b20 Fixed cmake buildsystem - option command only supports boolean values 2011-07-04 23:47:45 +02:00
Simon McVittie
b32aaa8a57 Cope with platforms whose vsnprintf violates both POSIX and C99 - part 1 2011-07-03 06:47:39 +02:00
Simon McVittie
e7bd2bb848 In Windows _dbus_printf_string_upper_bound, don't crash on malloc failure 2011-07-03 06:36:07 +02:00
Ralf Habacker
84b03cae58 Limit batch file creating to windows 2011-07-03 01:39:09 +02:00
Ralf Habacker
b77885c1db Fixed cmake buildsystem on unix - option command only supports boolean values 2011-07-03 01:36:48 +02:00
Ralf Habacker
6321a98492 Collected cmake doc into README.cmake. 2011-07-02 21:02:46 +02:00
Ralf Habacker
a7f98d8819 Added DBUS_ENABLE_STATS option to cmake buildsystem to keep in sync with autotools. 2011-07-02 00:53:23 +02:00
Ralf Habacker
e2f94ea14f win32 fix: Keep server autolaunch mutex settings according to client detection algorithmus. 2011-07-01 16:28:19 +02:00
Simon McVittie
636a9a29f8 Merge branch 'dbus-1.4' 2011-07-01 14:54:42 +01:00
Jiří Klimeš
0dcb911251 DBusConnection: use DBUS_ERROR_OBJECT_PATH_IN_USE instead of DBUS_ERROR_ADDRESS_IN_USE
While registering an object path the possible error is
DBUS_ERROR_OBJECT_PATH_IN_USE, not DBUS_ERROR_ADDRESS_IN_USE (the error
is set by _dbus_object_tree_register()).

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38874
2011-07-01 14:48:48 +01:00
Simon McVittie
30f116fd2d Include size of link cache in per-connection statistics
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:01:56 +01:00
Simon McVittie
cf08dce402 Also record peak values for queued bytes/fds in connection stats
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:01:56 +01:00
Simon McVittie
f69ac31dd9 Add an initial round of stats to the Stats interface
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:01:56 +01:00
Simon McVittie
fce1f6b55f DBusConnection, DBusTransport: add queue statistics
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:01:46 +01:00
Simon McVittie
8a3e7581e7 BusConnections: add usage stats for well-known names, match rules
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:01:06 +01:00
Simon McVittie
2351f57081 DBusList: add usage stats
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:01:02 +01:00
Simon McVittie
82bc508785 DBusMemPool: add usage stats
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:00:57 +01:00
Simon McVittie
206fff7ee6 Add a stub .Debug.Stats interface if --enable-stats
There are no actual statistics yet, just a count of how many times the
method has been called, and (for the per-connection stats) the unique name.

Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:00:49 +01:00
Simon McVittie
bc212b72b2 configure.ac: add --enable-stats
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:00:43 +01:00
Simon McVittie
85e9a28303 match_rule_to_string: don't reinvent dbus_message_type_to_string
We don't allow match rules with unknown message types, so losing the
"type='%d'" case isn't a great loss.

Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34040
2011-06-24 16:00:13 +01:00
Simon McVittie
16b9600964 Remove maximum length field from DBusString
The source code says it's "a historical artifact from a feature that
turned out to be dumb". Respond accordingly!

This reduces sizeof (DBusString) by 20% on ILP32 architectures, which
can't hurt. (No reduction on LP64 architectures that align pointers
naturally, unfortunately.)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38570
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-06-22 19:15:05 +01:00
Simon McVittie
e3b9a0597c Remove unused _dbus_string_copy_data_len, _dbus_string_steal_data_len
They're only compiled when building tests.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38570
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-06-22 19:15:01 +01:00
Simon McVittie
c8a7417c73 Split DBUS_GENERIC_STRING_PREAMBLE into sensible lines
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38570
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-06-22 19:14:46 +01:00
Ralf Habacker
736445ee44 CMake fix: Do not use FORCE in variables which should be changeable by the user. 2011-06-20 09:29:12 +02:00
Ralf Habacker
aba867f242 fixed cmake error: doc says CACHE needs type *and* doc string 2011-06-14 18:45:46 +02:00
Simon McVittie
5e7824729d NEWS 2011-06-13 16:54:00 +01:00
Simon McVittie
a246e250d0 DBusLoop: store watches in a hash table keyed by fd
This means we don't need to build up the watches_for_fds array, because
it's quick to find the watches based on the fd.

This also fixes fd.o #23194, because we only put each fd in the
array of DBusPollFD once, with the union of all its watches' flags; we
can no longer get more entries in the array than our number of file
descriptors, which is capped at our RLIMIT_NOFILE, so we can't get
EINVAL from poll(2).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=23194
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:37:25 +01:00
Simon McVittie
9aa45eef4d DBusLoop: fold Callback into TimeoutCallback
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:32:49 +01:00
Simon McVittie
6600f17a7e Drop WatchCallback entirely, just use a list of DBusWatch in the main loop
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:30:27 +01:00
Simon McVittie
5bd6056169 DBusLoop: inline add_callback, remove_callback into their callers
The watch and timeout code paths will diverge completely when we change
WatchCallback * to just be a DBusWatch *, removing the benefit of having
common code.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:28:06 +01:00
Simon McVittie
0292b1a56d DBusLoop: move OOM flag in watches inside the DBusWatch
This will eventually let us maintain a DBusPollFD[] of just the active
watches, between several iterations. The more immediate benefit is that
WatchCallback can go away, because it only contains a refcount, a
now-useless type, and a watch that already has its own refcount.

This doesn't take any more memory for DBusWatch when not using DBusLoop
(e.g. in client/service code or bindings), because we're just using more
bits in an existing bitfield.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:25:33 +01:00
Simon McVittie
88bf20007b DBusLoop: keep separate lists of watches and timeouts
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:20:41 +01:00
Simon McVittie
7d9592ef55 DBusLoop: factor out watch_flags_to_poll_events, watch_flags_from_poll_revents
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:18:19 +01:00
Simon McVittie
63b9770604 Remove _dbus_loop_add_watch_full
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:15:53 +01:00
Simon McVittie
e421626d86 bus-activation: separate the "finished" callback from the watch callback
This has been marked as broken since 2003...

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:13:02 +01:00
Simon McVittie
4b43f5db7a DBusLoop: remove second layer of watch callbacks where possible
Similar to the previous commit, almost every use of DBusWatch can just
have the main loop call dbus_watch_handle.

The one exception is the bus activation code; it's had a comment
explaining why it's wrong since 2003. We should fix that one day, but for
now, just migrate it to a new _dbus_loop_add_watch_full which preserves
the second-layer callback.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:09:50 +01:00
Simon McVittie
93385b7339 DBusLoop: remove a layer of pointless abstraction around timeouts
Instead of supplying 8 tiny wrapper functions around dbus_timeout_handle,
each with a user_data parameter that's a potentially unsafe borrowed
pointer but isn't actually used, we can call dbus_timeout_handle directly
and save a lot of trouble.

One of the wrappers previously called dbus_timeout_handle repeatedly
if it returned FALSE to indicate OOM, but that timeout's handler never
actually returned FALSE, so there was no practical effect. The rest just
ignore the return, which is documented as OK to do.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:07:17 +01:00
Simon McVittie
b8ccef11bb DBusConnection: ref the connection in the timeout handler
client_timeout_callback in bus/test.c refs the connection across the
timeout invocation, which looks suspiciously like a workaround. If we
make the timeout handler itself ref the connection, we won't need that,
and can simplify timeout handling drastically.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 16:04:39 +01:00
Simon McVittie
c7ef3ead55 bus signal_handler: don't use _dbus_warn, and don't pretend to be portable
_dbus_warn isn't async-signal-safe, so that's out. We can use write()
instead; it's POSIX but not ISO C, but then again, so are signals.
Accordingly, guard it with DBUS_UNIX.

dbus-sysdeps-util-win doesn't actually implement _dbus_set_signal_handler
anyway, so not compiling this code on non-Unix seems more honest.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 15:59:22 +01:00
Simon McVittie
50c81a35a7 bus: signal_handler: ignore failure to write, and explain why
See the comment in the source code for rationale.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 15:58:45 +01:00
Simon McVittie
c5c7850762 Check that watches are removed, then invalidated, then unreffed
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 15:48:50 +01:00
Simon McVittie
58f968a2cc Always remove, invalidate and free watches before closing watched sockets
This should mean we don't get invalid fds in the main loop.

The BSD (kqueue) and Windows code paths are untested, but follow the same
patterns as the tested Linux/generic Unix versions.

DBusTransportSocket was already OK (it called free_watches() before
_dbus_close_socket, and that did the remove, invalidate, unref dance).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
2011-06-13 15:45:54 +01:00
Simon McVittie
a2e330980d bump version 2011-06-13 10:32:30 +01:00
Simon McVittie
d28c80cf8d ahem. 2011-06-10 23:47:33 +01:00
Simon McVittie
eee95a83f8 Prepare 1.5.4 2011-06-10 22:59:26 +01:00
Simon McVittie
166bed249d Merge branch 'dbus-1.4'
Conflicts:
	NEWS
	configure.ac
2011-06-10 22:46:42 +01:00
Simon McVittie
5bfe1310c4 version bump 2011-06-10 22:45:46 +01:00
Simon McVittie
78ba729412 prepare 1.4.12 2011-06-10 21:56:16 +01:00