Merge branch 'softlink'

This commit is contained in:
Gregory Nutt 2017-02-03 09:25:17 -06:00
commit 5f4a26fee6
18 changed files with 653 additions and 115 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: August 4, 2016</p>
<p>Last Updated: February 2, 2017</p>
</td>
</tr>
</table>
@ -263,223 +263,229 @@
<tr>
<td><br></td>
<td>
<a href="#cmdls">2.30 List Directory Contents (ls)</a>
<a href="#cmdln">2.30 List to a File or Directory (ln)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdlsmod">2.31 Show information about installed OS modules (lsmod)</a>
<a href="#cmdls">2.31 List Directory Contents (ls)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmd5">2.32 Calculate MD5 (md5)</a>
<a href="#cmdlsmod">2.32 Show information about installed OS modules (lsmod)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmbhw">2.33 Access Memory (mb, mh, and mw)</a>
<a href="#cmdmd5">2.33 Calculate MD5 (md5)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdps">2.34 Show Current Tasks and Threads (ps)</a>
<a href="#cmdmbhw">2.34 Access Memory (mb, mh, and mw)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmkdir">2.35 Create a Directory (mkdir)</a>
<a href="#cmdps">2.35 Show Current Tasks and Threads (ps)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmkfatfs">2.36 Create a FAT Filesystem (mkfatfs)</a>
<a href="#cmdmkdir">2.36 Create a Directory (mkdir)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmkfifo">2.37 Create a FIFO (mkfifo)</a>
<a href="#cmdmkfatfs">2.37 Create a FAT Filesystem (mkfatfs)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmkrd">2.38 Create a RAMDISK (mkrd)</a>
<a href="#cmdmkfifo">2.38 Create a FIFO (mkfifo)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmount">2.39 Mount a File System (mount)</a>
<a href="#cmdmkrd">2.39 Create a RAMDISK (mkrd)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdmv">2.40 Rename a File (mv)</a>
<a href="#cmdmount">2.40 Mount a File System (mount)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdnfsmount">2.41 Mount an NFS file system (nfsmount)</a>
<a href="#cmdmv">2.41 Rename a File (mv)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdnslookup">2.42 Lookup a network address (nslookup)</a>
<a href="#cmdnfsmount">2.42 Mount an NFS file system (nfsmount)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdpasswd">2.43 Change a User's Password (passwd)</a>
<a href="#cmdnslookup">2.43 Lookup a network address (nslookup)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdping">2.44 Check Network Peer (ping/ping6)</a>
<a href="#cmdpasswd">2.44 Change a User's Password (passwd)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdpoweroff">2.45 Shut the system down (poweroff)</a>
<a href="#cmdping">2.45 Check Network Peer (ping/ping6)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdput">2.46 Send File Via TFTP (put)</a>
<a href="#cmdpoweroff">2.46 Shut the system down (poweroff)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdpwd">2.47 Show Current Working Directory (pwd)</a>
<a href="#cmdput">2.47 Send File Via TFTP (put)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdreboot">2.48 Reset and reboot the system (reboot)</a>
<a href="#cmdpwd">2.48 Show Current Working Directory (pwd)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdrm">2.49 Remove a File (rm)</a>
<a href="#cmdreboot">2.49 Reset and reboot the system (reboot)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdrmdir">2.50 Remove a Directory (rmdir)</a>
<a href="#cmdrm">2.50 Remove a File (rm)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdrmmod">2.51 Remove on OS Module (rmmod)</a>
<a href="#cmdrmdir">2.51 Remove a Directory (rmdir)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdset">2.52 Set an Environment Variable (set)</a>
<a href="#cmdrmmod">2.52 Remove on OS Module (rmmod)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdsh">2.53 Execute an NSH Script (sh)</a>
<a href="#cmdset">2.53 Set an Environment Variable (set)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdshutdown">2.54 Shut the system down (shutdown)</a>
<a href="#cmdsh">2.54 Execute an NSH Script (sh)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdsleep">2.55 Wait for Seconds (sleep)</a>
<a href="#cmdshutdown">2.55 Shut the system down (shutdown)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdtime">2.56 Time execution of another command (time)</a>
<a href="#cmdsleep">2.56 Wait for Seconds (sleep)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdunmount">2.57 Unmount a File System (umount)</a>
<a href="#cmdtime">2.57 Time execution of another command (time)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmduname">2.58 Print system information (uname)</a>
<a href="#cmdunmount">2.58 Unmount a File System (umount)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdunset">2.59 Unset an Environment Variable (unset)</a>
<a href="#cmduname">2.59 Print system information (uname)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdurldec">2.60 URL Decode (urldecode)</a>
<a href="#cmdunset">2.60 Unset an Environment Variable (unset)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdurlencode">2.61 URL Encode (urlencode)</a>
<a href="#cmdurldec">2.61 URL Decode (urldecode)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmduseradd">2.62 Add a New User (useradd)</a>
<a href="#cmdurlencode">2.62 URL Encode (urlencode)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmduserdel">2.63 Delete a user (userdel)</a>
<a href="#cmduseradd">2.63 Add a New User (useradd)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdusleep">2.64 Wait for Microseconds (usleep)</a>
<a href="#cmduserdel">2.64 Delete a user (userdel)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdwget">2.65 Get File Via HTTP (wget)</a>
<a href="#cmdusleep">2.65 Wait for Microseconds (usleep)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdxd">2.66 Hexadecimal Dump of Memory (xd)</a>
<a href="#cmdwget">2.66 Get File Via HTTP (wget)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdxd">2.67 Hexadecimal Dump of Memory (xd)</a>
</td>
</tr>
<tr>
@ -1681,13 +1687,6 @@ hexdump &lt;file or device&gt;
Dump data in hexadecimal format from a file or character device.
</p>
<tr>
<td><br></td>
<td>
<a href="#"></a>
</td>
</tr>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
@ -1937,7 +1936,32 @@ losetup d &lt;dev-path&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdls"><h2>2.30 List Directory Contents (ls)</h2></a>
<a name="cmdln"><h2>2.30 List to a File or Directory (ln)</h2></a>
</td>
</tr>
</table>
<p><b>Command Syntax:</b></p>
<ul><pre>
link [-s] &lt;target&gt; &lt;link&gt;
</pre></ul>
<p>
<b>Synopsis</b>.
The <code>link</code> command will create a new symbolic link at &lt;link&gt; for the existing file or directory, &lt;target&gt;.
This implementation is simplied for use with NuttX in these ways:
</p>
<ul>
<li>Links may be created only within the NuttX top-level, pseudo file system.
No file system currently supported by NuttX provides symbolic links.</li>
<li>For the same reason, only soft links are implemented.</li>
<li>File privileges are ignored.</li>
<li><code>c_time</code> is not updated.</li>
</ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdls"><h2>2.31 List Directory Contents (ls)</h2></a>
</td>
</tr>
</table>
@ -1975,7 +1999,7 @@ ls [-lRs] &lt;dir-path&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdlsmod"><h2>2.31 Show information about installed OS modules (lsmod)</h2></a>
<a name="cmdlsmod"><h2>2.32 Show information about installed OS modules (lsmod)</h2></a>
</td>
</tr>
</table>
@ -2008,7 +2032,7 @@ mydriver 20404659 20404625 0 20404580 552 204047a8 0
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmd5"><h2>2.32 Calculate MD5 (md5)</h2></a>
<a name="cmdmd5"><h2>2.33 Calculate MD5 (md5)</h2></a>
</td>
</tr>
</table>
@ -2025,7 +2049,7 @@ md5 [-f] &lt;string or filepath&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmbhw"><h2>2.33 Access Memory (mb, mh, and mw)</h2></a>
<a name="cmdmbhw"><h2>2.34 Access Memory (mb, mh, and mw)</h2></a>
</td>
</tr>
</table>
@ -2079,7 +2103,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdps"><h2>2.34 Show Current Tasks and Threads (ps)</h2></a>
<a name="cmdps"><h2>2.35 Show Current Tasks and Threads (ps)</h2></a>
</td>
</tr>
</table>
@ -2113,7 +2137,7 @@ nsh&gt; mount -t procfs /proc
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmkdir"><h2>2.35 Create a Directory (mkdir)</h2></a>
<a name="cmdmkdir"><h2>2.36 Create a Directory (mkdir)</h2></a>
</td>
</tr>
</table>
@ -2148,7 +2172,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmkfatfs"><h2>2.36 Create a FAT Filesystem (mkfatfs)</h2></a>
<a name="cmdmkfatfs"><h2>2.37 Create a FAT Filesystem (mkfatfs)</h2></a>
</td>
</tr>
</table>
@ -2173,7 +2197,7 @@ mkfatfs [-F &lt;fatsize&gt;] &lt;block-driver&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmkfifo"><h2>2.37 Create a FIFO (mkfifo)</h2></a>
<a name="cmdmkfifo"><h2>2.38 Create a FIFO (mkfifo)</h2></a>
</td>
</tr>
</table>
@ -2211,7 +2235,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmkrd"><h2>2.38 Create a RAMDISK (mkrd)</h2></a>
<a name="cmdmkrd"><h2>2.39 Create a RAMDISK (mkrd)</h2></a>
</td>
</tr>
</table>
@ -2262,7 +2286,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmount"><h2>2.39 Mount a File System (mount)</h2></a>
<a name="cmdmount"><h2>2.40 Mount a File System (mount)</h2></a>
</td>
</tr>
</table>
@ -2341,7 +2365,7 @@ nsh&gt; mount
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdmv"><h2>2.40 Rename a File (mv)</h2></a>
<a name="cmdmv"><h2>2.41 Rename a File (mv)</h2></a>
</td>
</tr>
</table>
@ -2359,7 +2383,7 @@ mv &lt;old-path&gt; &lt;new-path&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdnfsmount"><h2>2.41 Mount an NFS file system (nfsmount)</h2></a>
<a name="cmdnfsmount"><h2>2.42 Mount an NFS file system (nfsmount)</h2></a>
</td>
</tr>
</table>
@ -2378,7 +2402,7 @@ nfsmount &lt;server-address&gt; &lt;mount-point&gt; &lt;remote-path&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdnslookup"><h2>2.42 Lookup a network address (nslookup)</h2></a>
<a name="cmdnslookup"><h2>2.43 Lookup a network address (nslookup)</h2></a>
</td>
</tr>
</table>
@ -2395,7 +2419,7 @@ nslookup &lt;host-name&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdpasswd"><h2>2.43 Change a User's Password (passwd)</h2></a>
<a name="cmdpasswd"><h2>2.44 Change a User's Password (passwd)</h2></a>
</td>
</tr>
</table>
@ -2412,7 +2436,7 @@ passwd &lt;username&gt; &lt;password&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdping"><h2>2.44 Check Network Peer (ping/ping6)</h2></a>
<a name="cmdping"><h2>2.45 Check Network Peer (ping/ping6)</h2></a>
</td>
</tr>
</table>
@ -2449,7 +2473,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdpoweroff"><h2>2.45 Shut the system down (poweroff)</h2></a>
<a name="cmdpoweroff"><h2>2.46 Shut the system down (poweroff)</h2></a>
</td>
</tr>
</table>
@ -2471,7 +2495,7 @@ poweroff
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdput"><h2>2.46 Send File Via TFTP (put)</h2></a>
<a name="cmdput"><h2>2.47 Send File Via TFTP (put)</h2></a>
</td>
</tr>
</table>
@ -2506,7 +2530,7 @@ 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.47 Show Current Working Directory (pwd)</h2></a>
<a name="cmdpwd"><h2>2.48 Show Current Working Directory (pwd)</h2></a>
</td>
</tr>
</table>
@ -2536,7 +2560,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdreboot"><h2>2.48 Reboot the system (reboot)</h2></a>
<a name="cmdreboot"><h2>2.49 Reboot the system (reboot)</h2></a>
</td>
</tr>
</table>
@ -2558,7 +2582,7 @@ reboot
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdrm"><h2>2.49 Remove a File (rm)</h2></a>
<a name="cmdrm"><h2>2.50 Remove a File (rm)</h2></a>
</td>
</tr>
</table>
@ -2592,7 +2616,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdrmdir"><h2>2.50 Remove a Directory (rmdir)</h2></a>
<a name="cmdrmdir"><h2>2.51 Remove a Directory (rmdir)</h2></a>
</td>
</tr>
</table>
@ -2627,7 +2651,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdrmmod"><h2>2.51 Remove on OS Module (rmmod)</h2></a>
<a name="cmdrmmod"><h2>2.52 Remove on OS Module (rmmod)</h2></a>
</td>
</tr>
</table>
@ -2655,7 +2679,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdset"><h2>2.52 Set an Environment Variable (set)</h2></a>
<a name="cmdset"><h2>2.53 Set an Environment Variable (set)</h2></a>
</td>
</tr>
</table>
@ -2681,7 +2705,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdsh"><h2>2.53 Execute an NSH Script (sh)</h2></a>
<a name="cmdsh"><h2>2.54 Execute an NSH Script (sh)</h2></a>
</td>
</tr>
</table>
@ -2700,7 +2724,7 @@ sh &lt;script-path&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdshutdown"><h2>2.54 Shut the system down (shutdown)</h2></a>
<a name="cmdshutdown"><h2>2.55 Shut the system down (shutdown)</h2></a>
</td>
</tr>
</table>
@ -2721,7 +2745,7 @@ shutdown [--reboot]
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdsleep"><h2>2.55 Wait for Seconds (sleep)</h2></a>
<a name="cmdsleep"><h2>2.56 Wait for Seconds (sleep)</h2></a>
</td>
</tr>
</table>
@ -2738,7 +2762,7 @@ sleep &lt;sec&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdtime"><h2>2.56 Time execution of another command (time)</h2></a>
<a name="cmdtime"><h2>2.57 Time execution of another command (time)</h2></a>
</td>
</tr>
</table>
@ -2797,7 +2821,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdunmount"><h2>2.57 Unmount a File System (umount)</h2></a>
<a name="cmdunmount"><h2>2.58 Unmount a File System (umount)</h2></a>
</td>
</tr>
</table>
@ -2827,7 +2851,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmduname"><h2>2.58 Print system information (uname)</h2></a>
<a name="cmduname"><h2>2.59 Print system information (uname)</h2></a>
</td>
</tr>
</table>
@ -2894,7 +2918,7 @@ uname [-a | -imnoprsv]
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdunset"><h2>2.59 Unset an Environment Variable (unset)</h2></a>
<a name="cmdunset"><h2>2.60 Unset an Environment Variable (unset)</h2></a>
</td>
</tr>
</table>
@ -2920,7 +2944,7 @@ nsh&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdurldec"><h2>2.60 URL Decode (urldecode)</h2></a>
<a name="cmdurldec"><h2>2.61 URL Decode (urldecode)</h2></a>
</td>
</tr>
</table>
@ -2937,7 +2961,7 @@ urldecode [-f] &lt;string or filepath&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdurlencode"><h2>2.61 URL Encode (urlencode)</h2></a>
<a name="cmdurlencode"><h2>2.62 URL Encode (urlencode)</h2></a>
</td>
</tr>
</table>
@ -2954,7 +2978,7 @@ urlencode [-f] &lt;string or filepath&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmduseradd"><h2>2.62 Add a New User (useradd)</h2></a>
<a name="cmduseradd"><h2>2.63 Add a New User (useradd)</h2></a>
</td>
</tr>
</table>
@ -2971,7 +2995,7 @@ useradd &lt;username&gt; &lt;password&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmduserdel"><h2>2.63 Delete a user (userdel)</h2></a>
<a name="cmduserdel"><h2>2.64 Delete a user (userdel)</h2></a>
</td>
</tr>
</table>
@ -2988,7 +3012,7 @@ userdel &lt;username&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdusleep"><h2>2.64 Wait for Microseconds (usleep)</h2></a>
<a name="cmdusleep"><h2>2.65 Wait for Microseconds (usleep)</h2></a>
</td>
</tr>
</table>
@ -3005,7 +3029,7 @@ usleep &lt;usec&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdwget"><h2>2.65 Get File Via HTTP (wget)</h2></a>
<a name="cmdwget"><h2>2.66 Get File Via HTTP (wget)</h2></a>
</td>
</tr>
</table>
@ -3032,7 +3056,7 @@ wget [-o &lt;local-path&gt;] &lt;url&gt;
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdxd"><h2>2.66 Hexadecimal Dump of Memory (xd)</h2></a>
<a name="cmdxd"><h2>2.67 Hexadecimal Dump of Memory (xd)</h2></a>
</td>
</tr>
</table>
@ -3241,10 +3265,15 @@ nsh&gt;
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0 &amp;&amp; <code>CONFIG_DEV_LOOP</code></td>
<td><code>CONFIG_NSH_DISABLE_LOSETUP</code></td>
</tr>
<tr>
<td><b><code>ln</code></b></td>
<td><code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td>
<td><code>CONFIG_NSH_DISABLE_LL</code></td>
</tr>
<tr>
<td><b><code>ls</code></b></td>
<td><code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td>
<td><code>CONFIG_NSH_DISABLE_LS</code></td>
<td><code>CONFIG_NSH_DISABLE_LS</code> &amp;&amp; <code>CONFIG_PSEUDOFS_SOFTLINKS</code></td>
</tr>
<tr>
<td><b><code>lsmod</code></b></td>
@ -5165,10 +5194,10 @@ xxd -i romfs_img >nsh_romfsimg.h
<li><a href="#custinit"><code>CONFIG_NSH_ROMFSETC</code></a></li>
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ARCHROMFS</code></a></li>
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ROMFSMOUNTPT</code></a></li>
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ROMFSSECTSIZE</code></a></li>
</ul></td>
<td width="33%" valign="top">
<ul>
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ROMFSSECTSIZE</code></a></li>
<li><a href="#nshconfiguration"><code>CONFIG_NSH_STRERROR</code></a></li>
<li><a href="#nshconfiguration"><code>CONFIG_NSH_TELNET</code></a></li>
<li><a href="#nshconfiguration"><code>CONFIG_NSH_TMPDIR</code></a></li>
@ -5218,6 +5247,7 @@ xxd -i romfs_img >nsh_romfsimg.h
<li><a href="#cmdinsmod"><code>insmod</code></a></li>
<li><a href="#cmdkill"><code>kill</code></a></li>
<li><a href="#cmdlosetup"><code>losetup</code></a></li>
<li><a href="#cmdln">ln</code></a></li>
<li><a href="#cmdls">ls</code></a></li>
<li><a href="#cmdmbhw"><code>mb</code></a></li>
<li><a href="#nshlogin">Login</a></li>

