cleanup, docs
This commit is contained in:
+6
-17
@@ -39,7 +39,6 @@ int uce_host_dir_remove(const char* path, size_t path_len, const char* current,
|
||||
size_t uce_host_file_temp(const char* prefix, size_t prefix_len, const char* current, size_t current_len, char* buf, size_t cap);
|
||||
int uce_host_file_chmod(const char* path, size_t path_len, const char* current, size_t current_len, uint32_t mode);
|
||||
int uce_host_file_symlink(const char* target, size_t target_len, const char* linkpath, size_t linkpath_len, const char* current, size_t current_len);
|
||||
size_t uce_host_file_readlink(const char* path, size_t path_len, const char* current, size_t current_len, char* buf, size_t cap);
|
||||
int uce_host_file_fsync(uint64_t handle);
|
||||
int uce_host_task_spawn(const char* key, size_t key_len, uint64_t callback_id, double interval, uint64_t timeout, int repeat);
|
||||
int uce_host_task_pid(const char* key, size_t key_len);
|
||||
@@ -248,16 +247,6 @@ bool file_symlink(String target, String linkpath)
|
||||
String current = wasm_current_unit_file();
|
||||
return(uce_host_file_symlink(target.data(), target.size(), linkpath.data(), linkpath.size(), current.data(), current.size()) != 0);
|
||||
}
|
||||
String file_readlink(String path)
|
||||
{
|
||||
String current = wasm_current_unit_file();
|
||||
size_t required = uce_host_file_readlink(path.data(), path.size(), current.data(), current.size(), 0, 0);
|
||||
if(required == 0) return("");
|
||||
String out(required, 0);
|
||||
size_t got = uce_host_file_readlink(path.data(), path.size(), current.data(), current.size(), &out[0], required);
|
||||
out.resize(got <= required ? got : 0);
|
||||
return(out);
|
||||
}
|
||||
bool file_fsync(u64 h) { return(uce_host_file_fsync(h) != 0); }
|
||||
|
||||
|
||||
@@ -525,8 +514,8 @@ bool ws_close(String connection_id)
|
||||
context->resources.websocket_dispatch_commands.push(command);
|
||||
return(true);
|
||||
}
|
||||
String backtrace_frames_string(void* const* frames, size_t size, u32 skip_frames) { (void)frames; (void)size; (void)skip_frames; return(capture_backtrace_string(0, 0)); }
|
||||
String capture_backtrace_string(u32 max_frames, u32 skip_frames)
|
||||
String backtrace_get_frames(void* const* frames, size_t size, u32 skip_frames) { (void)frames; (void)size; (void)skip_frames; return(backtrace_capture(0, 0)); }
|
||||
String backtrace_capture(u32 max_frames, u32 skip_frames)
|
||||
{
|
||||
(void)max_frames;
|
||||
(void)skip_frames;
|
||||
@@ -788,7 +777,7 @@ void close_locked_file(int fd)
|
||||
|
||||
}
|
||||
|
||||
String backtrace_frames_string(void* const* frames, size_t size, u32 skip_frames)
|
||||
String backtrace_get_frames(void* const* frames, size_t size, u32 skip_frames)
|
||||
{
|
||||
if(size == 0)
|
||||
return("");
|
||||
@@ -807,14 +796,14 @@ String backtrace_frames_string(void* const* frames, size_t size, u32 skip_frames
|
||||
return(trace);
|
||||
}
|
||||
|
||||
String capture_backtrace_string(u32 max_frames, u32 skip_frames)
|
||||
String backtrace_capture(u32 max_frames, u32 skip_frames)
|
||||
{
|
||||
if(max_frames == 0)
|
||||
return("");
|
||||
|
||||
std::vector<void*> frames(max_frames);
|
||||
size_t size = backtrace(frames.data(), max_frames);
|
||||
return(backtrace_frames_string(frames.data(), size, skip_frames));
|
||||
return(backtrace_get_frames(frames.data(), size, skip_frames));
|
||||
}
|
||||
|
||||
String signal_name(int sig)
|
||||
@@ -1345,7 +1334,7 @@ StringMap memcache_get_multiple(u64 connection, StringList keys)
|
||||
|
||||
void on_segfault(int sig)
|
||||
{
|
||||
String trace = capture_backtrace_string(32, 1);
|
||||
String trace = backtrace_capture(32, 1);
|
||||
String sig_label = signal_name(sig);
|
||||
if(sig_label != "")
|
||||
fprintf(stderr, "SEG FAULT: %d (%s):\n%s", sig, sig_label.c_str(), trace.c_str());
|
||||
|
||||
Reference in New Issue
Block a user