Feat: POSIX signal
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <vector.h>
|
||||
#include <signal.h>
|
||||
|
||||
typedef struct {
|
||||
uint64_t x0, x1;
|
||||
@@ -38,6 +40,13 @@ typedef struct process {
|
||||
void *mem;
|
||||
size_t mem_size;
|
||||
|
||||
void *sigstack;
|
||||
size_t sigstack_size;
|
||||
|
||||
bool sigstate[SIGNAL_NUM];
|
||||
int32_t current_signal;
|
||||
signal_handler_t sighandlers[SIGNAL_NUM];
|
||||
|
||||
trapframe_t *regs;
|
||||
} process_t;
|
||||
|
||||
@@ -51,3 +60,4 @@ int32_t run_process(uint64_t process);
|
||||
process_t *fork_process(const process_t *from);
|
||||
|
||||
extern int32_t global_pid_counter;
|
||||
extern vector_t *global_processes;
|
||||
|
||||
11
kernel/include/signal.h
Normal file
11
kernel/include/signal.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define SIGNAL_NUM 32
|
||||
|
||||
#define SIGKILL 9
|
||||
|
||||
typedef void (*signal_handler_t)();
|
||||
|
||||
void run_signal(int32_t SIGNAL);
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <process.h>
|
||||
#include <signal.h>
|
||||
|
||||
void syscall_handler(trapframe_t *regs);
|
||||
|
||||
@@ -12,4 +13,7 @@ int32_t sys_exec(const char *name, char *const argv[]);
|
||||
int32_t sys_fork(void);
|
||||
void sys_exit(int32_t status);
|
||||
int32_t sys_mbox_call(uint8_t ch, uint32_t *mbox);
|
||||
void sys_kill(int32_t pid);
|
||||
void sys_kill_by_id(int32_t pid);
|
||||
void sys_signal(int32_t SIGNAL, signal_handler_t handler);
|
||||
void sys_kill(int32_t pid, int32_t SIGNAL);
|
||||
void sys_sigreturn(void);
|
||||
|
||||
Reference in New Issue
Block a user