Changeset 98099 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jan 17, 2023 9:13:37 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/linux/HostHardwareLinux.cpp
r98073 r98099 1255 1255 VECTOR_PTR(char *) vecpchDevs; 1256 1256 VEC_INIT_PTR(&vecpchDevs, char *, RTStrFree); 1257 for (;;) 1258 { 1259 rc = readFilePaths(mpcszDevicesRoot, &vecpchDevs, false); 1257 rc = readFilePaths(mpcszDevicesRoot, &vecpchDevs, false); 1258 if (RT_SUCCESS(rc)) 1259 { 1260 char **ppszEntry; 1261 VEC_FOR_EACH(&vecpchDevs, char *, ppszEntry) 1262 if (RT_FAILURE(rc = iwAddWatch(&mWatches, *ppszEntry))) 1263 break; 1264 1260 1265 if (RT_SUCCESS(rc)) 1261 1266 { 1262 char **ppszEntry; 1263 VEC_FOR_EACH(&vecpchDevs, char *, ppszEntry) 1264 if (RT_FAILURE(rc = iwAddWatch(&mWatches, *ppszEntry))) 1265 break; 1266 } 1267 if (RT_FAILURE(rc)) 1268 break; 1269 1270 struct pollfd pollFD[MAX_POLLID]; 1271 pollFD[RPIPE_ID].fd = mhWakeupPipeR; 1272 pollFD[RPIPE_ID].events = POLLIN; 1273 pollFD[INOTIFY_ID].fd = iwGetFD(&mWatches); 1274 pollFD[INOTIFY_ID].events = POLLIN | POLLERR | POLLHUP; 1275 errno = 0; 1276 int cPolled = poll(pollFD, RT_ELEMENTS(pollFD), aMillies); 1277 if (cPolled < 0) 1278 { 1279 Assert(errno > 0); 1280 rc = RTErrConvertFromErrno(errno); 1281 } 1282 else if (pollFD[RPIPE_ID].revents) 1283 { 1284 rc = drainWakeupPipe(); 1285 if (RT_SUCCESS(rc)) 1286 rc = VERR_INTERRUPTED; 1287 break; 1288 } 1289 else if (!(pollFD[INOTIFY_ID].revents)) 1290 { 1291 AssertBreakStmt(cPolled == 0, rc = VERR_INTERNAL_ERROR); 1292 rc = VERR_TIMEOUT; 1293 } 1294 Assert(errno == 0 || (RT_FAILURE(rc) && rc != VERR_TIMEOUT)); 1295 if (RT_FAILURE(rc)) 1296 break; 1297 AssertBreakStmt(cPolled == 1, rc = VERR_INTERNAL_ERROR); 1298 if (RT_FAILURE(rc = drainInotify())) 1299 break; 1267 struct pollfd pollFD[MAX_POLLID]; 1268 pollFD[RPIPE_ID].fd = mhWakeupPipeR; 1269 pollFD[RPIPE_ID].events = POLLIN; 1270 pollFD[INOTIFY_ID].fd = iwGetFD(&mWatches); 1271 pollFD[INOTIFY_ID].events = POLLIN | POLLERR | POLLHUP; 1272 errno = 0; 1273 int cPolled = poll(pollFD, RT_ELEMENTS(pollFD), aMillies); 1274 if (cPolled < 0) 1275 { 1276 Assert(errno > 0); 1277 rc = RTErrConvertFromErrno(errno); 1278 } 1279 else if (pollFD[RPIPE_ID].revents) 1280 { 1281 rc = drainWakeupPipe(); 1282 if (RT_SUCCESS(rc)) 1283 rc = VERR_INTERRUPTED; 1284 } 1285 else if ((pollFD[INOTIFY_ID].revents)) 1286 { 1287 if (cPolled == 1) 1288 rc = drainInotify(); 1289 else 1290 AssertFailedStmt(rc = VERR_INTERNAL_ERROR); 1291 } 1292 else 1293 { 1294 if (errno == 0 && cPolled == 0) 1295 rc = VERR_TIMEOUT; 1296 else 1297 AssertFailedStmt(rc = VERR_INTERNAL_ERROR); 1298 } 1299 } 1300 1300 } 1301 1301
Note:
See TracChangeset
for help on using the changeset viewer.