Docsity

Signals and System Calls: Understanding sigaction and kill, Slides of Computer Programming

Partial preview of the text

Download Signals and System Calls: Understanding sigaction and kill and more Slides Computer Programming in PDF only on Docsity!

Week 5 Topics

  • Signals
    • sigaction
    • kill
  • Midterm review
  • Some system calls
  • HW 2 hints

Signals

  • sigaction
  • kill

kill

  • Send a signal to a process
    • #include <signal.h>
    • #include <sys/types.h>
    • int kill(pid_t pid, int signo);
    • See example5.c
    • See example6.c for the use of alarm

Impact of signals on system calls

  • A system call may return prematurely
    • See example7.c
  • How can we deal with this problem?
    • Check the return value of the system call and act accordingly