Support thread local storage

This commit is contained in:
Justine Tunney 2022-05-16 13:20:08 -07:00
parent 91ee2b19d4
commit 55de4ca6b5
197 changed files with 1483 additions and 874 deletions

View file

@ -18,6 +18,7 @@
*/
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
@ -107,8 +108,16 @@ int LoadZipArgsImpl(int *argc, char ***argv, char *data) {
* If the special argument `...` *is* encountered, then it'll be
* replaced with whatever CLI args were specified by the user.
*
* @return 0 on success, or -1 w/ errno
* @return 0 on success, or -1 if not found w/o errno clobber
*/
int LoadZipArgs(int *argc, char ***argv) {
return LoadZipArgsImpl(argc, argv, xslurp("/zip/.args", 0));
int e;
char *p;
e = errno;
if ((p = xslurp("/zip/.args", 0))) {
return LoadZipArgsImpl(argc, argv, p);
} else {
errno = e;
return -1;
}
}