mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 11:18:30 +00:00
Fix small matters and improve sysconf()
- Fix mkdeps.com out of memory error - Remove static memory from __get_cpu_count() - Add support for passing hyphen to cat in cocmd - Change more ZipOS errors from ENOTSUP to EROFS - Specify mem_unit in sysinfo() output on BSD OSes
This commit is contained in:
parent
eebc24b9cd
commit
3a9cac4892
55 changed files with 411 additions and 262 deletions
|
@ -18,6 +18,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/sysinfo.h"
|
||||
#include "libc/calls/struct/sysinfo.internal.h"
|
||||
#include "libc/calls/syscall-nt.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
|
@ -40,7 +41,7 @@ struct loadavg {
|
|||
* @raise ENOSYS on metal
|
||||
*/
|
||||
int getloadavg(double *a, int n) {
|
||||
/* cat /proc/loadavg */
|
||||
// cat /proc/loadavg
|
||||
int i, rc;
|
||||
if (n > 3) n = 3;
|
||||
if (!n) {
|
||||
|
@ -51,7 +52,7 @@ int getloadavg(double *a, int n) {
|
|||
return sys_getloadavg_nt(a, n);
|
||||
} else if (IsLinux()) {
|
||||
struct sysinfo si;
|
||||
if ((rc = sysinfo(&si)) != -1) {
|
||||
if ((rc = sys_sysinfo(&si)) != -1) {
|
||||
for (i = 0; i < n; i++) {
|
||||
a[i] = 1. / 65536 * si.loads[i];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue