Prologue-Style Aliases (=); Epilogue-Style Aliases (+=) - Red Hat ENTERPRISE LINUX 5.4 - SYSTEMTAP LANGUAGE Reference Manual

Systemtap language reference
Hide thumbs Also See for ENTERPRISE LINUX 5.4 - SYSTEMTAP LANGUAGE:
Table of Contents

Advertisement

Chapter 3. Components of a SystemTap script
probe socket.sendmsg = kernel.function ("sock_sendmsg") { ... }
probe socket.do_write = kernel.function ("do_sock_write") { ... }
probe socket.send = socket.sendmsg, socket.do_write { ... }
There are two types of aliases, the prologue style and the epilogue style which are identified by the
equal sign (=) and "+=" respectively.
A probe that names the new probe point will create an actual probe, with the handler of the alias pre-
pended.
This pre-pending behavior serves several purposes. It allows the alias definition to pre-process the
context of the probe before passing control to the handler specified by the user. This has several
possible uses, demonstrated as follows.
# Skip probe unless given condition is met:
if ($flag1 != $flag2) next
# Supply values describing probes:
name = "foo"
# Extract the target variable to a plain local variable:
var = $var

3.2.1. Prologue-style aliases (=)

For a prologue style alias, the statement block that follows an alias definition is implicitly added as a
prologue to any probe that refers to the alias. The following is an example.
# Defines a new probe point syscall.read, which expands to
# kernel.function("sys_read"), with the given statement as
# a prologue.
#
probe syscall.read = kernel.function("sys_read") {
fildes = $fd
}

3.2.2. Epilogue-style aliases (+=)

The statement block that follows an alias definition is implicitly added as an epilogue to any probe that
refers to the alias. It is not useful to define new variable there (since no subsequent code will see it),
but rather the code can take action based upon variables left set by the prologue or by the user code.
The following is an example:
# Defines a new probe point with the given statement as an
# epilogue.
#
10

Advertisement

Table of Contents
loading

Table of Contents