Changeset 16178 in vbox
- Timestamp:
- Jan 22, 2009 3:39:48 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 41924
- Location:
- trunk/src/VBox/Main
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/vbox-dbus.h
r16068 r16178 26 26 #include <stdint.h> 27 27 28 #define LIB_DBUS_1_2"libdbus-1.so.2" /* This should be compatible */29 #define LIB_DBUS_1_3"libdbus-1.so.3"28 #define VBOX_DBUS_1_2_LIB "libdbus-1.so.2" /* This should be compatible */ 29 #define VBOX_DBUS_1_3_LIB "libdbus-1.so.3" 30 30 31 31 /** Types and defines from the dbus header files which we need. These are … … 85 85 typedef void (*DBusFreeFunction) (void *); 86 86 87 /** The following are the symbols which we need from libdbus-1. */ 88 extern void (*vbox_dbus_error_init)(DBusError *); 89 inline void dbus_error_init(DBusError *error) 90 { vbox_dbus_error_init(error); } 91 extern DBusConnection *(*vbox_dbus_bus_get)(DBusBusType, DBusError *); 92 inline DBusConnection *dbus_bus_get(DBusBusType type, DBusError *error) 93 { return vbox_dbus_bus_get(type, error); } 94 extern DBusConnection *(*vbox_dbus_bus_get_private)(DBusBusType, DBusError *); 95 inline DBusConnection *dbus_bus_get_private(DBusBusType type, DBusError *error) 96 { return vbox_dbus_bus_get_private(type, error); } 97 extern void (*vbox_dbus_error_free)(DBusError *); 98 inline void dbus_error_free(DBusError *error) 99 { vbox_dbus_error_free(error); } 100 extern void (*vbox_dbus_connection_unref)(DBusConnection *); 101 inline void dbus_connection_unref(DBusConnection *connection) 102 { vbox_dbus_connection_unref(connection); } 103 extern void (*vbox_dbus_connection_close)(DBusConnection *); 104 inline void dbus_connection_close(DBusConnection *connection) 105 { vbox_dbus_connection_close(connection); } 106 extern void (*vbox_dbus_connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t); 107 inline void dbus_connection_set_exit_on_disconnect(DBusConnection *connection, dbus_bool_t boolean) 108 { vbox_dbus_connection_set_exit_on_disconnect(connection, boolean); } 109 extern dbus_bool_t (*vbox_dbus_bus_name_has_owner)(DBusConnection *, const char *, 110 DBusError *); 111 inline dbus_bool_t dbus_bus_name_has_owner(DBusConnection *connection, const char *string, 112 DBusError *error) 113 { return vbox_dbus_bus_name_has_owner(connection, string, error); } 114 extern void (*vbox_dbus_bus_add_match)(DBusConnection *, const char *, DBusError *); 115 inline void dbus_bus_add_match(DBusConnection *connection, const char *string, DBusError *error) 116 { vbox_dbus_bus_add_match(connection, string, error); } 117 extern void (*vbox_dbus_bus_remove_match)(DBusConnection *, const char *, DBusError *); 118 inline void dbus_bus_remove_match(DBusConnection *connection, const char *string, DBusError *error) 119 { vbox_dbus_bus_remove_match(connection, string, error); } 120 extern void (*vbox_dbus_message_unref)(DBusMessage *); 121 inline void dbus_message_unref(DBusMessage *message) 122 { vbox_dbus_message_unref(message); } 123 extern DBusMessage* (*vbox_dbus_message_new_method_call)(const char *, const char *, 124 const char *, const char *); 125 inline DBusMessage* dbus_message_new_method_call(const char *string1, const char *string2, 126 const char *string3, const char *string4) 127 { return vbox_dbus_message_new_method_call(string1, string2, string3, string4); } 128 extern void (*vbox_dbus_message_iter_init_append)(DBusMessage *, DBusMessageIter *); 129 inline void dbus_message_iter_init_append(DBusMessage *message, DBusMessageIter *iter) 130 { vbox_dbus_message_iter_init_append(message, iter); } 131 extern dbus_bool_t (*vbox_dbus_message_iter_append_basic)(DBusMessageIter *, int, 132 const void *); 133 inline dbus_bool_t dbus_message_iter_append_basic(DBusMessageIter *iter, int val, 134 const void *string) 135 { return vbox_dbus_message_iter_append_basic(iter, val, string); } 136 extern DBusMessage * (*vbox_dbus_connection_send_with_reply_and_block)(DBusConnection *, 137 DBusMessage *, int, 138 DBusError *error); 139 inline DBusMessage * dbus_connection_send_with_reply_and_block(DBusConnection *connection, 140 DBusMessage *message, int val, 141 DBusError *error) 142 { return vbox_dbus_connection_send_with_reply_and_block(connection, message, val, error); } 143 extern dbus_bool_t (*vbox_dbus_message_iter_init) (DBusMessage *, DBusMessageIter *); 144 inline dbus_bool_t dbus_message_iter_init(DBusMessage *message, DBusMessageIter *iter) 145 { return vbox_dbus_message_iter_init(message, iter); } 146 extern int (*vbox_dbus_message_iter_get_arg_type) (DBusMessageIter *); 147 inline int dbus_message_iter_get_arg_type(DBusMessageIter *iter) 148 { return vbox_dbus_message_iter_get_arg_type(iter); } 149 extern int (*vbox_dbus_message_iter_get_element_type) (DBusMessageIter *); 150 inline int dbus_message_iter_get_element_type(DBusMessageIter *iter) 151 { return vbox_dbus_message_iter_get_element_type(iter); } 152 extern void (*vbox_dbus_message_iter_recurse) (DBusMessageIter *, DBusMessageIter *); 153 inline void dbus_message_iter_recurse(DBusMessageIter *iter1, DBusMessageIter *iter2) 154 { vbox_dbus_message_iter_recurse(iter1, iter2); } 155 extern void (*vbox_dbus_message_iter_get_basic) (DBusMessageIter *, void *); 156 inline void dbus_message_iter_get_basic(DBusMessageIter *iter, void *pvoid) 157 { vbox_dbus_message_iter_get_basic(iter, pvoid); } 158 extern dbus_bool_t (*vbox_dbus_message_iter_next) (DBusMessageIter *); 159 inline dbus_bool_t dbus_message_iter_next(DBusMessageIter *iter) 160 { return vbox_dbus_message_iter_next(iter); } 161 extern dbus_bool_t (*vbox_dbus_connection_add_filter) (DBusConnection *, DBusHandleMessageFunction, 162 void *, DBusFreeFunction); 163 inline dbus_bool_t dbus_connection_add_filter(DBusConnection *connection, 164 DBusHandleMessageFunction function1, 165 void *pvoid, DBusFreeFunction function2) 166 { return vbox_dbus_connection_add_filter(connection, function1, pvoid, function2); } 167 extern void (*vbox_dbus_connection_remove_filter) (DBusConnection *, DBusHandleMessageFunction, 168 void *); 169 inline void dbus_connection_remove_filter(DBusConnection *connection, 170 DBusHandleMessageFunction function, void *pvoid) 171 { vbox_dbus_connection_remove_filter(connection, function, pvoid); } 172 extern dbus_bool_t (*vbox_dbus_connection_read_write_dispatch) (DBusConnection *, int); 173 inline dbus_bool_t dbus_connection_read_write_dispatch(DBusConnection *connection, int val) 174 { return vbox_dbus_connection_read_write_dispatch(connection, val); } 175 extern dbus_bool_t (*vbox_dbus_message_is_signal) (DBusMessage *, const char *, const char *); 176 inline dbus_bool_t dbus_message_is_signal(DBusMessage *message, const char *string1, const char *string2) 177 { return vbox_dbus_message_is_signal(message, string1, string2); } 178 extern DBusMessage *(*vbox_dbus_connection_pop_message)(DBusConnection *); 179 inline DBusMessage *dbus_connection_pop_message(DBusConnection *connection) 180 { return vbox_dbus_connection_pop_message(connection); } 87 /* Declarations of the functions that we need from libdbus-1 */ 88 #define VBOX_PROXY_STUB(function, rettype, signature, shortsig) \ 89 extern rettype ( function ) signature ; 90 91 #include "vbox-dbus-internal.h" 92 93 #undef VBOX_PROXY_STUB 181 94 182 95 /** 183 * Checks whether libdbus is present and if so loads all symbols we need. This 184 * should be called before making any calls to libdbus if that library is being 185 * loaded at runtime. 186 * @returns true if libdbus was found, false otherwise. 96 * Try to dynamically load the DBus library. This function should be called 97 * before attempting to use any of the DBus functions. It is safe to call this 98 * function multiple times. 99 * 100 * @returns iprt status code 187 101 */ 188 extern bool VBoxDBusCheckPresence(void); 189 /** Wrapper around dbus_connection_unref. We need this to use it as a free 190 * function in auto pointers, as a function pointer won't wash here. */ 191 extern void VBoxDBusConnectionUnref(DBusConnection *pConnection); 192 /** Wrapper around dbus_message_unref. We need this to use it as a free 193 * function in auto pointers, as a function pointer won't wash here. */ 194 extern void VBoxDBusMessageUnref(DBusMessage *pMessage); 102 extern int VBoxLoadDBusLib(void); 195 103 196 104 #endif /* ____H_VBOX_DBUS not defined */ -
trunk/src/VBox/Main/linux/HostHardwareLinux.cpp
r16137 r16178 79 79 extern void VBoxHalShutdown (DBusConnection *pConnection); 80 80 extern void VBoxHalShutdownPrivate (DBusConnection *pConnection); 81 extern void VBoxDBusConnectionUnref(DBusConnection *pConnection); 82 extern void VBoxDBusConnectionCloseAndUnref(DBusConnection *pConnection); 83 extern void VBoxDBusMessageUnref(DBusMessage *pMessage); 81 84 82 85 static int halInit(RTMemAutoPtr <DBusConnection, VBoxHalShutdown> *pConnection); … … 109 112 #if defined(RT_OS_LINUX) 110 113 #ifdef VBOX_WITH_DBUS 111 if (RT_SUCCESS (rc) && VBoxDBusCheckPresence() && (!success || testing()))114 if (RT_SUCCESS (rc) && RT_SUCCESS(VBoxLoadDBusLib()) && (!success || testing())) 112 115 rc = getDriveInfoFromHal(&mDVDList, true /* isDVD */, &success); 113 116 #endif /* VBOX_WITH_DBUS defined */ … … 154 157 #if defined(RT_OS_LINUX) 155 158 #ifdef VBOX_WITH_DBUS 156 if (RT_SUCCESS (rc) && VBoxDBusCheckPresence() && (!success || testing())) 159 if ( RT_SUCCESS (rc) 160 && RT_SUCCESS(VBoxLoadDBusLib()) 161 && (!success || testing())) 157 162 rc = getDriveInfoFromHal(&mFloppyList, false /* isDVD */, &success); 158 163 #endif /* VBOX_WITH_DBUS defined */ … … 197 202 #if defined(RT_OS_LINUX) 198 203 #ifdef VBOX_WITH_DBUS 199 if (RT_SUCCESS (rc) && VBoxDBusCheckPresence() && (!success || testing())) 204 if ( RT_SUCCESS (rc) 205 && RT_SUCCESS(VBoxLoadDBusLib()) 206 && (!success || testing())) 200 207 rc = getUSBDeviceInfoFromHal(&mDeviceList, &halSuccess); 201 208 /* Try the old API if the new one *succeeded* as only one of them will … … 226 233 /** A flag to say that we wish to interrupt the current wait. */ 227 234 bool mInterrupt; 235 /** Constructor */ 236 Context() : mTriggered(false), mInterrupt(false) {} 228 237 #endif /* defined RT_OS_LINUX && defined VBOX_WITH_DBUS */ 229 238 }; … … 238 247 int rc = VINF_SUCCESS; 239 248 240 if (VBoxDBusCheckPresence())241 {242 mContext = new Context;249 mContext = new Context; 250 if (RT_SUCCESS(VBoxLoadDBusLib())) 251 { 243 252 for (unsigned i = 0; RT_SUCCESS(rc) && i < 5 && !mContext->mConnection; ++i) 244 253 { … … 617 626 autoDBusError dbusError; 618 627 619 RTMemAutoPtr <DBusConnection, VBoxDBusConnection Unref> dbusConnection;628 RTMemAutoPtr <DBusConnection, VBoxDBusConnectionCloseAndUnref> dbusConnection; 620 629 dbusConnection = dbus_bus_get_private (DBUS_BUS_SYSTEM, &dbusError.get()); 621 630 if (!dbusConnection) … … 650 659 * @param pConnection the connection handle 651 660 */ 652 /* static*/661 /* extern */ 653 662 void VBoxHalShutdown (DBusConnection *pConnection) 654 663 { … … 672 681 * @param pConnection the connection handle 673 682 */ 674 /* static*/683 /* extern */ 675 684 void VBoxHalShutdownPrivate (DBusConnection *pConnection) 676 685 { … … 689 698 LogFlowFunc(("returning\n")); 690 699 dbusError.FlowLog(); 700 } 701 702 /** Wrapper around dbus_connection_unref. We need this to use it as a real 703 * function in auto pointers, as a function pointer won't wash here. */ 704 /* extern */ 705 void VBoxDBusConnectionUnref(DBusConnection *pConnection) 706 { 707 dbus_connection_unref(pConnection); 708 } 709 710 /** 711 * This function closes and unrefs a private connection to dbus. It should 712 * only be called once no-one else is referencing the connection. 713 */ 714 /* extern */ 715 void VBoxDBusConnectionCloseAndUnref(DBusConnection *pConnection) 716 { 717 dbus_connection_close(pConnection); 718 dbus_connection_unref(pConnection); 719 } 720 721 /** Wrapper around dbus_message_unref. We need this to use it as a real 722 * function in auto pointers, as a function pointer won't wash here. */ 723 /* extern */ 724 void VBoxDBusMessageUnref(DBusMessage *pMessage) 725 { 726 dbus_message_unref(pMessage); 691 727 } 692 728 -
trunk/src/VBox/Main/linux/vbox-dbus.cpp
r16006 r16178 23 23 #include "vbox-dbus.h" 24 24 25 #include <iprt/err.h> 25 #define LOG_GROUP LOG_GROUP_MAIN 26 #include <VBox/log.h> 27 #include <VBox/err.h> 28 26 29 #include <iprt/ldr.h> 27 28 /** 29 * Whether we have tried to load libdbus-1 yet. This flag should only be set 30 * to "true" after we have either loaded the library and all symbols which we 31 * need, or failed to load something and unloaded and set back to zero 32 * pLibDBus. 33 */ 34 static bool gCheckedForLibDBus = false; 35 /** 36 * Pointer to the libdbus-1 shared object. This should only be set once all 37 * needed libraries and symbols have been successfully loaded. 38 */ 39 static RTLDRMOD ghLibDBus = NULL; 30 #include <iprt/assert.h> 31 #include <iprt/once.h> 40 32 41 33 /** The following are the symbols which we need from libdbus. */ 42 void (*vbox_dbus_error_init)(DBusError *); 43 DBusConnection *(*vbox_dbus_bus_get)(DBusBusType, DBusError *); 44 DBusConnection *(*vbox_dbus_bus_get_private)(DBusBusType, DBusError *); 45 void (*vbox_dbus_error_free)(DBusError *); 46 void (*vbox_dbus_connection_unref)(DBusConnection *); 47 void (*vbox_dbus_connection_close)(DBusConnection *); 48 void (*vbox_dbus_connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t); 49 dbus_bool_t (*vbox_dbus_bus_name_has_owner)(DBusConnection *, const char *, 50 DBusError *); 51 void (*vbox_dbus_bus_add_match)(DBusConnection *, const char *, DBusError *); 52 void (*vbox_dbus_bus_remove_match)(DBusConnection *, const char *, DBusError *); 53 void (*vbox_dbus_message_unref)(DBusMessage *); 54 DBusMessage* (*vbox_dbus_message_new_method_call)(const char *, const char *, 55 const char *, const char *); 56 void (*vbox_dbus_message_iter_init_append)(DBusMessage *, DBusMessageIter *); 57 dbus_bool_t (*vbox_dbus_message_iter_append_basic)(DBusMessageIter *, int, 58 const void *); 59 DBusMessage * (*vbox_dbus_connection_send_with_reply_and_block)(DBusConnection *, 60 DBusMessage *, int, 61 DBusError *error); 62 dbus_bool_t (*vbox_dbus_message_iter_init) (DBusMessage *, DBusMessageIter *); 63 int (*vbox_dbus_message_iter_get_arg_type) (DBusMessageIter *); 64 int (*vbox_dbus_message_iter_get_element_type) (DBusMessageIter *); 65 void (*vbox_dbus_message_iter_recurse) (DBusMessageIter *, DBusMessageIter *); 66 void (*vbox_dbus_message_iter_get_basic) (DBusMessageIter *, void *); 67 dbus_bool_t (*vbox_dbus_message_iter_next) (DBusMessageIter *); 68 dbus_bool_t (*vbox_dbus_connection_add_filter) (DBusConnection *, DBusHandleMessageFunction, 69 void *, DBusFreeFunction); 70 void (*vbox_dbus_connection_remove_filter) (DBusConnection *, DBusHandleMessageFunction, 71 void *); 72 dbus_bool_t (*vbox_dbus_connection_read_write_dispatch) (DBusConnection *, int); 73 dbus_bool_t (*vbox_dbus_message_is_signal) (DBusMessage *, const char *, const char *); 74 DBusMessage *(*vbox_dbus_connection_pop_message)(DBusConnection *); 34 #define VBOX_PROXY_STUB(function, rettype, signature, shortsig) \ 35 void (*function ## _fn)(void); \ 36 rettype function signature \ 37 { return ( (rettype (*) signature) function ## _fn ) shortsig; } 75 38 76 bool VBoxDBusCheckPresence(void) 39 #include "vbox-dbus-internal.h" 40 41 static int32_t loadDBusLibOnce(void *, void *); 42 43 #undef VBOX_PROXY_STUB 44 45 /* Now comes a table of functions to be loaded from libdbus-1 */ 46 typedef struct 77 47 { 78 RTLDRMOD hLibDBus; 48 const char *name; 49 void (**fn)(void); 50 } SHARED_FUNC; 79 51 80 if (ghLibDBus != 0 && gCheckedForLibDBus == true) 81 return true; 82 if (gCheckedForLibDBus == true) 83 return false; 84 if ( !RT_SUCCESS(RTLdrLoad(LIB_DBUS_1_3, &hLibDBus)) 85 && !RT_SUCCESS(RTLdrLoad(LIB_DBUS_1_2, &hLibDBus))) 86 { 87 return false; 88 } 89 if ( RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_error_init", 90 (void **) &vbox_dbus_error_init)) 91 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_bus_get", 92 (void **) &vbox_dbus_bus_get)) 93 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_bus_get_private", 94 (void **) &vbox_dbus_bus_get_private)) 95 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_error_free", 96 (void **) &vbox_dbus_error_free)) 97 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_connection_unref", 98 (void **) &vbox_dbus_connection_unref)) 99 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_connection_close", 100 (void **) &vbox_dbus_connection_close)) 101 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_connection_set_exit_on_disconnect", 102 (void **) &vbox_dbus_connection_set_exit_on_disconnect)) 103 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_bus_name_has_owner", 104 (void **) &vbox_dbus_bus_name_has_owner)) 105 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_bus_add_match", 106 (void **) &vbox_dbus_bus_add_match)) 107 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_bus_remove_match", 108 (void **) &vbox_dbus_bus_remove_match)) 109 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_message_unref", 110 (void **) &vbox_dbus_message_unref)) 111 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_message_new_method_call", 112 (void **) &vbox_dbus_message_new_method_call)) 113 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_message_iter_init_append", 114 (void **) &vbox_dbus_message_iter_init_append)) 115 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_message_iter_append_basic", 116 (void **) &vbox_dbus_message_iter_append_basic)) 117 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_connection_send_with_reply_and_block", 118 (void **) &vbox_dbus_connection_send_with_reply_and_block)) 119 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_message_iter_init", 120 (void **) &vbox_dbus_message_iter_init)) 121 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_message_iter_get_arg_type", 122 (void **) &vbox_dbus_message_iter_get_arg_type)) 123 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_message_iter_get_element_type", 124 (void **) &vbox_dbus_message_iter_get_element_type)) 125 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_message_iter_recurse", 126 (void **) &vbox_dbus_message_iter_recurse)) 127 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_message_iter_get_basic", 128 (void **) &vbox_dbus_message_iter_get_basic)) 129 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_message_iter_next", 130 (void **) &vbox_dbus_message_iter_next)) 131 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_connection_add_filter", 132 (void **) &vbox_dbus_connection_add_filter)) 133 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_connection_remove_filter", 134 (void **) &vbox_dbus_connection_remove_filter)) 135 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_connection_read_write_dispatch", 136 (void **) &vbox_dbus_connection_read_write_dispatch)) 137 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_message_is_signal", 138 (void **) &vbox_dbus_message_is_signal)) 139 && RT_SUCCESS(RTLdrGetSymbol(hLibDBus, "dbus_connection_pop_message", 140 (void **) &vbox_dbus_connection_pop_message)) 141 ) 142 { 143 ghLibDBus = hLibDBus; 144 gCheckedForLibDBus = true; 145 return true; 146 } 147 else 148 { 149 RTLdrClose(hLibDBus); 150 gCheckedForLibDBus = true; 151 return false; 152 } 52 #define VBOX_PROXY_STUB(s, dummy1, dummy2, dummy3 ) { #s , & s ## _fn } , 53 static SHARED_FUNC SharedFuncs[] = 54 { 55 #include "vbox-dbus-internal.h" 56 { NULL, NULL } 57 }; 58 #undef VBOX_PROXY_STUB 59 60 /* extern */ 61 int VBoxLoadDBusLib(void) 62 { 63 static RTONCE sOnce = RTONCE_INITIALIZER; 64 65 LogFlowFunc(("\n")); 66 int rc = RTOnce (&sOnce, loadDBusLibOnce, NULL, NULL); 67 LogFlowFunc(("rc = %Rrc\n", rc)); 68 return rc; 153 69 } 154 70 155 void VBoxDBusConnectionUnref(DBusConnection *pConnection) 71 /* The function which does the actual work for VBoxLoadDBusLib, serialised for 72 * thread safety. */ 73 static int32_t loadDBusLibOnce(void *, void *) 156 74 { 157 dbus_connection_unref(pConnection); 75 int rc = VINF_SUCCESS; 76 RTLDRMOD hLib; 77 78 LogFlowFunc(("\n")); 79 rc = RTLdrLoad(VBOX_DBUS_1_2_LIB, &hLib); 80 if (RT_FAILURE(rc)) 81 rc = RTLdrLoad(VBOX_DBUS_1_3_LIB, &hLib); 82 if (RT_FAILURE(rc)) 83 LogRelFunc(("Failed to load library %s or %s\n", 84 VBOX_DBUS_1_2_LIB, VBOX_DBUS_1_3_LIB)); 85 for (unsigned i = 0; RT_SUCCESS(rc) && SharedFuncs[i].name != NULL; ++i) 86 rc = RTLdrGetSymbol(hLib, SharedFuncs[i].name, (void**)SharedFuncs[i].fn); 87 LogFlowFunc(("rc = %Rrc\n", rc)); 88 return rc; 158 89 } 159 90 160 void VBoxDBusMessageUnref(DBusMessage *pMessage)161 {162 dbus_message_unref(pMessage);163 }164 -
trunk/src/VBox/Main/testcase/tstHostHardwareLinux.cpp
r15465 r16178 36 36 #include <errno.h> 37 37 #include <string.h> 38 #include <stdlib.h> 38 39 39 40 int main() … … 133 134 RTPrintf ("Waiting for hotplug events. Note that DBus often seems to deliver duplicate events in close succession.\n"); 134 135 RTPrintf ("Waiting for a hotplug event for five seconds...\n"); 135 waiter.Wait (5000); 136 if (RT_FAILURE(waiter.Wait (5000))) 137 { 138 RTPrintf("Failed!\n"); 139 exit(1); 140 } 136 141 RTPrintf ("Waiting for a hotplug event, Ctrl-C to abort...\n"); 137 waiter.Wait(RT_INDEFINITE_WAIT); 142 if (RT_FAILURE(waiter.Wait(RT_INDEFINITE_WAIT))) 143 { 144 RTPrintf("Failed!\n"); 145 exit(1); 146 } 138 147 #endif /* VBOX_USB_WITH_SYSFS */ 139 148 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.