diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-04-18 03:08:16 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-04-18 03:08:16 +0200 |
commit | 4139c1b2729f88991159b9affa2ebf3e4eb904a0 (patch) | |
tree | 230a49b730ba77bec3829595313bdb4b7bcd53f4 /dbus.c | |
parent | 41447faf1fc57463becabce399d983df762a104c (diff) |
dbus: greatly extend dbus coverage
Diffstat (limited to 'dbus.c')
-rw-r--r-- | dbus.c | 30 |
1 files changed, 28 insertions, 2 deletions
@@ -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; +} |