Changeset 59436 in vbox
- Timestamp:
- Jan 22, 2016 1:58:58 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/darwin/iokit.cpp
r59374 r59436 48 48 #include <iprt/process.h> 49 49 #include <iprt/assert.h> 50 #include <iprt/system.h> 50 51 #include <iprt/thread.h> 51 52 #include <iprt/uuid.h> 52 #include <iprt/system.h>53 53 #ifdef STANDALONE_TESTCASE 54 54 # include <iprt/initterm.h> … … 85 85 #define VBOX_OSX_EL_CAPTIAN_VER 15 86 86 87 87 88 /********************************************************************************************************************************* 88 89 * Global Variables * … … 91 92 static mach_port_t g_MasterPort = NULL; 92 93 /** Major darwin version as returned by uname -r. */ 93 uint32_t g_uMajorDarwin = 0;94 static uint32_t g_uMajorDarwin = 0; 94 95 95 96 … … 107 108 108 109 /* Get the darwin version we are running on. */ 109 char aszVersion[16] = { 0 };110 int rc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, & aszVersion[0], sizeof(aszVersion));110 char szVersion[64]; 111 int rc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, &szVersion[0], sizeof(szVersion)); 111 112 if (RT_SUCCESS(rc)) 112 113 { 113 /* Make sure it is zero terminated (paranoia). */ 114 aszVersion[15] = '\0'; 115 rc = RTStrToUInt32Ex(&aszVersion[0], NULL, 10, &g_uMajorDarwin); 116 if ( rc != VINF_SUCCESS 117 && rc != VWRN_TRAILING_CHARS) 118 LogRel(("IOKit: Failed to convert the major part of the version string \"%s\" into an integer\n", &aszVersion[0])); 114 rc = RTStrToUInt32Ex(&szVersion[0], NULL, 10, &g_uMajorDarwin); 115 AssertLogRelMsg(rc == VINF_SUCCESS || rc == VWRN_TRAILING_CHARS, 116 ("Failed to convert the major part of the version string '%s' into an integer: %Rrc\n", 117 szVersion, rc)); 119 118 } 120 119 else 121 LogRel(("IOKit:Failed to query the OS release version with %Rrc\n", rc));120 AssertLogRelMsgFailed(("Failed to query the OS release version with %Rrc\n", rc)); 122 121 } 123 122 return true; … … 498 497 { 499 498 io_object_t Child; 500 while ((Child = IOIteratorNext(Children)) )499 while ((Child = IOIteratorNext(Children)) != IO_OBJECT_NULL) 501 500 { 502 501 darwinDumpObjInt(Child, cIndents + 4); … … 555 554 { 556 555 io_object_t Object; 557 while ((Object = IOIteratorNext(pIterator)) )556 while ((Object = IOIteratorNext(pIterator)) != IO_OBJECT_NULL) 558 557 { 559 558 DARWIN_IOKIT_DUMP_OBJ(Object); … … 730 729 return NULL; 731 730 io_object_t Child; 732 while ((Child = IOIteratorNext(Children)) )731 while ((Child = IOIteratorNext(Children)) != IO_OBJECT_NULL) 733 732 { 734 733 krc = IOObjectGetClass(Child, pszNameBuf); … … 788 787 } 789 788 789 790 790 /** 791 791 * Finds the matching IOUSBHostDevice registry entry for the given legacy USB device interface (IOUSBDevice). … … 825 825 */ 826 826 io_object_t USBDevice; 827 while ((USBDevice = IOIteratorNext(USBDevices)) != 0)827 while ((USBDevice = IOIteratorNext(USBDevices)) != IO_OBJECT_NULL) 828 828 { 829 829 DARWIN_IOKIT_DUMP_OBJ(USBDevice); … … 851 851 } 852 852 853 853 854 static bool darwinUSBDeviceIsGrabbedDetermineState(PUSBDEVICE pCur, io_object_t USBDevice) 854 855 { … … 866 867 RTPROCESS Client = NIL_RTPROCESS; 867 868 io_object_t Interface; 868 while ((Interface = IOIteratorNext(Interfaces)) != 0)869 while ((Interface = IOIteratorNext(Interfaces)) != IO_OBJECT_NULL) 869 870 { 870 871 io_name_t szName; … … 903 904 } 904 905 906 905 907 /** 906 908 * Worker for determining the USB device state for devices which are not captured by the VBoxUSB driver … … 926 928 bool fSeizable = true; 927 929 io_object_t Interface; 928 while ((Interface = IOIteratorNext(Interfaces)) != 0)930 while ((Interface = IOIteratorNext(Interfaces)) != IO_OBJECT_NULL) 929 931 { 930 932 io_name_t szName; … … 945 947 { 946 948 io_object_t Child1; 947 while ((Child1 = IOIteratorNext(Children1)) != 0)949 while ((Child1 = IOIteratorNext(Children1)) != IO_OBJECT_NULL) 948 950 { 949 951 krc = IOObjectGetClass(Child1, szName); … … 995 997 } 996 998 999 997 1000 /** 998 1001 * Worker function for DarwinGetUSBDevices() that tries to figure out … … 1029 1032 if (g_uMajorDarwin >= VBOX_OSX_EL_CAPTIAN_VER) 1030 1033 { 1031 io_object_t IOUSBDeviceNew = 0; 1032 1034 io_object_t IOUSBDeviceNew = IO_OBJECT_NULL; 1033 1035 io_object_t krc = darwinGetUSBHostDeviceFromLegacyDevice(USBDevice, &IOUSBDeviceNew); 1034 1036 if ( krc == KERN_SUCCESS 1035 && IOUSBDeviceNew != 0)1037 && IOUSBDeviceNew != IO_OBJECT_NULL) 1036 1038 { 1037 1039 darwinDetermineUSBDeviceStateWorker(pCur, IOUSBDeviceNew); … … 1077 1079 unsigned i = 0; 1078 1080 io_object_t USBDevice; 1079 while ((USBDevice = IOIteratorNext(USBDevices)) != 0)1081 while ((USBDevice = IOIteratorNext(USBDevices)) != IO_OBJECT_NULL) 1080 1082 { 1081 1083 DARWIN_IOKIT_DUMP_OBJ(USBDevice); … … 1335 1337 unsigned cMatches = 0; 1336 1338 io_object_t USBDevice; 1337 while ((USBDevice = IOIteratorNext(USBDevices)) )1339 while ((USBDevice = IOIteratorNext(USBDevices)) != IO_OBJECT_NULL) 1338 1340 { 1339 1341 cMatches++; … … 1477 1479 unsigned i = 0; 1478 1480 io_object_t DVDService; 1479 while ((DVDService = IOIteratorNext(DVDServices)) != 0)1481 while ((DVDService = IOIteratorNext(DVDServices)) != IO_OBJECT_NULL) 1480 1482 { 1481 1483 DARWIN_IOKIT_DUMP_OBJ(DVDService); … … 1633 1635 PDARWINETHERNIC pTail = NULL; 1634 1636 io_object_t EtherIfService; 1635 while ((EtherIfService = IOIteratorNext(EtherIfServices)) != 0)1637 while ((EtherIfService = IOIteratorNext(EtherIfServices)) != IO_OBJECT_NULL) 1636 1638 { 1637 1639 /*
Note:
See TracChangeset
for help on using the changeset viewer.