summaryrefslogtreecommitdiff
path: root/sys/src/cmd/aux/kbdfs
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-11-06 17:19:41 +0100
committercinap_lenrek <cinap_lenrek@gmx.de>2012-11-06 17:19:41 +0100
commit599dd1c34f1d4e62ee29b2de42eaba7143590347 (patch)
treea7cc4f9983f42263a0b6b02ebcdb3268c60dce1e /sys/src/cmd/aux/kbdfs
parent120412a6a2bddf3ae01f4e10bb4173021e802a84 (diff)
make interrupt key (Del) just work in the console
these changes make the interrupt key available in the console (before rio is started). kbdfs: will now send a "interrupt" note to its invoking process group in cooked mode. bootrc: is now prepared to handle interrupts, mainly to not accidently spawn a new bootargs prompt. init: forwards the interrupt to the cpurc/termrc pgrp. vncs: shields itself from kbdfs notegroup so interrrupt wont kill the whole vnc session.
Diffstat (limited to 'sys/src/cmd/aux/kbdfs')
-rw-r--r--sys/src/cmd/aux/kbdfs/kbdfs.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/sys/src/cmd/aux/kbdfs/kbdfs.c b/sys/src/cmd/aux/kbdfs/kbdfs.c
index e65cfa0c5..5cc423988 100644
--- a/sys/src/cmd/aux/kbdfs/kbdfs.c
+++ b/sys/src/cmd/aux/kbdfs/kbdfs.c
@@ -93,6 +93,7 @@ int scanfd;
int ledsfd;
int consfd;
int mctlfd;
+int notefd;
int kbdopen;
int consctlopen;
@@ -566,6 +567,10 @@ lineproc(void *aux)
case '\0': /* flush */
nr = 0;
continue;
+ case Kdel:
+ if(notefd >= 0)
+ write(notefd, "interrupt", 9);
+ continue;
case Kbs: /* ^H: erase character */
case Knack: /* ^U: erase line */
case Ketb: /* ^W: erase word */
@@ -1285,18 +1290,25 @@ reboot(void)
close(fd);
}
+int
+procopen(int pid, char *name, int mode)
+{
+ char buf[128];
+
+ snprint(buf, sizeof(buf), "/proc/%d/%s", pid, name);
+ return eopen(buf, mode);
+}
+
void
elevate(void)
{
- char buf[128];
Dir *d, nd;
int fd;
if(debug)
return;
- snprint(buf, sizeof(buf), "/proc/%d/ctl", getpid());
- if((fd = eopen(buf, OWRITE)) < 0)
+ if((fd = procopen(getpid(), "ctl", OWRITE)) < 0)
return;
/* get higher than normal priority */
@@ -1351,6 +1363,8 @@ threadmain(int argc, char** argv)
usage();
}ARGEND
+ notefd = procopen(getpid(), "notepg", OWRITE);
+
scanfd = eopen("/dev/scancode", OREAD);
ledsfd = eopen("/dev/leds", OWRITE);
mctlfd = eopen("/dev/mousectl", OWRITE);