diff -ruN ninja-1.6.0-orig/src/util.cc ninja-1.6.0-new/src/util.cc --- ninja-1.6.0-orig/src/util.cc 2015-06-29 17:21:30.000000000 +0000 +++ ninja-1.6.0-new/src/util.cc 2015-09-29 18:25:40.593853286 +0000 @@ -570,17 +570,30 @@ } else { posix_compatible_load = -0.0; } - return posix_compatible_load; } #else double GetLoadAverage() { double loadavg[3] = { 0.0f, 0.0f, 0.0f }; +/* loadavg for uclibc on linux, actually works lib independant on all linux... */ +#if defined(__UCLIBC__) && defined(__linux__) + int fh; + char fb[16]; + if ( (fh=open("/proc/loadavg",O_RDONLY)) !=-1 ){ /* it's a pitty /proc can't be mmapped */ + if (read(fh,fb,sizeof(fb)-1)!=-1){ + fb[15]='\0'; /* ensure string termination */ + loadavg[0]=strtod(fb,NULL); /* nasty but only the first val is used anyway */ + } + close(fh); + } +#else + if (getloadavg(loadavg, 3) < 0) { // Maybe we should return an error here or the availability of // getloadavg(3) should be checked when ninja is configured. return -0.0f; } +#endif return loadavg[0]; } #endif // _WIN32