--- /dev/null
+#ifndef HOSTCOMPAT_GIO_H
+#define HOSTCOMPAT_GIO_H
+
+typedef enum {
+ G_DBUS_MESSAGE_TYPE_INVALID,
+ G_DBUS_MESSAGE_TYPE_METHOD_CALL,
+ G_DBUS_MESSAGE_TYPE_METHOD_RETURN,
+ G_DBUS_MESSAGE_TYPE_ERROR,
+ G_DBUS_MESSAGE_TYPE_SIGNAL
+} GDBusMessageType;
+
+typedef enum {
+ G_DBUS_MESSAGE_FLAGS_NONE = 0,
+ G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED = (1<<0),
+ G_DBUS_MESSAGE_FLAGS_NO_AUTO_START = (1<<1)
+} GDBusMessageFlags;
+
+typedef enum
+{
+ G_DBUS_MESSAGE_BYTE_ORDER_BIG_ENDIAN = 'B',
+ G_DBUS_MESSAGE_BYTE_ORDER_LITTLE_ENDIAN = 'l'
+} GDBusMessageByteOrder;
+
+typedef enum
+{
+ G_DBUS_SEND_MESSAGE_FLAGS_NONE = 0,
+ G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL = (1<<0)
+} GDBusSendMessageFlags;
+
+struct GTypeInstance {
+ ptr_t g_class; // GTypeClass *
+};
+
+struct GObject {
+ struct GTypeInstance g_type_instance;
+
+ volatile uint_t ref_count;
+ ptr_t qdata; // void *
+};
+
+struct GHashTable {
+ int_t size;
+ int_t mod;
+ uint_t mask;
+ int_t nnodes;
+ int_t noccupied;
+
+ ptr_t keys; // void *keys;
+ ptr_t hashes; // void *hashes;
+ ptr_t values; // void *values;
+};
+
+struct GVariant {
+ ptr_t type_info; // void *type_info;
+ ulong_t size;
+
+ union {
+ struct {
+ ptr_t bytes; // void *bytes;
+ ptr_t gconstpointer; // const char *gconstpointer;
+ } serialised;
+
+ struct {
+ ptr_t children; // struct GVariant **children;
+ ulong_t n_children;
+ } tree;
+ } content;
+
+ int_t state;
+ int_t ref_count;
+};
+
+struct GDBusMessage {
+ struct GObject parent_instance;
+ uint_t type; // GDBusMessageType type;
+ uint_t flags; // GDBusMessageFlags flags;
+ int_t locked; // gboolean
+ uint_t byte_order; // GDBusMessageByteOrder byte_order;
+ unsigned char major_protocol_version;
+ uint32_t serial;
+ ptr_t headers; // GHashTable *headers;
+ ptr_t body; // GVariant *body;
+// this part is under #ifdef G_OS_UNIX
+ ptr_t fd_list; // GUnixFDList *fd_list;
+// #endif G_OS_UNIX
+};
+
+#endif // HOSTCOMPAT_GIO_H
--- /dev/null
+#ifndef HOSTCOMPAT_LIBDBUS_H
+#define HOSTCOMPAT_LIBDBUS_H
+
+struct DBusString {
+ ptr_t str;
+ int_t len;
+ int_t allocated;
+ uint_t constant : 1;
+ uint_t locked : 1;
+ uint_t invalid : 1;
+ uint_t align_offset : 3;
+};
+
+struct DBusHeaderFields {
+ int_t value_pos;
+};
+
+struct DBusHeader {
+ struct DBusString data;
+
+ struct DBusHeaderFields fields[10];
+
+ uint32_t padding:3;
+ uint32_t byte_order:8;
+ unsigned char protocol_version;
+};
+
+struct DBusDataSlot {
+ ptr_t data; // void *data;
+ ptr_t dummy1; // void *dummy1;
+};
+
+struct DBusDataSlotList {
+ ptr_t slots; //DBusDataSlot *slots;
+ int_t n_slots;
+};
+
+struct DBusMessage {
+ int32_t refcount;
+ struct DBusHeader header;
+ struct DBusString body;
+
+ // we don't access anything below
+
+ uint_t locked : 1;
+ uint_t in_cache : 1; // this is under #ifdef but it does not hurt us
+
+ ptr_t list; // void *
+ long_t size_counter_delta;
+ int_t timeout_ms;
+
+ uint32_t changed_stamp : 21;
+ struct DBusDataSlotList slot_list;
+
+// this is under #ifndef DBUS_DISABLE_CHECKS
+// this is important if anyone wants to access fields below
+ int_t generation;
+// #endif DBUS_DISABLE_CHECKS
+
+// this part is under #ifdef HAVE_UNIX_FD_PASSING
+ ptr_t unix_fds; // int *
+
+ uint_t n_unix_fds;
+ uint_t n_unix_fds_allocated;
+
+ long_t unix_fd_counter_delta;
+// #endif HAVE_UNIX_FD_PASSING
+
+ ptr_t signature; // struct DBusString *signature;
+ ptr_t unique_sender; // struct DBusString *unique_sender;
+ ulong_t gvariant_body_last_offset;
+ ulong_t gvariant_body_last_pos;
+};
+
+struct DBusLink {
+ ptr_t prev; // struct DBusLink *prev;
+ ptr_t next; // struct DBusLink *next;
+ ptr_t data; // void *data;
+};
+
+struct DBusList {
+ ptr_t prev; // struct DBusList *prev;
+ ptr_t next; // struct DbusList *next;
+ ptr_t data; // void *data;
+};
+
+struct DBusConnection {
+ int32_t refcount;
+
+ ptr_t mutex; // DBusRMutex *mutex;
+
+ ptr_t dispatch_mutex; // DBusCMutex *dispatch_mutex;
+ ptr_t dispatch_cond; // DBusCondVar *dispatch_cond;
+ ptr_t io_path_mutex; // DBusCMutex *io_path_mutex;
+ ptr_t io_path_cond; // DBusCondVar *io_path_cond;
+
+ ptr_t outgoing_messages; // struct DBusList *outgoing_messages;
+ ptr_t incoming_messages; // struct DBusList *incoming_messages;
+ ptr_t expired_messages; // struct DBusList *expired_messages;
+
+ ptr_t message_borrowed; // struct DBusMessage *message_borrowed;
+
+ int_t n_outgoing;
+ int_t n_incoming;
+
+ ptr_t outgoing_counter; // DBusCounter *outgoing_counter;
+
+ ptr_t transport; // DBusTransport *transport;
+ ptr_t watches; // DBusWatchList *watches;
+ ptr_t timeouts; // DBusTimeoutList *timeouts;
+
+ ptr_t filter_list; // DBusList *filter_list;
+
+ ptr_t slot_mutex; // DBusRMutex *slot_mutex;
+ struct DBusDataSlotList slot_list;
+
+ ptr_t pending_replies; // DBusHashTable *pending_replies;
+
+ uint32_t client_serial;
+ ptr_t disconnect_message_link; // DBusList *disconnect_message_link;
+
+ ptr_t wakeup_main_function; // DBusWakeupMainFunction wakeup_main_function;
+ ptr_t wakeup_main_data; // void *wakeup_main_data;
+ ptr_t wants; // DBusFreeFunction free_wakeup_main_data;
+
+ ptr_t dispatch_status_function; // DBusDispatchStatusFunction dispatch_status_function;
+ ptr_t dispatch_status_data; // void *dispatch_status_data;
+ ptr_t free_dispatch_status_data; // DBusFreeFunction free_dispatch_status_data;
+
+ uint_t last_dispatch_status; // DBusDispatchStatus last_dispatch_status;
+
+ ptr_t objects; // DBusObjectTree *objects;
+
+ ptr_t server_guid; // char *server_guid;
+
+ uint32_t dispatch_acquired; // dbus_bool_t
+ uint32_t io_path_acquired; // dbus_bool_t
+
+ uint_t dispatch_disabled : 1;
+ uint_t shareable : 1;
+ uint_t exit_on_disconnect : 1;
+ uint_t route_peer_messages : 1;
+ uint_t disconnected_message_arrived : 1;
+ uint_t disconnected_message_processed : 1;
+
+ // There are actually some more fields below (with #ifdefs), however we do not use it.
+ // Add them if you need them.
+};
+
+#endif // LIBDBUS_H
#include <hostcompat/uapi/linux/ptrace.h>
#include <hostcompat/linux/sched.h>
-
-struct DBusString {
- ptr_t str;
- int_t len;
- uint_t allocated;
- uint_t constant : 1;
- uint_t locked : 1;
- uint_t invalid : 1;
- uint_t align_offset : 3;
-};
-
-struct DBusHeaderFields {
- int_t value_pos;
-};
-
-struct DBusHeader {
- struct DBusString data;
-
- struct DBusHeaderFields fields[9];
-
- u32 padding;
- u32 byte_order;
- unsigned char protocol_version;
-};
-
-struct DBusMessage {
- int_t refcount;
- struct DBusHeader header;
- struct DBusString body;
-
- uint_t locked : 1;
-
- ptr_t list; // void *
- long_t size_counter_delta;
- int_t timeout_ms;
-
- u32 changed_stamp : 21;
- ptr_t slot_list; // void *
-
- int_t generation;
-
- ptr_t unix_fds; // int *
-
- uint_t n_unix_fds;
- uint_t n_unix_fds_allocated;
-
- long_t unix_fd_counter_delta;
-
- ptr_t signature; // struct DBusString *signature;
- ptr_t unique_sender; // struct DBusString *unique_sender;
- ulong_t gvariant_body_last_offset;
- ulong_t gvariant_body_last_pos;
-};
+#include <hostcompat/dbus/libdbus.h>
struct data_t {
u32 pid;
#include <hostcompat/linux/sched.h>
#include <hostcompat/uapi/linux/ptrace.h>
-
-typedef enum {
- G_DBUS_MESSAGE_TYPE_INVALID,
- G_DBUS_MESSAGE_TYPE_METHOD_CALL,
- G_DBUS_MESSAGE_TYPE_METHOD_RETURN,
- G_DBUS_MESSAGE_TYPE_ERROR,
- G_DBUS_MESSAGE_TYPE_SIGNAL
-} GDBusMessageType;
-
-typedef enum {
- G_DBUS_MESSAGE_FLAGS_NONE = 0,
- G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED = (1<<0),
- G_DBUS_MESSAGE_FLAGS_NO_AUTO_START = (1<<1)
-} GDBusMessageFlags;
-
-typedef enum
-{
- G_DBUS_MESSAGE_BYTE_ORDER_BIG_ENDIAN = 'B',
- G_DBUS_MESSAGE_BYTE_ORDER_LITTLE_ENDIAN = 'l'
-} GDBusMessageByteOrder;
-
-typedef enum
-{
- G_DBUS_SEND_MESSAGE_FLAGS_NONE = 0,
- G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL = (1<<0)
-} GDBusSendMessageFlags;
-
-struct GTypeInstance {
- ptr_t g_class; // void *
-};
-
-struct GObject {
- struct GTypeInstance g_type_instance;
-
- volatile uint_t ref_count;
- ptr_t qdata; // void *
-};
-
-struct GDBusMessage {
- struct GObject parent_instance;
- GDBusMessageType type;
- GDBusMessageFlags flags;
- bool locked;
- uint_t byte_order; // GDBusMessageByteOrder byte_order;
- unsigned char major_protocol_version;
- unsigned int serial;
- ptr_t headers; // void *headers;
- ptr_t body; // void *body;
-};
-
-struct DBusString {
- ptr_t str;
- int_t len;
- uint_t allocated;
- unsigned int constant : 1;
- unsigned int locked : 1;
- unsigned int invalid : 1;
- unsigned int align_offset : 3;
-};
-
-struct DBusLink {
- ptr_t prev; // struct DBusLink *prev;
- ptr_t next; // struct DBusLink *next;
- ptr_t data; // void *data;
-};
-
-struct DBusHeaderFields {
- int_t value_pos;
-};
-
-struct DBusHeader {
- struct DBusString data;
-
- struct DBusHeaderFields fields[9];
-
- u32 padding;
- u32 byte_order;
- unsigned char protocol_version;
-};
-
-struct DBusDataSlot {
- ptr_t data; // void *data;
- ptr_t dummy1; // void *dummy1;
-};
-
-struct DBusDataSlotList {
- ptr_t slots; // struct DBusDataSlot *slots;
- int_t n_slots;
-};
-
-struct DBusList {
- ptr_t prev; // struct DBusList *prev;
- ptr_t next; // struct DbusList *next;
- ptr_t data; // void *data;
-};
-
-struct DBusMessage {
- int_t refcount;
- struct DBusHeader header;
- struct DBusString body;
-
- uint_t locked : 1;
- uint_t in_cache : 1;
-
- ptr_t counters; // void *counters;
- long_t size_counter_delta;
- int_t timeout_ms;
-
- u32 changed_stamp : 21;
- ptr_t slot_list; // struct DBusDataSlotList *slot_list;
-
- int_t generation;
-
- ptr_t unix_fds; // int *unix_fds;
-
- uint_t n_unix_fds;
- uint_t n_unix_fds_allocated;
-
- long_t unix_fd_counter_delta;
-
- ptr_t signature; // struct DBusString *signature;
- ptr_t unique_sender; // struct DBusString *unique_sender;
- long_t gvariant_body_last_offset;
- long_t gvariant_body_last_pos;
-};
-
-struct DBusConnection {
- int_t refcount;
-
- ptr_t mutex; // void *mutex;
-
- ptr_t dispatch_mutex; // void *dispatch_mutex;
- ptr_t dispatch_cond; // void *dispatch_cond;
- ptr_t io_path_mutex; // void *io_path_mutex;
- ptr_t io_path_cond; // void *io_path_cond;
-
- ptr_t outgoing_messages; // struct DBusList *outgoing_messages;
- ptr_t incoming_messages; // struct DBusList *incoming_messages;
- ptr_t expired_messages; // struct DBusList *expired_messages;
-
- ptr_t message_borrowed; // struct DBusMessage *message_borrowed;
-
- int_t n_outgoing;
- int_t n_incoming;
-};
+#include <hostcompat/dbus/libdbus.h>
+#include <hostcompat/dbus/gio.h>
struct data_t {
int pid;
#include <hostcompat/linux/sched.h>
#include <hostcompat/uapi/linux/ptrace.h>
+#include <hostcompat/dbus/gio.h>
+#include <hostcompat/dbus/libdbus.h>
#define DBUS_TYPE_OFFSET 1
-typedef enum {
- G_DBUS_MESSAGE_TYPE_INVALID,
- G_DBUS_MESSAGE_TYPE_METHOD_CALL,
- G_DBUS_MESSAGE_TYPE_METHOD_RETURN,
- G_DBUS_MESSAGE_TYPE_ERROR,
- G_DBUS_MESSAGE_TYPE_SIGNAL
-} GDBusMessageType;
-
-typedef enum {
- G_DBUS_MESSAGE_FLAGS_NONE = 0,
- G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED = (1<<0),
- G_DBUS_MESSAGE_FLAGS_NO_AUTO_START = (1<<1)
-} GDBusMessageFlags;
-
-typedef enum
-{
- G_DBUS_MESSAGE_BYTE_ORDER_BIG_ENDIAN = 'B',
- G_DBUS_MESSAGE_BYTE_ORDER_LITTLE_ENDIAN = 'l'
-} GDBusMessageByteOrder;
-
-struct GTypeInstance {
- ptr_t g_class; // void *g_class;
-};
-
-struct GObject {
- struct GTypeInstance g_type_instance;
-
- volatile uint_t ref_count;
- ptr_t qdata; // void *qdata;
-};
-
-struct GHashTable {
- int_t size;
- int_t mod;
- uint_t mask;
- int_t nnodes;
- int_t noccupied;
-
- ptr_t keys; // void *keys;
- ptr_t hashes; // void *hashes;
- ptr_t values; // void *values;
-};
-
-struct GVariant {
- ptr_t type_info; // void *type_info;
- ulong_t size;
-
- union {
- struct {
- ptr_t bytes; // void *bytes;
- ptr_t gconstpointer; // const char *gconstpointer;
- } serialised;
-
- struct {
- ptr_t children; // struct GVariant **children;
- ulong_t n_children;
- } tree;
- } content;
-
- int_t state;
- int_t ref_count;
-};
-
-struct GDBusMessage {
- struct GObject parent_instance;
- uint_t type; // GDBusMessageType type;
- uint_t flags; // GDBusMessageFlags flags;
- bool locked;
- uint_t byte_order; // GDBusMessageByteOrder byte_order;
- unsigned char major_protocol_version;
- uint_t serial;
- ptr_t headers; // struct GHashTable *headers;
- ptr_t body; // struct GVariant *body;
-};
-
-struct DBusString {
- ptr_t str; // void *str;
- int_t len;
- uint_t allocated;
- unsigned int constant : 1;
- unsigned int locked : 1;
- unsigned int invalid : 1;
- unsigned int align_offset : 3;
-};
-
-struct DBusHeaderFields {
- int_t value_pos;
-};
-
-struct DBusHeader {
- struct DBusString data;
-
- struct DBusHeaderFields fields[9];
-
- u32 padding;
- u32 byte_order;
- unsigned char protocol_version;
-};
-
-struct DBusMessage {
- int_t refcount;
- struct DBusHeader header;
- struct DBusString body;
-
- uint_t locked : 1;
-
- ptr_t list; // void * list;
- long_t size_counter_delta;
- int_t timeout_ms;
-
- u32 changed_stamp : 21;
- ptr_t slot_list; // void *slot_list;
-
- int_t generation;
-
- ptr_t unix_fds; // int *unix_fds;
-
- uint_t n_unix_fds;
- uint_t n_unix_fds_allocated;
-
- long_t unix_fd_counter_delta;
-
- ptr_t signature; // struct DBusString *signature;
- ptr_t unique_sender; // struct DBusString *unique_sender;
- uint_t gvariant_body_last_offset;
- uint_t gvariant_body_last_pos;
-};
-
struct data_t {
u32 pid;
char comm[TASK_COMM_LEN];
int message_type(struct pt_regs *ctx, void *conn, struct DBusMessage *message) {
const char *c = message->header.data.str;
- c++;
+ c += DBUS_TYPE_OFFSET;
msg_type.increment(*c);
return 0;
}