fix all PIFile::readAll calls
This commit is contained in:
@@ -113,7 +113,7 @@ bool PISystemMonitor::startOnProcess(int pID, PISystemTime interval) {
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
PRIVATE->hProc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pID_);
|
PRIVATE->hProc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pID_);
|
||||||
if (PRIVATE->hProc == 0) {
|
if (PRIVATE->hProc == 0) {
|
||||||
piCoutObj << "Can`t open process with ID = %1, %2!"_tr("PISystemMonitor").arg(pID_).arg(errorString());
|
piCoutObj << "Can`t open process with ID = %1, %2!"_tr("PISystemMonitor").arg(pID_).arg(errorString());
|
||||||
return false;
|
return false;
|
||||||
@@ -130,7 +130,7 @@ bool PISystemMonitor::startOnSelf(PISystemTime interval) {
|
|||||||
bool ret = startOnProcess(PIProcess::currentPID(), interval);
|
bool ret = startOnProcess(PIProcess::currentPID(), interval);
|
||||||
cycle = -1;
|
cycle = -1;
|
||||||
#else
|
#else
|
||||||
bool ret = start(interval);
|
bool ret = start(interval);
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ void PISystemMonitor::run() {
|
|||||||
// piCout << (PRIVATE->cpu_u_cur - PRIVATE->cpu_u_prev).toMilliseconds() / delay_ms;
|
// piCout << (PRIVATE->cpu_u_cur - PRIVATE->cpu_u_prev).toMilliseconds() / delay_ms;
|
||||||
# else
|
# else
|
||||||
PRIVATE->file.seekToBegin();
|
PRIVATE->file.seekToBegin();
|
||||||
PIString str = PIString::fromAscii(PRIVATE->file.readAll(true));
|
PIString str = PIString::fromAscii(PRIVATE->file.readAll());
|
||||||
int si = str.find('(') + 1, fi = 0, cc = 1;
|
int si = str.find('(') + 1, fi = 0, cc = 1;
|
||||||
for (int i = si; i < str.size_s(); ++i) {
|
for (int i = si; i < str.size_s(); ++i) {
|
||||||
if (str[i] == '(') cc++;
|
if (str[i] == '(') cc++;
|
||||||
@@ -250,7 +250,7 @@ void PISystemMonitor::run() {
|
|||||||
// piCout << sl[0] << sl[12] << sl[13];
|
// piCout << sl[0] << sl[12] << sl[13];
|
||||||
|
|
||||||
PRIVATE->filem.seekToBegin();
|
PRIVATE->filem.seekToBegin();
|
||||||
str = PIString::fromAscii(PRIVATE->filem.readAll(true));
|
str = PIString::fromAscii(PRIVATE->filem.readAll());
|
||||||
sl = str.split(" ");
|
sl = str.split(" ");
|
||||||
if (sl.size_s() < 6) return;
|
if (sl.size_s() < 6) return;
|
||||||
tstat.virtual_memsize = sl[0].toLong() * page_size;
|
tstat.virtual_memsize = sl[0].toLong() * page_size;
|
||||||
@@ -352,12 +352,12 @@ void PISystemMonitor::gatherThread(llong id) {
|
|||||||
#ifdef MICRO_PIP
|
#ifdef MICRO_PIP
|
||||||
ts.name = tbid.value(id, "<PIThread>");
|
ts.name = tbid.value(id, "<PIThread>");
|
||||||
#else
|
#else
|
||||||
ts.name = tbid.value(id, "<non-PIThread>");
|
ts.name = tbid.value(id, "<non-PIThread>");
|
||||||
# ifndef WINDOWS
|
# ifndef WINDOWS
|
||||||
PIFile f(PRIVATE->proc_dir + "task/" + PIString::fromNumber(id) + "/stat");
|
PIFile f(PRIVATE->proc_dir + "task/" + PIString::fromNumber(id) + "/stat");
|
||||||
// piCout << f.path();
|
// piCout << f.path();
|
||||||
if (!f.open(PIIODevice::ReadOnly)) return;
|
if (!f.open(PIIODevice::ReadOnly)) return;
|
||||||
PIString str = PIString::fromAscii(f.readAll(true));
|
PIString str = PIString::fromAscii(f.readAll());
|
||||||
int si = str.find('(') + 1, fi = 0, cc = 1;
|
int si = str.find('(') + 1, fi = 0, cc = 1;
|
||||||
for (int i = si; i < str.size_s(); ++i) {
|
for (int i = si; i < str.size_s(); ++i) {
|
||||||
if (str[i] == '(') cc++;
|
if (str[i] == '(') cc++;
|
||||||
|
|||||||
@@ -1208,7 +1208,7 @@ PIVector<PISerial::DeviceInfo> PISerial::availableDevicesInfo(bool test) {
|
|||||||
# endif
|
# endif
|
||||||
PIFile file_prefixes("/proc/tty/drivers", PIIODevice::ReadOnly);
|
PIFile file_prefixes("/proc/tty/drivers", PIIODevice::ReadOnly);
|
||||||
if (file_prefixes.open()) {
|
if (file_prefixes.open()) {
|
||||||
PIString fc = PIString::fromAscii(file_prefixes.readAll(true)), line, cpref;
|
PIString fc = PIString::fromAscii(file_prefixes.readAll()), line, cpref;
|
||||||
PIStringList words;
|
PIStringList words;
|
||||||
file_prefixes.close();
|
file_prefixes.close();
|
||||||
while (!fc.isEmpty()) {
|
while (!fc.isEmpty()) {
|
||||||
@@ -1235,8 +1235,8 @@ PIVector<PISerial::DeviceInfo> PISerial::availableDevicesInfo(bool test) {
|
|||||||
for (const auto & e: de) { // TODO changes in FileInfo
|
for (const auto & e: de) { // TODO changes in FileInfo
|
||||||
for (const auto & p: prefixes) {
|
for (const auto & p: prefixes) {
|
||||||
if (e.name().startsWith(p)) {
|
if (e.name().startsWith(p)) {
|
||||||
di = DeviceInfo();
|
di = DeviceInfo();
|
||||||
di.path = e.path;
|
di.path = e.path;
|
||||||
# ifdef LINUX
|
# ifdef LINUX
|
||||||
ssize_t lsz = readlink(("/sys/class/tty/" + e.name()).dataAscii(), linkbuf, 1024);
|
ssize_t lsz = readlink(("/sys/class/tty/" + e.name()).dataAscii(), linkbuf, 1024);
|
||||||
if (lsz > 0) {
|
if (lsz > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user