mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 08:18:30 +00:00
Add more raw system calls to redbean
We now have execve, setitimer, sigaction, sigsuspend, and sigprocmask.
This commit is contained in:
parent
281a0f2730
commit
fb7e8ef1e6
8 changed files with 329 additions and 73 deletions
|
@ -132,6 +132,7 @@
|
|||
#include "third_party/zlib/zlib.h"
|
||||
#include "tool/build/lib/case.h"
|
||||
#include "tool/build/lib/psk.h"
|
||||
#include "tool/net/luacheck.h"
|
||||
|
||||
STATIC_STACK_SIZE(0x40000);
|
||||
STATIC_YOINK("zip_uri_support");
|
||||
|
@ -173,16 +174,6 @@ STATIC_YOINK("zip_uri_support");
|
|||
#define HeaderEqualCase(H, S) \
|
||||
SlicesEqualCase(S, strlen(S), HeaderData(H), HeaderLength(H))
|
||||
|
||||
#define AssertLuaStackIsEmpty(L) \
|
||||
do { \
|
||||
if (lua_gettop(L)) { \
|
||||
char *s = LuaFormatStack(L); \
|
||||
WARNF("lua stack should be empty!\n%s", s); \
|
||||
free(s); \
|
||||
lua_settop(L, 0); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static const uint8_t kGzipHeader[] = {
|
||||
0x1F, // MAGNUM
|
||||
0x8B, // MAGNUM
|
||||
|
@ -397,7 +388,8 @@ static uint32_t clientaddrsize;
|
|||
|
||||
static size_t zsize;
|
||||
static char *outbuf;
|
||||
static lua_State *GL, *YL;
|
||||
static lua_State *GL;
|
||||
static lua_State *YL;
|
||||
static char *content;
|
||||
static uint8_t *zmap;
|
||||
static uint8_t *zbase;
|
||||
|
@ -1041,7 +1033,7 @@ static void LogLuaError(char *hook, char *err) {
|
|||
ERRORF("(lua) failed to run %s: %s", hook, err);
|
||||
}
|
||||
|
||||
static bool LuaRunCode(const char *code) {
|
||||
static bool LuaEvalCode(const char *code) {
|
||||
lua_State *L = GL;
|
||||
int status = luaL_loadstring(L, code);
|
||||
if (status != LUA_OK || LuaCallWithTrace(L, 0, 0, NULL) != LUA_OK) {
|
||||
|
@ -1053,6 +1045,10 @@ static bool LuaRunCode(const char *code) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool LuaEvalFile(const char *path) {
|
||||
return LuaEvalCode(gc(xslurp(path, 0)));
|
||||
}
|
||||
|
||||
static bool LuaOnClientConnection(void) {
|
||||
#ifndef STATIC
|
||||
bool dropit;
|
||||
|
@ -6979,7 +6975,8 @@ static void GetOpts(int argc, char *argv[]) {
|
|||
CASE('h', PrintUsage(stdout, EXIT_SUCCESS));
|
||||
CASE('M', ProgramMaxPayloadSize(ParseInt(optarg)));
|
||||
#ifndef STATIC
|
||||
CASE('e', LuaRunCode(optarg));
|
||||
CASE('e', LuaEvalCode(optarg));
|
||||
CASE('F', LuaEvalFile(optarg));
|
||||
CASE('E', leakcrashreports = true);
|
||||
CASE('A', storeasset = true; StorePath(optarg));
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue