diff options
Diffstat (limited to 'term')
-rw-r--r-- | term/Makefile | 8 | ||||
-rw-r--r-- | term/devio.c | 7 | ||||
-rw-r--r-- | term/term.h | 4 | ||||
-rw-r--r-- | term/users.c | 20 |
4 files changed, 34 insertions, 5 deletions
diff --git a/term/Makefile b/term/Makefile index 341da8f0..8adbced3 100644 --- a/term/Makefile +++ b/term/Makefile @@ -1,5 +1,5 @@ -# -# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +# +# Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc. # Written by Michael I. Bushnell, p/BSG. # # This file is part of the GNU Hurd. @@ -27,6 +27,8 @@ LCLHDRS = term.h DIST_FILES = ourmsg.defs HURDLIBS=trivfs fshelp iohelp ports ihash shouldbeinlibc threads -OBJS = $(subst .c,.o,$(SRCS)) termServer.o device_replyServer.o tioctlServer.o ourmsgUser.o +OBJS = $(subst .c,.o,$(SRCS)) termServer.o device_replyServer.o tioctlServer.o ourmsgUser.o include ../Makeconf + +device_replyServer-CPPFLAGS = -DTypeCheck=0 -Wno-unused # XXX diff --git a/term/devio.c b/term/devio.c index ed9df066..ce12b085 100644 --- a/term/devio.c +++ b/term/devio.c @@ -506,6 +506,13 @@ device_open_reply (mach_port_t replyport, if (returncode != 0) { + /* Note that DEVICE is total garbage (not a real port name at all!) + in this case. */ + + if (returncode == D_NO_SUCH_DEVICE) + /* Record that the device does not exist. */ + termflags |= NO_DEVICE; + /* Bogus. */ report_carrier_on (); report_carrier_off (); diff --git a/term/term.h b/term/term.h index da3d373a..64769fc1 100644 --- a/term/term.h +++ b/term/term.h @@ -25,6 +25,7 @@ #include <sys/types.h> #include <sys/mman.h> #include <fcntl.h> +#include <stdint.h> #undef MDMBUF #undef ECHO @@ -65,7 +66,7 @@ struct termios termstate; /* Other state with the following bits: */ -long termflags; +uint_fast32_t termflags; #define USER_OUTPUT_SUSP 0x00000001 /* user has suspended output */ #define TTY_OPEN 0x00000002 /* someone has us open */ @@ -78,6 +79,7 @@ long termflags; #define EXCL_USE 0x00000100 /* user accessible exclusive use */ #define NO_OWNER 0x00000200 /* there is no foreground_id */ #define ICKY_ASYNC 0x00000400 /* some user has set O_ASYNC */ +#define NO_DEVICE 0x00000800 /* the device does not exist */ #define QUEUE_LOWAT 100 #define QUEUE_HIWAT 300 diff --git a/term/users.c b/term/users.c index 60b7825f..6a5228b0 100644 --- a/term/users.c +++ b/term/users.c @@ -144,10 +144,19 @@ open_hook (struct trivfs_control *cntl, return pty_open_hook (cntl, user, flags); if ((flags & (O_READ|O_WRITE)) == 0) + /* Not asking for a port that can do i/o (just stat or chmod or whatnot), + so there is nothing else we need to think about. */ return 0; mutex_lock (&global_lock); + if (termflags & NO_DEVICE) + { + /* We previously discovered that the underlying device doesn't exist. */ + mutex_unlock (&global_lock); + return ENXIO; + } + if (!(termflags & TTY_OPEN)) { bzero (&termstate, sizeof termstate); @@ -194,11 +203,20 @@ open_hook (struct trivfs_control *cntl, } /* Wait for carrier to turn on. */ - while (((termflags & NO_CARRIER) && !(termstate.c_cflag & CLOCAL)) + while ((termflags & (NO_CARRIER|NO_DEVICE)) == NO_CARRIER + && !(termstate.c_cflag & CLOCAL) && !(flags & O_NONBLOCK) && !cancel) cancel = hurd_condition_wait (&carrier_alert, &global_lock); + if (termflags & NO_DEVICE) + { + /* The open of the underlying device returned an error indicating + that no such device exists. */ + mutex_unlock (&global_lock); + return ENXIO; + } + if (cancel) { mutex_unlock (&global_lock); |