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
|
@ -37,12 +37,10 @@ struct appendz appendz(char *p) {
|
|||
unassert(z.n >= W * 2 && !(z.n & (W - 1)));
|
||||
z.i = *(size_t *)(p + z.n - W);
|
||||
if (!IsTiny() && W == 8) {
|
||||
/*
|
||||
* This check should fail if an append*() function was passed a
|
||||
* pointer that was allocated manually by malloc(). Append ptrs
|
||||
* can be free()'d safely, but they need to be allocated by the
|
||||
* append library, because we write a special value to the end.
|
||||
*/
|
||||
// This check should fail if an append*() function was passed a
|
||||
// pointer that was allocated manually by malloc(). Append ptrs
|
||||
// can be free()'d safely, but they need to be allocated by the
|
||||
// append library, because we write a special value to the end.
|
||||
unassert((z.i >> 48) == APPEND_COOKIE);
|
||||
z.i &= 0x0000ffffffffffff;
|
||||
}
|
||||
|
|
|
@ -413,24 +413,6 @@ static struct dirent *readdir_zipos(DIR *dir) {
|
|||
return ent;
|
||||
}
|
||||
|
||||
static void *golden(void *a, const void *b, size_t n) {
|
||||
size_t i;
|
||||
char *volatile d = a;
|
||||
const char *volatile s = b;
|
||||
if (d > s) {
|
||||
for (i = n; i--;) {
|
||||
d[i] = s[i];
|
||||
asm volatile("" ::: "memory");
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < n; ++i) {
|
||||
d[i] = s[i];
|
||||
asm volatile("" ::: "memory");
|
||||
}
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
static struct dirent *readdir_unix(DIR *dir) {
|
||||
if (dir->buf_pos >= dir->buf_end) {
|
||||
long basep = dir->tell;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
static inline int PutsImpl(const char *s, FILE *f) {
|
||||
static inline int puts_unlocked(const char *s, FILE *f) {
|
||||
size_t n, r;
|
||||
if ((n = strlen(s))) {
|
||||
r = fwrite_unlocked(s, 1, n, f);
|
||||
|
@ -45,7 +45,7 @@ int puts(const char *s) {
|
|||
int bytes;
|
||||
f = stdout;
|
||||
flockfile(f);
|
||||
bytes = PutsImpl(s, f);
|
||||
bytes = puts_unlocked(s, f);
|
||||
funlockfile(f);
|
||||
return bytes;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue