<?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>task_current_syscall</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="ch03s02.html" title="System Call Information" /><link rel="prev" href="ch03s02.html" title="System Call Information" /><link rel="next" href="ch03s03.html" title="System Call Tracing" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span>task_current_syscall</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><th width="60%" align="center"><code class="filename">System Call Information</code></th><td width="20%" align="right"> <a accesskey="n" href="ch03s03.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="task_current_syscall"><a id="API-task-current-syscall"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>task_current_syscall — Discover what a blocked task is doing. </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">task_current_syscall </b>(</code></td><td>struct task_struct * <var class="pdparam">target</var>, </td></tr><tr><td> </td><td>long * <var class="pdparam">callno</var>, </td></tr><tr><td> </td><td>unsigned long <var class="pdparam">args[6]</var>, </td></tr><tr><td> </td><td>unsigned int <var class="pdparam">maxargs</var>, </td></tr><tr><td> </td><td>unsigned long * <var class="pdparam">sp</var>, </td></tr><tr><td> </td><td>unsigned long * <var class="pdparam">pc</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Arguments"><a id="id2896158"></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 examine </p></dd><dt><span class="term"><em class="parameter"><code>callno</code></em></span></dt><dd><p> filled with system call number or -1 </p></dd><dt><span class="term"><em class="parameter"><code>args[6]</code></em></span></dt><dd><p> filled with <em class="parameter"><code>maxargs</code></em> system call arguments </p></dd><dt><span class="term"><em class="parameter"><code>maxargs</code></em></span></dt><dd><p> number of elements in <em class="parameter"><code>args</code></em> to fill </p></dd><dt><span class="term"><em class="parameter"><code>sp</code></em></span></dt><dd><p> filled with user stack pointer </p></dd><dt><span class="term"><em class="parameter"><code>pc</code></em></span></dt><dd><p> filled with user PC </p></dd></dl></div></div><div class="refsect1" title="Description"><a id="id2896277"></a><h2>Description</h2><p> If <em class="parameter"><code>target</code></em> is blocked in a system call, returns zero with *<em class="parameter"><code>callno</code></em> set to the the call's number and <em class="parameter"><code>args</code></em> filled in with its arguments. Registers not used for system call arguments may not be available and it is not kosher to use <span class="structname">struct user_regset</span> calls while the system call is still in progress. Note we may get this result if <em class="parameter"><code>target</code></em> has finished its system call but not yet returned to user mode, such as when it's stopped for signal handling or syscall exit tracing. </p><p> If <em class="parameter"><code>target</code></em> is blocked in the kernel during a fault or exception, returns zero with *<em class="parameter"><code>callno</code></em> set to -1 and does not fill in <em class="parameter"><code>args</code></em>. If so, it's now safe to examine <em class="parameter"><code>target</code></em> using <span class="structname">struct user_regset</span> <code class="function">get</code> calls as long as we're sure <em class="parameter"><code>target</code></em> won't return to user mode. </p><p> Returns -<code class="constant">EAGAIN</code> if <em class="parameter"><code>target</code></em> does not remain blocked. </p><p> Returns -<code class="constant">EINVAL</code> if <em class="parameter"><code>maxargs</code></em> is too large (maximum is six). </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03s02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><code class="filename">System Call Information</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <code class="filename">System Call Tracing</code></td></tr></table></div></body></html>