[comp.unix.questions] Help! I need an interrupt!!

lear@aramis.RUTGERS.EDU (eliot lear) (05/02/87)

Hello all,

I would like to do the following in UNIX but I am not quite sure how...

My problem:

I want to place a command on a key.  It is an old TOPS-20ism that I
enjoyed to place commands on keys, such as accessing your editor with
one character, like C-K or C-E.  The program I would like to put on
a key is a FAST network send program.  The problem is that I do not
believe that UNIX allows for user definable interrupt characters and
I do not know how to write the program without at least one interrupt
character.  Someone suggested using the quit character and one of my
friends who has spent lots of time building TeX quickly killed (-9)
the idea.

My solution:

I propose to place a group of ``slots'' in the ttychars struct and
make minor changes to tty.c to allow for user definable interrupts. It
would also require use of a signal.  If I want to be lazy I could just
use one of SIGUSR1 and SIGUSR2.  Otherwise, I could probably hack it
so that the user could specify the signal.

My problem with my solution:

I *really* don't want to add to the kernel unless absolutely
necessary.  If anyone knows of a method that allows me to set up my
``interrupt key'', please do not hesitate to mail or post!!!

Thanks in advance....
-- 

[lear@rutgers.edu]
[{harvard|pyrnj|seismo|ihnp4}!rutgers!lear]

edw@ius2.cs.cmu.edu (Eddie Wyatt) (05/02/87)

  Instead of setting up interrupt keys, how about using a polling
technique combined with a timer interrupt.

  That is, setup an interrupt timer (using setitimer) with an interrupt
handler (using signal or sigvec) such that the interrupt handler 
will poll stdin (using select and fileno(stdin) to get a file descriptor of
stdin) to see if and charcters are out there?

-- 
					Eddie Wyatt

edw@ius2.cs.cmu.edu (Eddie Wyatt) (05/02/87)

 Oh, another technique would be to fork a process just to take
care of stdin (and stdout).  Once one of the special characters
comes in, just have the process signal (using kill) that an
interrupt has occurred.
-- 
					Eddie Wyatt