Skip to content

Commit

Permalink
pty: Add debug message for ptmx open
Browse files Browse the repository at this point in the history
Opens of /dev/ptmx don't use tty_open() so debug messages are
not printed for those opens; print a debug message with the
open count (which must always be 1) if TTY_DEBUG_HANGUP is defined.

NB: Each tty core source file undefs support for debug messages.
The relevant source file must be patched/edited to enable these
messages.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Jul 24, 2015
1 parent fb6edc9 commit d684779
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/tty/pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
#include <linux/mutex.h>
#include <linux/poll.h>

#undef TTY_DEBUG_HANGUP
#ifdef TTY_DEBUG_HANGUP
# define tty_debug_hangup(tty, f, args...) tty_debug(tty, f, ##args)
#else
# define tty_debug_hangup(tty, f, args...) do {} while (0)
#endif

#ifdef CONFIG_UNIX98_PTYS
static struct tty_driver *ptm_driver;
Expand Down Expand Up @@ -779,6 +785,8 @@ static int ptmx_open(struct inode *inode, struct file *filp)
if (retval)
goto err_release;

tty_debug_hangup(tty, "(tty count=%d)\n", tty->count);

tty_unlock(tty);
return 0;
err_release:
Expand Down

0 comments on commit d684779

Please sign in to comment.