public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] A new testcase for tty tapset
  2009-10-02 21:03 [PATCH] A new tapset that adds support for tty and serial devices leitao
@ 2009-10-02 21:03 ` leitao
  2009-10-13 20:55   ` David Smith
  0 siblings, 1 reply; 4+ messages in thread
From: leitao @ 2009-10-02 21:03 UTC (permalink / raw)
  To: systemtap; +Cc: root

From: root <root@devhv4e-phantom-lp3.austin.ibm.com>

This is a basic test to assure that the tty tapset is working
compiling and working properly
---
 testsuite/buildok/tty.stp |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)
 create mode 100755 testsuite/buildok/tty.stp

diff --git a/testsuite/buildok/tty.stp b/testsuite/buildok/tty.stp
new file mode 100755
index 0000000..73f8706
--- /dev/null
+++ b/testsuite/buildok/tty.stp
@@ -0,0 +1,37 @@
+#! stap -wp4
+
+probe tty.poll{
+	printf("Pooling tty %s for wait queue key %d\n", file_name, wait_key);
+}
+
+probe tty.register {
+	printf("Device registered using index %d using driver %s(%s)\n", index, driver_name, name)
+}
+
+probe tty.unregister {
+	printf("Device registred using index %d using driver %s(%s)\n", index, driver_name, name)
+}
+
+probe tty.release {
+	printf("Closing file %s\n", file_name)
+	printf("INODE: number %d\nState: %d\nFlag: %d\n", inode_number, inode_state, inode_flags)
+	printf("File: %s mode %x flags %x\n", file_name, file_mode, file_flags)
+}
+
+probe tty.open {
+	printf("Opening tty file %s\n", file_name)
+	printf("INODE: number %d\nState: %d\nFlag: %d\n", inode_number, inode_state, inode_flags)
+	printf("File: %s mode %x flags %x\n", file_name, file_mode, file_flags)
+}
+
+probe tty.resize {
+	printf("Resizing %s from %dx%d to %dx%d\n", name, old_row, old_col, new_row, new_col)
+}
+
+probe tty.ioctl {
+	printf("Ioctling file %s with %d %d\n", name, cmd, arg)
+}
+
+probe tty.init {
+	printf("new tty with name %s from driver %s and module %s\n", driver_name, name, module)
+}
-- 
1.6.0.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] A new tapset that adds support for tty and serial devices
@ 2009-10-02 21:03 leitao
  2009-10-02 21:03 ` [PATCH] A new testcase for tty tapset leitao
  0 siblings, 1 reply; 4+ messages in thread
From: leitao @ 2009-10-02 21:03 UTC (permalink / raw)
  To: systemtap; +Cc: root

From: root <root@devhv4e-phantom-lp3.austin.ibm.com>

A new tapset that supports tty devices and consequently serial
devices. It is just a basic implementation that can be extended
as demands appears
---
 tapset/serial.stp |  141 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 141 insertions(+), 0 deletions(-)
 create mode 100644 tapset/serial.stp

diff --git a/tapset/serial.stp b/tapset/serial.stp
new file mode 100644
index 0000000..123fbfb
--- /dev/null
+++ b/tapset/serial.stp
@@ -0,0 +1,141 @@
+// tty tapset
+// Copyright (C) 2009 IBM Corp.
+//
+// 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($filp->f_path->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") {
+	inode_number= $inode->i_ino
+	inode_state = $inode->i_state
+	inode_flags = $inode->i_flags
+
+	file_name = d_name($filp->f_path->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("tty_do_resize"){
+	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
+
+	new_row = $ws->ws_row
+	new_col = $ws->ws_col
+	new_ypixel = $ws->ws_ypixel
+	new_xpixel = $ws->ws_xpixel
+}
+
+/**
+ * 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 = d_name($file->f_path->dentry)
+	
+	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"){
+	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
+ * @driver_name: the driver name
+ * @name: the driver  .dev_name name
+ * @module: the module name
+ * @index: the tty index requested
+ */
+probe tty.poll = kernel.function("tty_poll"){
+	file_name = d_name($filp->f_path->dentry)
+
+	if ($wait)
+		wait_key = $wait->key
+	else
+		wait_key = 0
+}
-- 
1.6.0.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] A new testcase for tty tapset
  2009-10-02 21:03 ` [PATCH] A new testcase for tty tapset leitao
