Messages in this thread Patch in this message | | | Date | Sat, 5 Jun 1999 12:00:08 +0300 | From | Nimrod Zimerman <> | Subject | [PATCH] Re: sound and control-c |
| |
On Tue, Jun 01, 1999 at 05:05:49PM -0400, Navindra Umanee wrote:
[I CC this to Alan because it is, in a way, sound related, and I couldn't find anyone maintaining signal handling...]
> I've noticed that the problem also occurs with the wavplay and > playmidi programs (and probably others). I just gave 'cat' as the > simplest example... > > > Maybe this is a non-issue, hence. When I get some time, I'll take a look > > again.
Okay. I had some time (actually, that's a lie. I don't have any time. I just decided to postpone something else), so I decided to figure out what's wrong with ctrl-c and sound. Here are my results.
Stopping pending sound with the same signal that caused the writing program to terminate - doesn't work. For example, when playing sound with 'cat soundfile.wav > /dev/dsp', and using SIGKILL to kill it, another SIGKILL wouldn't stop the pending sound. Some other signal would.
This happens due to the following bit of code (linux/arch/i386/kernel/signal.c:do_signal() - and applies to other arches quite equally):
default: lock_kernel(); sigaddset(¤t->signal, signr); current->flags |= PF_SIGNALED; do_exit(exit_code); /* NOTREACHED */
This is executed when a signal is sent to a process, such that the signal is supposed to kill the process (like, a signal that isn't captured).
What happens is that the pending signal is added back to the signal set (it was previously removed, when the processing started). However, the sigpending bit of the task isn't updated. This simply means that this signal can have no effect from this point on, unless some other signal is sent.
The patch below applies on 2.2.9 (and probably on mostly anything else). One line. Works fine here (I've been running with it for the past few hours). If this seems to be the correct thing to do, it should probably be added for the other arches too.
--- linux/arch/i386/kernel/signal.c.ORIG Tue Dec 1 21:28:24 1998 +++ linux/arch/i386/kernel/signal.c Sat Jun 5 11:44:02 1999 @@ -698,6 +698,7 @@ default: lock_kernel(); sigaddset(¤t->signal, signr); + recalc_sigpending(current); current->flags |= PF_SIGNALED; do_exit(exit_code); /* NOTREACHED */
Nimrod
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |