summaryrefslogtreecommitdiff
path: root/term/users.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-10-01 21:45:20 +0000
committerRoland McGrath <roland@gnu.org>1999-10-01 21:45:20 +0000
commite974c97c3880954c22c8444279b2663406065621 (patch)
treeeff6498b5e2c391febe50652af00ab59569a6ef4 /term/users.c
parent571422c27c919de580d9a44b821ced09f3f69d6f (diff)
1999-10-01 Roland McGrath <roland@baalperazim.frob.com>
* term.h (NO_DEVICE): New macro, bit for termflags. (termflags): Change type to uint_fast32_t. * devio.c (device_open_reply): For D_NO_SUCH_DEVICE error reply, set NO_DEVICE flag in termflags. * users.c (open_hook): If NO_DEVICE flag set, return ENXIO immediately. If we put out an open request, check for that bit as well as NO_CARRIER changing in termflags and diagnose with ENXIO. * Makefile (device_replyServer-CPPFLAGS): New variable, turn off TypeCheck for this stub. This is necessary for error replies to get through to our server-side functions in devio.c.
Diffstat (limited to 'term/users.c')
-rw-r--r--term/users.c20
1 files changed, 19 insertions, 1 deletions
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);