Changeset 84209 in vbox for trunk/src/VBox/Additions
- Timestamp:
- May 8, 2020 12:28:20 PM (5 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
r84147 r84209 107 107 static int vgsvcGstCtrlHandleSessionOpen(PVBGLR3GUESTCTRLCMDCTX pHostCtx); 108 108 static int vgsvcGstCtrlHandleSessionClose(PVBGLR3GUESTCTRLCMDCTX pHostCtx); 109 static int vgsvcGstCtrlInvalidate(void); 109 110 static void vgsvcGstCtrlShutdown(void); 110 111 … … 205 206 if (RT_SUCCESS(rc)) 206 207 { 207 g_fControlSupportsOptimizations = VbglR3GuestCtrlSupportsOptimizations(g_idControlSvcClient); 208 if (g_fControlSupportsOptimizations) 209 rc = VbglR3GuestCtrlMakeMeMaster(g_idControlSvcClient); 208 rc = vgsvcGstCtrlInvalidate(); 210 209 if (RT_SUCCESS(rc)) 211 { 212 VGSvcVerbose(3, "Guest control service client ID=%RU32%s\n", 213 g_idControlSvcClient, g_fControlSupportsOptimizations ? " w/ optimizations" : ""); 214 215 /* 216 * Report features to the host. 217 */ 218 const uint64_t fGuestFeatures = VBOX_GUESTCTRL_GF_0_SET_SIZE 219 | VBOX_GUESTCTRL_GF_0_PROCESS_ARGV0; 220 221 rc = VbglR3GuestCtrlReportFeatures(g_idControlSvcClient, fGuestFeatures, &g_fControlHostFeatures0); 222 if (RT_SUCCESS(rc)) 223 VGSvcVerbose(3, "Host features: %#RX64\n", g_fControlHostFeatures0); 224 else 225 VGSvcVerbose(1, "Warning! Feature reporing failed: %Rrc\n", rc); 226 227 return VINF_SUCCESS; 228 } 229 VGSvcError("Failed to become guest control master: %Rrc\n", rc); 230 VbglR3GuestCtrlDisconnect(g_idControlSvcClient); 210 return rc; 231 211 } 232 212 else … … 248 228 } 249 229 230 static int vgsvcGstCtrlInvalidate(void) 231 { 232 VGSvcVerbose(1, "Invalidating configuration ...\n"); 233 234 int rc = VINF_SUCCESS; 235 236 g_fControlSupportsOptimizations = VbglR3GuestCtrlSupportsOptimizations(g_idControlSvcClient); 237 if (g_fControlSupportsOptimizations) 238 rc = VbglR3GuestCtrlMakeMeMaster(g_idControlSvcClient); 239 if (RT_SUCCESS(rc)) 240 { 241 VGSvcVerbose(3, "Guest control service client ID=%RU32%s\n", 242 g_idControlSvcClient, g_fControlSupportsOptimizations ? " w/ optimizations" : ""); 243 244 /* 245 * Report features to the host. 246 */ 247 const uint64_t fGuestFeatures = VBOX_GUESTCTRL_GF_0_SET_SIZE 248 | VBOX_GUESTCTRL_GF_0_PROCESS_ARGV0; 249 250 rc = VbglR3GuestCtrlReportFeatures(g_idControlSvcClient, fGuestFeatures, &g_fControlHostFeatures0); 251 if (RT_SUCCESS(rc)) 252 VGSvcVerbose(3, "Host features: %#RX64\n", g_fControlHostFeatures0); 253 else 254 VGSvcVerbose(1, "Warning! Feature reporing failed: %Rrc\n", rc); 255 256 return VINF_SUCCESS; 257 } 258 VGSvcError("Failed to become guest control master: %Rrc\n", rc); 259 VbglR3GuestCtrlDisconnect(g_idControlSvcClient); 260 261 return rc; 262 } 250 263 251 264 /** … … 327 340 else if (rc == VERR_VM_RESTORED) 328 341 { 329 VGSvcVerbose(1, "The VM session ID changed (i.e. restored) .\n");342 VGSvcVerbose(1, "The VM session ID changed (i.e. restored)\n"); 330 343 int rc2 = VGSvcGstCtrlSessionClose(&g_Session); 344 AssertRC(rc2); 345 346 rc2 = VbglR3GuestCtrlSessionHasChanged(g_idControlSvcClient, g_idControlSession); 347 AssertRC(rc2); 348 349 /* Invalidate the internal state to match the current host we got restored from. */ 350 rc2 = vgsvcGstCtrlInvalidate(); 331 351 AssertRC(rc2); 332 352 } -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
r84160 r84209 1852 1852 1853 1853 /** 1854 * Invalidates a guest session by updating all it's internal parameters like host features and stuff. 1855 * 1856 * @param pSession Session to invalidate. 1857 * @param idClient Client ID to use. 1858 */ 1859 static void vgsvcGstCtrlSessionInvalidate(PVBOXSERVICECTRLSESSION pSession, uint32_t idClient) 1860 { 1861 RT_NOREF(pSession); 1862 1863 VGSvcVerbose(1, "Invalidating session %RU32 (client ID=%RU32)\n", idClient, pSession->StartupInfo.uSessionID); 1864 1865 int rc2 = VbglR3GuestCtrlQueryFeatures(idClient, &g_fControlHostFeatures0); 1866 if (RT_SUCCESS(rc2)) /* Querying host features is not fatal -- do not use rc here. */ 1867 { 1868 VGSvcVerbose(1, "g_fControlHostFeatures0=%#x\n", g_fControlHostFeatures0); 1869 } 1870 else 1871 VGSvcVerbose(1, "Querying host features failed with %Rrc\n", rc2); 1872 } 1873 1874 /** 1854 1875 * Main message handler for the guest control session process. 1855 1876 * … … 1873 1894 g_idControlSvcClient = idClient; 1874 1895 1875 int rc2 = VbglR3GuestCtrlQueryFeatures(idClient, &g_fControlHostFeatures0);1876 if (RT_FAILURE(rc2)) /* Querying host features is not fatal -- do not use rc here. */ 1877 VGSvcVerbose(1, "Querying host features failed with %Rrc\n", rc2);1896 VGSvcVerbose(1, "Using client ID=%RU32\n", idClient); 1897 1898 vgsvcGstCtrlSessionInvalidate(pSession, idClient); 1878 1899 1879 1900 rc = vgsvcGstCtrlSessionReadKeyAndAccept(idClient, pSession->StartupInfo.uSessionID); 1880 1901 if (RT_SUCCESS(rc)) 1881 1902 { 1882 VGSvcVerbose(1, "Using client ID=%RU32, g_fControlHostFeatures0=%#x\n", idClient, g_fControlHostFeatures0);1883 1884 1903 /* 1885 1904 * Report started status. … … 1927 1946 /* Let others run (guests are often single CPU) ... */ 1928 1947 RTThreadYield(); 1948 } 1949 /* 1950 * Handle restore notification from host. All the context IDs (sessions, 1951 * files, proceses, etc) are invalidated by a VM restore and must be closed. 1952 */ 1953 else if (rc == VERR_VM_RESTORED) 1954 { 1955 VGSvcVerbose(1, "The VM session ID changed (i.e. restored)\n"); 1956 int rc2 = VGSvcGstCtrlSessionClose(&g_Session); 1957 AssertRC(rc2); 1958 1959 rc2 = VbglR3GuestCtrlSessionHasChanged(g_idControlSvcClient, g_idControlSvcClient); 1960 AssertRC(rc2); 1961 1962 /* Invalidate the internal state to match the current host we got restored from. */ 1963 vgsvcGstCtrlSessionInvalidate(pSession, g_idControlSvcClient); 1929 1964 } 1930 1965 else
Note:
See TracChangeset
for help on using the changeset viewer.