embeddedsw/lib/bsp/xilkernel/doc/html/api/process_8c.html
Jagannadha Sutradharudu Teki 2c8f92039d embeddesw: Add initial code support
Added initial support Xilinx Embedded Software.

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
2014-06-24 16:45:01 +05:30

400 lines
19 KiB
HTML
Executable file

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>2014.1_doc: process.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.5 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="dirs.html"><span>Directories</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul></div>
<div class="nav">
<a class="el" href="dir_U_3A_2Fdoxygen_5Fpublish_2Fsources_2Fbsp_2Fxilkernel_5Fv6_5F0_2Fsrc_2Fsrc_2F.html">src</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_U_3A_2Fdoxygen_5Fpublish_2Fsources_2Fbsp_2Fxilkernel_5Fv6_5F0_2Fsrc_2Fsrc_2Fsys_2F.html">sys</a></div>
<h1>process.c File Reference</h1><code>#include &lt;stdio.h&gt;</code><br>
<code>#include &lt;string.h&gt;</code><br>
<code>#include &lt;<a class="el" href="os__config_8h.html">os_config.h</a>&gt;</code><br>
<code>#include &lt;<a class="el" href="init_8h.html">sys/init.h</a>&gt;</code><br>
<code>#include &lt;<a class="el" href="config__param_8h.html">config/config_param.h</a>&gt;</code><br>
<code>#include &lt;<a class="el" href="config__cparam_8h.html">config/config_cparam.h</a>&gt;</code><br>
<code>#include &lt;sys/arch.h&gt;</code><br>
<code>#include &lt;<a class="el" href="ktypes_8h.html">sys/ktypes.h</a>&gt;</code><br>
<code>#include &lt;<a class="el" href="ksched_8h.html">sys/ksched.h</a>&gt;</code><br>
<code>#include &lt;<a class="el" href="process_8h.html">sys/process.h</a>&gt;</code><br>
<code>#include &lt;<a class="el" href="mem_8h.html">sys/mem.h</a>&gt;</code><br>
<code>#include &lt;<a class="el" href="queue_8h.html">sys/queue.h</a>&gt;</code><br>
<code>#include &lt;<a class="el" href="ksemaphore_8h.html">sys/ksemaphore.h</a>&gt;</code><br>
<code>#include &lt;<a class="el" href="msg_8h.html">sys/msg.h</a>&gt;</code><br>
<code>#include &lt;<a class="el" href="shm_8h.html">sys/shm.h</a>&gt;</code><br>
<code>#include &lt;<a class="el" href="decls_8h.html">sys/decls.h</a>&gt;</code><br>
<code>#include &lt;<a class="el" href="stats_8h.html">sys/stats.h</a>&gt;</code><br>
<code>#include &lt;<a class="el" href="timer_8h.html">sys/timer.h</a>&gt;</code><br>
<code>#include &lt;pthread.h&gt;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="process_8c.html#80cdd601c76f55298c07400b7bc590e8">idle_task</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">pid_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="process_8c.html#05d3e9db8d242b06de90aa951d7e77b1">proc_create</a> (unsigned int priority)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="process_8c.html#47825286650f0d1c03eb5d895d74445b">process_invalidate</a> (<a class="el" href="struct__process__struct.html">process_struct</a> *proc)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="process_8c.html#b93638f1cade5ca458cefe81282e6c87">sys_process_status</a> (pid_t pid, <a class="el" href="struct__ps__stat.html">p_stat</a> *ps)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">pid_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="process_8c.html#55a8fac89c511c87549b523180014861">sys_get_currentPID</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="process_8c.html#bfa5620df1483750c886bb02d304a57e">process_block</a> (queuep queue, unsigned int state)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="process_8c.html#488b40f441162bf218c37bd0c61f55a1">process_unblock</a> (queuep queue)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">reent_t *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="process_8c.html#b090f6ff9784a64a9af8565c69b4bfe3">sys_get_reentrancy</a> (void)</td></tr>
<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="721cf5bdc6cf0ee8f6f87cc679ced33e"></a><!-- doxytag: member="process.c::kernel_sp" ref="721cf5bdc6cf0ee8f6f87cc679ced33e" args="" -->
void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="process_8c.html#721cf5bdc6cf0ee8f6f87cc679ced33e">kernel_sp</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Process Table. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="5f791cfb55e97daa4605c4f66fe1864a"></a><!-- doxytag: member="process.c::current_pid" ref="5f791cfb55e97daa4605c4f66fe1864a" args="" -->
pid_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="process_8c.html#5f791cfb55e97daa4605c4f66fe1864a">current_pid</a> = -1</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Kernel Stack pointer. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="16473dd9392e6263085737463a61ec46"></a><!-- doxytag: member="process.c::prev_pid" ref="16473dd9392e6263085737463a61ec46" args="" -->
pid_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="process_8c.html#16473dd9392e6263085737463a61ec46">prev_pid</a> = -1</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Currently executing processes' ID. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1437f3eb1a6c8ca2d39e9c23f611c018"></a><!-- doxytag: member="process.c::current_process" ref="1437f3eb1a6c8ca2d39e9c23f611c018" args="" -->
<a class="el" href="struct__process__struct.html">process_struct</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="process_8c.html#1437f3eb1a6c8ca2d39e9c23f611c018">current_process</a> = NULL</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">ID of process executing immediately before a context switch. <br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This contains process management and thread management modules. <hr><h2>Function Documentation</h2>
<a class="anchor" name="80cdd601c76f55298c07400b7bc590e8"></a><!-- doxytag: member="process.c::idle_task" ref="80cdd601c76f55298c07400b7bc590e8" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void idle_task </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">void&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<ul>
<li>This task is run when the system is idle. This task is initialized during system init and is always run with the least priority. <dl compact><dt><b>Returns:</b></dt><dd></dd></dl>
</li><li>Nothing <dl compact><dt><b>Note:</b></dt><dd></dd></dl>
</li><li>None </li></ul>
</td>
</tr>
</table>
<a class="anchor" name="05d3e9db8d242b06de90aa951d7e77b1"></a><!-- doxytag: member="process.c::proc_create" ref="05d3e9db8d242b06de90aa951d7e77b1" args="(unsigned int priority)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">pid_t proc_create </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">unsigned int&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>priority</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Process creation primitive.<ul>
<li>Reserves a pid for the process.</li><li>Initializes the process structure (except for the context)</li><li>Places the process in the READY_Q. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>priority</em>&nbsp;</td><td>is the priority of the process </td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd></dd></dl>
</li><li>PID of the new process.</li><li>-1 on Error. Max. process exceeded. <dl compact><dt><b>Note:</b></dt><dd></dd></dl>
</li><li>None </li></ul>
</td>
</tr>
</table>
<a class="anchor" name="bfa5620df1483750c886bb02d304a57e"></a><!-- doxytag: member="process.c::process_block" ref="bfa5620df1483750c886bb02d304a57e" args="(queuep queue, unsigned int state)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void process_block </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">queuep&nbsp;</td>
<td class="mdname" nowrap> <em>queue</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>unsigned int&nbsp;</td>
<td class="mdname" nowrap> <em>state</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Block the process.<ul>
<li>Place the process into the specified wait queue, change the state of the process and set the kernel flag to PROCESS_BLOCK.</li><li>Call the process_scheduler <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>queue</em>&nbsp;</td><td>is the queue where the process is enqueued.</td></tr>
</table>
</dl>
</li><li>state is the state of the process in queue. <dl compact><dt><b>Returns:</b></dt><dd></dd></dl>
</li><li>Nothing <dl compact><dt><b>Note:</b></dt><dd></dd></dl>
</li><li>None </li></ul>
</td>
</tr>
</table>
<a class="anchor" name="47825286650f0d1c03eb5d895d74445b"></a><!-- doxytag: member="process.c::process_invalidate" ref="47825286650f0d1c03eb5d895d74445b" args="(process_struct *proc)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">int process_invalidate </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct__process__struct.html">process_struct</a> *&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>proc</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Remove the Process with pid. This is an internal proc that is called by sys_kill() and also by the schedulers to remove "DEAD" processes <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>proc</em>&nbsp;</td><td>is the process structure of process to invalidate </td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>0 on Success</li><li>-1 on Error </li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd><ul>
<li>None </li></ul>
</dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="488b40f441162bf218c37bd0c61f55a1"></a><!-- doxytag: member="process.c::process_unblock" ref="488b40f441162bf218c37bd0c61f55a1" args="(queuep queue)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void process_unblock </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">queuep&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>queue</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Unblock the first process in queue and place it onto the ready queue. Call the process_scheduler only if this is PRIO scheduling. This is because we do not want the current process to prematurely lose its time slice. Change the state of the process to PROC_READY <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>queue</em>&nbsp;</td><td>is the queue where the process is enqueued. </td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>Nothing </li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd><ul>
<li>None </li></ul>
</dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="55a8fac89c511c87549b523180014861"></a><!-- doxytag: member="process.c::sys_get_currentPID" ref="55a8fac89c511c87549b523180014861" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">pid_t sys_get_currentPID </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">void&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Return the PID of the currently running process context <dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>PID of the currently running process context. </li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd><ul>
<li>None </li></ul>
</dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="b090f6ff9784a64a9af8565c69b4bfe3"></a><!-- doxytag: member="process.c::sys_get_reentrancy" ref="b090f6ff9784a64a9af8565c69b4bfe3" args="(void)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">reent_t* sys_get_reentrancy </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">void&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Return the kernel re-entrancy structure. This structure holds program level state information for the current process. Upon each context switch this structure is updated. to minimize the run-time efficiency, each application ELF file can query a pointer to this structure once and then use it for all subsequent state information queries. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>None</em>&nbsp;</td><td></td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>Pointer to kernel re-entrancy structure </li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd><ul>
<li>None </li></ul>
</dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="b93638f1cade5ca458cefe81282e6c87"></a><!-- doxytag: member="process.c::sys_process_status" ref="b93638f1cade5ca458cefe81282e6c87" args="(pid_t pid, p_stat *ps)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">int sys_process_status </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">pid_t&nbsp;</td>
<td class="mdname" nowrap> <em>pid</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="struct__ps__stat.html">p_stat</a> *&nbsp;</td>
<td class="mdname" nowrap> <em>ps</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Return the status of the process. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>pid</em>&nbsp;</td><td>is the Process ID of the process.<ul>
<li>ps is the structure where the status is returned. </li></ul>
</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>The status of the process is returned on ps</li><li>If pid not an active process, ps-&gt;pid is assigned -1 </li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd><ul>
<li>None </li></ul>
</dd></dl>
</td>
</tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Thu Feb 13 14:46:24 2014 for 2014.1_doc by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.5 </small></address>
</body>
</html>