From 0e08ac0f24f7684edbc6fadc6e95bcc0ef5acf4b Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Fri, 4 Oct 1996 16:39:22 +0000 Subject: (pty_io_read, pty_io_write): Honor O_NONBLOCK. --- term/ptyio.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'term/ptyio.c') diff --git a/term/ptyio.c b/term/ptyio.c index e8952859..d032eab3 100644 --- a/term/ptyio.c +++ b/term/ptyio.c @@ -294,6 +294,11 @@ pty_io_read (struct trivfs_protid *cred, while (!control_byte && (!qsize (outputq) || (termflags & USER_OUTPUT_SUSP))) { + if (cred->po->openmodes & O_NONBLOCK) + { + mutex_unlock (&global_lock); + return EWOULDBLOCK; + } pty_read_blocked = 1; if (hurd_condition_wait (&pty_read_wakeup, &global_lock)) { @@ -368,7 +373,14 @@ pty_io_write (struct trivfs_protid *cred, { /* Wait for the queue to be empty */ while (qsize (inputq) && !cancel) - cancel = hurd_condition_wait (inputq->wait, &global_lock); + { + if (cred->po->openmodes & O_NONBLOCK) + { + mutex_unlock (&global_lock); + return EWOULDBLOCK; + } + cancel = hurd_condition_wait (inputq->wait, &global_lock); + } if (cancel) { mutex_unlock (&global_lock); -- cgit v1.2.3