Messages in this thread Patch in this message | | | From | "Paul Fulghum" <> | Subject | Proposed patch tty_io.c/8K write split | Date | Tue, 24 Aug 1999 09:29:26 -0500 |
| |
I have previously posted a suggestion to allow line disciplines to avoid the splitting of write() calls into 8K chunks. No one objected so I am posting the actual patch for comments. The patch is against 2.2.11. The point of this change is to allow a line discipline I wrote to process complete write() calls without interference from tty_io.c.
The change adds a new TTY flag that suppresses the write split in tty_io.c. If this flag is not set then the behavior is unchanged. If set then the line discipline write routine is called with the parameters of the original write (no write split). When a line discipline is loaded (ldisc open called) then the ldisc can set the flag if necessary. When the ldisc is unloaded (ldisc close called), then the flag can be restored.
This patch is very minimal and does not change the default behavior if the new flag is not set. Please post any objections. If none are raised then I will submit this patch.
diff -Naur linux-2.2.11/drivers/char/tty_io.c linux-2.2.11-mg/drivers/char/tty_io.c --- linux-2.2.11/drivers/char/tty_io.c Mon Aug 9 14:05:09 1999 +++ linux-2.2.11-mg/drivers/char/tty_io.c Mon Aug 23 15:36:41 1999 @@ -656,23 +656,27 @@ down(&inode->i_sem); return -ERESTARTSYS; } - for (;;) { - unsigned long size = PAGE_SIZE*2; - if (size > count) - size = count; - ret = write(tty, file, buf, size); - if (ret <= 0) - break; - written += ret; - buf += ret; - count -= ret; - if (!count) - break; - ret = -ERESTARTSYS; - if (signal_pending(current)) - break; - if (current->need_resched) - schedule(); + if ( test_bit(TTY_NO_WRITE_SPLIT, &tty->flags) ) + written = write(tty, file, buf, count); + else { + for (;;) { + unsigned long size = PAGE_SIZE*2; + if (size > count) + size = count; + ret = write(tty, file, buf, size); + if (ret <= 0) + break; + written += ret; + buf += ret; + count -= ret; + if (!count) + break; + ret = -ERESTARTSYS; + if (signal_pending(current)) + break; + if (current->need_resched) + schedule(); + } } if (written) { file->f_dentry->d_inode->i_mtime = CURRENT_TIME; diff -Naur linux-2.2.11/include/linux/tty.h linux-2.2.11-mg/include/linux/tty.h --- linux-2.2.11/include/linux/tty.h Mon Aug 23 14:52:57 1999 +++ linux-2.2.11-mg/include/linux/tty.h Mon Aug 23 15:34:43 1999 @@ -328,6 +328,7 @@ #define TTY_HW_COOK_OUT 14 #define TTY_HW_COOK_IN 15 #define TTY_PTY_LOCK 16 +#define TTY_NO_WRITE_SPLIT 17
#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
Paul Fulghum paulkf@microgate.com Microgate Corporation www.microgate.com 9501 Capital of Texas Hwy Austin, Texas 78759 (512)-345-7791
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |