1 / 7

Advanced UNIX programming

Advanced UNIX programming. Fall 2002 Instructor: Ashok Srinivasan Lecture 12. Acknowledgements: The syllabus and power point presentations are modified versions of those by T. Baker and X. Yuan. Announcements. Reading assignment Work on HW 2 Prepare for midterm

lainey
Download Presentation

Advanced UNIX programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced UNIX programming Fall 2002 Instructor: Ashok Srinivasan Lecture 12 Acknowledgements: The syllabus and power point presentations are modified versions of those by T. Baker and X. Yuan

  2. Announcements • Reading assignment • Work on HW 2 • Prepare for midterm • Midterm1: Monday, 30 Sep 2002

  3. Week 5 Topics • Signals • sigaction • kill • Midterm review • Some system calls • HW 2 hints

  4. Signals • sigaction • kill

  5. sigaction • Supersedes the signal function • #include <signal.h> • int sigaction(int signo, const struct sigaction * act, struct sigaction *oact) • struct sigaction { void (*sa_handler)(); /* signal handler */ sigset_t sa_mask; /*additional signal to block */ int sa_flags; /* options: we will set it to 0 */ sa_sigaction; /* we will not use it */ }; • See example4.c

  6. 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

  7. 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

More Related