View File

@ -32,6 +32,7 @@ gettimeofday NXgettimeofday
ioctl NXioctl
isatty NXisatty
kill NXkill
link NXlink
listen NXlisten
lseek NXlseek
mallinfo NXmallinfo

View File

@ -40,6 +40,18 @@ config DISABLE_PSEUDOFS_OPERATIONS
However, in practical embedded system, they are seldom needed and
you can save a little FLASH space by disabling the capability.
config PSEUDOFS_SOFTLINKS
bool "Pseudo-filesystem soft links"
default n
depends on !DISABLE_PSEUDOFS_OPERATIONSi && EXPERIMENTAL
---help---
Enable support for soft links in the pseudeo file system. Soft
links are not supported within mounted volumes by any NuttX file
system. However, if this option is selected, then soft links
may be add in the pseudo file system. This might be useful, for
to link a directory in the pseudo-file system, such as /bin, to
to a directory in a mounted volume, say /mnt/sdcard/bin.
config FS_READABLE
bool
default n

View File

@ -1,7 +1,7 @@
############################################################################
# fs/Makefile
#
# Copyright (C) 2007, 2008, 2011-2014, 2016 Gregory Nutt. All rights reserved.
# Copyright (C) 2007, 2008, 2011-2014, 2016-2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without

View File

