miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Loading...
Searching...
No Matches
signal.h File Reference
#include <miniOS/types.h>
Include dependency graph for signal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mini_sigaction

Macros

#define SIGHUP   1
#define SIGINT   2
#define SIGQUIT   3
#define SIGILL   4
#define SIGABRT   6
#define SIGTRAP   5
#define SIGFPE   8
#define SIGKILL   9
#define SIGSEGV   11
#define SIGPIPE   13
#define SIGALRM   14
#define SIGTERM   15
#define SIGCHLD   17
#define SIGCONT   18
#define SIGSTOP   19
#define SIGTSTP   20
#define SIG_DFL   ((sighandler_t)0)
#define SIG_IGN   ((sighandler_t)1)
#define MINIOS_SA_NOCLDWAIT   0x00000002U
#define MINIOS_SA_RESTART   0x10000000U
#define MINIOS_SA_RESETHAND   0x80000000U

Typedefs

typedef void(*) sighandler_t(int signum)
typedef uint32_t minisigset_t
typedef struct mini_sigaction mini_sigaction_t

Functions

void signal_dispatch (void)
void ring3_invoke_handler (int sig, sighandler_t handler)

Macro Definition Documentation

◆ MINIOS_SA_NOCLDWAIT

#define MINIOS_SA_NOCLDWAIT   0x00000002U

◆ MINIOS_SA_RESETHAND

#define MINIOS_SA_RESETHAND   0x80000000U

◆ MINIOS_SA_RESTART

#define MINIOS_SA_RESTART   0x10000000U

◆ SIG_DFL

#define SIG_DFL   ((sighandler_t)0)

◆ SIG_IGN

#define SIG_IGN   ((sighandler_t)1)

◆ SIGABRT

#define SIGABRT   6

◆ SIGALRM

#define SIGALRM   14

◆ SIGCHLD

#define SIGCHLD   17

◆ SIGCONT

#define SIGCONT   18

◆ SIGFPE

#define SIGFPE   8

◆ SIGHUP

#define SIGHUP   1

◆ SIGILL

#define SIGILL   4

◆ SIGINT

#define SIGINT   2

◆ SIGKILL

#define SIGKILL   9

◆ SIGPIPE

#define SIGPIPE   13

◆ SIGQUIT

#define SIGQUIT   3

◆ SIGSEGV

#define SIGSEGV   11

◆ SIGSTOP

#define SIGSTOP   19

◆ SIGTERM

#define SIGTERM   15

◆ SIGTRAP

#define SIGTRAP   5

◆ SIGTSTP

#define SIGTSTP   20

Typedef Documentation

◆ mini_sigaction_t

mini_sigaction_t — per-signal disposition record.

Stored in struct thread::signal_actions[1..31]. sa_flags holds MINIOS_SA_RESTART and other SA_* flags. sa_mask is reserved (zero) — miniOS does not block signals during handlers yet.

◆ minisigset_t

◆ sighandler_t

typedef void(*) sighandler_t(int signum)

Function Documentation

◆ ring3_invoke_handler()

void ring3_invoke_handler ( int sig,
sighandler_t handler )

ring3_invoke_handler() - Set up user stack to invoke a signal handler. @sig: Signal number passed as first argument to handler (RDI per SysV ABI). @handler: User-mode function pointer to invoke.

Modifies the current thread's saved_user_rip to point to @handler and adjusts saved_user_rsp to push the signal number onto the user stack. SYSRET then jumps directly into the handler. Full trampoline (return path via SYS_sigreturn).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ signal_dispatch()

void signal_dispatch ( void )

signal_dispatch() - Deliver all pending signals before returning to userspace.

Called from syscall.asm immediately before SYSRET. Scans the current thread's pending_signals bitmask (bits 1-31). For SIGKILL and SIGTERM calls sched_exit_current(128 + signum). For other signals invokes the registered handler via ring3_invoke_handler() if a non-default handler is registered, otherwise clears the pending bit and continues.

Context: Called with interrupts disabled (CLI before SYSRET path). Does not return if SIGKILL or SIGTERM is pending.

Here is the call graph for this function:
Here is the caller graph for this function: