From e974c97c3880954c22c8444279b2663406065621 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 1 Oct 1999 21:45:20 +0000 Subject: 1999-10-01 Roland McGrath * 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. --- term/users.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'term/users.c') 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); -- cgit v1.2.3