H chapter 8 exceptional control flow void longjmpjmp

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: he process group ID of the current process. #include <unistd.h> pid t getpgrp(void); returns: process group ID of calling process By default, a child process belongs to the same process group as its parent. A process can change the process group of itself or another process by using the setpgid function: 424 #include <unistd.h> pid t setpgid(pid t pid, pid t pgid); CHAPTER 8. EXCEPTIONAL CONTROL FLOW returns: 0 on success, -1 on error. The setpgid function changes the process group of process pid to pgid. If pid is zero, the PID of the current process is used. If pgid is zero, the PID of the process specified by pid is used for the process group ID. For example, if process 15213 is the calling process, then setpgid(0, 0); creates a new process group whose process group ID is 15213, and adds process 15213 to this new group. Sending Signals With the kill Program The /bin/kill program sends an arbitrary signal to another process. For example unix> kill -9 15213 sends signal 9 (SIGKILL) to process 15213. A negative PID causes the sig...
View Full Document

Ask a homework question - tutors are online