an adaptation of /n/sources/patch/telnet-notkbd from stallion. the readme is: This patch corrects a couple of minor problems with telnet when using the notkbd option (-n). The first issue was to disable changing raw mode when a pipe was being used. This would result in raw mode being enabled on the calling console. The second issue was a deadlock caused by the net child being handed a terminal note. This would cause the parent to spin waiting for the child to notify. This was changed to a waitpid loop such that the main thread can shutdown gracefully if needed. Reference: /n/atom/patch/applied2013/telnetnokbd Date: Wed Dec 11 15:28:17 CET 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/cmd/ip/telnet.c Wed Dec 11 15:27:35 2013 +++ /sys/src/cmd/ip/telnet.c Wed Dec 11 15:27:35 2013 @@ -164,12 +164,13 @@ netpid = pid; notify(notifyf); fromkbd(net); - if(notkbd) - for(;;) - sleep(0); + if(notkbd){ + while(waitpid() != -1) + ; + }else + sendnote(netpid, "die"); if (svc) remove(svc); - sendnote(netpid, "die"); exits(0); } } @@ -325,7 +326,7 @@ void consctlcmd(char *s) { - if(srv != nil) + if(srv != nil || notkbd) return; if(debug) fprint(2, "consctl: %s\n", s);