SIGSTOP and SIGCONT

100 views
Skip to first unread message

patacongo

unread,
Aug 30, 2018, 3:38:34 PM8/30/18
to NuttX
Some of the recent changes from Pinecone implemented default actions for SIGKILL.  I worked to integrate this a little better into the NuttX signal handling architecture and add SIGINT.  The only SIGINT and SIGKILL is the you cannot catch or ignore SIGKILL.  In practice, SIGINT is like Ctrl-C from a keyboard:  It will kill the task unless the task has chosen to catch or ignore SIGINT.  SIGKILL is usually signal 9 and we are all familiar with unconditionally killing a task with 'kill -9".

In the past few days, I also implemented SIGSTOP, SIGSTP, and SIGCONT.  SIGSTOP and SIGSTP both case a task to be paused (SIGSTP can be caught or ignored, SIGSTOP cannot be).  SIGSTP is normally sent from the keyboard via Ctrl-Z.  Most of you are familiar with using Ctrl-Z to stop a task then 'bg' or 'fg' from the Bash command line to resume the task.

[There is currently no support for Ctrl-Z in the serial TTY nor support fg or bg in NSH, so those could be nice future projects.]

I also added a test in the apps OS Test example.  That test creates a 'victim' task then suspends with SIGSTOP, resumes it with SIGCONT, and kills itwith SIGKILL.  The OS test output looks like this:

user_main: signal action test
suspend_test: Starting victim task
suspend_test: Started victim_main pid=84
victim_main: Victim started
suspend_test:  Is the victim saying anything?
victim_main: Wasting time
victim_main: Wasting time
victim_main: Wasting time
suspend_test: Signaling pid=84 with SIGSTOP
suspend_test:  Is the victim still jabbering?
suspend_test: Signaling pid=84 with SIGCONT
suspend_test:  The victim should continue the rant.
victim_main: Wasting time
victim_main: Wasting time
victim_main: Wasting time
victim_main: Wasting time
suspend_test: Signaling pid=84 with SIGKILL
suspend_test: done

So this all seems to be working, but not super-thoroughly tested.

Reply all
Reply to author
Forward
0 new messages