Changeset 99631 in vbox
- Timestamp:
- May 5, 2023 12:17:43 PM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/DisplayServerType.cpp
r99627 r99631 65 65 66 66 /** 67 * Tries to load a (system) library via a set of different names / versions. 68 * 69 * @returns VBox status code. 70 * @returns VERR_NOT_FOUND if the library was not found. 71 * 72 * @param apszLibs Array of library (version) names to search for. 73 * Descending order (e.g. "libfoo.so", "libfoo.so.2", "libfoo.so.2.6"). 74 * @param cLibs Number of library names in \a apszLibs. 75 * @param phLdrMod Where to return the library handle on success. 76 */ 77 static int vbghDisplayServerTryLoadLib(const char **apszLibs, size_t cLibs, PRTLDRMOD phLdrMod) 78 { 79 for (size_t i = 0; i < cLibs; i++) 80 { 81 int rc2 = RTLdrLoadSystem(apszLibs[i], /* fNoUnload = */ true, phLdrMod); 82 if (RT_SUCCESS(rc2)) 83 return VINF_SUCCESS; 84 } 85 86 return VERR_NOT_FOUND; 87 } 88 89 /** 67 90 * Tries to detect the desktop display server type the process is running in. 68 91 * … … 84 107 bool fHasWayland = false; 85 108 RTLDRMOD hWaylandClient = NIL_RTLDRMOD; 86 int rc = RTLdrLoadSystem("libwayland-client.so", /* fNoUnload = */ true, &hWaylandClient); 109 110 /* Array of libwayland-client.so versions to search for. 111 * Descending precedence. */ 112 const char* aLibsWayland[] = 113 { 114 "libwayland-client.so", 115 "libwayland-client.so.0" /* Needed for Ubuntu */ 116 }; 117 118 int rc = vbghDisplayServerTryLoadLib(aLibsWayland, RT_ELEMENTS(aLibsWayland), &hWaylandClient); 87 119 if (RT_SUCCESS(rc)) 88 120 { … … 106 138 } 107 139 140 /* Array of libX11.so versions to search for. 141 * Descending precedence. */ 142 const char* aLibsX11[] = 143 { 144 "libX11.so" 145 }; 146 108 147 /* Also try to connect to the default X11 display to determine if Xserver is running: */ 109 148 bool fHasX = false; 110 149 RTLDRMOD hX11 = NIL_RTLDRMOD; 111 rc = RTLdrLoadSystem("libX11.so", /* fNoUnload = */ true, &hX11);150 rc = vbghDisplayServerTryLoadLib(aLibsX11, RT_ELEMENTS(aLibsX11), &hX11); 112 151 if (RT_SUCCESS(rc)) 113 152 {
Note:
See TracChangeset
for help on using the changeset viewer.