@ 2009-10-13 20:55   ` David Smith
  0 siblings, 0 replies; 4+ messages in thread
From: David Smith @ 2009-10-13 20:55 UTC (permalink / raw)
  To: leitao; +Cc: systemtap, root

In general the tapset and testcase look fine, but I have a few comments
about missing variables.  Also, it might help if the testcase probes
were in the same order as the tapset probes.

On 10/02/2009 04:02 PM, leitao@linux.vnet.ibm.com wrote:
> From: root <root@devhv4e-phantom-lp3.austin.ibm.com>
> 
> This is a basic test to assure that the tty tapset is working
> compiling and working properly
> ---
>  testsuite/buildok/tty.stp |   37 +++++++++++++++++++++++++++++++++++++
>  1 files changed, 37 insertions(+), 0 deletions(-)
>  create mode 100755 testsuite/buildok/tty.stp
> 
> diff --git a/testsuite/buildok/tty.stp b/testsuite/buildok/tty.stp
> new file mode 100755
> index 0000000..73f8706
> --- /dev/null
> +++ b/testsuite/buildok/tty.stp
> @@ -0,0 +1,37 @@
> +#! stap -wp4
> +
> +probe tty.poll{
> +	printf("Pooling tty %s for wait queue key %d\n", file_name, wait_key);
> +}
> +
> +probe tty.register {
> +	printf("Device registered using index %d using driver %s(%s)\n", index, driver_name, name)
> +}

Could you add module here?

> +probe tty.unregister {
> +	printf("Device registred using index %d using driver %s(%s)\n", index, driver_name, name)
> +}

Could you add module here?

> +
> +probe tty.release {
> +	printf("Closing file %s\n", file_name)
> +	printf("INODE: number %d\nState: %d\nFlag: %d\n", inode_number, inode_state, inode_flags)
> +	printf("File: %s mode %x flags %x\n", file_name, file_mode, file_flags)
> +}
> +
> +probe tty.open {
> +	printf("Opening tty file %s\n", file_name)
> +	printf("INODE: number %d\nState: %d\nFlag: %d\n", inode_number, inode_state, inode_flags)
> +	printf("File: %s mode %x flags %x\n", file_name, file_mode, file_flags)
> +}
> +
> +probe tty.resize {
> +	printf("Resizing %s from %dx%d to %dx%d\n", name, old_row, old_col, new_row, new_col)
> +}

Could you add old_ypixel, old_xpixel, new_ypixel, and new_xpixel here?

> +probe tty.ioctl {
> +	printf("Ioctling file %s with %d %d\n", name, cmd, arg)
> +}
> +
> +probe tty.init {
> +	printf("new tty with name %s from driver %s and module %s\n", driver_name, name, module)
> +}


-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] A new testcase for tty tapset
  2009-10-20 18:10 [PATCH] A new tapset that adds support for tty and serial devices leitao
@ 2009-10-20 18:10 ` leitao
  0 siblings, 0 replies; 4+ messages in thread
From: leitao @ 2009-10-20 18:10 UTC (permalink / raw)
  To: systemtap

This is a basic test to assure that the tty tapset is working
compiling and working properly
---
 testsuite/buildok/tty.stp |   51 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100755 testsuite/buildok/tty.stp

diff --git a/testsuite/buildok/tty.stp b/testsuite/buildok/tty.stp
new file mode 100755
index 0000000..0b5018d
--- /dev/null
+++ b/testsuite/buildok/tty.stp
@@ -0,0 +1,51 @@
+#! stap -wp4
+
+probe tty.poll{
+	printf("Pooling tty %s for wait queue key %d\n", file_name, wait_key);
+}
+
+probe tty.register {
+	printf("Device registered using index %d using driver %s(%s/%s)\n", index, driver_name, name, module)
+}
+
+probe tty.unregister {
+	printf("Device registered using index %d using driver %s(%s/%s)\n", index, driver_name, name, module)
+}
+
+probe tty.release {
+	printf("Closing file %s\n", file_name)
+	printf("INODE: number %d\nState: %d\nFlag: %d\n", inode_number, inode_state, inode_flags)
+	printf("File: %s (mode %x flags %x)\n", file_name, file_mode, file_flags)
+}
+
+probe tty.open {
+	printf("Opening tty file %s\n", file_name)
+	printf("INODE: number %d\nState: %d\nFlag: %d\n", inode_number, inode_state, inode_flags)
+	printf("File: %s mode %x flags %x\n", file_name, file_mode, file_flags)
+}
+
+probe tty.resize {
+	printf("Resizing %s from %dx%d (%d/%d) to %dx%d (%d/%d)\n", name, old_row, old_col, old_xpixel, old_ypixel,
+		 new_row, new_col, new_xpixel, new_ypixel)
+}
+
+probe tty.ioctl {
+	printf("Ioctling file %s with %d %d\n", name, cmd, arg)
+}
+
+probe tty.init {
+	printf("new tty with name %s from driver %s and module %s\nn", driver_name, name, module)
+}
+
+probe tty.receive {
+	printf("Driver %s/%s (%d/%d) received %s (%s) with len %d\n", name, driver_name, index, id, cp, fp, count)
+}
+
+
+probe tty.write {
+	printf("Buffer %s (len %d) wrote on file %s (driver %s)\n", buffer, nr, file_name, driver_name)
+}
+
+probe tty.read {
+	printf("Reading tty file %s (driver %s) to a buffer with size %d containing %s\n", file_name, driver_name, nr, buffer)
+}
-- 
1.6.0.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-20 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-02 21:03 [PATCH] A new tapset that adds support for tty and serial devices leitao
2009-10-02 21:03 ` [PATCH] A new testcase for tty tapset leitao
2009-10-13 20:55   ` David Smith
2009-10-20 18:10 [PATCH] A new tapset that adds support for tty and serial devices leitao
2009-10-20 18:10 ` [PATCH] A new testcase for tty tapset leitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).