Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed 0_CProgrammingLab/cprogramminglab-handout.tar
Binary file not shown.
5 changes: 3 additions & 2 deletions 5_ShellLab/shlab-handout/tsh.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,13 @@ void sigchld_handler(int sig) {
} else if (WIFSIGNALED(status)) {
// Child process is terminated by signal of WTERMSIG(code)
deletejob(jobs, pid);
printf("Job [%d] (%d) terminated by signal %d\n",
sio_put("Job [%d] (%d) terminated by signal %d\n",
jid, pid, WTERMSIG(status));
// instead of using printf, use sio_put to avoid interleaving.
} else if (WIFSTOPPED(status)) {
// child process was stopped by signal of WSTOPSIG(code)
setjobstate(jobs, pid, ST);
printf("Job [%d] (%d) stopped by signal %d\n",
sio_put("Job [%d] (%d) stopped by signal %d\n",
jid, pid, WSTOPSIG(status));
}

Expand Down