summaryrefslogtreecommitdiffstats
path: root/tapset
diff options
context:
space:
mode:
Diffstat (limited to 'tapset')
-rw-r--r--tapset/context.stp2
-rw-r--r--tapset/errno.stp2
-rw-r--r--tapset/ioscheduler.stp16
-rw-r--r--tapset/irq.stp16
-rw-r--r--tapset/linuxmib.stp4
-rw-r--r--tapset/nd_syscalls.stp3
-rw-r--r--tapset/scheduler.stp9
-rw-r--r--tapset/string.stp129
-rw-r--r--tapset/syscalls.stp3
-rw-r--r--tapset/tcpmib.stp16
-rw-r--r--tapset/tty.stp34
11 files changed, 156 insertions, 78 deletions
diff --git a/tapset/context.stp b/tapset/context.stp
index 36701e6e..b30f7dca 100644
--- a/tapset/context.stp
+++ b/tapset/context.stp
@@ -15,7 +15,7 @@
%{
#include <asm/processor.h>
-#if defined(__powerpc64__)
+#if defined(__powerpc__)
#if !defined(task_pt_regs)
#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.regs)
#endif
diff --git a/tapset/errno.stp b/tapset/errno.stp
index 011ff7e2..d4d571be 100644
--- a/tapset/errno.stp
+++ b/tapset/errno.stp
@@ -369,7 +369,7 @@ static long _stp_returnval(struct pt_regs *regs) {
#elif defined (__x86_64__)
// TODO: Handle -m32 apps.
return regs->rax;
-#elif defined (__powerpc64__)
+#elif defined (__powerpc__)
return regs->gpr[3];
#elif defined (__ia64__)
return regs->r8;
diff --git a/tapset/ioscheduler.stp b/tapset/ioscheduler.stp
index 7f26cf23..9b353577 100644
--- a/tapset/ioscheduler.stp
+++ b/tapset/ioscheduler.stp
@@ -155,7 +155,7 @@ probe ioscheduler.elv_completed_request
*
*/
probe ioscheduler.elv_add_request.tp
- = kernel.trace("block_rq_insert")
+ = kernel.trace("block_rq_insert") ?
{
q = $q
elevator_name = kernel_string($q->elevator->elevator_type->elevator_name)
@@ -197,7 +197,7 @@ probe ioscheduler.elv_add_request =
*
*/
probe ioscheduler_trace.elv_completed_request
- = kernel.trace("block_rq_complete")
+ = kernel.trace("block_rq_complete") ?
{
elevator_name = kernel_string($q->elevator->elevator_type->elevator_name)
rq = $rq
@@ -224,7 +224,7 @@ rq_flags = $rq==0? 0:$rq->cmd_flags
*
*/
probe ioscheduler_trace.elv_issue_request
- = kernel.trace("block_rq_issue")
+ = kernel.trace("block_rq_issue") ?
{
elevator_name = kernel_string($q->elevator->elevator_type->elevator_name)
rq = $rq
@@ -251,7 +251,7 @@ rq_flags = $rq==0? 0:$rq->cmd_flags
*
*/
probe ioscheduler_trace.elv_requeue_request
- = kernel.trace("block_rq_requeue")
+ = kernel.trace("block_rq_requeue") ?
{
elevator_name = kernel_string($q->elevator->elevator_type->elevator_name)
rq = $rq
@@ -277,7 +277,7 @@ rq_flags = $rq==0? 0:$rq->cmd_flags
*
*/
probe ioscheduler_trace.elv_abort_request
- = kernel.trace("block_rq_abort")
+ = kernel.trace("block_rq_abort") ?
{
elevator_name = kernel_string($q->elevator->elevator_type->elevator_name)
rq = $rq
@@ -299,7 +299,7 @@ rq_flags = $rq==0? 0:$rq->cmd_flags
* @rq_queue : request queue
*
*/
-probe ioscheduler_trace.plug = kernel.trace("block_plug")
+probe ioscheduler_trace.plug = kernel.trace("block_plug") ?
{
rq_queue = $q
}
@@ -311,7 +311,7 @@ probe ioscheduler_trace.plug = kernel.trace("block_plug")
* @rq_queue : request queue
*
*/
-probe ioscheduler_trace.unplug_io = kernel.trace("block_unplug_io")
+probe ioscheduler_trace.unplug_io = kernel.trace("block_unplug_io") ?
{
rq_queue = $q
}
@@ -322,7 +322,7 @@ probe ioscheduler_trace.unplug_io = kernel.trace("block_unplug_io")
* @rq_queue : request queue
*
*/
-probe ioscheduler_trace.unplug_timer = kernel.trace("block_unplug_timer")
+probe ioscheduler_trace.unplug_timer = kernel.trace("block_unplug_timer") ?
{
rq_queue = $q
}
diff --git a/tapset/irq.stp b/tapset/irq.stp
index 6a9b9147..5d919659 100644
--- a/tapset/irq.stp
+++ b/tapset/irq.stp
@@ -17,7 +17,7 @@
* @wq_thread : task_struct of the workqueue thread.
* @cpu : cpu for which the worker thread is created.
*/
-probe workqueue.create = kernel.trace("workqueue_creation")
+probe workqueue.create = kernel.trace("workqueue_creation") ?
{
wq_thread = $wq_thread
cpu = $cpu
@@ -29,7 +29,7 @@ probe workqueue.create = kernel.trace("workqueue_creation")
* @work : work_struct* being queued.
* @work_func : pointer to handler func.
*/
-probe workqueue.insert = kernel.trace("workqueue_insertion")
+probe workqueue.insert = kernel.trace("workqueue_insertion") ?
{
wq_thread = $wq_thread
work = $work
@@ -42,7 +42,7 @@ probe workqueue.insert = kernel.trace("workqueue_insertion")
* @work : work_struct* being executed.
* @work_func : pointer to handler func.
*/
-probe workqueue.execute = kernel.trace("workqueue_execution")
+probe workqueue.execute = kernel.trace("workqueue_execution") ?
{
wq_thread = $wq_thread
work = $work
@@ -53,7 +53,7 @@ probe workqueue.execute = kernel.trace("workqueue_execution")
* probe workqueue.destroy : probes destruction of each worker thread of each cpu for a workqueue.
* @wq_thread : task_struct of the workqueue thread.
*/
-probe workqueue.destroy = kernel.trace("workqueue_destruction")
+probe workqueue.destroy = kernel.trace("workqueue_destruction") ?
{
wq_thread = $wq_thread
}
@@ -84,7 +84,7 @@ probe workqueue.destroy = kernel.trace("workqueue_destruction")
* @thread : thread pointer for threaded interrupts.
* @thread_flags : Flags related to thread.
*/
-probe irq_handler.entry = kernel.trace("irq_handler_entry")
+probe irq_handler.entry = kernel.trace("irq_handler_entry") ?
{
irq = $irq
action = $action
@@ -125,7 +125,7 @@ probe irq_handler.entry = kernel.trace("irq_handler_entry")
* @thread : thread pointer for threaded interrupts.
* @thread_flags : Flags related to thread.
*/
-probe irq_handler.exit = kernel.trace("irq_handler_exit")
+probe irq_handler.exit = kernel.trace("irq_handler_exit") ?
{
irq = $irq
action = $action
@@ -150,7 +150,7 @@ probe irq_handler.exit = kernel.trace("irq_handler_exit")
* @vec : softirq_action vector.
* @action : pointer to softirq handler just about to execute.
*/
-probe softirq.entry = kernel.trace("softirq_entry")
+probe softirq.entry = kernel.trace("softirq_entry") ?
{
h = $h
vec = $vec
@@ -164,7 +164,7 @@ probe softirq.entry = kernel.trace("softirq_entry")
* @vec : softirq_action vector.
* @action : pointer to softirq handler that just finished execution.
*/
-probe softirq.exit = kernel.trace("softirq_exit")
+probe softirq.exit = kernel.trace("softirq_exit") ?
{
h = $h
vec = $vec
diff --git a/tapset/linuxmib.stp b/tapset/linuxmib.stp
index e19755a9..90145b62 100644
--- a/tapset/linuxmib.stp
+++ b/tapset/linuxmib.stp
@@ -94,7 +94,11 @@ probe linuxmib.ListenDrops=kernel.function("tcp_v4_syn_recv_sock").return
*/
probe linuxmib.TCPMemoryPressures=kernel.function("tcp_enter_memory_pressure")
{
+%( kernel_v >= "2.6.27" %?
sk = $sk
+%:
+ sk = 0;
+%)
op = 1;
if ( $tcp_memory_pressure ) next
key = linuxmib_filter_key(sk,op);
diff --git a/tapset/nd_syscalls.stp b/tapset/nd_syscalls.stp
index f9a6ffce..e7492a11 100644
--- a/tapset/nd_syscalls.stp
+++ b/tapset/nd_syscalls.stp
@@ -1320,6 +1320,9 @@ function __is_user_regs:long (regs:long)
#elif defined(__powerpc64__)
unsigned long msr = kread(&regs->msr);
THIS->__retvalue = ((msr >> MSR_PR_LG) & 0x1);
+#elif defined(__powerpc__)
+ unsigned long msr = kread(&regs->msr);
+ THIS->__retvalue = ((msr >> MSR_PR) != 0);
#elif defined(__arm__)
long cpsr = kread(&regs->ARM_cpsr);
THIS->__retvalue = ((cpsr & 0xf) == 0);
diff --git a/tapset/scheduler.stp b/tapset/scheduler.stp
index b1911ac2..1610dc0a 100644
--- a/tapset/scheduler.stp
+++ b/tapset/scheduler.stp
@@ -183,7 +183,7 @@ probe scheduler.ctxswitch
probe __scheduler.kthread_stop.kp = kernel.function("kthread_stop")
{
thread_pid = $k->tgid
- thread_priority = $k->priority
+ thread_priority = $k->prio
}
probe __scheduler.kthread_stop.tp = kernel.trace("sched_kthread_stop")
{
@@ -285,7 +285,11 @@ probe __scheduler.migrate.kp1 = kernel.function("pull_task")
}
probe __scheduler.migrate.kp = kernel.function("set_task_cpu")
{
+%( kernel_v >= "2.6.23" %?
cpu_to = $new_cpu
+%:
+ cpu_to = $cpu
+%)
}
probe __scheduler.migrate.tp = kernel.trace("sched_migrate_task")
{
@@ -384,7 +388,8 @@ probe scheduler.process_fork
* @pid: pid of the process sending signal
* @signal_number: signal number
*/
-probe __scheduler.signal_send.kp = kernel.function("__send_signal")
+probe __scheduler.signal_send.kp = kernel.function("__send_signal") !,
+ kernel.function("send_signal")
{
pid = $t->tgid
}
diff --git a/tapset/string.stp b/tapset/string.stp
index 92750b6b..59ba74ee 100644
--- a/tapset/string.stp
+++ b/tapset/string.stp
@@ -1,36 +1,45 @@
-/** @addtogroup library
-* The library tapset is a collection of standard functions.
-* @{
-*/
+// Standard string functions tapset.
+// Copyright (C) 2009 Red Hat, Inc.
+//
+// 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.
-/** @addtogroup library
-* @code function strlen:long(s:string) @endcode
-* @param s string
-* @return Returns the length of the string.
-*/
+/**
+ * sfunction strlen - Returns the length of a string.
+ * @s: the string
+ *
+ * Description: Returns the lenght of the string, which can be zero up
+ * to MAXSTRINGLEN.
+ */
function strlen:long(s:string) %{ /* pure */ /* unprivileged */
THIS->__retvalue = strlen(THIS->s);
%}
-/** @addtogroup library
-* @code function substr:string(str:string,start:long,length:long) @endcode
-* @param str string
-* @param start Starting position. 0 = start of the string
-* @param length Length of string to return.
-* @return Returns the substring.
-*/
+/**
+ * sfunction substr - Returns a substring.
+ * @str: The string to take a substring from
+ * @start: Starting position. 0 = start of the string.
+ * @length: Length of string to return.
+ *
+ * Description: Returns the substring of the up to the given length
+ * starting at the given start position.
+ */
function substr:string(str:string,start:long, length:long) %{ /* pure */ /* unprivileged */
int length = THIS->length >= MAXSTRINGLEN ? MAXSTRINGLEN : THIS->length + 1;
if (THIS->start >= 0 && length > 0 && THIS->start < strlen(THIS->str))
strlcpy(THIS->__retvalue, THIS->str + THIS->start, length);
%}
-/** @addtogroup library
-* @code function stringat:string(str:string, pos:long) @endcode
-* @param str string
-* @param pos the given position. 0 = start of the string
-* @return Returns the char in given position of string.
-*/
+/**
+ * sfunction stringat - Returns the char at a given position in the string.
+ * @str: The string to fetch the character from.
+ * @pos: The position to get the character from. 0 = start of the string.
+ *
+ * Returns the character at a given position in the string or zero if the
+ * string doesn't have as many characters.
+ */
function stringat:long(str:string, pos:long) %{ /* pure */ /* unprivileged */
if (THIS->pos >= 0 && THIS->pos < strlen(THIS->str))
THIS->__retvalue = THIS->str[THIS->pos];
@@ -38,12 +47,13 @@ function stringat:long(str:string, pos:long) %{ /* pure */ /* unprivileged */
THIS->__retvalue = 0;
%}
-/** @addtogroup library
-* @code isinstr:long(s1:string,s2:string) @endcode
-* @param s1 string
-* @param s2 string
-* @return Returns 1 if s2 is in s1. Otherwise 0.
-*/
+/**
+ * sfunction isinstr - Returns whether a string is a substring of another string.
+ * @s1: String to search in.
+ * @s2: Substring to find.
+ *
+ * Description: Returns 1 if s2 is in s1, otherwise 0.
+ */
function isinstr:long(s1:string,s2:string) %{ /* pure */ /* unprivileged */
if (strstr(THIS->s1,THIS->s2) != NULL)
THIS->__retvalue = 1;
@@ -51,30 +61,44 @@ function isinstr:long(s1:string,s2:string) %{ /* pure */ /* unprivileged */
THIS->__retvalue = 0;
%}
-/*
- * text_str()
+/**
+ * sfunction text_str - Escape any non-printable chars in a string.
+ * @input: The string to escape.
*
- * Takes a string, and any ASCII characters that are not printable are
- * replaced by the corresponding escape sequence in the returned
- * string.
+ * Description Takes a string, and any ASCII characters that are not
+ * printable are replaced by the corresponding escape sequence in the
+ * returned string.
*/
function text_str:string(input:string)
%{ /* pure */ /* unprivileged */
_stp_text_str(THIS->__retvalue, THIS->input, 0, 0, 0);
%}
+/**
+ * sfunction text_strn - Escape any non-printable chars in a string.
+ * @input: The string to escape.
+ * @len: Maximum length of string to return. 0 means MAXSTRINGLEN.
+ * @quoted: Put double quotes around the string. If input string is
+ * truncated it will have "..." after the second quote.
+ *
+ * Description Takes a string, and any ASCII characters that are not
+ * printable are replaced by the corresponding escape sequence in the
+ * returned string.
+ */
function text_strn:string(input:string, len:long, quoted:long)
%{ /* pure */ /* unprivileged */
_stp_text_str(THIS->__retvalue, THIS->input, THIS->len, THIS->quoted, 0);
%}
-/*
- * tokenize - Given a string and a token delimiter,
- * return the next non-empty token in the string
- * or blank when no more non-empty tokens are left
- * input String to tokenize. If NULL, returns the next non-empty token
- * in the string passed in the previous call to tokenize().
- * delim Token delimiter. Set of characters that delimit the tokens.
+/**
+ * sfunction tokenize - Return the next non-empty token in a string.
+ * @input: String to tokenize. If NULL, returns the next non-empty token
+ * in the string passed in the previous call to tokenize().
+ * @delim: Token delimiter. Set of characters that delimit the tokens.
+ *
+ * Description: Given a string and a token delimiter, return the next
+ * non-empty token in the string or blank when no more non-empty tokens
+ * are left.
*/
function tokenize:string(input:string, delim:string)
%{ /* unprivileged */
@@ -98,12 +122,13 @@ function tokenize:string(input:string, delim:string)
}
%}
-/** @addtogroup library
- * @code str_replace:string (prnt_str:string, srch_str:string, rplc_str:string) @endcode
- * @param prnt_str The parent string.
- * @param srch_str The substring which is used to search in the parent string prnt_str.
- * @param rplc_str The substring which is used to replace the searched string srch_str.
- * @return Returns the parent string with substrings replaced. Else returns parent string.
+/**
+ * sfunction - str_replace Replaces all instances of a substring with another.
+ * @prnt_str: The string to search and replace in.
+ * @srch_str: The substring which is used to search in prnt_str string.
+ * @rplc_str: The substring which is used to replace srch_str.
+ *
+ * Description: Returns the given string with substrings replaced.
*/
function str_replace:string (prnt_str:string, srch_str:string, rplc_str:string)
%{ /* pure */ /* unprivileged */
@@ -129,14 +154,12 @@ function str_replace:string (prnt_str:string, srch_str:string, rplc_str:string)
return;
%}
-/*
- * strtol - Convert a string to a long
- * str String to convert
- * base The base to use
+/**
+ * sfunction - strtol - Convert a string to a long.
+ * @str: String to convert.
+ * @base: The base to use
*/
function strtol:long(str:string, base:long)
%{ /* pure */ /* unprivileged */
THIS->__retvalue = simple_strtol(THIS->str, NULL, THIS->base);
-%}
-
-/** @} */
+%} \ No newline at end of file
diff --git a/tapset/syscalls.stp b/tapset/syscalls.stp
index dde0ca9f..430d37ff 100644
--- a/tapset/syscalls.stp
+++ b/tapset/syscalls.stp
@@ -1093,6 +1093,9 @@ function __is_user_regs:long (regs:long)
#elif defined(__powerpc64__)
unsigned long msr = kread(&regs->msr);
THIS->__retvalue = ((msr >> MSR_PR_LG) & 0x1);
+#elif defined(__powerpc__)
+ unsigned long msr = kread(&regs->msr);
+ THIS->__retvalue = ((msr >> MSR_PR) != 0);
#elif defined(__arm__)
long cpsr = kread(&regs->ARM_cpsr);
THIS->__retvalue = ((cpsr & 0xf) == 0);
diff --git a/tapset/tcpmib.stp b/tapset/tcpmib.stp
index 8b443309..497fb7dd 100644
--- a/tapset/tcpmib.stp
+++ b/tapset/tcpmib.stp
@@ -99,6 +99,16 @@ function tcpmib_remote_port:long(sk:long)
CATCH_DEREF_FAULT();
%}
+function tcpmib_filter_key:long (sk:long, op:long) {
+ // ensure all these functions will build
+ if ( tcpmib_get_state(sk) ) return 0
+ if ( tcpmib_local_addr(sk) ) return 0
+ if ( tcpmib_remote_addr(sk) ) return 0
+ if ( tcpmib_local_port(sk) ) return 0
+ if ( tcpmib_remote_port(sk) ) return 0
+ return op
+}
+
/**
* probe tcpmib.ActiveOpens - Count an active opening of a socket.
* @sk: Pointer to the struct sock being acted on.
@@ -209,7 +219,7 @@ tcpmib.EstabResets=kernel.function("tcp_set_state")
*
*/
probe
-tcpmib.InSegs=kernel.function("__inet_lookup_established").return
+tcpmib.InSegs=kernel.function("__inet_lookup_established").return ?
{
sk=$return
op=1
@@ -292,7 +302,11 @@ function __tcpmib_input_route_type_new:long (skb:long)
probe
tcpmib.OutRsts.A=kernel.function("tcp_v4_send_reset")
{
+%( kernel_v >= "2.6.20" %?
sk = $sk;
+%:
+ sk = 0;
+%)
skb = $skb
op = 1;
if ( _is_reset(skb) ) next
diff --git a/tapset/tty.stp b/tapset/tty.stp
index f6ce8ea9..2c4507d2 100644
--- a/tapset/tty.stp
+++ b/tapset/tty.stp
@@ -22,7 +22,11 @@ probe tty.open = kernel.function("tty_open") {
inode_state = $inode->i_state
inode_flags = $inode->i_flags
+%( kernel_v >= "2.6.20" %?
file_name = d_name($filp->f_path->dentry)
+%:
+ file_name = d_name($filp->f_dentry)
+%)
file_mode = $filp->f_mode
file_flags = $filp->f_flags
}
@@ -41,7 +45,11 @@ probe tty.release = kernel.function("tty_release") {
inode_state = $inode->i_state
inode_flags = $inode->i_flags
+%( kernel_v >= "2.6.20" %?
file_name = d_name($filp->f_path->dentry)
+%:
+ file_name = d_name($filp->f_dentry)
+%)
file_mode = $filp->f_mode
file_flags = $filp->f_flags
}
@@ -58,7 +66,7 @@ probe tty.release = kernel.function("tty_release") {
* @new_ypixel: the new ypixel value
* @new_xpixel: the new xpixel value
*/
-probe tty.resize = kernel.function("tty_do_resize"){
+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
@@ -78,7 +86,11 @@ probe tty.resize = kernel.function("tty_do_resize"){
* @arg: the ioctl argument
*/
probe tty.ioctl = kernel.function("tty_ioctl"){
+%( kernel_v >= "2.6.20" %?
name = kernel_string($file->f_path->dentry->d_iname)
+%:
+ name = kernel_string($file->f_dentry->d_iname)
+%)
cmd = $cmd
arg = $arg
@@ -90,7 +102,7 @@ probe tty.ioctl = kernel.function("tty_ioctl"){
* @name: the driver .dev_name name
* @module: the module name
*/
-probe tty.init = kernel.function("tty_init_dev"){
+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)
@@ -130,11 +142,17 @@ probe tty.unregister = kernel.function("tty_unregister_device"){
* @wait_key: the wait queue key
*/
probe tty.poll = kernel.function("tty_poll"){
+%( kernel_v >= "2.6.20" %?
file_name = d_name($filp->f_path->dentry)
+%:
+ file_name = d_name($filp->f_dentry)
+%)
+%( kernel_v >= "2.6.31" %?
if ($wait)
wait_key = $wait->key
else
+%)
wait_key = 0
}
@@ -166,11 +184,15 @@ probe tty.receive = kernel.function("n_tty_receive_buf"){
* @driver_name: the driver name
* @file_name: the file name lreated to the tty
*/
-probe tty.write = kernel.function("n_tty_write"){
+probe tty.write = kernel.function("n_tty_write") ? {
buffer = kernel_string($buf)
nr = $nr
+%( kernel_v >= "2.6.20" %?
file_name = d_name($file->f_path->dentry)
+%:
+ file_name = d_name($file->f_dentry)
+%)
driver_name = kernel_string($tty->driver->driver_name)
}
@@ -181,9 +203,13 @@ probe tty.write = kernel.function("n_tty_write"){
* @driver_name: the driver name
* @file_name: the file name lreated to the tty
*/
-probe tty.read = kernel.function("n_tty_read"){
+probe tty.read = kernel.function("n_tty_read") ? {
buffer = kernel_string($buf)
nr = $nr
+%( kernel_v >= "2.6.20" %?
file_name = d_name($file->f_path->dentry)
+%:
+ file_name = d_name($file->f_dentry)
+%)
driver_name = kernel_string($tty->driver->driver_name)
}