blob: 14269f129a62dcc2c5fd8b573727882aec48e193 (
plain) (
blame) 
 | 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  | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title xmlns:d="http://docbook.org/ns/docbook">3.3.2.3. Checking Target Variable Availability</title><link rel="stylesheet" type="text/css" href="Common_Content/css/default.css" /><link rel="stylesheet" media="print" href="Common_Content/css/print.css" type="text/css" /><meta xmlns:d="http://docbook.org/ns/docbook" name="generator" content="not publican" /><meta xmlns:d="http://docbook.org/ns/docbook" name="package" content="" /><link rel="home" href="index.html" title="SystemTap Beginners Guide" /><link rel="up" href="targetvariables.html" title="3.3.2. Target Variables" /><link rel="prev" href="typecasting.html" title="3.3.2.2. Typecasting" /><link rel="next" href="handlerconditionalstatements.html" title="3.3.3. Conditional Statements" /></head><body><p id="title"></p><ul class="docnav top"><li class="previous"><a accesskey="p" href="typecasting.html"><strong>Prev</strong></a></li><li class="home">SystemTap Beginners Guide</li><li class="next"><a accesskey="n" href="handlerconditionalstatements.html"><strong>Next</strong></a></li></ul><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="targetavailable"> </a>3.3.2.3. Checking Target Variable Availability</h4></div></div></div><a id="id3107" class="indexterm"></a><div class="para">	As code evolves the target variables available may change.	The <code class="command">@defined</code> makes it easier to handle	those variations in the available target variables.	The <code class="command">@defined</code> provides a test to see if a particular	target variable is available. The result of this test	can be used to select the appropriate expression. </div><div class="para">	The <a class="xref" href="targetavailable.html#available">Example 3.10, “Testing target variable available Example”</a> from the <code class="command">memory.stp</code> tapset provides an probe event alias.	Some version of the kernel functions being probed have an argument <code class="command">$flags</code>. When available, the <code class="command">$flags</code> argument is used to generate	the local variable <code class="command">write_access</code>.	The versions of the probed functions that do not have the <code class="command">$flags</code> argument have a <code class="command">$write</code>	argument and that is used instead for the local variable <code class="command">write_access</code>. </div><div class="example"><a id="available"> </a><p class="title"><strong>Example 3.10. Testing target variable available Example</strong></p><div class="example-contents"><pre class="programlisting">probe vm.pagefault = kernel.function("__handle_mm_fault@mm/memory.c") ?, kernel.function("handle_mm_fault@mm/memory.c") ? { name = "pagefault" write_access = (@defined($flags)	? $flags & FAULT_FLAG_WRITE : $write_access)	address = $address } </pre></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="typecasting.html"><strong>Prev</strong>3.3.2.2. Typecasting</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="handlerconditionalstatements.html"><strong>Next</strong>3.3.3. Conditional Statements</a></li></ul></body></html> 
 |