Changeset 85274 in vbox for trunk/src/VBox/Main/src-server/darwin
- Timestamp:
- Jul 12, 2020 1:32:28 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139251
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/darwin/PerformanceDarwin.cpp
r82968 r85274 122 122 { 123 123 *total = totalRAM; 124 *available = cb / 1024; 124 cb /= 1024; 125 *available = cb < ~(ULONG)0 ? (ULONG)cb : ~(ULONG)0; 125 126 *used = *total - *available; 126 127 } … … 131 132 { 132 133 Log7(("getProcessInfo() getting info for %d", process)); 133 int nb = proc_pidinfo(process, PROC_PIDTASKINFO, 0,tinfo, sizeof(*tinfo));134 if ( nb<= 0)134 int cbRet = proc_pidinfo((pid_t)process, PROC_PIDTASKINFO, 0, tinfo, sizeof(*tinfo)); 135 if (cbRet <= 0) 135 136 { 136 int rc= errno;137 Log(("proc_pidinfo() -> %s", strerror( rc)));138 return RTErrConvertFromDarwin( rc);137 int iErrNo = errno; 138 Log(("proc_pidinfo() -> %s", strerror(iErrNo))); 139 return RTErrConvertFromDarwin(iErrNo); 139 140 } 140 else if ((unsigned int)nb< sizeof(*tinfo))141 if ((unsigned int)cbRet < sizeof(*tinfo)) 141 142 { 142 Log(("proc_pidinfo() -> too few bytes %d", nb));143 Log(("proc_pidinfo() -> too few bytes %d", cbRet)); 143 144 return VERR_INTERNAL_ERROR; 144 145 } … … 171 172 if (RT_SUCCESS(rc)) 172 173 { 173 *used = tinfo.pti_resident_size / 1024; 174 uint64_t cKbResident = tinfo.pti_resident_size / 1024; 175 *used = cKbResident < ~(ULONG)0 ? (ULONG)cKbResident : ~(ULONG)0; 174 176 } 175 177 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.