aboutsummaryrefslogtreecommitdiff
path: root/term/users.c
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1999-10-04 14:39:04 +0000
committerThomas Bushnell <thomas@gnu.org>1999-10-04 14:39:04 +0000
commit6edeb62e3980f1a3769ed74cb81567744b5b6e92 (patch)
tree22add65c288e7b6fccbae236ef56fabfddf194db /term/users.c
parentffca5c4649a2808f523532728c4f1e9a0be0b912 (diff)
downloadhurd-6edeb62e3980f1a3769ed74cb81567744b5b6e92.tar.gz
hurd-6edeb62e3980f1a3769ed74cb81567744b5b6e92.tar.bz2
hurd-6edeb62e3980f1a3769ed74cb81567744b5b6e92.zip
1999-10-04 Thomas Bushnell, BSG <tb@mit.edu>
* term.h, devio.c, users.c: Revert previous change. Do it this way instead: * users.c (report_carrier_error): New function. (carrier_error): New static global variable. (open_hook): Deal with errors from carrier open. * devio.c (device_open_reply): Move the !RETURNCODE case out of the "initial open" case and use report_carrier_error. * term.h (report_carrier_error): Declare new function.
Diffstat (limited to 'term/users.c')
-rw-r--r--term/users.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/term/users.c b/term/users.c
index 6a5228b0..1168ca10 100644
--- a/term/users.c
+++ b/term/users.c
@@ -72,6 +72,8 @@ static int sigs_in_progress;
static struct condition input_sig_wait = CONDITION_INITIALIZER;
static int input_sig_wakeup;
+static error_t carrier_error;
+
/* Attach this on the hook of any protid that is a ctty. */
struct protid_hook
{
@@ -144,19 +146,10 @@ 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);
@@ -203,31 +196,28 @@ open_hook (struct trivfs_control *cntl,
}
/* Wait for carrier to turn on. */
- while ((termflags & (NO_CARRIER|NO_DEVICE)) == NO_CARRIER
- && !(termstate.c_cflag & CLOCAL)
+ while (((termflags & 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);
return EINTR;
}
- termflags |= TTY_OPEN;
- (*bottom->set_bits) ();
+ err = carrier_error;
+ carrier_error = 0;
+
+ if (!err)
+ {
+ termflags |= TTY_OPEN;
+ (*bottom->set_bits) ();
+ }
mutex_unlock (&global_lock);
- return 0;
+ return err;
}
error_t (*trivfs_check_open_hook) (struct trivfs_control *,
struct iouser *, int)
@@ -2162,6 +2152,13 @@ report_carrier_on ()
condition_broadcast (&carrier_alert);
}
+void
+report_carrier_error (error_t err)
+{
+ carrier_error = err;
+ condition_broadcast (&carrier_alert);
+}
+
kern_return_t
S_term_get_nodename (io_t arg,
char *name)