{"id":100668,"date":"2026-09-05T03:16:57","date_gmt":"2026-09-04T19:16:57","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/100668.html"},"modified":"2026-09-05T03:16:57","modified_gmt":"2026-09-04T19:16:57","slug":"%e6%96%87%e4%bb%b6%e6%8f%8f%e8%bf%b0%e7%ac%a6","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/100668.html","title":{"rendered":"\u6587\u4ef6\u63cf\u8ff0\u7b26"},"content":{"rendered":"<h2>\u4e00.linux \u6253\u5f00\u6587\u4ef6\u4e09\u5c42\u7ed3\u6784\u5173\u7cfb\u56fe<\/h2>\n<p>\u6587\u4ef6\u63cf\u8ff0\u7b26\u3001\u6253\u5f00\u6587\u4ef6\u8868\u3001inode \u5173\u7cfb\u56fe<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"938\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260904191655-6a9b1927a6805.png\" width=\"2234\" \/><\/p>\n<li>\u8fdb\u7a0b\u6587\u4ef6\u63cf\u8ff0\u7b26\u8868&#xff08;fd_array []&#xff09; \u5c5e\u4e8e\u8fdb\u7a0b PCB&#xff08;task_struct&#xff09;\u79c1\u6709&#xff0c;fd \u5c31\u662f\u6570\u7ec4\u4e0b\u6807&#xff08;0\/1\/2 \u6807\u51c6\u8f93\u5165\u8f93\u51fa\u9519\u8bef&#xff09;<\/li>\n<li>\u7cfb\u7edf\u6253\u5f00\u6587\u4ef6\u8868&#xff08;struct file \/file_struct&#xff09; \u5168\u5c40\u5185\u6838\u5171\u4eab&#xff0c;\u4fdd\u5b58\u8bfb\u5199\u504f\u79fb\u91cf\u3001\u6253\u5f00\u6807\u5fd7\u3001\u5f15\u7528\u8ba1\u6570<\/li>\n<li>inode \u8868&#xff08;inode&#xff09; \u4ee3\u8868\u78c1\u76d8\u4e0a\u771f\u5b9e\u6587\u4ef6&#xff0c;\u5b58\u653e\u6587\u4ef6\u5143\u4fe1\u606f<\/li>\n<p>\u5176\u4e2d\u78c1\u76d8\u6587\u4ef6\u5c5e\u6027\u5728inode,\u5185\u5bb9\u5728\u7f13\u51b2\u533a<\/p>\n<h3>1. \u6587\u4ef6\u6253\u5f00\u4e0e\u521b\u5efa<\/h3>\n<p>\u901a\u8fc7\u6587\u4ef6\u540d\u6765\u6253\u5f00\u6587\u4ef6&#xff0c;\u4e0d\u5b58\u5728\u6587\u4ef6\u5c31\u4f1a\u521b\u5efa\u65b0\u7684\u6587\u4ef6\u3002\u6587\u4ef6\u90fd\u662f\u5177\u6709\u6743\u9650\u7684&#xff0c;\u6240\u4ee5\u6211\u4eec\u9700\u8981\u8fdb\u884c\u6743\u9650\u7684\u5b9a\u4e49\u3002<\/p>\n<p>#include &lt;sys\/types.h&gt;<br \/>\n#include &lt;sys\/stat.h&gt;<br \/>\n#include &lt;fcntl.h&gt;<\/p>\n<p>\/\/ \u6253\u5f00\u5df2\u6709\u6587\u4ef6<br \/>\nint open(const char *pathname, int flags);<br \/>\n\/\/ \u521b\u5efa&#043;\u6253\u5f00\u6587\u4ef6&#xff08;\u5e26\u6743\u9650mode&#xff09;<br \/>\nint open(const char *pathname, int flags, mode_t mode);<\/p>\n<p>\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u6587\u4ef6\u540d&#xff0c;\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u6587\u4ef6\u7684\u6253\u5f00\u65b9\u5f0f&#xff0c;\u7b2c\u4e09\u4e2a\u53c2\u6570\u662f\u6587\u4ef6\u6743\u9650\u63a9\u7801\u3002<\/p>\n<h3>2. \u6587\u4ef6\u5173\u95ed<\/h3>\n<p>\u6587\u4ef6\u6253\u5f00\u540e\u9700\u8981\u53ca\u65f6\u5173\u95ed\u3002<\/p>\n<p>#include &lt;unistd.h&gt;<br \/>\nint close(int fd);<\/p>\n<p>\u53c2\u6570\u662f\u6587\u4ef6\u63cf\u8ff0\u7b26&#xff0c;\u4e00\u4e2a\u8fdb\u7a0b\u7684\u6574\u6570\u7f16\u53f7\u3002<\/p>\n<h3>3. \u6587\u4ef6\u5199\u5165<\/h3>\n<p>\u6587\u4ef6\u9700\u8981\u8fdb\u884c\u5199\u5165\u64cd\u4f5c\u3002<\/p>\n<p>#include &lt;unistd.h&gt;<br \/>\nssize_t write(int fd, const void *buf, size_t count);<\/p>\n<h3>4. \u6587\u4ef6\u518d\u6b21\u5199\u5165<\/h3>\n<p>4.1 \u6e05\u7a7a\u5199\u5165<\/p>\n<p>\u4e0e\u5e38\u89c4\u8bed\u8a00\u4e0d\u4e00\u6837&#xff0c;\u5f88\u591a\u662f\u9ed8\u8ba4\u6e05\u7a7a\u7684&#xff0c;\u4f46\u662f\u8fd9\u91cc\u9700\u8981\u624b\u52a8\u6e05\u7a7a&#xff0c;\u8981\u4e0d\u7136\u4f1a\u51fa\u73b0\u8986\u76d6\u4e4b\u524d\u7684\u5185\u5bb9\u3002<\/p>\n<p>\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u6587\u4ef6\u63cf\u8ff0\u7b26&#xff0c;\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u9700\u8981\u5199\u5165\u5185\u5bb9\u7f13\u51b2\u533a\u7684\u8d77\u59cb\u5730\u5740&#xff0c;\u7b2c\u4e09\u4e2a\u53c2\u6570\u662f\u5199\u5165\u5185\u5bb9\u7684\u5927\u5c0f\u3002<\/p>\n<p>\u4f7f\u7528\u5b8f\u5b9a\u4e49\u6620\u5c04 O_TRUNC \u9009\u9879\u3002<\/p>\n<p>\/\/ \u518d\u6b21\u6253\u5f00&#xff0c;O_TRUNC \u4f1a\u6e05\u7a7a\u4e4b\u524d\u6587\u5b57&#xff0c;\u91cd\u65b0\u5199<br \/>\nint fd2 &#061; open(&#034;test.txt&#034;, O_WRONLY | O_CREAT | O_TRUNC, 0666);<br \/>\nchar buf2[] &#061; &#034;\u8986\u76d6\u540e\u7684\u65b0\u5185\u5bb9\\\\n&#034;;<br \/>\nwrite(fd2, buf2, strlen(buf2));<br \/>\nclose(fd2);<br \/>\nreturn 0;<\/p>\n<p>4.2 \u7ed3\u5c3e\u8ffd\u52a0\u5199\u5165<\/p>\n<p>\u4f7f\u7528\u5b8f\u5b9a\u4e49\u6620\u5c04 O_APPEND \u9009\u9879\u3002<\/p>\n<p>\/\/ \u518d\u6b21\u6253\u5f00\u8ffd\u52a0<br \/>\nint fd2 &#061; open(&#034;log.txt&#034;, O_WRONLY | O_CREAT | O_APPEND, 0666);<br \/>\nwrite(fd2, &#034;\u7b2c\u4e8c\u6761\u65e5\u5fd7\\\\n&#034;, strlen(&#034;\u7b2c\u4e8c\u6761\u65e5\u5fd7\\\\n&#034;));<br \/>\nclose(fd2);<br \/>\nreturn 0;<\/p>\n<p>\u9ed8\u8ba4\u5199\u5165\u7684\u662f\u5b57\u7b26\u4e32&#xff0c;\u5c06\u6574\u6570\u5199\u5165\u4f1a\u53d8\u6210\u4e71\u7801&#xff0c;\u9700\u8981\u5199\u5165\u65f6\u8fd8\u662f\u9700\u8981\u8f6c\u5316\u4e3a\u5b57\u7b26\u4e32\u3002<\/p>\n<h3>5. \u6587\u4ef6\u8bfb\u53d6<\/h3>\n<p>#include &lt;unistd.h&gt;<br \/>\nssize_t read(int fd, void *buf, size_t count);<\/p>\n<p>fd \u53c2\u6570\u662f\u6587\u4ef6\u63cf\u8ff0\u7b26&#xff0c;\u4e00\u4e2a\u8fdb\u7a0b\u7684\u6574\u6570\u7f16\u53f7\u3002<\/p>\n<h3>6. \u6587\u4ef6\u63cf\u8ff0\u7b26\u4e0e\u6807\u51c6\u6d41<\/h3>\n<p>FILE* \u8fd4\u56de\u503c\u91cc\u9762\u5c01\u88c5\u4e86\u6587\u4ef6\u63cf\u8ff0\u7b26 fd&#xff0c;\u4f8b\u5982 stdin\u3001stdout\u3001stderr \u8fd9\u4e9b\u5bf9\u5e94\u7684\u662f 0\u30011\u30012\u3002<\/p>\n<h3>7. \u91cd\u5b9a\u5411<\/h3>\n<p>\u66f4\u6539\u6587\u4ef6\u63cf\u8ff0\u7b26\u7684\u6307\u9488\u6307\u5411\u3002<\/p>\n<h3>8. \u91cd\u5b9a\u5411\u539f\u7406<\/h3>\n<p>\u6587\u4ef6\u63cf\u8ff0\u7b26\u7684\u5206\u914d\u89c4\u5219&#xff1a;\u6700\u5c0f\u7684\u3001\u6ca1\u6709\u88ab\u4f7f\u7528\u7684&#xff0c;\u4f5c\u4e3a\u65b0\u7684 fd \u7ed9\u7528\u6237\u3002<\/p>\n<p>int dup2(int oldfd, int newfd);<\/p>\n<p>\u4f5c\u7528&#xff1a;\u8ba9 newfd \u6307\u5411 oldfd \u6240\u5173\u8054\u7684\u6587\u4ef6<\/p>\n<li>fd 0 \u2014 stdin \u6807\u51c6\u8f93\u5165 \u9ed8\u8ba4&#xff1a;\u952e\u76d8<\/li>\n<li>fd 1 \u2014 stdout \u6807\u51c6\u8f93\u51fa \u9ed8\u8ba4&#xff1a;\u7ec8\u7aef\u5c4f\u5e55<\/li>\n<li>fd 2 \u2014 stderr \u6807\u51c6\u9519\u8bef \u9ed8\u8ba4&#xff1a;\u7ec8\u7aef\u5c4f\u5e55<\/li>\n<li>fd 3 \u7b2c\u4e00\u4e2a\u7a7a\u95f2\u53ef\u7528\u7684\u6587\u4ef6\u63cf\u8ff0\u7b26 \u8fdb\u7a0b\u65b0\u5efa\u6587\u4ef6\u3001socket&#xff0c;\u4f18\u5148\u5206\u914d\u6700\u5c0f\u7a7a\u95f2 fd&#xff0c;0\/1\/2 \u88ab\u5360\u7528&#xff0c;\u6240\u4ee5\u65b0\u6253\u5f00\u6587\u4ef6\u4e00\u822c\u62ff\u5230 3\u3002<\/li>\n<p>\u4f8b\u5b50:<\/p>\n<p>int dup2(3, 1);<\/p>\n<p>\u91cd\u5b9a\u5411\u4e4b\u540e\u53ef\u4ee5\u8fdb\u884cclose(oldfd)<\/p>\n<p>\u91cd\u5b9a\u5411\u7684\u65b9\u5f0f\u53ef\u4ee5\u662f\u6e05\u7a7a\u91cd\u5b9a\u5411,\u8ffd\u52a0\u91cd\u5b9a\u5411,\u540c\u6837\u7684\u4f7f\u7528O_TRUNC,O_APPEND\u9009\u9879.<\/p>\n<p>\u6240\u4ee5\u91cd\u5b9a\u5411\u5c31\u662f:\u6253\u5f00\u6587\u4ef6\u7684\u65b9\u5f0f(\u8ffd\u52a0,\u53ea\u8bfb\u7b49)&#043;dup2(\u4ece\u54ea\u91cc\u5230\u54ea\u91cc,\u4f7f\u7528\u6587\u4ef6\u63cf\u8ff0\u7b26)<\/p>\n<\/p>\n<ul>\n<li>&gt; \u6807\u51c6\u8f93\u51fa\u91cd\u5b9a\u5411&#xff08;\u8986\u76d6&#xff09;<\/li>\n<li>&gt;&gt; \u6807\u51c6\u8f93\u51fa\u91cd\u5b9a\u5411&#xff08;\u8ffd\u52a0&#xff09;<\/li>\n<li>&lt; \u6807\u51c6\u8f93\u5165\u91cd\u5b9a\u5411<\/li>\n<\/ul>\n<p>\u91cd\u5b9a\u5411\u4e00\u5b9a\u662f\u5b50\u8fdb\u7a0b\u8fdb\u884c\u91cd\u5b9a\u5411<\/p>\n<p>\u91cd\u5b9a\u5411\u7ec6\u8282<\/p>\n<p>\u5f53\u4ece\u6807\u51c6\u8f93\u51fa\u91cd\u5b9a\u5411\u5230\u4e00\u4e2a\u6307\u5b9a\u6587\u4ef6log.txt\u65f6,1\u548c2\u6307\u5411\u7684\u6807\u51c6\u8f93\u51fa\u548c\u9519\u8bef\u90fd\u662f\u540c\u4e00\u4e2a\u663e\u793a\u5668<\/p>\n<p>.\/out.cc &gt; log.txt  \/\/\u5176\u4e2d\u76841\u4f1a\u7701\u7565,\u5373\u6807\u51c6\u8f93\u51fa<br \/>\n.\/out.cc 1 &gt; log.txt  \/\/\u5f53\u4f60\u4f7f\u7528\u6807\u51c6erro\u65f6,\u8fd8\u662f\u4f1a\u663e\u793a\u5230\u663e\u793a\u5668\u4e0a\u9762<br \/>\n.\/out.cc 1 &gt; log.normal 2&gt;log.erro<\/p>\n<p>\u4e3a\u4ec0\u4e48\u9700\u8981\u5b58\u5728\u4e00\u4e2a\u6807\u51c6\u9519\u8bef:\u53ef\u4ee5\u901a\u8fc7\u91cd\u5b9a\u5411\u7684\u80fd\u529b,\u628a\u5e38\u89c4\u6d88\u606f\u548c\u9519\u8bef\u6d88\u606f\u8fdb\u884c\u5206\u79bb.<\/p>\n<p>\u5982\u679c\u6211\u4eec\u4e0d\u60f3\u5c06\u6807\u51c6\u9519\u8bef\u548c\u6807\u51c6\u8f93\u51fa\u7684\u5185\u5bb9\u8fdb\u884c\u5206\u5f00<\/p>\n<p>.\/out 1&gt;log.txt 2&gt;&gt;log.txt \/\/\u4f7f\u7528\u8ffd\u52a0\u91cd\u5b9a\u5411<br \/>\n.\/out 1&gt;log.txt 2&gt;&amp;1        \/\/\u8ba92&#xff08;\u6807\u51c6\u9519\u8bef&#xff09;\u5b8c\u5168\u590d\u5236 1 \u53f7\u901a\u9053\u3002<\/p>\n<h3>9.\u5f15\u7528\u8ba1\u6570<\/h3>\n<p>\u57fa\u7840\u5b9a\u4e49<\/p>\n<p>\u5f15\u7528\u8ba1\u6570&#xff1a;\u5185\u6838\u7ed9\u300c\u6587\u4ef6\u8868\u9879\u300d\u8bbe\u7f6e\u4e00\u4e2a\u6570\u5b57&#xff0c;\u8bb0\u5f55\u5f53\u524d\u6709\u591a\u5c11\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\u6307\u5411\u8fd9\u540c\u4e00\u4e2a\u6587\u4ef6\u8868\u3002\u00a0<\/p>\n<h2>\u4e8c.\u7406\u89e3&#034;\u4e00\u5207\u7686\u6587\u4ef6&#034;<\/h2>\n<p>\u6211\u4eec\u53ea\u8981\u62ff\u5230\u4e0a\u5c42\u7684\u6587\u4ef6\u63cf\u8ff0\u7b26\u5c31\u53ef\u4ee5\u901a\u8fc7struct file\u91cc\u9762\u7684\u51fd\u6570\u6307\u9488(\u6307\u5411\u51fd\u6570\u65b9\u6cd5,\u8bfb\u5199\u7b49)\u6765\u8bbf\u95ee\u4e0d\u540c\u7684\u786c\u4ef6(\u952e\u76d8,\u78c1\u76d8\u7b49),\u5c31\u662fc\u7248\u672c\u7684\u591a\u6001<\/p>\n<h3>1.\u7f13\u51b2\u533a<\/h3>\n<p>\u7f13\u51b2\u533a\u5c31\u50cf\u4e00\u4e2a\u5feb\u9012\u7ad9,\u5728\u4f60\u5fd9\u788c\u7684\u65f6\u5019\u53ef\u4ee5\u5c06\u4f60\u7684\u5305\u88f9\u6682\u5b58,\u4e0d\u81f3\u4e8e\u505c\u4e0b\u624b\u4e2d\u7684\u5de5\u4f5c. \u63d0\u9ad8\u5404\u65b9\u7684\u6548\u7387.<\/p>\n<p>\u4ec0\u4e48\u662f\u7f13\u51b2\u533a:\u5185\u5b58\u7684\u4e00\u6bb5\u7a7a\u95f4<\/p>\n<p>\u5728c\u6807\u51c6\u5e93\u4e2d\u4f1a\u6709\u7528\u6237\u7ea7\u7684\u8bed\u8a00\u7f13\u51b2\u533a,\u4f7f\u7528\u5e93\u51fd\u6570(printf,fprintf.fput,fwrite)\u5e76\u4e0d\u662f\u76f4\u63a5\u5230\u6587\u4ef6\u5185\u6838\u7f13\u51b2\u533a,\u5f53\u7528\u6237(\u5f3a\u5236\u5237\u65b0,\u5237\u65b0\u6761\u4ef6\u6ee1\u8db3,\u8fdb\u7a0b\u9000\u51fa)\u7684\u65f6\u5019\u624d\u4f1a\u901a\u8fc7(fd&#043;\u7cfb\u7edf\u8c03\u7528write\u7b49)\u8fdb\u5165\u5230\u5185\u6838\u7f13\u51b2\u533a,fd\u53ef\u4ee5\u627e\u5230\u5bf9\u5e94\u6587\u4ef6,\u5728\u6ee1\u8db3\u6761\u4ef6\u7684\u65f6\u5019\u5c31\u53ef\u4ee5\u901a\u8fc7fd\u627e\u5230\u5bf9\u5e94\u6587\u4ef6\u5199\u5165\u5185\u6838\u7f13\u51b2\u533a\u518d\u5199\u5165\u5230\u5bf9\u5e94\u7684\u786c\u4ef6<\/p>\n<p>\u4e00\u4e2a\u6587\u4ef6\u90fd\u8981\u6709\u81ea\u5df1\u7684\u7f13\u51b2\u533a,FILE\u662f\u4e00\u4e2a\u7ed3\u6784\u4f53,\u91cc\u9762\u6709fd\u548c\u7f13\u51b2\u533a\u6307\u9488<\/p>\n<h3 style=\"background-color:transparent\">2.\u7f13\u51b2\u7684\u51e0\u79cd\u65b9\u5f0f:<\/h3>\n<p>1.\u7acb\u5373\u5237\u65b0&#8212;\u65e0\u7f13\u51b2&#8212;\u5199\u900f\u6a21\u5f0fWT<\/p>\n<p>2.\u7f13\u51b2\u533a\u6ee1\u4e86&#8212;\u5168\u7f13\u51b2&#8212;\u7f13\u51b2\u533a\u6700\u6ee1,\u6548\u7387\u6700\u9ad8!(\u666e\u901a\u6587\u4ef6)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/p>\n<p>3.\u884c\u5237\u65b0&#8212;\u884c\u7f13\u51b2(\u663e\u793a\u5668)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>\u7cfb\u7edf\u8c03\u7528\u662f\u6709\u6210\u672c\u7684,\u6240\u4ee5\u6211\u4eec\u901a\u8fc7\u8bed\u8a00\u7f13\u51b2\u533a\u6765\u52a0\u5feb\u6548\u7387<\/p>\n<p>\u6211\u4eec\u53ea\u8981\u5c06\u6570\u636e\u4ea4\u7ed9OS,\u5c31\u76f8\u5f53\u4e8e\u4ea4\u7ed9\u4e86\u786c\u4ef6!\u6570\u636e\u4ea4\u7ed9\u7cfb\u7edf,\u4ea4\u7ed9\u786c\u4ef6&#8212;\u672c\u8d28\u5168\u662f\u62f7\u8d1d!\u8ba1\u7b97\u673a\u6d41\u52a8\u7684\u672c\u8d28:\u4e00\u5207\u7686\u62f7\u8d1d<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00.linux \u6253\u5f00\u6587\u4ef6\u4e09\u5c42\u7ed3\u6784\u5173\u7cfb\u56fe\u6587\u4ef6\u63cf\u8ff0\u7b26\u3001\u6253\u5f00\u6587\u4ef6\u8868\u3001inode \u5173\u7cfb\u56fe\u8fdb\u7a0b\u6587\u4ef6\u63cf\u8ff0\u7b26\u8868&#xff08;fd_array []&#xff09; \u5c5e\u4e8e\u8fdb\u7a0b PCB&#xff08;task_struct&#xff09;\u79c1\u6709&#xff0c;fd \u5c31\u662f\u6570\u7ec4\u4e0b\u6807&#xff08;0\/1\/2 \u6807\u51c6\u8f93\u5165\u8f93\u51fa\u9519\u8bef&#xff09;\u7cfb\u7edf\u6253\u5f00\u6587\u4ef6\u8868&#xff08;struct file \/file_struct&#xff09; \u5168\u5c40\u5185\u6838\u5171\u4eab&#xff0c;\u4fdd\u5b58\u8bfb\u5199\u504f\u79fb\u91cf\u3001\u6253\u5f00\u6807\u5fd7\u3001\u5f15\u7528\u8ba1\u6570i<\/p>\n","protected":false},"author":2,"featured_media":100667,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,58,87,190,427],"topic":[],"class_list":["post-100668","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-java","tag-linux","tag-87","tag-190","tag-427"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6587\u4ef6\u63cf\u8ff0\u7b26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/100668.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6587\u4ef6\u63cf\u8ff0\u7b26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00.linux \u6253\u5f00\u6587\u4ef6\u4e09\u5c42\u7ed3\u6784\u5173\u7cfb\u56fe\u6587\u4ef6\u63cf\u8ff0\u7b26\u3001\u6253\u5f00\u6587\u4ef6\u8868\u3001inode \u5173\u7cfb\u56fe\u8fdb\u7a0b\u6587\u4ef6\u63cf\u8ff0\u7b26\u8868&#xff08;fd_array []&#xff09; \u5c5e\u4e8e\u8fdb\u7a0b PCB&#xff08;task_struct&#xff09;\u79c1\u6709&#xff0c;fd \u5c31\u662f\u6570\u7ec4\u4e0b\u6807&#xff08;0\/1\/2 \u6807\u51c6\u8f93\u5165\u8f93\u51fa\u9519\u8bef&#xff09;\u7cfb\u7edf\u6253\u5f00\u6587\u4ef6\u8868&#xff08;struct file \/file_struct&#xff09; \u5168\u5c40\u5185\u6838\u5171\u4eab&#xff0c;\u4fdd\u5b58\u8bfb\u5199\u504f\u79fb\u91cf\u3001\u6253\u5f00\u6807\u5fd7\u3001\u5f15\u7528\u8ba1\u6570i\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/100668.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-04T19:16:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260904191655-6a9b1927a6805.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/100668.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/100668.html\",\"name\":\"\u6587\u4ef6\u63cf\u8ff0\u7b26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-04T19:16:57+00:00\",\"dateModified\":\"2026-09-04T19:16:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/100668.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/100668.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/100668.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6587\u4ef6\u63cf\u8ff0\u7b26\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u6587\u4ef6\u63cf\u8ff0\u7b26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/100668.html","og_locale":"zh_CN","og_type":"article","og_title":"\u6587\u4ef6\u63cf\u8ff0\u7b26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00.linux \u6253\u5f00\u6587\u4ef6\u4e09\u5c42\u7ed3\u6784\u5173\u7cfb\u56fe\u6587\u4ef6\u63cf\u8ff0\u7b26\u3001\u6253\u5f00\u6587\u4ef6\u8868\u3001inode \u5173\u7cfb\u56fe\u8fdb\u7a0b\u6587\u4ef6\u63cf\u8ff0\u7b26\u8868&#xff08;fd_array []&#xff09; \u5c5e\u4e8e\u8fdb\u7a0b PCB&#xff08;task_struct&#xff09;\u79c1\u6709&#xff0c;fd \u5c31\u662f\u6570\u7ec4\u4e0b\u6807&#xff08;0\/1\/2 \u6807\u51c6\u8f93\u5165\u8f93\u51fa\u9519\u8bef&#xff09;\u7cfb\u7edf\u6253\u5f00\u6587\u4ef6\u8868&#xff08;struct file \/file_struct&#xff09; \u5168\u5c40\u5185\u6838\u5171\u4eab&#xff0c;\u4fdd\u5b58\u8bfb\u5199\u504f\u79fb\u91cf\u3001\u6253\u5f00\u6807\u5fd7\u3001\u5f15\u7528\u8ba1\u6570i","og_url":"https:\/\/www.wsisp.com\/helps\/100668.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-04T19:16:57+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260904191655-6a9b1927a6805.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/100668.html","url":"https:\/\/www.wsisp.com\/helps\/100668.html","name":"\u6587\u4ef6\u63cf\u8ff0\u7b26 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-04T19:16:57+00:00","dateModified":"2026-09-04T19:16:57+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/100668.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/100668.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/100668.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u6587\u4ef6\u63cf\u8ff0\u7b26"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/100668","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=100668"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/100668\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/100667"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=100668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=100668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=100668"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=100668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}