diff --git a/elks/arch/i86/drivers/char/ntty.c b/elks/arch/i86/drivers/char/ntty.c index ed928a218..0d7f096fd 100644 --- a/elks/arch/i86/drivers/char/ntty.c +++ b/elks/arch/i86/drivers/char/ntty.c @@ -212,14 +212,14 @@ void tty_release(struct inode *inode, struct file *file) * * while (tty->outq.len > 0) { * ch = tty_outproc(tty); - * write_char_to_device(device, (char)ch); + * write_char_to_device(device, ch); * cnt++; * } * */ int tty_outproc(register struct tty *tty) { - int t_oflag; /* WARNING: highly arch dependent, termios.c_oflag truncated to 16 bits*/ + int t_oflag; /* WARNING: termios.c_oflag truncated to 16 bits */ int ch; ch = tty->outq.base[tty->outq.tail]; @@ -247,7 +247,7 @@ int tty_outproc(register struct tty *tty) break; #endif case '\t': - if ((t_oflag & TABDLY) == TAB3) { + if ((t_oflag & TABDLY) == XTABS) { ch = ' '; /* Expand tabs to spaces */ tty->ostate = 0x20 + TAB_SPACES - 1; } @@ -267,7 +267,7 @@ static void tty_echo(register struct tty *tty, unsigned char ch) if ((tty->termios.c_lflag & ECHO) || ((tty->termios.c_lflag & ECHONL) && (ch == '\n'))) { if ((ch == tty->termios.c_cc[VERASE] || ch == tty->termios.c_cc[VERASE2]) - && (tty->termios.c_lflag & ECHOE)) { + && (tty->termios.c_lflag & ECHOE)) { chq_addch(&tty->outq, '\b'); chq_addch(&tty->outq, ' '); chq_addch(&tty->outq, '\b'); @@ -290,10 +290,11 @@ size_t tty_write(struct inode *inode, struct file *file, char *data, size_t len) i = 0; while (i < len) { - s = chq_wait_wr(&tty->outq, file->f_flags & O_NONBLOCK); + s = chq_wait_wr(&tty->outq, (file->f_flags & O_NONBLOCK) | i); if (s < 0) { /* FIXME EAGAIN not returned, cycle required on telnet nonblocking terminal */ if (s == -EINTR || s == -EAGAIN) { + tty->ops->write(tty); wake_up(&tty->outq.wait); schedule(); continue; @@ -302,10 +303,10 @@ size_t tty_write(struct inode *inode, struct file *file, char *data, size_t len) i = s; break; } - chq_addch_nowakeup(&tty->outq, get_user_char((void *)data++)); - tty->ops->write(tty); + chq_addch_nowakeup(&tty->outq, get_user_char(data++)); i++; } + tty->ops->write(tty); wake_up(&tty->outq.wait); return i; } diff --git a/elks/fs/read_write.c b/elks/fs/read_write.c index aab465628..627d68a2e 100644 --- a/elks/fs/read_write.c +++ b/elks/fs/read_write.c @@ -90,7 +90,7 @@ int sys_read(unsigned int fd, char *buf, size_t count) fop = file->f_op; if (fop->read) { retval = (int) fop->read(file->f_inode, file, buf, count); - schedule(); + schedule(); // FIXME removing these slows down localhost networking } } return retval; @@ -129,7 +129,7 @@ int sys_write(unsigned int fd, char *buf, size_t count) } written = (int) fop->write(inode, file, buf, count); - schedule(); // FIXME should this be here? + schedule(); // FIXME removing these slows down localhost networking } } return written; diff --git a/elks/include/linuxmt/chqueue.h b/elks/include/linuxmt/chqueue.h index 6c7ef834f..42fe07617 100644 --- a/elks/include/linuxmt/chqueue.h +++ b/elks/include/linuxmt/chqueue.h @@ -1,8 +1,8 @@ -/* chqueue.h (C) 1997 Chad Page, rewritten Greg Haerr Oct 2020 */ - #ifndef __LINUXMT_CHQ_H #define __LINUXMT_CHQ_H +/* chqueue.h (C) 1997 Chad Page, rewritten Greg Haerr Oct 2020 */ + struct ch_queue { unsigned char *base; int size; /* doesn't have to be power of two*/ @@ -11,15 +11,12 @@ struct ch_queue { }; extern void chq_init(register struct ch_queue *,unsigned char *,int); -/*extern void chq_erase(register struct ch_queue *);*/ extern int chq_wait_wr(register struct ch_queue *,int); +extern int chq_wait_rd(register struct ch_queue *,int); extern void chq_addch(register struct ch_queue *,unsigned char); extern void chq_addch_nowakeup(register struct ch_queue *,unsigned char); -extern int chq_delch(register struct ch_queue *); extern int chq_peekch(register struct ch_queue *); -/*extern int chq_full(register struct ch_queue *);*/ - -extern int chq_wait_rd(register struct ch_queue *,int); extern int chq_getch(register struct ch_queue *); +/*extern int chq_full(register struct ch_queue *);*/ #endif