diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2015-07-12 22:49:07 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-07-23 21:31:29 -0400 |
commit | 3a6b02dc1f1b37fe2e9c86c00edf07c04bed9fab (patch) | |
tree | 91c7ea9b303e3bf36589c387168e99eae60f7e35 /drivers/tty/tty_io.c | |
parent | 4fef53518f9b4813043bdb48b70bd9fbf4ad2597 (diff) |
tty: core: Improve debug message content
Output the function name, tty name, and invariant failure (if applicable).
Add the tty count to the tty_open() message. Fix the disassociate_ctty()
message, which printed the NULL pointer and the wrong message.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_io.c')
-rw-r--r-- | drivers/tty/tty_io.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 6bdfb98bf020..1738fcaea891 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -531,7 +531,8 @@ static void __proc_set_tty(struct tty_struct *tty) | |||
531 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | 531 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); |
532 | tty->session = get_pid(task_session(current)); | 532 | tty->session = get_pid(task_session(current)); |
533 | if (current->signal->tty) { | 533 | if (current->signal->tty) { |
534 | printk(KERN_DEBUG "tty not NULL!!\n"); | 534 | printk(KERN_DEBUG "%s: %s: current tty %s not NULL!!\n", |
535 | __func__, tty->name, current->signal->tty->name); | ||
535 | tty_kref_put(current->signal->tty); | 536 | tty_kref_put(current->signal->tty); |
536 | } | 537 | } |
537 | put_pid(current->signal->tty_old_pgrp); | 538 | put_pid(current->signal->tty_old_pgrp); |
@@ -929,8 +930,7 @@ void disassociate_ctty(int on_exit) | |||
929 | tty_kref_put(tty); | 930 | tty_kref_put(tty); |
930 | } else { | 931 | } else { |
931 | #ifdef TTY_DEBUG_HANGUP | 932 | #ifdef TTY_DEBUG_HANGUP |
932 | printk(KERN_DEBUG "error attempted to write to tty [0x%p]" | 933 | printk(KERN_DEBUG "%s: no current tty\n", __func__); |
933 | " = NULL", tty); | ||
934 | #endif | 934 | #endif |
935 | } | 935 | } |
936 | 936 | ||
@@ -1712,8 +1712,8 @@ static int tty_release_checks(struct tty_struct *tty, int idx) | |||
1712 | { | 1712 | { |
1713 | #ifdef TTY_PARANOIA_CHECK | 1713 | #ifdef TTY_PARANOIA_CHECK |
1714 | if (idx < 0 || idx >= tty->driver->num) { | 1714 | if (idx < 0 || idx >= tty->driver->num) { |
1715 | printk(KERN_DEBUG "%s: bad idx when trying to free (%s)\n", | 1715 | printk(KERN_DEBUG "%s: %s: bad idx %d\n", |
1716 | __func__, tty->name); | 1716 | __func__, tty->name, idx); |
1717 | return -1; | 1717 | return -1; |
1718 | } | 1718 | } |
1719 | 1719 | ||
@@ -1722,20 +1722,22 @@ static int tty_release_checks(struct tty_struct *tty, int idx) | |||
1722 | return 0; | 1722 | return 0; |
1723 | 1723 | ||
1724 | if (tty != tty->driver->ttys[idx]) { | 1724 | if (tty != tty->driver->ttys[idx]) { |
1725 | printk(KERN_DEBUG "%s: driver.table[%d] not tty for (%s)\n", | 1725 | printk(KERN_DEBUG "%s: %s: bad driver table[%d] = %p\n", |
1726 | __func__, idx, tty->name); | 1726 | __func__, tty->name, idx, tty->driver->ttys[idx]); |
1727 | return -1; | 1727 | return -1; |
1728 | } | 1728 | } |
1729 | if (tty->driver->other) { | 1729 | if (tty->driver->other) { |
1730 | struct tty_struct *o_tty = tty->link; | 1730 | struct tty_struct *o_tty = tty->link; |
1731 | 1731 | ||
1732 | if (o_tty != tty->driver->other->ttys[idx]) { | 1732 | if (o_tty != tty->driver->other->ttys[idx]) { |
1733 | printk(KERN_DEBUG "%s: other->table[%d] not o_tty for (%s)\n", | 1733 | printk(KERN_DEBUG "%s: %s: bad other table[%d] = %p\n", |
1734 | __func__, idx, tty->name); | 1734 | __func__, tty->name, idx, |
1735 | tty->driver->other->ttys[idx]); | ||
1735 | return -1; | 1736 | return -1; |
1736 | } | 1737 | } |
1737 | if (o_tty->link != tty) { | 1738 | if (o_tty->link != tty) { |
1738 | printk(KERN_DEBUG "%s: bad pty pointers\n", __func__); | 1739 | printk(KERN_DEBUG "%s: %s: bad link = %p\n", |
1740 | __func__, tty->name, o_tty->link); | ||
1739 | return -1; | 1741 | return -1; |
1740 | } | 1742 | } |
1741 | } | 1743 | } |
@@ -2106,7 +2108,8 @@ retry_open: | |||
2106 | tty->driver->subtype == PTY_TYPE_MASTER) | 2108 | tty->driver->subtype == PTY_TYPE_MASTER) |
2107 | noctty = 1; | 2109 | noctty = 1; |
2108 | #ifdef TTY_DEBUG_HANGUP | 2110 | #ifdef TTY_DEBUG_HANGUP |
2109 | printk(KERN_DEBUG "%s: opening %s...\n", __func__, tty->name); | 2111 | printk(KERN_DEBUG "%s: %s: (tty count=%d)\n", __func__, tty->name, |
2112 | tty->count); | ||
2110 | #endif | 2113 | #endif |
2111 | if (tty->ops->open) | 2114 | if (tty->ops->open) |
2112 | retval = tty->ops->open(tty, filp); | 2115 | retval = tty->ops->open(tty, filp); |
@@ -2116,8 +2119,8 @@ retry_open: | |||
2116 | 2119 | ||
2117 | if (retval) { | 2120 | if (retval) { |
2118 | #ifdef TTY_DEBUG_HANGUP | 2121 | #ifdef TTY_DEBUG_HANGUP |
2119 | printk(KERN_DEBUG "%s: error %d in opening %s...\n", __func__, | 2122 | printk(KERN_DEBUG "%s: %s: error %d, releasing...\n", __func__, |
2120 | retval, tty->name); | 2123 | tty->name, retval); |
2121 | #endif | 2124 | #endif |
2122 | tty_unlock(tty); /* need to call tty_release without BTM */ | 2125 | tty_unlock(tty); /* need to call tty_release without BTM */ |
2123 | tty_release(inode, filp); | 2126 | tty_release(inode, filp); |