feat: Add signals, exec/wait, and FD/pipe support

Introduce process lifecycle and POSIX-like features: add parent_pid, pgid, exited/exit_status, signal state and handlers, waitpid/reap, and an exec-replace function. Refactor file descriptor handling to use fd_kind/fd_flags with reference-counted file refs and in-process pipes; implement open/read/write/close/seek/tell/size/dup/dup2/pipe/fcntl semantics and O_* flags. Add syscall handlers for exec, waitpid, kill/signal, sigaction, sigprocmask, sigpending, meminfo/ticks and map many SYSTEM_CMD_* constants; deliver signals from the syscall path. Cleanup/terminate logic updated to free resources correctly and initialize kernel/user processes with new state. Misc: minor syscall/table renames (wallpaper), helper utilities (process_close_fd_inner, process_init_signal_state) and paging/stack handling for exec.
This commit is contained in:
boreddevnl
2026-04-20 00:03:52 +02:00
parent ae8c7e21ac
commit af5eda1647
35 changed files with 2234 additions and 208 deletions

View File

@@ -269,7 +269,7 @@ void viewer_open_file(const char *path) {
viewer_img_h = fit_h;
viewer_has_image = (viewer_frame_count > 0);
if (viewer_has_image) {
viewer_next_frame_tick = sys_system(16, 0, 0, 0, 0) + (viewer_delays[0] * 60 / 1000);
viewer_next_frame_tick = sys_system(SYSTEM_CMD_GET_TICKS, 0, 0, 0, 0) + (viewer_delays[0] * 60 / 1000);
}
}
free(delays);
@@ -337,7 +337,7 @@ int main(int argc, char **argv) {
win_w = ev.arg1;
win_h = ev.arg2;
resize_pending = true;
last_resize_tick = sys_system(16, 0, 0, 0, 0);
last_resize_tick = sys_system(SYSTEM_CMD_GET_TICKS, 0, 0, 0, 0);
// Fast background clear during active resize
ui_draw_rect(win, 0, 0, win_w, win_h, 0xFF000000);
ui_mark_dirty(win, 0, 0, win_w, win_h - 20);
@@ -348,7 +348,7 @@ int main(int argc, char **argv) {
}
} else {
if (resize_pending) {
uint64_t now = sys_system(16, 0, 0, 0, 0);
uint64_t now = sys_system(SYSTEM_CMD_GET_TICKS, 0, 0, 0, 0);
if (now > last_resize_tick + 10) {
viewer_paint(win);
ui_mark_dirty(win, 0, 0, win_w, win_h - 20);
@@ -357,7 +357,7 @@ int main(int argc, char **argv) {
}
if (viewer_has_image && viewer_frame_count > 1) {
uint64_t now = sys_system(16, 0, 0, 0, 0);
uint64_t now = sys_system(SYSTEM_CMD_GET_TICKS, 0, 0, 0, 0);
if (now >= viewer_next_frame_tick) {
viewer_current_frame = (viewer_current_frame + 1) % viewer_frame_count;
viewer_next_frame_tick = now + (viewer_delays[viewer_current_frame] * 60 / 1000);