@ -1,7 +1,7 @@
/****************************************************************************
* fs/inode/fs_inode.c
*
* Copyright (C) 2007-2009, 2011-2012, 2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011-2012, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -40,7 +40,9 @@
#include <nuttx/config.h>
#include <assert.h>
#include <limits.h>
#include <semaphore.h>
#include <assert.h>
#include <errno.h>
#include <nuttx/kmalloc.h>
@ -166,6 +168,52 @@ static int _inode_compare(FAR const char *fname,
}
}
/****************************************************************************
* Name: _inode_dereference
*
* Description:
* If the inode is a soft link, then (1) get the name of the full path of
* the soft link, (2) recursively look-up the inode referenced by the soft
* link, and (3) return the inode referenced by the soft link.
*
* Assumptions:
* The caller holds the g_inode_sem semaphore
*
****************************************************************************/
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
static inline FAR struct inode *
_inode_dereference(FAR struct inode *node, FAR struct inode **peer,
FAR struct inode **parent, FAR const char **relpath)
{
FAR const char *copy;
unsigned int count = 0;
/* An infinite loop is avoided only by the loop count.
*
* REVISIT: The ELOOP error should be reported to the application in that
* case but there is no simple mechanism to do that.
*/
while (node != NULL && INODE_IS_SOFTLINK(node))
{
/* Careful: inode_search_nofollow overwrites the input string pointer */
copy = (FAR const char *)node->u.i_link;
/* Now, look-up the inode associated with the target path */
node = inode_search_nofollow(&copy, peer, parent, relpath);
if (node == NULL && ++count > SYMLOOP_MAX)
{
return NULL;
}
}
return node;
}
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -274,28 +322,54 @@ void inode_semgive(void)
}
/****************************************************************************
* Name: inode_search
* Name: inode_search and inode_search_nofollow
*
* Description:
* Find the inode associated with 'path' returning the inode references
* and references to its companion nodes.
*
* Both versions will follow soft links in path leading up to the terminal
* node. inode_search() will deference that terminal node,
* inode_search_nofollow will not.
*
* Assumptions:
* The caller holds the g_inode_sem semaphore
*
****************************************************************************/
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
FAR struct inode *inode_search_nofollow(FAR const char **path,
FAR struct inode **peer,
FAR struct inode **parent,
FAR const char **relpath)
#else
FAR struct inode *inode_search(FAR const char **path,
FAR struct inode **peer,
FAR struct inode **parent,
FAR const char **relpath)
#endif
{
FAR const char *name = *path + 1; /* Skip over leading '/' */
FAR struct inode *node = g_root_inode;
FAR struct inode *left = NULL;
FAR struct inode *above = NULL;
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
FAR struct inode *newnode;
#endif
while (node)
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
/* Handle the case were the root node is a symbolic link */
#warning Missing logic
#endif
/* Traverse the pseudo file system node tree until either (1) all nodes
* have been examined without finding the matching node, or (2) the
* matching node is found.
*/
while (node != NULL)
{
int result = _inode_compare(name, node);
@ -318,6 +392,43 @@ FAR struct inode *inode_search(FAR const char **path,
else if (result > 0)
{
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
/* If the inode in the is a soft link and this is the inode at
* at the head of the peer list and not the final node in the
* path), then (1) get the name of the full path of the soft
* link, (2) recursively look-up the inode referenced by the
* soft link, and (3) use the peer of that inode instead.
*/
FAR const char *nextname = inode_nextname(name);
if (*nextname != '\0')
{
newnode = _inode_dereference(node, NULL, &above, relpath);
if (newnode == NULL)
{
/* Probably means that the node is a symbolic link, but
* that the target of the symbolic link does not exist.
*/
break;
}
else if (newnode != node)
{
/* The node was a valid symbolic link and we have jumped to a
* different, spot in the the pseudo file system tree. Reset
* everything and continue looking at the next level "down"
* from that new spot in the tree.
*/
above = newnode;
left = NULL;
node = newnode->i_child;
continue;
}
}
#endif
/* Continue looking to the left */
left = node;
node = node->i_peer;
}
@ -326,15 +437,15 @@ FAR struct inode *inode_search(FAR const char **path,
else
{
/* Now there are three more possibilities:
* (1) This is the node that we are looking for or,
/* Now there are three remaining possibilities:
* (1) This is the node that we are looking for.
* (2) The node we are looking for is "below" this one.
* (3) This node is a mountpoint and will absorb all request
* below this one
*/
name = inode_nextname(name);
if (!*name || INODE_IS_MOUNTPT(node))
if (*name == '\0' || INODE_IS_MOUNTPT(node))
{
/* Either (1) we are at the end of the path, so this must be the
* node we are looking for or else (2) this node is a mountpoint
@ -345,15 +456,72 @@ FAR struct inode *inode_search(FAR const char **path,
{
*relpath = name;
}
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
/* NOTE that if the terminal inode is a soft link, it is not
* deferenced in this case. The raw inode is returned.
*
* In that case a wrapper function will perform that operation.
*/
#endif
break;
}
else
{
/* More to go, keep looking at the next level "down" */
/* More nodes to be examined in the path... */
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
/* If this intermediate inode in the is a soft link, then (1)
* get the name of the full path of the soft link, (2) recursively
* look-up the inode referenced by the sof link, and (3)
* continue searching with that inode instead.
*/
newnode = _inode_dereference(node, NULL, NULL, relpath);
if (newnode == NULL)
{
/* Probably means that the node is a symbolic link, but
* that the target of the symbolic link does not exist.
*/
break;
}
else if (newnode != node)
{
/* The node was a valid symbolic link and we have jumped to a
* different, spot in the the pseudo file system tree. Reset
* everything and continue looking to the right (if possible)
* otherwise at the next level "down" from that new spot in
* the tree.
*/
if (newnode->i_peer != NULL)
{
above = NULL; /* REVISIT: This can't be right */
left = newnode;
node = newnode->i_peer;
/* Did the symbolic link take us to a mountpoint? */
if (INODE_IS_MOUNTPT(newnode))
{
/* Yes.. return the mountpoint information */
if (relpath)
{
*relpath = name;
}
break;
}
}
}
#endif
/* Keep looking at the next level "down" */
above = node;
left = NULL;
node = node->i_child;
node = node->i_child;
}
}
}
@ -387,6 +555,33 @@ FAR struct inode *inode_search(FAR const char **path,
return node;
}
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
FAR struct inode *inode_search(FAR const char **path,
FAR struct inode **peer,
FAR struct inode **parent,
FAR const char **relpath)
{
/* Lookup the terminal inode */
FAR struct inode *node = inode_search_nofollow(path, peer, parent, relpath);
/* Did we find it? */
if (node != NULL)
{
/* Yes.. If the terminal inode in the is a soft link, then (1) get
* the name of the full path of the soft link, (2) recursively
* look-up the inode referenced by the soft link, and (3)
* return that inode instead.
*/
return _inode_dereference(node, peer, parent, relpath);
}
return node;
}
#endif
/****************************************************************************
* Name: inode_free
*
@ -401,8 +596,29 @@ void inode_free(FAR struct inode *node)
if (node != NULL)
{
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
/* Symbol links should never have peers or children */
DEBUGASSERT(!INODE_IS_SOFTLINK(node) ||
(node->i_peer == NULL && node->i_child == NULL));
#endif
/* Free all peers and children of this i_node */
inode_free(node->i_peer);
inode_free(node->i_child);
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
/* If the inode is a symbolic link, the free the path to the linked
* entity.
*/
if (INODE_IS_SOFTLINK(node) && node->u.i_link != NULL)
{
kmm_free(node->u.i_link);
}
#endif
kmm_free(node);
}
}

View File

@ -49,12 +49,16 @@
****************************************************************************/
/****************************************************************************
* Name: inode_find
* Name: inode_find and indode_find_nofollow
*
* Description:
* This is called from the open() logic to get a reference to the inode
* associated with a path.
*
* Both versions will follow soft links in path leading up to the terminal
* node. inode_find() will deference that terminal node,
* indode_find_nofollow no follow will not.
*
****************************************************************************/
FAR struct inode *inode_find(FAR const char *path, FAR const char **relpath)
@ -82,3 +86,30 @@ FAR struct inode *inode_find(FAR const char *path, FAR const char **relpath)
return node;
}
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
FAR struct inode *inode_find_nofollow(FAR const char *path,
FAR const char **relpath)
{
FAR struct inode *node;
if (path == NULL || *path != '/')
{
return NULL;
}
/* Find the node matching the path. If found, increment the count of
* references on the node.
*/
inode_semtake();
node = inode_search_nofollow(&path, (FAR struct inode**)NULL,
(FAR struct inode**)NULL, relpath);
if (node)
{
node->i_crefs++;
}
inode_semgive();
return node;
}
#endif

