summaryrefslogtreecommitdiff
path: root/term/ptyio.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-10-04 16:39:22 +0000
committerMiles Bader <miles@gnu.org>1996-10-04 16:39:22 +0000
commit0e08ac0f24f7684edbc6fadc6e95bcc0ef5acf4b (patch)
tree0d6daee84d05165d8f96c453c9a39bd62f0793c8 /term/ptyio.c
parenta0ed94f39e75cb746541940edf8e96515963abe8 (diff)
(pty_io_read, pty_io_write): Honor O_NONBLOCK.
Diffstat (limited to 'term/ptyio.c')
-rw-r--r--term/ptyio.c14
1 files changed, 13 insertions, 1 deletions
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);