summaryrefslogtreecommitdiffstats
path: root/kernel/0001-tty-notifier.patch
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/0001-tty-notifier.patch')
-rw-r--r--kernel/0001-tty-notifier.patch58
1 files changed, 35 insertions, 23 deletions
diff --git a/kernel/0001-tty-notifier.patch b/kernel/0001-tty-notifier.patch
index d531fb8..6e1b29d 100644
--- a/kernel/0001-tty-notifier.patch
+++ b/kernel/0001-tty-notifier.patch
@@ -1,13 +1,13 @@
-From a578319c78d30fe0a6cae11723daa1f65a2200c9 Mon Sep 17 00:00:00 2001
+From 5ab78e8b939366aa096c28898bbf20ddcb3a61f4 Mon Sep 17 00:00:00 2001
From: Jiri Olsa <Jiri Olsa jolsa@redhat.com>
-Date: Wed, 14 Apr 2010 12:03:26 +0200
+Date: Tue, 20 Apr 2010 14:21:39 +0200
Subject: [PATCH 1/4] tty notifier
---
- drivers/char/Kconfig | 6 +++
- drivers/char/tty_io.c | 106 +++++++++++++++++++++++++++++++++++++++++++++++++
- include/linux/tty.h | 22 ++++++++++
- 3 files changed, 134 insertions(+), 0 deletions(-)
+ drivers/char/Kconfig | 6 ++
+ drivers/char/tty_io.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++
+ include/linux/tty.h | 22 +++++++++
+ 3 files changed, 153 insertions(+), 0 deletions(-)
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 3141dd3..9be342e 100644
@@ -26,10 +26,10 @@ index 3141dd3..9be342e 100644
endmenu
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
-index 6da962c..1f77159 100644
+index 6da962c..f0463d0 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
-@@ -154,6 +154,90 @@ static void release_tty(struct tty_struct *tty, int idx);
+@@ -154,6 +154,112 @@ static void release_tty(struct tty_struct *tty, int idx);
static void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
static void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
@@ -115,12 +115,34 @@ index 6da962c..1f77159 100644
+ atomic_notifier_call_chain(&tty_notifier_list, TTY_NOTIFY_DATA, &param);
+}
+
++/**
++ * tty_del - remove tty from the global list
++ *
++ * Locking: tty_mutex
++ */
++
++static void tty_del(struct tty_struct *tty)
++{
++
++ mutex_lock(&tty_mutex);
++
++ /* It's the master who's on the list... */
++ if (tty->driver->type == TTY_DRIVER_TYPE_PTY)
++ if (tty->driver->subtype == PTY_TYPE_SLAVE);
++ tty = tty->link;
++
++ if (tty)
++ list_del(&tty->list);
++
++ mutex_unlock(&tty_mutex);
++}
++
+#endif
+
/**
* alloc_tty_struct - allocate a tty object
*
-@@ -981,6 +1065,11 @@ static inline ssize_t do_tty_write(
+@@ -981,6 +1087,11 @@ static inline ssize_t do_tty_write(
ret = -EFAULT;
if (copy_from_user(tty->write_buf, buf, size))
break;
@@ -132,7 +154,7 @@ index 6da962c..1f77159 100644
ret = write(tty, file, tty->write_buf, size);
if (ret <= 0)
break;
-@@ -1352,6 +1441,11 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
+@@ -1352,6 +1463,11 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
retval = tty_ldisc_setup(tty, tty->link);
if (retval)
goto release_mem_out;
@@ -144,30 +166,20 @@ index 6da962c..1f77159 100644
return tty;
fail_no_mem:
-@@ -1476,6 +1570,10 @@ static void release_tty(struct tty_struct *tty, int idx)
- /* This should always be true but check for the moment */
- WARN_ON(tty->index != idx);
-
-+#ifdef CONFIG_TTY_NOTIFIER
-+ list_del(&tty->list);
-+#endif
-+
- if (tty->link)
- tty_kref_put(tty->link);
- tty_kref_put(tty);
-@@ -1705,6 +1803,11 @@ int tty_release(struct inode *inode, struct file *filp)
+@@ -1705,6 +1821,12 @@ int tty_release(struct inode *inode, struct file *filp)
#ifdef TTY_DEBUG_HANGUP
printk(KERN_DEBUG "freeing tty structure...");
#endif
+
+#ifdef CONFIG_TTY_NOTIFIER
+ notify_tty_release(tty);
++ tty_del(tty);
+#endif
+
/*
* Ask the line discipline code to release its structures
*/
-@@ -2770,6 +2873,9 @@ void initialize_tty_struct(struct tty_struct *tty,
+@@ -2770,6 +2892,9 @@ void initialize_tty_struct(struct tty_struct *tty,
spin_lock_init(&tty->read_lock);
spin_lock_init(&tty->ctrl_lock);
INIT_LIST_HEAD(&tty->tty_files);