View File

@ -58,6 +58,11 @@
* path refers to. This is normally done in preparation to removing or
* moving an inode.
*
* In symbolic links in the pseduo file system are enabled, then this
* logic will follow the symbolic links up until the terminal node. Then
* that link in removed. So if this the terminal node is a symbolic link,
* the symbolic link node will be removed, not the target of the link.
*
* Assumptions/Limitations:
* The caller must hold the inode semaphore
*
@ -79,7 +84,7 @@ FAR struct inode *inode_unlink(FAR const char *path)
/* Find the node to unlink */
node = inode_search(&name, &peer, &parent, (const char **)NULL);
node = inode_search_nofollow(&name, &peer, &parent, (const char **)NULL);
if (node)
{
/* If peer is non-null, then remove the node from the right of

View File

@ -112,14 +112,18 @@ void inode_semtake(void);
void inode_semgive(void);
/****************************************************************************
* Name: inode_search
* Name: inode_search and inode_search_nofollow
*
* Description:
* Find the inode associated with 'path' returning the inode references
* and references to its companion nodes.
*
* Both versions will follow soft links in path leading up to the terminal
* node. inode_search() will deference that terminal node,
* inode_search_nofollow will not.
*
* Assumptions:
* The caller holds the tree_sem
* The caller holds the g_inode_sem semaphore
*
****************************************************************************/
@ -128,6 +132,15 @@ FAR struct inode *inode_search(FAR const char **path,
FAR struct inode **parent,
FAR const char **relpath);
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
FAR struct inode *inode_search_nofollow(FAR const char **path,
FAR struct inode **peer,
FAR struct inode **parent,
FAR const char **relpath);
#else
# define inode_search_nofollow(p,l,a,r) inode_search(p,l,a,r)
#endif
/****************************************************************************
* Name: inode_free
*
@ -205,15 +218,26 @@ FAR struct inode *inode_unlink(FAR const char *path);
int inode_remove(FAR const char *path);
/****************************************************************************
* Name: inode_find
* Name: inode_find and indode_find_nofollow
*
* Description:
* This is called from the open() logic to get a reference to the inode
* associated with a path.
*
* Both versions will follow soft links in path leading up to the terminal
* node. inode_find() will deference that terminal node,
* indode_find_nofollow no follow will not.
*
****************************************************************************/
FAR struct inode *inode_find(FAR const char *path, const char **relpath);
FAR struct inode *inode_find(FAR const char *path, FAR const char **relpath);
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
FAR struct inode *inode_find_nofollow(FAR const char *path,
FAR const char **relpath);
#else
# define inode_find_nofollow(p,r) inode_find(p,r)
#endif
/****************************************************************************
* Name: inode_addref

View File

@ -1,7 +1,7 @@
############################################################################
# fs/vfs/Make.defs
#
# Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
# Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -86,6 +86,10 @@ endif
CSRCS += fs_pread.c fs_pwrite.c
ifneq ($(CONFIG_PSEUDOFS_SOFTLINKS),0)
CSRCS += fs_link.c
endif
# Stream support
ifneq ($(CONFIG_NFILE_STREAMS),0)

180
fs/vfs/fs_link.c Normal file
View File

@ -0,0 +1,180 @@
/****************************************************************************
* fs/vfs/fs_link.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs/fs.h>
#include "inode/inode.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: link
*
* Description:
* The link() function will create a new link (directory entry) for the
* existing file, path2. This implementation is simplied for use with
* NuttX in these ways:
*
* - Links may be created only within the NuttX top-level, pseudo file
* system. No file system currently supported by NuttX provides
* symbolic links.
* - For the same reason, only soft links are implemented.
* - File privileges are ignored.
* - c_time is not updated.
*
* Input Parameters:
* path1 - Points to a pathname naming an existing file.
* path2 - Points to a pathname naming the new directory entry to be created.
*
* Returned Value:
* On success, zero (OK) is returned. Otherwise, -1 (ERROR) is returned
* the the errno variable is set appropriately.
*
****************************************************************************/
int link(FAR const char *path1, FAR const char *path2)
{
FAR struct inode *inode;
int errcode;
int ret;
/* Both paths must be absolute. We need only check path1 here. path2 will
* be checked by inode find.
*/
if (path1 == NULL || *path1 != '/')
{
errcode = EINVAL;
goto errout;
}
/* Check that no inode exists at the 'path1' and that the path up to 'path1'
* does not lie on a mounted volume.
*/
inode = inode_find(path2, NULL);
if (inode != NULL)
{
#ifndef CONFIG_DISABLE_MOUNTPOINT
/* Check if the inode is a mountpoint. */
if (INODE_IS_MOUNTPT(inode))
{
/* Symbolic links within the mounted volume are not supported */
errcode = ENOSYS;
}
else
#endif
{
/* A node already exists in the pseudofs at 'path1' */
errcode = EEXIST;
}
goto errout_with_inode;
}
/* No inode exists that contains this path. Create a new inode in the
* pseudo-filesystem at this location.
*/
else
{
/* Copy path1 */
FAR char *newpath2 = strdup(path1);
if (newpath2 == NULL)
{
errcode = ENOMEM;
goto errout;
}
/* Create an inode in the pseudo-filesystem at this path.
* NOTE that the new inode will be created with a reference
* count of zero.
*/
inode_semtake();
ret = inode_reserve(path2, &inode);
inode_semgive();
if (ret < 0)
{
kmm_free(newpath2);
errcode = -ret;
goto errout;
}
/* Initialize the inode */
INODE_SET_SOFTLINK(inode);
inode->u.i_link = newpath2;
inode->i_crefs = 1;
}
/* Symbolic link successfully created */
return OK;
errout_with_inode:
inode_release(inode);
errout:
set_errno(errcode);
return ERROR;
}
#endif /* CONFIG_PSEUDOFS_SOFTLINKS */

View File

@ -85,9 +85,11 @@ int unlink(FAR const char *pathname)
int errcode;
int ret;
/* Get an inode for this file */
/* Get an inode for this file (without deference the final node in the path
* which may be a symbolic link)
*/
inode = inode_find(pathname, &relpath);
inode = inode_find_nofollow(pathname, &relpath);
if (!inode)
{
/* There is no inode that includes in this path */
@ -124,11 +126,11 @@ int unlink(FAR const char *pathname)
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
/* If this is a "dangling" pseudo-file node (i.e., it has operations) then rm
* should remove the node.
/* If this is a "dangling" pseudo-file node (i.e., it has no operations)
* or a soft link, then rm should remove the node.
*/
if (!INODE_IS_SPECIAL(inode) && inode->u.i_ops)
if (!INODE_IS_SPECIAL(inode))
{
/* If this is a pseudo-file node (i.e., it has no operations)
* then unlink should remove the node.

View File

@ -111,6 +111,12 @@
*
* _POSIX_SEM_NSEMS_MAX Max number of open semaphores per task
* _POSIX_SEM_VALUE_MAX Max value a semaphore may have
*
* Required for symbolic links
* _POSIX_SYMLOOP_MAX Maximum number of symbolic links that can be
* reliably traversed in the resolution of a pathname
* in the absence of a loop.
*
*/
#define _POSIX_ARG_MAX 4096
@ -143,6 +149,10 @@
#define _POSIX_RTSIG_MAX 31
#define _POSIX_SIGQUEUE_MAX 32
/* Required for symbolic links */
#define _POSIX_SYMLOOP_MAX 100
/* Required for POSIX timers.
*
* _POSIX_DELAYTIMER_MAX is the number of timer expiration overruns.
@ -205,6 +215,8 @@
#define RTSIG_MAX _POSIX_RTSIG_MAX
#define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX
#define SYMLOOP_MAX _POSIX_SYMLOOP_MAX
#define DELAYTIMER_MAX _POSIX_DELAYTIMER_MAX
#define TIMER_MAX _POSIX_TIMER_MAX
#define CLOCKRES_MIN _POSIX_CLOCKRES_MIN

View File

@ -76,6 +76,7 @@
#define FSNODEFLAG_TYPE_DRIVER 0x00000000 /* Character driver */
#define FSNODEFLAG_TYPE_BLOCK 0x00000001 /* Block driver */
#define FSNODEFLAG_TYPE_MOUNTPT 0x00000002 /* Mount point */
#define FSNODEFLAG_TYPE_SOFTLINK 0x00000003 /* Soft link */
#define FSNODEFLAG_TYPE_SPECIAL 0x00000004 /* Special OS type */
#define FSNODEFLAG_TYPE_NAMEDSEM 0x00000004 /* Named semaphore */
#define FSNODEFLAG_TYPE_MQUEUE 0x00000005 /* Message Queue */
@ -90,6 +91,7 @@
#define INODE_IS_DRIVER(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_DRIVER)
#define INODE_IS_BLOCK(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_BLOCK)
#define INODE_IS_MOUNTPT(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_MOUNTPT)
#define INODE_IS_SOFTLINK(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_SOFTLINK)
#define INODE_IS_NAMEDSEM(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_NAMEDSEM)
#define INODE_IS_MQUEUE(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_MQUEUE)
#define INODE_IS_SHM(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_SHM)
@ -105,6 +107,7 @@
#define INODE_SET_DRIVER(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_DRIVER)
#define INODE_SET_BLOCK(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_BLOCK)
#define INODE_SET_MOUNTPT(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_MOUNTPT)
#define INODE_SET_SOFTLINK(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_SOFTLINK)
#define INODE_SET_NAMEDSEM(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_NAMEDSEM)
#define INODE_SET_MQUEUE(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_MQUEUE)
#define INODE_SET_SHM(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_SHM)
@ -313,16 +316,19 @@ struct mountpt_operations
union inode_ops_u
{
FAR const struct file_operations *i_ops; /* Driver operations for inode */
FAR const struct file_operations *i_ops; /* Driver operations for inode */
#ifndef CONFIG_DISABLE_MOUNTPOINT
FAR const struct block_operations *i_bops; /* Block driver operations */
FAR const struct mountpt_operations *i_mops; /* Operations on a mountpoint */
FAR const struct block_operations *i_bops; /* Block driver operations */
FAR const struct mountpt_operations *i_mops; /* Operations on a mountpoint */
#endif
#ifdef CONFIG_FS_NAMED_SEMAPHORES
FAR struct nsem_inode_s *i_nsem; /* Named semaphore */
FAR struct nsem_inode_s *i_nsem; /* Named semaphore */
#endif
#ifndef CONFIG_DISABLE_MQUEUE
FAR struct mqueue_inode_s *i_mqueue; /* POSIX message queue */
FAR struct mqueue_inode_s *i_mqueue; /* POSIX message queue */
#endif
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
FAR char *i_link; /* Full path to link target */
#endif
};

View File

@ -323,11 +323,18 @@
# define SYS_statfs (__SYS_filedesc+12)
# define SYS_telldir (__SYS_filedesc+13)
# if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0
# define SYS_pipe2 (__SYS_filedesc+14)
# define __SYS_mkfifo2 (__SYS_filedesc+15)
# if defined(CONFIG_PSEUDOFS_SOFTLINKS)
# define SYS_link (__SYS_filedesc+14)
# define __SYS_pipes (__SYS_filedesc+15)
# else
# define __SYS_mkfifo2 (__SYS_filedesc+14)
# define __SYS_pipes (__SYS_filedesc+14)
# endif
# if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0
# define SYS_pipe2 (__SYS_pipes+0)
# define __SYS_mkfifo2 (__SYS_pipes+1)
# else
# define __SYS_mkfifo2 (__SYS_pipes+0)
# endif
# if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/unistd.h
*
* Copyright (C) 2007-2009, 2013-2014, 2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2013-2014, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -190,6 +190,7 @@ FAR char *getcwd(FAR char *buf, size_t size);
int access(FAR const char *path, int amode);
int rmdir(FAR const char *pathname);
int unlink(FAR const char *pathname);
int link(FAR const char *path1, FAR const char *path2);
/* Execution of programs from files */

View File

@ -32,6 +32,7 @@
"insmod","nuttx/module.h","defined(CONFIG_MODULE)","FAR void *","FAR const char *","FAR const char *"
"ioctl","sys/ioctl.h","!defined(CONFIG_LIBC_IOCTL_VARIADIC) && (CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0)","int","int","int","unsigned long"
"kill","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","pid_t","int"
"link","unistd.h","defined(CONFIG_PSEUDOFS_SOFTLINKS)","int","FAR const char *","FAR const char *"
"listen","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int"
"lseek","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0","off_t","int","off_t","int"
"mkdir","sys/stat.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","FAR const char*","mode_t"

Can't render this file because it has a wrong number of fields in line 2.

View File

@ -232,6 +232,10 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert)
SYSCALL_LOOKUP(statfs, 2, STUB_statfs)
SYSCALL_LOOKUP(telldir, 1, STUB_telldir)
# if defined(CONFIG_PSEUDOFS_SOFTLINKS)
SYSCALL_LOOKUP(link, 2, STUB_link)
# endif
# if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0
SYSCALL_LOOKUP(pipe2, 2, STUB_pipe2)
# endif

View File

@ -238,6 +238,8 @@ uintptr_t STUB_stat(int nbr, uintptr_t parm1, uintptr_t parm2);
uintptr_t STUB_statfs(int nbr, uintptr_t parm1, uintptr_t parm2);
uintptr_t STUB_telldir(int nbr, uintptr_t parm1);
uintptr_t STUB_link(int nbr, uintptr_t parm1, uintptr_t parm2);
uintptr_t STUB_pipe2(int nbr, uintptr_t parm1, uintptr_t parm2);
uintptr_t STUB_mkfifo2(int nbr, uintptr_t parm1, uintptr_t parm2,
uintptr_t parm3);