diff options
author | Anton Kling <anton@kling.gg> | 2023-10-30 22:12:14 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-10-31 00:18:38 +0100 |
commit | 8a9208612eec8ddae4c418485d848ecfa0613699 (patch) | |
tree | 2f4b29200c2f0c19ae52f45bdb9b38a41b356e30 /kernel/includes/signal.h | |
parent | ca76600acc8bf7a02346efa5bd8f17072210ec01 (diff) |
Meta: Move kernel and userland to their own folders.
This is to allow both the kernel and the userland to share certain
header files and to make the folder structure a bit more clear.
Diffstat (limited to 'kernel/includes/signal.h')
-rw-r--r-- | kernel/includes/signal.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/kernel/includes/signal.h b/kernel/includes/signal.h new file mode 100644 index 0000000..3de9998 --- /dev/null +++ b/kernel/includes/signal.h @@ -0,0 +1,46 @@ +#ifndef SIGNAL_H +#define SIGNAL_H +#include <sys/types.h> +#define SIGHUP 0 +#define SIGINT 1 +#define SIGWINCH 2 +#define SIGQUIT 3 +#define SIG_IGN 4 +typedef int pid_t; +typedef int uid_t; +typedef int sigset_t; + +union sigval { + int sival_int; // Integer signal value. + void *sival_ptr; // Pointer signal value. +}; + +struct siginfo { + int si_signo; // Signal number. + int si_code; // Signal code. + int si_errno; // If non-zero, an errno value associated with + // this signal, as described in <errno.h>. + pid_t si_pid; // Sending process ID. + uid_t si_uid; // Real user ID of sending process. + void *si_addr; // Address of faulting instruction. + int si_status; // Exit value or signal. + long si_band; // Band event for SIGPOLL. + union sigval si_value; // Signal value. +}; + +typedef struct siginfo siginfo_t; + +int kill(pid_t pid, int sig); + +struct sigaction { + void (*sa_handler)(int); // Pointer to a signal-catching function or one of + // the macros SIG_IGN or SIG_DFL. + sigset_t sa_mask; // Additional set of signals to be blocked during execution + // of signal-catching function. + int sa_flags; // Special flags to affect behavior of signal. + void (*sa_sigaction)(int, siginfo_t *, + void *); // Pointer to a signal-catching function. +}; + +int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); +#endif // SIGNAL_H |