Fix the MODE=tinylinux build

This commit is contained in:
Justine Tunney 2023-08-19 06:56:05 -07:00
parent 965516e313
commit 610e0d95cb
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
5 changed files with 56 additions and 24 deletions

View file

@ -19,38 +19,16 @@
#include "libc/assert.h"
#include "libc/atomic.h"
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/dce.h"
#include "libc/intrin/atomic.h"
#include "libc/intrin/strace.internal.h"
#include "libc/limits.h"
#include "libc/macros.internal.h"
#include "libc/nt/accounting.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
static uint32_t __kmp32(const void *buf, size_t size) {
size_t i;
uint32_t h;
const uint32_t kPhiPrime = 0x9e3779b1;
const unsigned char *p = (const unsigned char *)buf;
for (h = i = 0; i < size; i++) h = (p[i] + h) * kPhiPrime;
return h;
}
textwindows uint32_t __synthesize_uid(void) {
char16_t buf[257];
static atomic_uint uid;
uint32_t tmp, size = ARRAYLEN(buf);
if (!(tmp = atomic_load_explicit(&uid, memory_order_acquire))) {
GetUserName(&buf, &size);
tmp = __kmp32(buf, size >> 1) & INT_MAX;
if (!tmp) ++tmp;
atomic_store_explicit(&uid, tmp, memory_order_release);
}
return tmp;
}
/**
* Returns real user id of process.
*