summaryrefslogtreecommitdiff
path: root/dbus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-18 03:08:16 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-18 03:08:16 +0200
commit4139c1b2729f88991159b9affa2ebf3e4eb904a0 (patch)
tree230a49b730ba77bec3829595313bdb4b7bcd53f4 /dbus.c
parent41447faf1fc57463becabce399d983df762a104c (diff)
dbus: greatly extend dbus coverage
Diffstat (limited to 'dbus.c')
-rw-r--r--dbus.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/dbus.c b/dbus.c
index a1a3606361..79b1a7ebc3 100644
--- a/dbus.c
+++ b/dbus.c
@@ -19,17 +19,19 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <dbus/dbus.h>
-
#include <sys/epoll.h>
#include <sys/timerfd.h>
#include <errno.h>
#include <unistd.h>
+#include <dbus/dbus.h>
#include "dbus.h"
#include "log.h"
#include "strv.h"
#include "cgroup.h"
+#include "dbus-unit.h"
+#include "dbus-job.h"
+#include "dbus-manager.h"
static void api_bus_dispatch_status(DBusConnection *bus, DBusDispatchStatus status, void *data) {
Manager *m = data;
@@ -1023,6 +1025,10 @@ int bus_property_append_uint64(Manager *m, DBusMessageIter *i, const char *prope
assert(property);
assert(data);
+ /* Let's ensure that pid_t is actually 64bit, and hence this
+ * function can be used for usec_t */
+ assert_cc(sizeof(uint64_t) == sizeof(usec_t));
+
if (!dbus_message_iter_append_basic(i, DBUS_TYPE_UINT64, data))
return -ENOMEM;
@@ -1035,8 +1041,28 @@ int bus_property_append_uint32(Manager *m, DBusMessageIter *i, const char *prope
assert(property);
assert(data);
+ /* Let's ensure that pid_t and mode_t is actually 32bit, and
+ * hence this function can be used for pid_t/mode_t */
+ assert_cc(sizeof(uint32_t) == sizeof(pid_t));
+ assert_cc(sizeof(uint32_t) == sizeof(mode_t));
+ assert_cc(sizeof(uint32_t) == sizeof(unsigned));
+
if (!dbus_message_iter_append_basic(i, DBUS_TYPE_UINT32, data))
return -ENOMEM;
return 0;
}
+
+int bus_property_append_int32(Manager *m, DBusMessageIter *i, const char *property, void *data) {
+ assert(m);
+ assert(i);
+ assert(property);
+ assert(data);
+
+ assert_cc(sizeof(int32_t) == sizeof(int));
+
+ if (!dbus_message_iter_append_basic(i, DBUS_TYPE_INT32, data))
+ return -ENOMEM;
+
+ return 0;
+}