9
0
Fork 0

Add NSH kill command

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3322 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2011-02-27 17:26:06 +00:00
parent 5690a26348
commit 22b1c60a56
6 changed files with 208 additions and 90 deletions

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1>
<p>Last Updated: July 06, 2010</p>
<p>Last Updated: February 27, 2011</p>
</td>
</tr>
</table>
@ -149,139 +149,145 @@
<tr>
<td><br></td>
<td>
<a href="#cmdlosetup">2.12 Setup/teardown the Loop Device (losetup)</a>
<a href="#cmdkill">2.12 Send a signal to a task (kill)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdls">2.13 List Directory Contents (ls)</a>
<a href="#cmdlosetup">2.13 Setup/teardown the Loop Device (losetup)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmbhw">2.14 Access Memory (mb, mh, and mw)</a>
<a href="#cmdls">2.14 List Directory Contents (ls)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmem">2.15 Show Memory Manager Status (mem)</a>
<a href="#cmdmbhw">2.15 Access Memory (mb, mh, and mw)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdps">2.16 Show Current Tasks and Threads (ps)</a>
<a href="#cmdmem">2.16 Show Memory Manager Status (mem)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmkdir">2.17 Create a Directory (mkdir)</a>
<a href="#cmdps">2.17 Show Current Tasks and Threads (ps)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmkfatfs">2.18 Create a FAT Filesystem (mkfatfs)</a>
<a href="#cmdmkdir">2.18 Create a Directory (mkdir)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmkfifo">2.19 Create a FIFO (mkfifo)</a>
<a href="#cmdmkfatfs">2.19 Create a FAT Filesystem (mkfatfs)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmkrd">2.20 Create a RAMDISK (mkrd)</a>
<a href="#cmdmkfifo">2.20 Create a FIFO (mkfifo)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmount">2.21 Mount a File System (mount)</a>
<a href="#cmdmkrd">2.21 Create a RAMDISK (mkrd)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdping">2.22 Check Network Peer (ping)</a>
<a href="#cmdmount">2.22 Mount a File System (mount)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdput">2.23 Send File Via TFTP (put)</a>
<a href="#cmdping">2.23 Check Network Peer (ping)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdpwd">2.24 Show Current Working Directory (pwd)</a>
<a href="#cmdput">2.24 Send File Via TFTP (put)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdrm">2.25 Remove a File (rm)</a>
<a href="#cmdpwd">2.25 Show Current Working Directory (pwd)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdrmdir">2.26 Remove a Directory (rmdir)</a>
<a href="#cmdrm">2.26 Remove a File (rm)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdset">2.27 Set an Environment Variable (set)</a>
<a href="#cmdrmdir">2.27 Remove a Directory (rmdir)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdsh">2.28 Execute an NSH Script (sh)</a>
<a href="#cmdset">2.28 Set an Environment Variable (set)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdsleep">2.29 Wait for Seconds (sleep)</a>
<a href="#cmdsh">2.29 Execute an NSH Script (sh)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdunmount">2.30 Unmount a File System (umount)</a>
<a href="#cmdsleep">2.30 Wait for Seconds (sleep)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdunset">2.31 Unset an Environment Variable (unset)</a>
<a href="#cmdunmount">2.31 Unmount a File System (umount)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdusleep">2.32 Wait for Microseconds (usleep)</a>
<a href="#cmdunset">2.32 Unset an Environment Variable (unset)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdwget">2.33 Get File Via HTTP (wget)</a>
<a href="#cmdusleep">2.33 Wait for Microseconds (usleep)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdxd">2.34 Hexadecimal Dump (xd)</a>
<a href="#cmdwget">2.34 Get File Via HTTP (wget)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdxd">2.35 Hexadecimal Dump (xd)</a>
</td>
</tr>
<tr>
@ -682,7 +688,7 @@ test &lt;expression&gt;
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
cat <code>&lt;path&gt;</code> [<code>&lt;path&gt;</code> [<code>&lt;path&gt;</code> ...]]
</pre></ul>
@ -700,7 +706,7 @@ cat <code>&lt;path&gt;</code> [<code>&lt;path&gt;</code> [<code>&lt;path&gt;</co
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
cd [&lt;dir-path&gt;|-|~|..]
</pre></ul>
@ -742,7 +748,7 @@ cd [&lt;dir-path&gt;|-|~|..]
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
cp &lt;source-path&gt; &lt;dest-path&gt;
</pre></ul>
@ -760,7 +766,7 @@ cp &lt;source-path&gt; &lt;dest-path&gt;
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
dd if=&lt;infile&gt; of=&lt;outfile&gt; [bs=&lt;sectsize&gt;] [count=&lt;sectors&gt;] [skip=&lt;sectors&gt;]
</pre></ul>
@ -819,7 +825,7 @@ nsh&gt; dd if=/dev/ram0 of=/dev/null
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
echo [&lt;string|$name&gt; [&lt;string|$name&gt;...]]
</pre></ul>
@ -856,7 +862,7 @@ exec &lt;hex-address&gt;
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
get [-b|-n] [-f &lt;local-path&gt;] -h &lt;ip-address&gt; &lt;remote-path&gt;
</pre></ul>
@ -891,7 +897,7 @@ get [-b|-n] [-f &lt;local-path&gt;] -h &lt;ip-address&gt; &lt;remote-path&gt;
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
exit
</pre></ul>
@ -910,7 +916,7 @@ exit
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
help
</pre></ul>
@ -927,7 +933,7 @@ help
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
ifconfig
</pre></ul>
@ -948,12 +954,28 @@ eth0 HWaddr 00:18:11:80:10:06
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdlosetup"><h2>2.12 Setup/teardown the Loop Device (losetup)</h2></a>
<a name="cmdkill"><h2>2.12 Send a signal to a task (kill)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax 1:</b></p>
<ul><pre>
kill -&lt;signal&gt; &lt;pid&gt;
</pre></ul>
<p>
<b>Synopsis</b>.
Send the <signal> to the task identified by <pid>.
</p>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdlosetup"><h2>2.13 Setup/teardown the Loop Device (losetup)</h2></a>
</td>
</tr>
</table>
<p><b>Command Syntax 1:</b></p>
<ul><pre>
losetup [-o <offset>] [-r] &lt;dev-path&gt; &lt;file-path&gt;
</pre></ul>
@ -989,7 +1011,7 @@ nsh&gt;
</pre></ul>
</p>
<a <p><b>Command Syntax 2:</b></p>
<p><b>Command Syntax 2:</b></p>
<ul><pre>
losetup d &lt;dev-path&gt;
</pre></ul>
@ -1001,12 +1023,12 @@ losetup d &lt;dev-path&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdls"><h2>2.13 List Directory Contents (ls)</h2></a>
<a name="cmdls"><h2>2.14 List Directory Contents (ls)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
ls [-lRs] &lt;dir-path&gt;
</pre></ul>
@ -1038,7 +1060,7 @@ ls [-lRs] &lt;dir-path&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmbhw"><h2>2.14 Access Memory (mb, mh, and mw)</h2></a>
<a name="cmdmbhw"><h2>2.15 Access Memory (mb, mh, and mw)</h2></a>
</td>
</tr>
</table>
@ -1092,12 +1114,12 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmem"><h2>2.15 Show Memory Manager Status (mem)</h2></a>
<a name="cmdmem"><h2>2.16 Show Memory Manager Status (mem)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
mem
</pre></ul>
@ -1141,12 +1163,12 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdps"><h2>2.16 Show Current Tasks and Threads (ps)</h2></a>
<a name="cmdps"><h2>2.17 Show Current Tasks and Threads (ps)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
ps
</pre></ul>
@ -1167,7 +1189,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmkdir"><h2>2.17 Create a Directory (mkdir)</h2></a>
<a name="cmdmkdir"><h2>2.18 Create a Directory (mkdir)</h2></a>
</td>
</tr>
</table>
@ -1202,7 +1224,7 @@ nsh>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmkfatfs"><h2>2.18 Create a FAT Filesystem (mkfatfs)</h2></a>
<a name="cmdmkfatfs"><h2>2.19 Create a FAT Filesystem (mkfatfs)</h2></a>
</td>
</tr>
</table>
@ -1222,7 +1244,7 @@ mkfatfs &lt;path&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmkfifo"><h2>2.19 Create a FIFO (mkfifo)</h2></a>
<a name="cmdmkfifo"><h2>2.20 Create a FIFO (mkfifo)</h2></a>
</td>
</tr>
</table>
@ -1260,7 +1282,7 @@ nsh>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmkrd"><h2>2.20 Create a RAMDISK (mkrd)</h2></a>
<a name="cmdmkrd"><h2>2.21 Create a RAMDISK (mkrd)</h2></a>
</td>
</tr>
</table>
@ -1311,7 +1333,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmount"><h2>2.21 Mount a File System (mount)</h2></a>
<a name="cmdmount"><h2>2.22 Mount a File System (mount)</h2></a>
</td>
</tr>
</table>
@ -1378,12 +1400,12 @@ nsh>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdping"><h2>2.22 Check Network Peer (ping)</h2></a>
<a name="cmdping"><h2>2.23 Check Network Peer (ping)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
ping [-c &lt;count&gt;] [-i &lt;interval&gt;] &lt;ip-address&gt;
</pre></ul>
@ -1411,12 +1433,12 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdput"><h2>2.23 Send File Via TFTP (put)</h2></a>
<a name="cmdput"><h2>2.24 Send File Via TFTP (put)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
put [-b|-n] [-f &lt;remote-path&gt;] -h &lt;ip-address&gt; &lt;local-path&gt;
</pre></ul>
@ -1446,12 +1468,12 @@ put [-b|-n] [-f &lt;remote-path&gt;] -h &lt;ip-address&gt; &lt;local-path&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdpwd"><h2>2.24 Show Current Working Directory (pwd)</h2></a>
<a name="cmdpwd"><h2>2.25 Show Current Working Directory (pwd)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
pwd
</pre></ul>
@ -1476,12 +1498,12 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdrm"><h2>2.25 Remove a File (rm)</h2></a>
<a name="cmdrm"><h2>2.26 Remove a File (rm)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
rm &lt;file-path&gt;
</pre></ul>
@ -1510,12 +1532,12 @@ nsh>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdrmdir"><h2>2.26 Remove a Directory (rmdir)</h2></a>
<a name="cmdrmdir"><h2>2.27 Remove a Directory (rmdir)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
rmdir &lt;dir-path&gt;
</pre></ul>
@ -1545,12 +1567,12 @@ nsh>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdset"><h2>2.27 Set an Environment Variable (set)</h2></a>
<a name="cmdset"><h2>2.28 Set an Environment Variable (set)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
set &lt;name&gt; &lt;value&gt;
</pre></ul>
@ -1571,12 +1593,12 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdsh"><h2>2.28 Execute an NSH Script (sh)</h2></a>
<a name="cmdsh"><h2>2.29 Execute an NSH Script (sh)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
sh &lt;script-path&gt;
</pre></ul>
@ -1589,12 +1611,12 @@ sh &lt;script-path&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdsleep"><h2>2.29 Wait for Seconds (sleep)</h2></a>
<a name="cmdsleep"><h2>2.30 Wait for Seconds (sleep)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
sleep &lt;sec&gt;
</pre></ul>
@ -1606,12 +1628,12 @@ sleep &lt;sec&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdunmount"><h2>2.30 Unmount a File System (umount)</h2></a>
<a name="cmdunmount"><h2>2.31 Unmount a File System (umount)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
umount &lt;dir-path&gt;
</pre></ul>
@ -1636,12 +1658,12 @@ nsh>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdunset"><h2>2.31 Unset an Environment Variable (unset)</h2></a>
<a name="cmdunset"><h2>2.32 Unset an Environment Variable (unset)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
unset &lt;name&gt;
</pre></ul>
@ -1662,12 +1684,12 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdusleep"><h2>2.32 Wait for Microseconds (usleep)</h2></a>
<a name="cmdusleep"><h2>2.33 Wait for Microseconds (usleep)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
usleep &lt;usec&gt;
</pre></ul>
@ -1679,12 +1701,12 @@ usleep &lt;usec&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdwget">2.33 Get File Via HTTP (wget)</a>
<a name="cmdwget">2.34 Get File Via HTTP (wget)</a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
wget [-o &lt;local-path&gt;] &lt;url&gt;
</pre></ul>
@ -1706,12 +1728,12 @@ wget [-o &lt;local-path&gt;] &lt;url&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdxd"><h2>2.34 Hexadecimal dump (xd)</h2></a>
<a name="cmdxd"><h2>2.35 Hexadecimal dump (xd)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<p><b>Command Syntax:</b></p>
<ul><pre>
xd &lt;hex-address&gt; &lt;byte-count&gt;
</pre></ul>
@ -1825,6 +1847,11 @@ nsh>
<td><code>CONFIG_NET</code></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_IFCONFIG</code></td>
</tr>
<tr>
<td><b><code>kill</code></b></td>
<td>!<code>CONFIG_DISABLE_SIGNALS</code></td>
<td><code>CONFIG_EXAMPLES_NSH_DISABLE_KILL</code></td>
</tr>
<tr>
<td><b><code>losetup</code></b></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td>
@ -2331,6 +2358,7 @@ nsh>
<li><a href="#cmdhelp"><code>help</code></a></li>
<li><a href="#conditional"><code>if-then[-else]-fi</code></a></li>
<li><a href="#cmdifconfig"><code>ifconfig</code></a></li>
<li><a href="#cmdkill"><code>kill</code></a></li>
<li><a href="#cmdlosetup"><code>losetup</code></a></li>
<li><a href="#cmdls">ls</code></a></li>
<li><a href="#cmdmbhw"><code>mb</code></a></li>

View File

@ -329,6 +329,10 @@ o ifconfig
if uIP statistics are enabled (CONFIG_NET_STATISTICS), then
this command will also show the detailed state of uIP.
o kill -<signal> <pid>
Send the <signal> to the task identified by <pid>.
o losetup [-d <dev-path>] | [[-o <offset>] [-r] <ldev-path> <file-path>]
Setup or teardown the loop device:
@ -769,6 +773,7 @@ Command Dependencies on Configuration Settings
get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558 (see note 1)
help --
ifconfig CONFIG_NET
kill !CONFIG_DISABLE_SIGNALS
losetup !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0
ls CONFIG_NFILE_DESCRIPTORS > 0
mb,mh,mw ---
@ -812,15 +817,16 @@ also allow it to squeeze into very small memory footprints.
CONFIG_EXAMPLES_NSH_DISABLE_CAT, CONFIG_EXAMPLES_NSH_DISABLE_CD, CONFIG_EXAMPLES_NSH_DISABLE_CP,
CONFIG_EXAMPLES_NSH_DISABLE_DD, CONFIG_EXAMPLES_NSH_DISABLE_ECHO, CONFIG_EXAMPLES_NSH_DISABLE_EXEC,
CONFIG_EXAMPLES_NSH_DISABLE_EXIT, CONFIG_EXAMPLES_NSH_DISABLE_GET, CONFIG_EXAMPLES_NSH_DISABLE_HELP,
CONFIG_EXAMPLES_NSH_DISABLE_IFCONFIG, CONFIG_EXAMPLES_NSH_DISABLE_LOSETUP, CONFIG_EXAMPLES_NSH_DISABLE_LS,
CONFIG_EXAMPLES_NSH_DISABLE_MB, CONFIG_EXAMPLES_NSH_DISABLE_MEM, CONFIG_EXAMPLES_NSH_DISABLE_MKDIR,
CONFIG_EXAMPLES_NSH_DISABLE_MKFATFS, CONFIG_EXAMPLES_NSH_DISABLE_MKFIFO, CONFIG_EXAMPLES_NSH_DISABLE_MKRD,
CONFIG_EXAMPLES_NSH_DISABLE_MH, CONFIG_EXAMPLES_NSH_DISABLE_MOUNT, CONFIG_EXAMPLES_NSH_DISABLE_MW,
CONFIG_EXAMPLES_NSH_DISABLE_PS, CONFIG_EXAMPLES_NSH_DISABLE_PING, CONFIG_EXAMPLES_NSH_DISABLE_PUT,
CONFIG_EXAMPLES_NSH_DISABLE_PWD, CONFIG_EXAMPLES_NSH_DISABLE_RM, CONFIG_EXAMPLES_NSH_DISABLE_RMDIR,
CONFIG_EXAMPLES_NSH_DISABLE_SET, CONFIG_EXAMPLES_NSH_DISABLE_SH, CONFIG_EXAMPLES_NSH_DISABLE_SLEEP,
CONFIG_EXAMPLES_NSH_DISABLE_TEST, CONFIG_EXAMPLES_NSH_DISABLE_UMOUNT, CONFIG_EXAMPLES_NSH_DISABLE_UNSET,
CONFIG_EXAMPLES_NSH_DISABLE_USLEEP, CONFIG_EXAMPLES_NSH_DISABLE_WGET, CONFIG_EXAMPLES_NSH_DISABLE_XD
CONFIG_EXAMPLES_NSH_DISABLE_IFCONFIG, CONFIG_EXAMPLES_NSH_DISABLE_KILL, CONFIG_EXAMPLES_NSH_DISABLE_LOSETUP,
CONFIG_EXAMPLES_NSH_DISABLE_LS, CONFIG_EXAMPLES_NSH_DISABLE_MB, CONFIG_EXAMPLES_NSH_DISABLE_MEM,
CONFIG_EXAMPLES_NSH_DISABLE_MKDIR, CONFIG_EXAMPLES_NSH_DISABLE_MKFATFS, CONFIG_EXAMPLES_NSH_DISABLE_MKFIFO,
CONFIG_EXAMPLES_NSH_DISABLE_MKRD, CONFIG_EXAMPLES_NSH_DISABLE_MH, CONFIG_EXAMPLES_NSH_DISABLE_MOUNT,
CONFIG_EXAMPLES_NSH_DISABLE_MW, CONFIG_EXAMPLES_NSH_DISABLE_PS, CONFIG_EXAMPLES_NSH_DISABLE_PING,
CONFIG_EXAMPLES_NSH_DISABLE_PUT, CONFIG_EXAMPLES_NSH_DISABLE_PWD, CONFIG_EXAMPLES_NSH_DISABLE_RM,
CONFIG_EXAMPLES_NSH_DISABLE_RMDIR, CONFIG_EXAMPLES_NSH_DISABLE_SET, CONFIG_EXAMPLES_NSH_DISABLE_SH,
CONFIG_EXAMPLES_NSH_DISABLE_SLEEP, CONFIG_EXAMPLES_NSH_DISABLE_TEST, CONFIG_EXAMPLES_NSH_DISABLE_UMOUNT,
CONFIG_EXAMPLES_NSH_DISABLE_UNSET, CONFIG_EXAMPLES_NSH_DISABLE_USLEEP, CONFIG_EXAMPLES_NSH_DISABLE_WGET,
CONFIG_EXAMPLES_NSH_DISABLE_XD
NSH-Specific Configuration Settings
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,7 +1,7 @@
/****************************************************************************
* examples/nsh/nsh.h
*
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -474,6 +474,9 @@ extern int cmd_lbracket(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif /* CONFIG_DISABLE_ENVIRON */
#ifndef CONFIG_DISABLE_SIGNALS
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_KILL
extern int cmd_kill(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_SLEEP
extern int cmd_sleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif

View File

@ -1,7 +1,7 @@
/****************************************************************************
* examples/nsh/nsh_main.c
*
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -189,6 +189,12 @@ static const struct cmdmap_s g_cmdmap[] =
# endif
#endif
#ifndef CONFIG_DISABLE_SIGNALS
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_SLEEP
{ "kill", cmd_kill, 3, 3, "kill -<signal> <pid>" },
# endif
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)
# ifndef CONFIG_EXAMPLES_NSH_DISABLE_LOSETUP
{ "losetup", cmd_losetup, 3, 6, "[-d <dev-path>] | [[-o <offset>] [-r] <dev-path> <file-path>]" },

View File

@ -1,7 +1,7 @@
/****************************************************************************
* examples/nsh/nsh_proccmds.c
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -43,6 +43,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <sched.h>
#include <errno.h>
#include "nsh.h"
@ -175,6 +176,80 @@ int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
}
#endif
/****************************************************************************
* Name: cmd_kill
****************************************************************************/
#ifndef CONFIG_DISABLE_SIGNALS
#ifndef CONFIG_EXAMPLES_NSH_DISABLE_KILL
int cmd_kill(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
char *ptr;
char *endptr;
long signal;
long pid;
/* Check incoming parameters. The first parameter should be "-<signal>" */
ptr = argv[1];
if (*ptr != '-' || ptr[1] < '0' || ptr[1] > '9')
{
goto invalid_arg;
}
/* Extract the signal number */
signal = strtol(&ptr[1], &endptr, 0);
/* The second parameter should be <pid> */
ptr = argv[2];
if (*ptr < '0' || *ptr > '9')
{
goto invalid_arg;
}
/* Extract athe pid */
pid = strtol(ptr, &endptr, 0);
/* Send the signal. Kill return values:
*
* EINVAL An invalid signal was specified.
* EPERM The process does not have permission to send the signal to any
* of the target processes.
* ESRCH The pid or process group does not exist.
* ENOSYS Do not support sending signals to process groups.
*/
if (kill((pid_t)pid, (int)signal) == 0)
{
return OK;
}
switch (errno)
{
case EINVAL:
goto invalid_arg;
case ESRCH:
nsh_output(vtbl, g_fmtnosuch, argv[0], "task", argv[2]);
return ERROR;
case EPERM:
case ENOSYS:
default:
nsh_output(vtbl, g_fmtcmdfailed, argv[0], "kill", NSH_ERRNO);
return ERROR;
}
invalid_arg:
nsh_output(vtbl, g_fmtarginvalid, argv[0]);
return ERROR;
}
#endif
#endif
/****************************************************************************
* Name: cmd_sleep
****************************************************************************/

View File

@ -1,7 +1,7 @@
/************************************************************************
* sched/sig_kill.c
*
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -96,7 +96,7 @@ int kill(pid_t pid, int signo)
if (pid <= 0)
{
*get_errno_ptr() = ENOSYS;
errno = ENOSYS;
return ERROR;
}
@ -104,7 +104,7 @@ int kill(pid_t pid, int signo)
if (!GOOD_SIGNO(signo))
{
*get_errno_ptr() = EINVAL;
errno = EINVAL;
return ERROR;
}
@ -118,7 +118,7 @@ int kill(pid_t pid, int signo)
sdbg("TCB=0x%08x signo=%d\n", stcb, signo);
if (!stcb)
{
*get_errno_ptr() = ESRCH;
errno = ESRCH;
sched_unlock();
return ERROR;
}