Signals/Interrupts Flashcards
Can signal handlers be interrupted by signals?
Yes, just not of same type
SIGSTP
Cannot be overridden, pauses a process
SIGKILL
Cannot be overridden, kills an orphan - I mean process
(Do or Don’t) Call library functions like printf
Don’t
(Do or Don’t) Use the signal() function to register your handlers
Don’t
(Do or Don’t) Use the sigaction() function to register your handlers
Do
(Registering signal handler) sa_handler
Specifies handling function
(Registering signal handler) sa_flags
Clear by setting to 0 i guess
(Registering signal handler) sigaction(1, 2, 3)
1) Signal number e.g SIGINT
2) Sigaction object pointer
3) Sigaction object pointer to old handler
SIGINT
keyboard interrupt
SIGSEGV
Segmentation fault
Causes: being stupid, or making illegal memory references
SIGFPE
Arithmetic/computational exception
Causes: being stupid, or dividing by 0
Mode bit
Indicates current mode, 1=kernel, 0=user
(Exceptional Events) Interrupt
Signal from device to notify attention is needed, always returns to next instruction
(Exceptional Events) TRAP
Intentional exception, usually utilizing some kind of sys call, always returns to next instruction