getloadavg fixed

This commit is contained in:
Your Name 2023-10-24 17:45:55 +03:00
parent 81a303cdca
commit 6aa4dcde7b
2 changed files with 0 additions and 4 deletions

View File

@ -4,12 +4,10 @@
int main(void) { int main(void) {
double avg[3] = {0, 0, 0}; double avg[3] = {0, 0, 0};
#ifndef __ANDROID__
if (getloadavg(avg, sizeof(avg) / sizeof(avg[0])) < 0) { if (getloadavg(avg, sizeof(avg) / sizeof(avg[0])) < 0) {
fprintf(stderr, "getloadavg: getloadavg() failed\n"); fprintf(stderr, "getloadavg: getloadavg() failed\n");
return 1; return 1;
} }
#endif
printf("%.2f %.2f %.2f\n", avg[0], avg[1], avg[2]); printf("%.2f %.2f %.2f\n", avg[0], avg[1], avg[2]);
} }

View File

@ -42,12 +42,10 @@ int main(void) {
/* Print 1, 5 and 15 minute load averages */ /* Print 1, 5 and 15 minute load averages */
double avg[3] = {0, 0, 0}; double avg[3] = {0, 0, 0};
#ifndef __ANDROID__
if (getloadavg(avg, sizeof(avg) / sizeof(avg[0])) < 0) { if (getloadavg(avg, sizeof(avg) / sizeof(avg[0])) < 0) {
fprintf(stderr, "getloadavg: getloadavg() failed\n"); fprintf(stderr, "getloadavg: getloadavg() failed\n");
return 1; return 1;
} }
#endif
printf(" load average: %.2f %.2f %.2f\n", avg[0], avg[1], avg[2]); printf(" load average: %.2f %.2f %.2f\n", avg[0], avg[1], avg[2]);
return 0; return 0;