cmd/vt: export /dev/tty as alias for /dev/cons

This commit is contained in:
Giacomo Tesio 2017-11-27 00:13:20 +01:00
parent 132f2ccee0
commit 66e9a1b676
1 changed files with 6 additions and 3 deletions

View File

@ -10,7 +10,7 @@
extern Channel *hc[2]; extern Channel *hc[2];
static File *devcons, *devconsctl; static File *devcons, *devtty, *devconsctl;
static Channel *readreq; static Channel *readreq;
static Channel *flushreq; static Channel *flushreq;
@ -61,7 +61,7 @@ fsreader(void* _)
static void static void
fsread(Req *r) fsread(Req *r)
{ {
if(r->fid->file == devcons){ if(r->fid->file == devcons || r->fid->file == devtty){
sendp(readreq, r); sendp(readreq, r);
return; return;
} }
@ -118,7 +118,7 @@ cvtc2r(char *b, int n, Partutf *u)
static void static void
fswrite(Req *r) fswrite(Req *r)
{ {
if(r->fid->file == devcons){ if(r->fid->file == devcons || r->fid->file == devtty){
Partutf *u; Partutf *u;
Rune *rp; Rune *rp;
@ -206,6 +206,9 @@ mountcons(void)
devcons = createfile(fs.tree->root, "cons", "vt", 0666, nil); devcons = createfile(fs.tree->root, "cons", "vt", 0666, nil);
if(devcons == nil) if(devcons == nil)
sysfatal("creating /dev/cons: %r"); sysfatal("creating /dev/cons: %r");
devtty = createfile(fs.tree->root, "tty", "vt", 0666, nil);
if(devtty == nil)
sysfatal("creating /dev/tty: %r");
devconsctl = createfile(fs.tree->root, "consctl", "vt", 0666, nil); devconsctl = createfile(fs.tree->root, "consctl", "vt", 0666, nil);
if(devconsctl == nil) if(devconsctl == nil)
sysfatal("creating /dev/consctl: %r"); sysfatal("creating /dev/consctl: %r");