Skip to contentSkip to conversation

make n_hdlc honor O_NONBLOCK on write

PATCH New Paul Fulghum 1 participant 1 message Jul 17, 2008 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make n_hdlc honor O_NONBLOCK on write

Make n_hdlc line discipline honor the O_NONBLOCK
file flag on write.

drivers/char/n_hdlc.c +4 -0
@@ -677,6 +677,10 @@ static ssize_t n_hdlc_tty_write(struct t
 	/* Allocate transmit buffer */
 	/* sleep until transmit buffer available */		
 	while (!(tbuf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list))) {
+		if (file->f_flags & O_NONBLOCK) {
+			error = -EAGAIN;
+			break;
+		}
 		schedule();
 			
 		n_hdlc = tty2n_hdlc (tty);