X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/b57f7e0a357aacf98ec5be826f7227f37e9806b8..14af5f7fc4d7557ee712d3b6a8b46d9034c2ff39:/src/dbusbind.c diff --git a/src/dbusbind.c b/src/dbusbind.c index d8d0c7c2ef..c89867fbae 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -1,5 +1,5 @@ /* Elisp bindings for D-Bus. - Copyright (C) 2007-2011 Free Software Foundation, Inc. + Copyright (C) 2007-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -111,13 +111,12 @@ static int xd_in_read_queued_messages = 0; /* Raise a Lisp error from a D-Bus ERROR. */ #define XD_ERROR(error) \ do { \ - char s[1024]; \ - strncpy (s, error.message, 1023); \ - dbus_error_free (&error); \ /* Remove the trailing newline. */ \ - if (strchr (s, '\n') != NULL) \ - s[strlen (s) - 1] = '\0'; \ - XD_SIGNAL1 (build_string (s)); \ + char const *mess = error.message; \ + char const *nl = strchr (mess, '\n'); \ + Lisp_Object err = make_string (mess, nl ? nl - mess : strlen (mess)); \ + dbus_error_free (&error); \ + XD_SIGNAL1 (err); \ } while (0) /* Macros for debugging. In order to enable them, build with @@ -126,7 +125,7 @@ static int xd_in_read_queued_messages = 0; #define XD_DEBUG_MESSAGE(...) \ do { \ char s[1024]; \ - snprintf (s, 1023, __VA_ARGS__); \ + snprintf (s, sizeof s, __VA_ARGS__); \ printf ("%s: %s\n", __func__, s); \ message ("%s: %s", __func__, s); \ } while (0) @@ -185,7 +184,7 @@ static int xd_in_read_queued_messages = 0; #endif /* This was a macro. On Solaris 2.11 it was said to compile for - hours, when optimzation is enabled. So we have transferred it into + hours, when optimization is enabled. So we have transferred it into a function. */ /* Determine the DBusType of a given Lisp symbol. OBJECT must be one of the predefined D-Bus type symbols. */ @@ -260,6 +259,18 @@ xd_symbol_to_dbus_type (Lisp_Object object) } \ while (0) +/* Append to SIGNATURE a copy of X, making sure SIGNATURE does + not become too long. */ +static void +xd_signature_cat (char *signature, char const *x) +{ + ptrdiff_t siglen = strlen (signature); + ptrdiff_t xlen = strlen (x); + if (DBUS_MAXIMUM_SIGNATURE_LENGTH - xlen <= siglen) + string_overflow (); + strcat (signature, x); +} + /* Compute SIGNATURE of OBJECT. It must have a form that it can be used in dbus_message_iter_open_container. DTYPE is the DBusType the object is related to. It is passed as argument, because it @@ -272,6 +283,8 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis { unsigned int subtype; Lisp_Object elt; + char const *subsig; + int subsiglen; char x[DBUS_MAXIMUM_SIGNATURE_LENGTH]; elt = object; @@ -329,12 +342,13 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis if (NILP (elt)) { subtype = DBUS_TYPE_STRING; - strcpy (x, DBUS_TYPE_STRING_AS_STRING); + subsig = DBUS_TYPE_STRING_AS_STRING; } else { subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); + subsig = x; } /* If the element type is DBUS_TYPE_SIGNATURE, and this is the @@ -343,7 +357,7 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis if ((subtype == DBUS_TYPE_SIGNATURE) && STRINGP (CAR_SAFE (XD_NEXT_VALUE (elt))) && NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) - strcpy (x, SSDATA (CAR_SAFE (XD_NEXT_VALUE (elt)))); + subsig = SSDATA (CAR_SAFE (XD_NEXT_VALUE (elt))); while (!NILP (elt)) { @@ -352,7 +366,10 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis elt = CDR_SAFE (XD_NEXT_VALUE (elt)); } - sprintf (signature, "%c%s", dtype, x); + subsiglen = snprintf (signature, DBUS_MAXIMUM_SIGNATURE_LENGTH, + "%c%s", dtype, subsig); + if (! (0 <= subsiglen && subsiglen < DBUS_MAXIMUM_SIGNATURE_LENGTH)) + string_overflow (); break; case DBUS_TYPE_VARIANT: @@ -384,10 +401,10 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis { subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); - strcat (signature, x); + xd_signature_cat (signature, x); elt = CDR_SAFE (XD_NEXT_VALUE (elt)); } - strcat (signature, DBUS_STRUCT_END_CHAR_AS_STRING); + xd_signature_cat (signature, DBUS_STRUCT_END_CHAR_AS_STRING); break; case DBUS_TYPE_DICT_ENTRY: @@ -408,7 +425,7 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis elt = XD_NEXT_VALUE (elt); subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); - strcat (signature, x); + xd_signature_cat (signature, x); if (!XD_BASIC_DBUS_TYPE (subtype)) wrong_type_argument (intern ("D-Bus"), CAR_SAFE (XD_NEXT_VALUE (elt))); @@ -417,14 +434,14 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis elt = CDR_SAFE (XD_NEXT_VALUE (elt)); subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); - strcat (signature, x); + xd_signature_cat (signature, x); if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) wrong_type_argument (intern ("D-Bus"), CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt)))); /* Closing signature. */ - strcat (signature, DBUS_DICT_ENTRY_END_CHAR_AS_STRING); + xd_signature_cat (signature, DBUS_DICT_ENTRY_END_CHAR_AS_STRING); break; default: @@ -951,7 +968,7 @@ DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0, connection = xd_initialize (bus, TRUE); /* Add the watch functions. We pass also the bus as data, in order - to distinguish between the busses in xd_remove_watch. */ + to distinguish between the buses in xd_remove_watch. */ if (!dbus_connection_set_watch_functions (connection, xd_add_watch, xd_remove_watch, @@ -1078,7 +1095,7 @@ object is returned instead of a list containing this single Lisp object. => "i686" usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TIMEOUT &rest ARGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service, path, interface, method; Lisp_Object result; @@ -1090,7 +1107,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI DBusError derror; unsigned int dtype; int timeout = -1; - size_t i = 5; + ptrdiff_t i = 5; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1143,7 +1160,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4, SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1151,7 +1168,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-4), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4, SDATA (format2 ("%s", args[i], Qnil))); } @@ -1260,7 +1277,7 @@ Example: -| i686 usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLER &optional :timeout TIMEOUT &rest ARGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service, path, interface, method, handler; Lisp_Object result; @@ -1271,7 +1288,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE unsigned int dtype; dbus_uint32_t serial; int timeout = -1; - size_t i = 6; + ptrdiff_t i = 6; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1326,7 +1343,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4, SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1334,7 +1351,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i - 4), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4, SDATA (format2 ("%s", args[i], Qnil))); } @@ -1386,7 +1403,7 @@ DEFUN ("dbus-method-return-internal", Fdbus_method_return_internal, This is an internal function, it shall not be used outside dbus.el. usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service; struct gcpro gcpro1, gcpro2; @@ -1395,7 +1412,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) DBusMessageIter iter; dbus_uint32_t serial; unsigned int ui_serial, dtype; - size_t i; + ptrdiff_t i; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1435,7 +1452,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-2), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 2, SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1443,7 +1460,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */) else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-2), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 2, SDATA (format2 ("%s", args[i], Qnil))); } @@ -1475,7 +1492,7 @@ DEFUN ("dbus-method-error-internal", Fdbus_method_error_internal, This is an internal function, it shall not be used outside dbus.el. usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service; struct gcpro gcpro1, gcpro2; @@ -1484,7 +1501,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) DBusMessageIter iter; dbus_uint32_t serial; unsigned int ui_serial, dtype; - size_t i; + ptrdiff_t i; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1525,7 +1542,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-2), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 2, SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1533,7 +1550,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */) else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-2), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 2, SDATA (format2 ("%s", args[i], Qnil))); } @@ -1588,7 +1605,7 @@ Example: "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs") usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service, path, interface, signal; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; @@ -1596,7 +1613,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) DBusMessage *dmessage; DBusMessageIter iter; unsigned int dtype; - size_t i; + ptrdiff_t i; char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; /* Check parameters. */ @@ -1640,7 +1657,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]); - XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4, SDATA (format2 ("%s", args[i], Qnil)), SDATA (format2 ("%s", args[i+1], Qnil))); ++i; @@ -1648,7 +1665,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) else { XD_DEBUG_VALID_LISP_OBJECT_P (args[i]); - XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-4), + XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4, SDATA (format2 ("%s", args[i], Qnil))); } @@ -1863,7 +1880,7 @@ xd_read_queued_messages (int fd, void *data, int for_read) busp = CDR_SAFE (busp); } - if (NILP(bus)) + if (NILP (bus)) return; /* We ignore all Lisp errors during the call. */ @@ -1919,11 +1936,11 @@ Example: => :already-owner. usage: (dbus-register-service BUS SERVICE &rest FLAGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service; DBusConnection *connection; - size_t i; + ptrdiff_t i; unsigned int value; unsigned int flags = 0; int result; @@ -2019,15 +2036,15 @@ INTERFACE, SIGNAL and HANDLER must not be nil. Example: `dbus-unregister-object' for removing the registration. usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARGS) */) - (size_t nargs, register Lisp_Object *args) + (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object bus, service, path, interface, signal, handler; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; Lisp_Object uname, key, key1, value; DBusConnection *connection; - size_t i; + ptrdiff_t i; char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; - char x[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; + int rulelen; DBusError derror; /* Check parameters. */ @@ -2054,13 +2071,7 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG && (SBYTES (service) > 0) && (strcmp (SSDATA (service), DBUS_SERVICE_DBUS) != 0) && (strncmp (SSDATA (service), ":", 1) != 0)) - { - uname = call2 (intern ("dbus-get-name-owner"), bus, service); - /* When there is no unique name, we mark it with an empty - string. */ - if (NILP (uname)) - uname = empty_unibyte_string; - } + uname = call2 (intern ("dbus-get-name-owner"), bus, service); else uname = service; @@ -2072,32 +2083,43 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG connection = xd_initialize (bus, TRUE); /* Create a rule to receive related signals. */ - sprintf (rule, - "type='signal',interface='%s',member='%s'", - SDATA (interface), - SDATA (signal)); + rulelen = snprintf (rule, sizeof rule, + "type='signal',interface='%s',member='%s'", + SDATA (interface), + SDATA (signal)); + if (! (0 <= rulelen && rulelen < sizeof rule)) + string_overflow (); /* Add unique name and path to the rule if they are non-nil. */ if (!NILP (uname)) { - sprintf (x, ",sender='%s'", SDATA (uname)); - strcat (rule, x); + int len = snprintf (rule + rulelen, sizeof rule - rulelen, + ",sender='%s'", SDATA (uname)); + if (! (0 <= len && len < sizeof rule - rulelen)) + string_overflow (); + rulelen += len; } if (!NILP (path)) { - sprintf (x, ",path='%s'", SDATA (path)); - strcat (rule, x); + int len = snprintf (rule + rulelen, sizeof rule - rulelen, + ",path='%s'", SDATA (path)); + if (! (0 <= len && len < sizeof rule - rulelen)) + string_overflow (); + rulelen += len; } /* Add arguments to the rule if they are non-nil. */ for (i = 6; i < nargs; ++i) if (!NILP (args[i])) { + int len; CHECK_STRING (args[i]); - sprintf (x, ",arg%lu='%s'", (unsigned long) (i-6), - SDATA (args[i])); - strcat (rule, x); + len = snprintf (rule + rulelen, sizeof rule - rulelen, + ",arg%"pD"d='%s'", i - 6, SDATA (args[i])); + if (! (0 <= len && len < sizeof rule - rulelen)) + string_overflow (); + rulelen += len; } /* Add the rule to the bus. */ @@ -2117,7 +2139,7 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG /* Create a hash table entry. */ key = list3 (bus, interface, signal); - key1 = list4 (uname, service, path, handler); + key1 = list5 (uname, service, path, handler, build_string (rule)); value = Fgethash (key, Vdbus_registered_objects_table, Qnil); if (NILP (Fmember (key1, value))) @@ -2149,7 +2171,7 @@ When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is not registered. This means that other D-Bus clients have no way of noticing the newly registered method. When interfaces are constructed incrementally by adding single methods or properties at a time, -DONT-REGISTER-SERVICE can be use to prevent other clients from +DONT-REGISTER-SERVICE can be used to prevent other clients from discovering the still incomplete interface.*/) (Lisp_Object bus, Lisp_Object service, Lisp_Object path, Lisp_Object interface, Lisp_Object method, Lisp_Object handler, @@ -2190,142 +2212,76 @@ void syms_of_dbusbind (void) { - Qdbus_init_bus = intern_c_string ("dbus-init-bus"); - staticpro (&Qdbus_init_bus); + DEFSYM (Qdbus_init_bus, "dbus-init-bus"); defsubr (&Sdbus_init_bus); - Qdbus_close_bus = intern_c_string ("dbus-close-bus"); - staticpro (&Qdbus_close_bus); + DEFSYM (Qdbus_close_bus, "dbus-close-bus"); defsubr (&Sdbus_close_bus); - Qdbus_get_unique_name = intern_c_string ("dbus-get-unique-name"); - staticpro (&Qdbus_get_unique_name); + DEFSYM (Qdbus_get_unique_name, "dbus-get-unique-name"); defsubr (&Sdbus_get_unique_name); - Qdbus_call_method = intern_c_string ("dbus-call-method"); - staticpro (&Qdbus_call_method); + DEFSYM (Qdbus_call_method, "dbus-call-method"); defsubr (&Sdbus_call_method); - Qdbus_call_method_asynchronously - = intern_c_string ("dbus-call-method-asynchronously"); - staticpro (&Qdbus_call_method_asynchronously); + DEFSYM (Qdbus_call_method_asynchronously, "dbus-call-method-asynchronously"); defsubr (&Sdbus_call_method_asynchronously); - Qdbus_method_return_internal - = intern_c_string ("dbus-method-return-internal"); - staticpro (&Qdbus_method_return_internal); + DEFSYM (Qdbus_method_return_internal, "dbus-method-return-internal"); defsubr (&Sdbus_method_return_internal); - Qdbus_method_error_internal = intern_c_string ("dbus-method-error-internal"); - staticpro (&Qdbus_method_error_internal); + DEFSYM (Qdbus_method_error_internal, "dbus-method-error-internal"); defsubr (&Sdbus_method_error_internal); - Qdbus_send_signal = intern_c_string ("dbus-send-signal"); - staticpro (&Qdbus_send_signal); + DEFSYM (Qdbus_send_signal, "dbus-send-signal"); defsubr (&Sdbus_send_signal); - Qdbus_register_service = intern_c_string ("dbus-register-service"); - staticpro (&Qdbus_register_service); + DEFSYM (Qdbus_register_service, "dbus-register-service"); defsubr (&Sdbus_register_service); - Qdbus_register_signal = intern_c_string ("dbus-register-signal"); - staticpro (&Qdbus_register_signal); + DEFSYM (Qdbus_register_signal, "dbus-register-signal"); defsubr (&Sdbus_register_signal); - Qdbus_register_method = intern_c_string ("dbus-register-method"); - staticpro (&Qdbus_register_method); + DEFSYM (Qdbus_register_method, "dbus-register-method"); defsubr (&Sdbus_register_method); - Qdbus_error = intern_c_string ("dbus-error"); - staticpro (&Qdbus_error); + DEFSYM (Qdbus_error, "dbus-error"); Fput (Qdbus_error, Qerror_conditions, list2 (Qdbus_error, Qerror)); Fput (Qdbus_error, Qerror_message, make_pure_c_string ("D-Bus error")); - QCdbus_system_bus = intern_c_string (":system"); - staticpro (&QCdbus_system_bus); - - QCdbus_session_bus = intern_c_string (":session"); - staticpro (&QCdbus_session_bus); - - QCdbus_request_name_allow_replacement - = intern_c_string (":allow-replacement"); - staticpro (&QCdbus_request_name_allow_replacement); - - QCdbus_request_name_replace_existing = intern_c_string (":replace-existing"); - staticpro (&QCdbus_request_name_replace_existing); - - QCdbus_request_name_do_not_queue = intern_c_string (":do-not-queue"); - staticpro (&QCdbus_request_name_do_not_queue); - - QCdbus_request_name_reply_primary_owner = intern_c_string (":primary-owner"); - staticpro (&QCdbus_request_name_reply_primary_owner); - - QCdbus_request_name_reply_exists = intern_c_string (":exists"); - staticpro (&QCdbus_request_name_reply_exists); - - QCdbus_request_name_reply_in_queue = intern_c_string (":in-queue"); - staticpro (&QCdbus_request_name_reply_in_queue); - - QCdbus_request_name_reply_already_owner = intern_c_string (":already-owner"); - staticpro (&QCdbus_request_name_reply_already_owner); - - QCdbus_timeout = intern_c_string (":timeout"); - staticpro (&QCdbus_timeout); - - QCdbus_type_byte = intern_c_string (":byte"); - staticpro (&QCdbus_type_byte); - - QCdbus_type_boolean = intern_c_string (":boolean"); - staticpro (&QCdbus_type_boolean); - - QCdbus_type_int16 = intern_c_string (":int16"); - staticpro (&QCdbus_type_int16); - - QCdbus_type_uint16 = intern_c_string (":uint16"); - staticpro (&QCdbus_type_uint16); - - QCdbus_type_int32 = intern_c_string (":int32"); - staticpro (&QCdbus_type_int32); - - QCdbus_type_uint32 = intern_c_string (":uint32"); - staticpro (&QCdbus_type_uint32); - - QCdbus_type_int64 = intern_c_string (":int64"); - staticpro (&QCdbus_type_int64); - - QCdbus_type_uint64 = intern_c_string (":uint64"); - staticpro (&QCdbus_type_uint64); - - QCdbus_type_double = intern_c_string (":double"); - staticpro (&QCdbus_type_double); - - QCdbus_type_string = intern_c_string (":string"); - staticpro (&QCdbus_type_string); - - QCdbus_type_object_path = intern_c_string (":object-path"); - staticpro (&QCdbus_type_object_path); - - QCdbus_type_signature = intern_c_string (":signature"); - staticpro (&QCdbus_type_signature); + DEFSYM (QCdbus_system_bus, ":system"); + DEFSYM (QCdbus_session_bus, ":session"); + DEFSYM (QCdbus_request_name_allow_replacement, ":allow-replacement"); + DEFSYM (QCdbus_request_name_replace_existing, ":replace-existing"); + DEFSYM (QCdbus_request_name_do_not_queue, ":do-not-queue"); + DEFSYM (QCdbus_request_name_reply_primary_owner, ":primary-owner"); + DEFSYM (QCdbus_request_name_reply_exists, ":exists"); + DEFSYM (QCdbus_request_name_reply_in_queue, ":in-queue"); + DEFSYM (QCdbus_request_name_reply_already_owner, ":already-owner"); + DEFSYM (QCdbus_timeout, ":timeout"); + DEFSYM (QCdbus_type_byte, ":byte"); + DEFSYM (QCdbus_type_boolean, ":boolean"); + DEFSYM (QCdbus_type_int16, ":int16"); + DEFSYM (QCdbus_type_uint16, ":uint16"); + DEFSYM (QCdbus_type_int32, ":int32"); + DEFSYM (QCdbus_type_uint32, ":uint32"); + DEFSYM (QCdbus_type_int64, ":int64"); + DEFSYM (QCdbus_type_uint64, ":uint64"); + DEFSYM (QCdbus_type_double, ":double"); + DEFSYM (QCdbus_type_string, ":string"); + DEFSYM (QCdbus_type_object_path, ":object-path"); + DEFSYM (QCdbus_type_signature, ":signature"); #ifdef DBUS_TYPE_UNIX_FD - QCdbus_type_unix_fd = intern_c_string (":unix-fd"); - staticpro (&QCdbus_type_unix_fd); + DEFSYM (QCdbus_type_unix_fd, ":unix-fd"); #endif - QCdbus_type_array = intern_c_string (":array"); - staticpro (&QCdbus_type_array); - - QCdbus_type_variant = intern_c_string (":variant"); - staticpro (&QCdbus_type_variant); - - QCdbus_type_struct = intern_c_string (":struct"); - staticpro (&QCdbus_type_struct); - - QCdbus_type_dict_entry = intern_c_string (":dict-entry"); - staticpro (&QCdbus_type_dict_entry); + DEFSYM (QCdbus_type_array, ":array"); + DEFSYM (QCdbus_type_variant, ":variant"); + DEFSYM (QCdbus_type_struct, ":struct"); + DEFSYM (QCdbus_type_dict_entry, ":dict-entry"); DEFVAR_LISP ("dbus-registered-buses", Vdbus_registered_buses, @@ -2357,6 +2313,9 @@ be called when a D-Bus message, which matches the key criteria, arrives (methods and signals), or a cons cell containing the value of the property. +For signals, there is also a fifth element RULE, which keeps the match +string the signal is registered with. + In the second case, the key in the hash table is the list (BUS SERIAL). BUS is either a Lisp symbol, `:system' or `:session', or a string denoting the bus address. SERIAL is the serial number of the