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

@@ -564,7 +564,7 @@ static void history_add(const char *line) {
static void get_time_string(char *out, int max_len) {
int dt[6] = {0};
sys_system(11, (uint64_t)dt, 0, 0, 0);
sys_system(SYSTEM_CMD_RTC_GET, (uint64_t)dt, 0, 0, 0);
char hh[4], mm[4];
itoa(dt[3], hh);
itoa(dt[4], mm);

View File

@@ -6,6 +6,6 @@
int main(int argc, char **argv) {
(void)argc; (void)argv;
sys_system(10, 0, 0, 0, 0);
sys_system(SYSTEM_CMD_CLEAR_SCREEN, 0, 0, 0, 0);
return 0;
}

View File

@@ -7,7 +7,7 @@
int main(int argc, char **argv) {
(void)argc; (void)argv;
int dt[6];
if (sys_system(11, (uint64_t)dt, 0, 0, 0) == 0) {
if (sys_system(SYSTEM_CMD_RTC_GET, (uint64_t)dt, 0, 0, 0) == 0) {
printf("Current Date: %d-%d-%d %d:%d:%d\n", dt[0], dt[1], dt[2], dt[3], dt[4], dt[5]);
} else {
printf("Error: Could not retrieve date.\n");

View File

@@ -85,7 +85,7 @@ int main(void) {
if (!fb) return 1;
// Seed PRNG with system time (ticks)
my_srand((unsigned int)sys_system(16, 0, 0, 0, 0));
my_srand((unsigned int)sys_system(SYSTEM_CMD_GET_TICKS, 0, 0, 0, 0));
// Initialize perfect slope
int max_h = WIN_H - 40; // max height