cleanup, docs

This commit is contained in:
root
2026-06-16 23:02:45 +00:00
parent ea08d5f28b
commit b8b56cf3dd
160 changed files with 1076 additions and 511 deletions
+14 -14
View File
@@ -179,7 +179,7 @@ String file_pread(u64 h, u64 offset, u64 len)
}
u64 file_write(u64 h, String data) { return(uce_host_file_handle_write(h, data.data(), data.size())); }
u64 file_pwrite(u64 h, u64 offset, String data) { return(uce_host_file_handle_pwrite(h, offset, data.data(), data.size())); }
s64 file_seek(u64 h, s64 offset, int whence) { return((s64)uce_host_file_handle_seek(h, offset, whence)); }
s64 file_seek(u64 h, s64 offset, s64 whence) { return((s64)uce_host_file_handle_seek(h, offset, (int)whence)); }
s64 file_tell(u64 h) { return((s64)uce_host_file_handle_tell(h)); }
void file_close(u64 h) { uce_host_file_handle_close(h); }
static DValue wasm_decode_dvalue_result(String encoded)
@@ -352,10 +352,10 @@ String process_start_directory()
cwd.resize(got <= required ? got : 0);
return(cwd);
}
time_t file_mtime(String file_name)
u64 file_mtime(String file_name)
{
String current = wasm_current_unit_file();
return((time_t)uce_host_file_mtime(file_name.data(), file_name.size(), current.data(), current.size()));
return((u64)uce_host_file_mtime(file_name.data(), file_name.size(), current.data(), current.size()));
}
void file_unlink(String file_name)
{
@@ -447,9 +447,9 @@ u64 time_parse(String time_String)
{
return(int_val(trim(shell_exec("date -u -d " + shell_escape(time_String) + " +'%s'"))));
}
u64 socket_connect(String host, short port)
u64 socket_connect(String host, u16 port)
{
return(uce_host_socket_connect(host.data(), host.size(), port));
return(uce_host_socket_connect(host.data(), host.size(), (int)port));
}
void socket_close(u64 sockfd) { uce_host_socket_close(sockfd); }
bool socket_write(u64 sockfd, String data)
@@ -527,7 +527,7 @@ String backtrace_capture(u32 max_frames, u32 skip_frames)
trace.resize(got <= required ? got : 0);
return(trace);
}
String signal_name(int sig)
String signal_name(s32 sig)
{
switch(sig)
{
@@ -559,7 +559,7 @@ StringList memcache_escape_keys(StringList keys)
result.push_back(memcache_escape_key(s));
return(result);
}
u64 memcache_connect(String host, short port)
u64 memcache_connect(String host, u16 port)
{
if(host == "")
host = "127.0.0.1";
@@ -645,7 +645,7 @@ extern "C" int uce_wasm_task_run(uint64_t callback_id)
return(0);
}
int task_kill(pid_t pid, int sig) { return(uce_host_task_kill(pid, sig)); }
int task_kill(pid_t pid, s32 sig) { return(uce_host_task_kill(pid, (int)sig)); }
String runtime_safe_key(String key, String label)
{
(void)label;
@@ -670,7 +670,7 @@ pid_t task_repeat(String key, f64 interval, std::function<void()> exec_after_spa
}
pid_t task_pid(String key) { return((pid_t)uce_host_task_pid(key.data(), key.size())); }
extern "C" unsigned int sleep(unsigned int seconds) { return(uce_host_sleep_us((uint64_t)seconds * 1000000ull)); }
extern "C" int usleep(unsigned int usec) { uce_host_sleep_us(usec); return(0); }
extern "C" s32 usleep(u32 usec) { uce_host_sleep_us(usec); return(0); }
pid_t server_start_http(String key, String socket_fn_or_port, String call_uce_filename, String call_function)
{
String current = wasm_current_unit_file();
@@ -806,7 +806,7 @@ String backtrace_capture(u32 max_frames, u32 skip_frames)
return(backtrace_get_frames(frames.data(), size, skip_frames));
}
String signal_name(int sig)
String signal_name(s32 sig)
{
switch(sig)
{
@@ -1089,7 +1089,7 @@ void cwd_set(String path)
chdir(path.c_str());
}
time_t file_mtime(String file_name)
u64 file_mtime(String file_name)
{
struct stat info;
if (stat(file_name.c_str(), &info) != 0)
@@ -1184,7 +1184,7 @@ u64 time_parse(String time_String)
return(int_val(trim(shell_exec("date -u -d "+shell_escape(time_String)+" +'%s'"))));
}
u64 socket_connect(String host, short port)
u64 socket_connect(String host, u16 port)
{
/*String addrinfo {
@@ -1269,7 +1269,7 @@ StringList memcache_escape_keys(StringList keys)
return(result);
}
u64 memcache_connect(String host, short port)
u64 memcache_connect(String host, u16 port)
{
return(socket_connect(host, port));
}
@@ -1454,7 +1454,7 @@ void task_close_inherited_fds()
close(fd);
}
int task_kill(pid_t pid, int sig)
int task_kill(pid_t pid, s32 sig)
{
if(pid <= 0)
{
+7 -7
View File
@@ -16,7 +16,7 @@ typedef int pid_t;
extern "C" {
int raise(int);
unsigned int sleep(unsigned int seconds);
int usleep(unsigned int usec);
s32 usleep(u32 usec);
}
#else
#include <sys/file.h>
@@ -59,7 +59,7 @@ String file_read(u64 h, u64 len);
String file_pread(u64 h, u64 offset, u64 len);
u64 file_write(u64 h, String data);
u64 file_pwrite(u64 h, u64 offset, String data);
s64 file_seek(u64 h, s64 offset, int whence);
s64 file_seek(u64 h, s64 offset, s64 whence);
s64 file_tell(u64 h);
void file_close(u64 h);
DValue file_stat(String path);
@@ -82,7 +82,7 @@ inline bool file_append(String file_name, Ts... args)
String cwd_get();
void cwd_set(String path);
String process_start_directory();
time_t file_mtime(String file_name);
u64 file_mtime(String file_name);
void file_unlink(String file_name);
String expand_path(String path, String relative_to_path = "");
StringList ls(String dir);
@@ -97,7 +97,7 @@ String time_format_utc(String format = "", u64 timestamp = 0);
String time_format_relative(u64 timestamp, String format_very_recent = "", u64 medium_recency_seconds = 0, String format_medium_recent = "", u64 not_recent_seconds = 0, String format_not_recent = "");
u64 time_parse(String time_String);
u64 socket_connect(String host, short port);
u64 socket_connect(String host, u16 port);
void socket_close(u64 sockfd);
bool socket_write(u64 sockfd, String data);
String socket_read(u64 sockfd, u32 max_length = 1024*128, u32 timeout = 1);
@@ -115,11 +115,11 @@ bool ws_close(String connection_id = "");
String backtrace_get_frames(void* const* frames, size_t size, u32 skip_frames = 0);
String backtrace_capture(u32 max_frames = 32, u32 skip_frames = 0);
String signal_name(int sig);
String signal_name(s32 sig);
String memcache_escape_key(String key);
StringList memcache_escape_keys(StringList keys);
u64 memcache_connect(String host = "127.0.0.1", short port = 11211);
u64 memcache_connect(String host = "127.0.0.1", u16 port = 11211);
String memcache_command(u64 connection, String command);
bool memcache_set(u64 connection, String key, String value, u64 expires_in = 60*60);
bool memcache_delete(u64 connection, String key);
@@ -137,7 +137,7 @@ extern pid_t my_pid;
#endif
void on_segfault(int sig);
int task_kill(pid_t pid, int sig = 0);
int task_kill(pid_t pid, s32 sig = 0);
String runtime_safe_key(String key, String label = "runtime key");
pid_t task(String key, std::function<void()> exec_after_spawn, u64 timeout = 60*10);