/usr/share/systemtap/tapset/linux/tty.stp is in systemtap-common 2.3-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | // tty tapset
// Copyright (C) 2009 IBM Corp.
// Copyright (C) 2010 Red Hat Inc.
//
// Author: Breno Leitao <leitao@linux.vnet.ibm.com>
//
// This file is part of systemtap, and is free software. You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.
/**
* probe tty.open - Called when a tty is opened
* @inode_number: the inode number
* @inode_state: the inode state
* @inode_flags: the inode flags
* @file_name: the file name
* @file_mode: the file mode
* @file_flags: the file flags
*/
probe tty.open = kernel.function("tty_open")
{
inode_number = $inode->i_ino
inode_state = $inode->i_state
inode_flags = $inode->i_flags
file_name = d_name(@choose_defined($filp->f_path->dentry,
$filp->f_dentry))
file_mode = $filp->f_mode
file_flags = $filp->f_flags
}
/**
* probe tty.release - Called when the tty is closed
* @inode_number: the inode number
* @inode_state: the inode state
* @inode_flags: the inode flags
* @file_name: the file name
* @file_mode: the file mode
* @file_flags: the file flags
*/
probe tty.release = kernel.function("tty_release")
{
// RHEL4 (2.6.9) kernel's debuginfo doesn't seem to have
// $inode, even though the function isn't inline. So, make
// sure $inode is defined.
if (@defined($inode)) {
inode_number = $inode->i_ino
inode_state = $inode->i_state
inode_flags = $inode->i_flags
}
else {
inode_number = -1
inode_state = -1
inode_flags = -1
}
file_name = d_name(@choose_defined($filp->f_path->dentry,
$filp->f_dentry))
file_mode = $filp->f_mode
file_flags = $filp->f_flags
}
/**
* probe tty.resize - Called when a terminal resize happens
* @name: the tty name
* @old_row: the old row value
* @old_col: the old col value
* @old_ypixel: the old ypixel
* @old_xpixel: the old xpixel
* @new_row: the new row value
* @new_col: the new col value
* @new_ypixel: the new ypixel value
* @new_xpixel: the new xpixel value
*/
probe tty.resize = kernel.function("tiocswinsz")
{
name = kernel_string($tty->name)
old_row = $tty->winsize->ws_row
old_col = $tty->winsize->ws_col
old_ypixel = $tty->winsize->ws_ypixel
old_xpixel = $tty->winsize->ws_xpixel
if (@defined($arg)) {
new_row = user_ushort($arg->ws_row)
new_col = user_ushort($arg->ws_col)
new_ypixel = user_ushort($arg->ws_ypixel)
new_xpixel = user_ushort($arg->ws_xpixel)
}
else {
new_row = -1
new_col = -1
new_ypixel = -1
new_xpixel = -1
}
}
/**
* probe tty.ioctl - called when a ioctl is request to the tty
* @name: the file name
* @cmd: the ioctl command
* @arg: the ioctl argument
*/
probe tty.ioctl = kernel.function("tty_ioctl")
{
name = kernel_string(@choose_defined($file->f_path->dentry->d_iname,
$file->f_dentry->d_iname))
cmd = $cmd
arg = $arg
}
/**
* probe tty.init - Called when a tty is being initalized
* @driver_name: the driver name
* @name: the driver .dev_name name
* @module: the module name
*/
probe tty.init = kernel.function("tty_init_dev") !,
kernel.function("init_dev")
{
driver_name = kernel_string($driver->driver_name)
name = kernel_string($driver->name)
module = kernel_string($driver->owner->name)
}
/**
* probe tty.register - Called when a tty device is registred
* @driver_name: the driver name
* @name: the driver .dev_name name
* @module: the module name
* @index: the tty index requested
*/
probe tty.register = kernel.function("tty_register_device")
{
driver_name = kernel_string($driver->driver_name)
name = kernel_string($driver->name)
module = kernel_string($driver->owner->name)
index = $index
}
/**
* probe tty.unregister - Called when a tty device is being unregistered
* @driver_name: the driver name
* @name: the driver .dev_name name
* @module: the module name
* @index: the tty index requested
*/
probe tty.unregister = kernel.function("tty_unregister_device")
{
driver_name = kernel_string($driver->driver_name)
name = kernel_string($driver->name)
module = kernel_string($driver->owner->name)
index = $index
}
/**
* probe tty.poll - Called when a tty device is being polled
* @file_name: the tty file name
* @wait_key: the wait queue key
*/
probe tty.poll = kernel.function("tty_poll")
{
file_name = d_name(@choose_defined($filp->f_path->dentry,
$filp->f_dentry))
wait_key = (@defined($wait->key) ? ($wait ? $wait->key : 0) : 0)
}
/**
* probe tty.receive - called when a tty receives a message
* @cp: the buffer that was received
* @fp: The flag buffer
* @count: The amount of characters received
* @driver_name: the driver name
* @name: the name of the module file
* @index: The tty Index
* @id: the tty id
*/
probe tty.receive = kernel.function("n_tty_receive_buf")
{
cp = kernel_string($cp)
fp = kernel_string($fp)
count = $count
driver_name = kernel_string($tty->driver->driver_name)
name = kernel_string($tty->driver->name)
index = $tty->index
id = $tty->magic
}
/**
* probe tty.write - write to the tty line
* @buffer: the buffer that will be written
* @nr: The amount of characters
* @driver_name: the driver name
* @file_name: the file name lreated to the tty
*/
probe tty.write = kernel.function("n_tty_write") !,
kernel.function("write_chan")
{
buffer = kernel_string($buf)
nr = $nr
file_name = d_name(@choose_defined($file->f_path->dentry,
$file->f_dentry))
driver_name = kernel_string($tty->driver->driver_name)
}
/**
* probe tty.read - called when a tty line will be read
* @buffer: the buffer that will receive the characters
* @nr: The amount of characters to be read
* @driver_name: the driver name
* @file_name: the file name lreated to the tty
*/
probe tty.read = kernel.function("n_tty_read") !,
kernel.function("read_chan")
{
buffer = kernel_string($buf)
nr = $nr
file_name = d_name(@choose_defined($file->f_path->dentry,
$file->f_dentry))
driver_name = kernel_string($tty->driver->driver_name)
}
|