Small pty/console patch.

C. Scott Ananian (cananian@lcs.mit.edu)
Wed, 14 Jan 1998 06:35:48 -0500 (EST)


Attached is a small patch to:
1) correct a crash reported on linux-kernel due to the lack of an ioctl
method for ptys.
2) Add the driver_name to the reported information about the console
driver, to make it like the other tty devices. This fills in a
gap in /proc/drivers.

Patch is against 2.1.78, tested on 2.1.79; should apply cleanly against
anything similar. This code hasn't been changed for quite a while.

--Scott

diff -ruHp -X badboys linux-orig/drivers/char/console.c linux/drivers/char/console.c
--- linux-orig/drivers/char/console.c Wed Jan 14 00:03:55 1998
+++ linux/drivers/char/console.c Tue Jan 13 21:22:49 1998
@@ -2019,6 +2019,7 @@ __initfunc(unsigned long con_init(unsign

memset(&console_driver, 0, sizeof(struct tty_driver));
console_driver.magic = TTY_DRIVER_MAGIC;
+ console_driver.driver_name = "virtual console";
console_driver.name = "tty";
console_driver.name_base = 1;
console_driver.major = TTY_MAJOR;
diff -ruHp -X badboys linux-orig/drivers/char/pty.c linux/drivers/char/pty.c
--- linux-orig/drivers/char/pty.c Wed Jan 14 00:03:55 1998
+++ linux/drivers/char/pty.c Tue Jan 13 22:00:56 1998
@@ -191,6 +191,15 @@ static int pty_chars_in_buffer(struct tt
return ((count < N_TTY_BUF_SIZE/2) ? 0 : count);
}

+/*
+ * Dummy ioctl routine to satisfy tty_ioctl calling conventions.
+ */
+static int pty_ioctl(struct tty_struct *tty, struct file * file,
+ unsigned int cmd, unsigned long arg)
+{
+ return -ENOIOCTLCMD;
+}
+
static void pty_flush_buffer(struct tty_struct *tty)
{
struct tty_struct *to = tty->link;
@@ -272,5 +281,6 @@ __initfunc(int pty_init(void))
pty_driver.write_room = pty_write_room;
pty_driver.flush_buffer = pty_flush_buffer;
pty_driver.chars_in_buffer = pty_chars_in_buffer;
+ pty_driver.ioctl = pty_ioctl;
pty_driver.unthrottle = pty_unthrottle;
pty_driver.set_termios = pty_set_termios;