Half-baked idea: Kill SIGOK

For more half-baked ideas, see the ideas tag

I’m sure you’ve sat there waiting for some long compile to finish. It’s just started the tests, but you don’t want it to do the tests, just finish compiling dammit!

My half-baked idea is this: sending a special signal to a process (SIGOK) should kill the process, but the process should return 0 (ie. non-error exit).

3 Comments

Filed under Uncategorized

3 responses to “Half-baked idea: Kill SIGOK

  1. Extending what is already UNIX’s most esoteric and least well-designed interface with a weird special case just to improve shell UI sounds a bit risky to me.

  2. I started trying a guru-mode systemtap script to inject a SIGKILL, then catch the process in kernel do_exit() and squash the exit code to 0. However, the obvious “$code = 0” is not enough to hide the signal, by my experiment, so it may need to modify current->signal or something too.

    It’s much simpler to just inject a call with gdb, like:

    gdb -ex ‘p _exit(0)’ -ex quit -p $TARGET_PID

    Of course this only works for a single process. If you want to “SIGOK” a whole process group, or a target already under ptrace, then I’d look back at a systemtap approach. (Or lobby for a real SIGOK — good luck…)

  3. Note the GNU coreutils timeout command since version 8.21 has a –preserve-status option for running commands that can run for an indeterminate amount of time. I.E. run until told to stop. You tell the timeout group to stop with the ALRM signal, so something like:

    timeout –preserve-status 365d my_command & pid=$!

    kill -ALRM $pid

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s