miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Toggle main menu visibility
Loading...
Searching...
No Matches
signal.h
Go to the documentation of this file.
1
// MIT License
2
//
3
// Copyright (c) 2026 Christian Spoo
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
//
12
// The above copyright notice and this permission notice shall be included in all
13
// copies or substantial portions of the Software.
14
//
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
// SOFTWARE.
22
23
#ifndef _MINIOS_SIGNAL_H_
24
#define _MINIOS_SIGNAL_H_
25
26
#include <
miniOS/types.h
>
27
28
/* Signal numbers (POSIX / Linux x86-64 ABI) */
29
#define SIGHUP 1
/* hangup */
30
#define SIGINT 2
/* interrupt (Ctrl-C) */
31
#define SIGQUIT 3
/* quit (Ctrl-\) */
32
#define SIGILL 4
/* illegal instruction */
33
#define SIGABRT 6
/* abort */
34
#define SIGTRAP 5
/* breakpoint/single-step trap (ptrace) */
35
#define SIGFPE 8
/* floating-point exception */
36
#define SIGKILL 9
/* unconditional termination; cannot be caught or ignored */
37
#define SIGSEGV 11
/* segmentation fault */
38
#define SIGPIPE 13
/* broken pipe */
39
#define SIGALRM 14
/* alarm clock (ITIMER_REAL expiry) */
40
#define SIGTERM 15
/* termination request; default action terminates process */
41
#define SIGCHLD 17
/* sent to parent when a child exits or stops (Linux ABI) */
42
#define SIGCONT 18
/* continue if stopped */
43
#define SIGSTOP 19
/* stop (cannot be caught or ignored) */
44
#define SIGTSTP 20
/* terminal stop (Ctrl-Z) */
45
46
/* Signal handler type */
47
typedef
void (*
sighandler_t
)(
int
signum);
48
49
/* Special handler values */
50
#define SIG_DFL ((sighandler_t)0)
/* default signal action */
51
#define SIG_IGN ((sighandler_t)1)
/* ignore signal */
52
53
/* ── Signal action flags (SA_* — Linux x86-64 ABI) ─────────────────────── */
54
#define MINIOS_SA_NOCLDWAIT 0x00000002U
/* do not produce zombies; skip SIGCHLD delivery */
55
#define MINIOS_SA_RESTART 0x10000000U
/* restart interrupted syscall on signal return */
56
#define MINIOS_SA_RESETHAND 0x80000000U
/* reset to SIG_DFL on delivery */
57
58
/* Signal mask type (bitmask of signals 1-31 in a uint32_t) */
59
typedef
uint32_t
minisigset_t
;
60
68
typedef
struct
mini_sigaction
{
69
sighandler_t
sa_handler
;
/* SIG_DFL, SIG_IGN, or user handler pointer */
70
int
sa_flags
;
/* MINIOS_SA_RESTART, MINIOS_SA_RESETHAND, ... */
71
minisigset_t
sa_mask
;
/* signals to block during handler (reserved, zero) */
72
}
mini_sigaction_t
;
73
86
void
signal_dispatch
(
void
);
87
98
void
ring3_invoke_handler
(
int
sig,
sighandler_t
handler);
99
100
#endif
/* _MINIOS_SIGNAL_H_ */
signal_dispatch
void signal_dispatch(void)
Definition
signal.c:35
sighandler_t
void(*) sighandler_t(int signum)
Definition
signal.h:47
minisigset_t
uint32_t minisigset_t
Definition
signal.h:59
mini_sigaction_t
struct mini_sigaction mini_sigaction_t
ring3_invoke_handler
void ring3_invoke_handler(int sig, sighandler_t handler)
Definition
signal.c:93
mini_sigaction
Definition
signal.h:68
mini_sigaction::sa_mask
minisigset_t sa_mask
Definition
signal.h:71
mini_sigaction::sa_flags
int sa_flags
Definition
signal.h:70
mini_sigaction::sa_handler
sighandler_t sa_handler
Definition
signal.h:69
types.h
uint32_t
unsigned int uint32_t
Definition
types.h:34
include
miniOS
signal.h
Generated by
1.18.0