Changeset 1d2a1a9 in mainline for uspace/lib/posix/stdlib.c
- Timestamp:
- 2011-08-17T20:44:32Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0cc32f2
- Parents:
- bb285b4 (diff), c53a705 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/stdlib.c
rbb285b4 r1d2a1a9 49 49 #include "libc/str.h" 50 50 #include "libc/vfs/vfs.h" 51 #include "libc/stats.h" 51 52 52 53 /** … … 473 474 * Get system load average statistics. 474 475 * 475 * Not supported. Always returns -1.476 *477 476 * @param loadavg Array where the load averages shall be placed. 478 477 * @param nelem Maximum number of elements to be placed into the array. … … 481 480 int bsd_getloadavg(double loadavg[], int nelem) 482 481 { 483 return -1; 482 assert(nelem > 0); 483 484 size_t count; 485 load_t *loads = stats_get_load(&count); 486 487 if (loads == NULL) { 488 return -1; 489 } 490 491 if (((size_t) nelem) < count) { 492 count = nelem; 493 } 494 495 for (size_t i = 0; i < count; ++i) { 496 loadavg[i] = (double) loads[i]; 497 } 498 499 free(loads); 500 return count; 484 501 } 485 502
Note:
See TracChangeset
for help on using the changeset viewer.