diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/kernel/sched.h | 9 | ||||
| -rw-r--r-- | include/kernel/sys.h | 3 | ||||
| -rw-r--r-- | include/signal.h | 35 | ||||
| -rw-r--r-- | include/unistd.h | 1 |
4 files changed, 47 insertions, 1 deletions
diff --git a/include/kernel/sched.h b/include/kernel/sched.h index 42b5b15..ac508b9 100644 --- a/include/kernel/sched.h +++ b/include/kernel/sched.h @@ -1,6 +1,7 @@ #ifndef _SCHED_H #define _SCHED_H +#include <signal.h> #include <stdint.h> #include <unistd.h> @@ -39,9 +40,17 @@ struct tss_struct { uint32_t io_map; } __attribute__((packed)); +/* + * WARNING: do not modify this structure + * unless the offsets defined in traps.s + * are updated + */ + struct task_struct { pid_t pid; int state; + uint32_t signal; + void *sig_handlers[NRSIG]; struct tss_struct tss; } __attribute__((packed)); diff --git a/include/kernel/sys.h b/include/kernel/sys.h index 248a93b..b2c1b3b 100644 --- a/include/kernel/sys.h +++ b/include/kernel/sys.h @@ -4,6 +4,7 @@ extern int sys_puts(void); extern int sys_time(void); extern int sys_getpid(void); extern int sys_getpdir(void); +extern int sys_signal(void); extern int sys_dummy(void); syscall_t call_table[256] = { @@ -11,7 +12,7 @@ syscall_t call_table[256] = { [1] = &sys_time, [2] = &sys_getpid, [3] = &sys_getpdir, - [4] = &sys_dummy, + [4] = &sys_signal, [5] = &sys_dummy, [6] = &sys_dummy, [7] = &sys_dummy, diff --git a/include/signal.h b/include/signal.h new file mode 100644 index 0000000..fee6c2b --- /dev/null +++ b/include/signal.h @@ -0,0 +1,35 @@ +#ifndef _SIGNAL_H +#define _SIGNAL_H + +#define NRSIG 32 + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGPROF 27 +#define SIGSYS 31 + +void *signal(int, void (*)(int)); + +#endif diff --git a/include/unistd.h b/include/unistd.h index 6925541..3b144f6 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -9,6 +9,7 @@ typedef uint16_t pid_t; #define __SYS_time 1 #define __SYS_getpid 2 #define __SYS_getpdir 3 +#define __SYS_signal 4 #define _syscall0(type, name) \ type name(void) { \ |
