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:
Justine Tunney 2023-08-17 00:25:01 -07:00
parent eebc24b9cd
commit 3a9cac4892
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
55 changed files with 411 additions and 262 deletions

View file

@ -314,7 +314,7 @@ void PrintMakeCommand(void) {
appends(&output, "make MODE=");
appends(&output, mode);
appends(&output, " -j");
appendd(&output, buf, FormatUint64(buf, _getcpucount()) - buf);
appendd(&output, buf, FormatUint64(buf, __get_cpu_count()) - buf);
appendw(&output, ' ');
appends(&output, target);
}

View file

@ -206,8 +206,8 @@ static void Crunch(void) {
free(sources.p);
sources.p = 0;
sources.i = j;
if (!radix_sort_int64((const long *)sauces, sources.i) ||
!radix_sort_int64((const long *)edges.p, edges.i)) {
if (radix_sort_int64((const long *)sauces, sources.i) == -1 ||
radix_sort_int64((const long *)edges.p, edges.i) == -1) {
DieOom();
}
}

View file

@ -163,9 +163,9 @@ static void GetOpts(int argc, char *argv[]) {
g_fszquota = 256 * 1000 * 1000;
if (!sysinfo(&si)) {
g_memquota = si.totalram;
g_proquota = _getcpucount() + si.procs;
g_proquota = __get_cpu_count() + si.procs;
} else {
g_proquota = _getcpucount() * 100;
g_proquota = __get_cpu_count() * 100;
g_memquota = 4L * 1024 * 1024 * 1024;
}
while ((opt = getopt(argc, argv, "hnqkNVT:p:u:g:c:C:D:P:M:F:O:v:")) != -1) {

View file

@ -131,7 +131,7 @@ int LuaGetCpuCore(lua_State *L) {
}
int LuaGetCpuCount(lua_State *L) {
lua_pushinteger(L, _getcpucount());
lua_pushinteger(L, __get_cpu_count());
return 1;
}