aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-10-13 05:41:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 12:51:42 -0400
commitfeebed6515a113eeb33919e9557a8b9710ea627c (patch)
tree0461178ee0c5e16ea90023e4b6386cb5c57d3391 /include/linux
parentbf7a06bcce205705ea5c7675cbb8ea9239ea30a0 (diff)
tty: shutdown method
Right now there are various drivers that try to use tty->count to know when they get the final close. Aristeau Rozanski showed while debugging the vt sysfs race that this isn't entirely safe. Instead of driver side tricks to work around this introduce a shutdown which is called when the tty is being destructed. This also means that the shutdown method is tied into the refcounting. Use this to rework the console close/sysfs logic. Remove lots of special case code from the tty core code. The pty code can now have a shutdown() method that replaces the special case hackery in the tree free up paths. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/tty.h3
-rw-r--r--include/linux/tty_driver.h6
2 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index e00393a3d1c9..6e39c705b9b6 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -354,7 +354,8 @@ extern void tty_throttle(struct tty_struct *tty);
354extern void tty_unthrottle(struct tty_struct *tty); 354extern void tty_unthrottle(struct tty_struct *tty);
355extern int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, 355extern int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty,
356 struct winsize *ws); 356 struct winsize *ws);
357 357extern void tty_shutdown(struct tty_struct *tty);
358extern void tty_free_termios(struct tty_struct *tty);
358extern int is_current_pgrp_orphaned(void); 359extern int is_current_pgrp_orphaned(void);
359extern struct pid *tty_get_pgrp(struct tty_struct *tty); 360extern struct pid *tty_get_pgrp(struct tty_struct *tty);
360extern int is_ignored(int sig); 361extern int is_ignored(int sig);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index ac6e58e26b73..2322313a8589 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -21,6 +21,11 @@
21 * 21 *
22 * Required method. 22 * Required method.
23 * 23 *
24 * void (*shutdown)(struct tty_struct * tty);
25 *
26 * This routine is called when a particular tty device is closed for
27 * the last time freeing up the resources.
28 *
24 * int (*write)(struct tty_struct * tty, 29 * int (*write)(struct tty_struct * tty,
25 * const unsigned char *buf, int count); 30 * const unsigned char *buf, int count);
26 * 31 *
@@ -200,6 +205,7 @@ struct tty_driver;
200struct tty_operations { 205struct tty_operations {
201 int (*open)(struct tty_struct * tty, struct file * filp); 206 int (*open)(struct tty_struct * tty, struct file * filp);
202 void (*close)(struct tty_struct * tty, struct file * filp); 207 void (*close)(struct tty_struct * tty, struct file * filp);
208 void (*shutdown)(struct tty_struct *tty);
203 int (*write)(struct tty_struct * tty, 209 int (*write)(struct tty_struct * tty,
204 const unsigned char *buf, int count); 210 const unsigned char *buf, int count);
205 int (*put_char)(struct tty_struct *tty, unsigned char ch); 211 int (*put_char)(struct tty_struct *tty, unsigned char ch);