mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 12:18:31 +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
|
@ -7,9 +7,26 @@
|
|||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||
╚─────────────────────────────────────────────────────────────────*/
|
||||
#endif
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
|
||||
// this implementation uses cosmopolitan specific apis so that the
|
||||
// resulting program will be 28kb in size. the proper way to do it
|
||||
// though is use sysconf(_SC_NPROCESSORS_ONLN), which is humongous
|
||||
|
||||
int main() {
|
||||
kprintf("%d\n", _getcpucount());
|
||||
int count;
|
||||
if ((count = __get_cpu_count()) != -1) {
|
||||
char ibuf[12];
|
||||
FormatInt32(ibuf, count);
|
||||
tinyprint(1, ibuf, "\n", NULL);
|
||||
return 0;
|
||||
} else {
|
||||
perror("__get_cpu_count");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue