<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>utrace_set_events</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="The utrace User Debugging Infrastructure" /><link rel="up" href="ch02.html" title="Chapter 2. utrace core API" /><link rel="prev" href="re16.html" title="utrace_attach_pid" /><link rel="next" href="re18.html" title="utrace_control" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span>utrace_set_events</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re16.html">Prev</a> </td><th width="60%" align="center">Chapter 2. utrace core API</th><td width="20%" align="right"> <a accesskey="n" href="re18.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="utrace_set_events"><a id="API-utrace-set-events"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>utrace_set_events — choose which event reports a tracing engine gets </p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int <b class="fsfunc">utrace_set_events </b>(</code></td><td>struct task_struct * <var class="pdparam">target</var>, </td></tr><tr><td> </td><td>struct utrace_engine * <var class="pdparam">engine</var>, </td></tr><tr><td> </td><td>unsigned long <var class="pdparam">events</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Arguments"><a id="id2892081"></a><h2>Arguments</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>target</code></em></span></dt><dd><p> thread to affect </p></dd><dt><span class="term"><em class="parameter"><code>engine</code></em></span></dt><dd><p> attached engine to affect </p></dd><dt><span class="term"><em class="parameter"><code>events</code></em></span></dt><dd><p> new event mask </p></dd></dl></div></div><div class="refsect1" title="Description"><a id="id2892139"></a><h2>Description</h2><p> This changes the set of events for which <em class="parameter"><code>engine</code></em> wants callbacks made. </p><p> This fails with -<code class="constant">EALREADY</code> and does nothing if you try to clear <code class="constant">UTRACE_EVENT</code>(<code class="constant">DEATH</code>) when the <em class="parameter"><code>report_death</code></em> callback may already have begun, if you try to clear <code class="constant">UTRACE_EVENT</code>(<code class="constant">REAP</code>) when the <em class="parameter"><code>report_reap</code></em> callback may already have begun, or if you try to newly set <code class="constant">UTRACE_EVENT</code>(<code class="constant">DEATH</code>) or <code class="constant">UTRACE_EVENT</code>(<code class="constant">QUIESCE</code>) when <em class="parameter"><code>target</code></em> is already dead or dying. </p><p> This can fail with -<code class="constant">ESRCH</code> when <em class="parameter"><code>target</code></em> has already been detached, including forcible detach on reaping. </p><p> If <em class="parameter"><code>target</code></em> was stopped before the call, then after a successful call, no event callbacks not requested in <em class="parameter"><code>events</code></em> will be made; if <code class="constant">UTRACE_EVENT</code>(<code class="constant">QUIESCE</code>) is included in <em class="parameter"><code>events</code></em>, then a <em class="parameter"><code>report_quiesce</code></em> callback will be made when <em class="parameter"><code>target</code></em> resumes. </p><p> If <em class="parameter"><code>target</code></em> was not stopped and <em class="parameter"><code>events</code></em> excludes some bits that were set before, this can return -<code class="constant">EINPROGRESS</code> to indicate that <em class="parameter"><code>target</code></em> may have been making some callback to <em class="parameter"><code>engine</code></em>. When this returns zero, you can be sure that no event callbacks you've disabled in <em class="parameter"><code>events</code></em> can be made. If <em class="parameter"><code>events</code></em> only sets new bits that were not set before on <em class="parameter"><code>engine</code></em>, then -<code class="constant">EINPROGRESS</code> will never be returned. </p><p> To synchronize after an -<code class="constant">EINPROGRESS</code> return, see <code class="function">utrace_barrier</code>. </p><p> When <em class="parameter"><code>target</code></em> is <em class="parameter"><code>current</code></em>, -<code class="constant">EINPROGRESS</code> is not returned. But note that a newly-created engine will not receive any callbacks related to an event notification already in progress. This call enables <em class="parameter"><code>events</code></em> callbacks to be made as soon as <em class="parameter"><code>engine</code></em> becomes eligible for any callbacks, see <code class="function">utrace_attach_task</code>. </p><p> These rules provide for coherent synchronization based on <code class="constant">UTRACE_STOP</code>, even when <code class="constant">SIGKILL</code> is breaking its normal simple rules. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re16.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="re18.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span>utrace_attach_pid</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span>utrace_control</span></td></tr></table></div></body></html>