{"id":72148,"date":"2026-02-04T23:04:58","date_gmt":"2026-02-04T15:04:58","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/72148.html"},"modified":"2026-02-04T23:04:58","modified_gmt":"2026-02-04T15:04:58","slug":"linux-18-%e8%bf%9b%e7%a8%8b%e6%8e%a7%e5%88%b6","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/72148.html","title":{"rendered":"Linux 18 \u8fdb\u7a0b\u63a7\u5236"},"content":{"rendered":"<p style=\"text-align:center\">&#x1f525;\u4e2a\u4eba\u4e3b\u9875&#xff1a;Milestone-\u91cc\u7a0b\u7891<\/p>\n<p style=\"text-align:center\">\u2744\ufe0f\u4e2a\u4eba\u4e13\u680f:\u00a0&lt;&lt;\u529b\u6263hot100&gt;&gt;\u00a0&lt;&lt;C&#043;&#043;&gt;&gt;&lt;&lt;Linux&gt;&gt;<\/p>\n<p style=\"text-align:center\">\u00a0 \u00a0 \u00a0 \u00a0&lt;&lt;Git&gt;&gt;&lt;&lt;MySQL&gt;&gt;<\/p>\n<p style=\"text-align:center\">&#x1f31f;\u5fc3\u5411\u5f80\u4e4b\u884c\u5fc5\u80fd\u81f3<\/p>\n<p style=\"text-align:center\">\n<p id=\"main-toc\">\u00a0\u76ee\u5f55<\/p>\n<p id=\"%E4%B8%80.%E8%BF%9B%E7%A8%8B%E5%88%9B%E5%BB%BA-toc\" style=\"margin-left:0px\">\u4e00.\u8fdb\u7a0b\u521b\u5efa<\/p>\n<p id=\"1.1%E5%86%8D%E8%AF%86fork-toc\" style=\"margin-left:40px\">1.1\u518d\u8bc6fork<\/p>\n<p id=\"1.2%20%E5%86%99%E6%97%B6%E6%8B%B7%E8%B4%9D-toc\" style=\"margin-left:40px\">1.2 \u5199\u65f6\u62f7\u8d1d<\/p>\n<p id=\"1.3%20fork%E8%B0%83%E7%94%A8%E5%A4%B1%E8%B4%A5%E5%8E%9F%E5%9B%A0-toc\" style=\"margin-left:40px\">1.3 fork\u8c03\u7528\u5931\u8d25\u539f\u56e0<\/p>\n<p id=\"%E4%BA%8C.%E8%BF%9B%E7%A8%8B%E7%BB%88%E6%AD%A2-toc\" style=\"margin-left:0px\">\u4e8c.\u8fdb\u7a0b\u7ec8\u6b62<\/p>\n<p id=\"2.1%20%E8%BF%9B%E7%A8%8B%E9%80%80%E5%87%BA%E5%9C%BA%E6%99%AF-toc\" style=\"margin-left:40px\">2.1 \u8fdb\u7a0b\u9000\u51fa\u573a\u666f<\/p>\n<p id=\"2.2exit%20%26%26%20_exit-toc\" style=\"margin-left:40px\">2.2exit &amp;&amp; _exit<\/p>\n<p id=\"%E4%B8%89.%E8%BF%9B%E7%A8%8B%E7%AD%89%E5%BE%85-toc\" style=\"margin-left:40px\">\u4e09.\u8fdb\u7a0b\u7b49\u5f85<\/p>\n<p id=\"3.1%E7%AD%89%E5%BE%85%E6%96%B9%E5%BC%8F-toc\" style=\"margin-left:80px\">3.1\u7b49\u5f85\u65b9\u5f0f<\/p>\n<p id=\"3.2%E8%8E%B7%E5%8F%96status%E5%92%8C%E4%BF%A1%E5%8F%B7-toc\" style=\"margin-left:80px\">3.2\u83b7\u53d6status\u548c\u4fe1\u53f7<\/p>\n<p id=\"%E5%9B%9B.%E9%98%BB%E5%A1%9E%E9%9D%9E%E9%98%BB%E5%A1%9E%E7%AD%89%E5%BE%85-toc\" style=\"margin-left:0px\">\u56db.\u963b\u585e\u975e\u963b\u585e\u7b49\u5f85<\/p>\n<p id=\"%E4%BA%94.%E8%BF%9B%E7%A8%8B%E7%A8%8B%E5%BA%8F%E6%9B%BF%E6%8D%A2-toc\" style=\"margin-left:0px\">\u4e94.\u8fdb\u7a0b\u7a0b\u5e8f\u66ff\u6362<\/p>\n<p id=\"5.1%20%E9%AA%8C%E8%AF%81id%E4%B8%8D%E5%8F%98%E4%B8%8E%E8%A6%86%E7%9B%96%E5%BC%8F%E5%86%99%E5%85%A5-toc\" style=\"margin-left:40px\">5.1 \u9a8c\u8bc1id\u4e0d\u53d8\u4e0e\u8986\u76d6\u5f0f\u5199\u5165<\/p>\n<p id=\"5.2%20%E6%9B%BF%E6%8D%A2%E5%87%BD%E6%95%B0-toc\" style=\"margin-left:40px\">5.2 \u66ff\u6362\u51fd\u6570<\/p>\n<p id=\"5.3%20%E5%91%BD%E5%90%8D%E7%90%86%E8%A7%A3-toc\" style=\"margin-left:40px\">5.3 \u547d\u540d\u7406\u89e3<\/p>\n<p id=\"5.4%20%E6%9B%BF%E6%8D%A2%E5%87%BD%E6%95%B0%E4%BD%BF%E7%94%A8-toc\" style=\"margin-left:40px\">5.4 \u66ff\u6362\u51fd\u6570\u4f7f\u7528<\/p>\n<p id=\"5.4.1%20execl-toc\" style=\"margin-left:80px\">5.4.1 execl<\/p>\n<p id=\"5.4.3%C2%A0execv-toc\" style=\"margin-left:80px\">5.4.3\u00a0execv<\/p>\n<p id=\"5.4.4%C2%A0execvp-toc\" style=\"margin-left:80px\">5.4.4\u00a0execvp<\/p>\n<p id=\"5.4.5%C2%A0execele-toc\" style=\"margin-left:80px\">5.4.5\u00a0execele<\/p>\n<p id=\"5.5%20execve-toc\" style=\"margin-left:40px\">5.5 execve<\/p>\n<hr id=\"hr-toc\" \/>\n<h2>\u4e00.\u8fdb\u7a0b\u521b\u5efa<\/h2>\n<h3 id=\"1.1%E5%86%8D%E8%AF%86fork\">1.1\u518d\u8bc6fork<\/h3>\n<p>\u5173\u4e8efork\u7684\u57fa\u7840\u4f7f\u7528,\u5728\u524d\u9762\u7684\u6587\u7ae0\u5df2\u7ecf\u8bb2\u8fc7,\u6b64\u5904\u4e0d\u518d\u8d58\u8ff0<\/p>\n<p>  <span style=\"color:#1f2329\">\u8fdb\u7a0b\u8c03\u2f64 <\/span><br \/>\n  <span style=\"color:#1f2329\">fork <\/span><br \/>\n  <span style=\"color:#1f2329\">&#xff0c;\u5f53\u63a7\u5236\u8f6c\u79fb\u5230\u5185\u6838\u4e2d\u7684 <\/span><br \/>\n  <span style=\"color:#1f2329\">fork <\/span><br \/>\n  <span style=\"color:#1f2329\">\u4ee3\u7801\u540e&#xff0c;\u5185\u6838\u505a&#xff1a; <\/span><\/p>\n<p>  <span style=\"color:#646a73\">\u5206\u914d\u65b0\u7684\u5185\u5b58\u5757\u548c\u5185\u6838\u6570\u636e\u7ed3\u6784\u7ed9\u2f26\u8fdb\u7a0b <\/span><\/p>\n<p>  <span style=\"color:#646a73\">\u5c06\u2f57\u8fdb\u7a0b\u90e8\u5206\u6570\u636e\u7ed3\u6784\u5185\u5bb9\u62f7\u2ec9\u2f84\u2f26\u8fdb\u7a0b <\/span><\/p>\n<p>  <span style=\"color:#646a73\">\u6dfb\u52a0\u2f26\u8fdb\u7a0b\u5230\u7cfb\u7edf\u8fdb\u7a0b\u5217\u8868\u5f53\u4e2d <\/span><\/p>\n<p>  <span style=\"color:#646a73\">fork <\/span><br \/>\n  <span style=\"color:#646a73\">\u8fd4\u56de&#xff0c;\u5f00\u59cb\u8c03\u5ea6\u5668\u8c03\u5ea6<\/span><\/p>\n<h3 id=\"1.2%20%E5%86%99%E6%97%B6%E6%8B%B7%E8%B4%9D\">1.2 \u5199\u65f6\u62f7\u8d1d<\/h3>\n<p>\u00a0\u5f53\u7236\u5b50\u6570\u636e\u672a\u88ab\u4fee\u6539\u5199\u5165\u65f6,\u5171\u7528\u540c\u4e00\u4efd\u8d44\u6e90,\u4f46\u5176\u4e2d\u4e00\u65b9\u6570\u636e\u8fdb\u884c\u4e86\u5199\u5165,\u4fbf\u4f1a\u5199\u65f6\u62f7\u8d1d\u4e00\u4efd<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"533\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204150454-6983601658f97.png\" width=\"1412\" \/><\/p>\n<p>\u53ef\u4ee5\u770b\u5230\u4fee\u6539\u524d,\u6570\u636e\u6bb5\u90fd\u4e3ar,\u4fee\u6539\u540e,\u4e0d\u53ea\u4e3ar,\u539f\u7406\u662f\u5bf9\u6743\u9650\u4e3ar\u7684\u6570\u636e\u6bb5\u8fdb\u884c\u5199\u5165,OS\u4f1a\u68c0\u67e5,\u53d1\u73b0\u9519\u8bef,\u5c31\u4f1a\u81ea\u52a8\u4fee\u6539\u6743\u9650,\u8fdb\u884c\u62f7\u8d1d<\/p>\n<p>\u540c\u65f6\u6211\u4eec\u53d1\u73b0\u6ca1\u88ab\u4fee\u6539\u7684\u4ee3\u7801\u6bb5\u4f9d\u65e7\u5171\u7528\u540c\u4e00\u4efd\u8d44\u6e90<\/p>\n<p>\u56e0\u6b64,\u5199\u65f6\u62f7\u8d1d\u7684\u597d\u5904<\/p>\n<p>1.\u51cf\u5c11\u521b\u5efa\u65f6\u95f4<\/p>\n<p>2.\u51cf\u5c11\u5185\u5b58\u6d6a\u8d39<\/p>\n<h3 id=\"1.3%20fork%E8%B0%83%E7%94%A8%E5%A4%B1%E8%B4%A5%E5%8E%9F%E5%9B%A0\">1.3 fork\u8c03\u7528\u5931\u8d25\u539f\u56e0<\/h3>\n<p>  <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n  <span style=\"color:#646a73\">\u7cfb\u7edf\u4e2d\u6709\u592a\u591a\u7684\u8fdb\u7a0b <\/span><\/p>\n<p>  <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n  <span style=\"color:#646a73\">\u5b9e\u9645\u2f64\u2f3e\u7684\u8fdb\u7a0b\u6570\u8d85\u8fc7\u4e86\u9650\u5236<\/span><\/p>\n<h2 id=\"%E4%BA%8C.%E8%BF%9B%E7%A8%8B%E7%BB%88%E6%AD%A2\">\u4e8c.\u8fdb\u7a0b\u7ec8\u6b62<\/h2>\n<p> <span style=\"color:#1f2329\">\u8fdb\u7a0b\u7ec8\u2f4c\u7684\u672c\u8d28\u662f\u91ca\u653e\u7cfb\u7edf\u8d44\u6e90&#xff0c;\u5c31\u662f\u91ca\u653e\u8fdb\u7a0b\u7533\u8bf7\u7684\u76f8\u5173\u5185\u6838\u6570\u636e\u7ed3\u6784\u548c\u5bf9\u5e94\u7684\u6570\u636e\u548c\u4ee3\u7801\u3002<\/span><\/p>\n<h3 id=\"2.1%20%E8%BF%9B%E7%A8%8B%E9%80%80%E5%87%BA%E5%9C%BA%E6%99%AF\">2.1 \u8fdb\u7a0b\u9000\u51fa\u573a\u666f<\/h3>\n<p> <span style=\"color:#646a73\">\u4ee3\u7801\u8fd0\u2f8f\u5b8c\u6bd5&#xff0c;\u7ed3\u679c\u6b63\u786e <\/span><\/p>\n<p> <span style=\"color:#646a73\">\u4ee3\u7801\u8fd0\u2f8f\u5b8c\u6bd5&#xff0c;\u7ed3\u679c\u4e0d\u6b63\u786e <\/span><\/p>\n<p> <span style=\"color:#646a73\">\u4ee3\u7801\u5f02\u5e38\u7ec8\u2f4c<\/span><\/p>\n<p>  \u5b50\u8fdb\u7a0b\u662f\u7531\u7236\u8fdb\u7a0b\u521b\u5efa\u7684,\u662f\u8981\u8ba9\u5b8c\u6210\u67d0\u4e9b\u4e8b\u60c5\u7684,\u5b50\u8fdb\u7a0b\u8981\u53cd\u9988\u7236\u8fdb\u7a0b\u67d0\u4e9b\u4fe1\u606f<\/p>\n<p> \u67e5\u770b\u6700\u8fd1\u4e00\u4e2a\u8fdb\u7a0b\u7684\u9000\u51fa\u7801,\u53ef\u4ee5\u901a\u8fc7 echo $ ?<\/p>\n<p>  \u4ee3\u7801\u6b63\u5e38\u8fd0\u884c,\u7ed3\u679c\u6b63\u786e<\/p>\n<p>  test1.c \ue61e \u2b80                                                                                                                                                                                                          \u2b82\u2b82 buffers<br \/>\n    1 #include&lt;stdio.h&gt;<br \/>\n    2 int main()<br \/>\n    3 {<br \/>\nW&gt;  4   int a &#061; 1;<br \/>\n    5   return 0;<br \/>\n    6 }                <\/p>\n<p>\u9000\u51fa\u7801:<\/p>\n<p>  [lcb&#064;hcss-ecs-1cde 4]$ echo $?<br \/>\n0<\/p>\n<p>\u4ee3\u7801\u8fd0\u884c\u5b8c\u6bd5,\u7ed3\u679c\u4e0d\u6b63\u786e<\/p>\n<p>    1 #include&lt;stdio.h&gt;<br \/>\n    2 int main()<br \/>\n    3 {<br \/>\n    4   int a &#061; 1;<br \/>\nW&gt;  5   a &#061;a\/0;<br \/>\n    6   return 0;<br \/>\n    7<br \/>\n    8 }<\/p>\n<p>\u9000\u51fa\u7801<\/p>\n<p>  [lcb&#064;hcss-ecs-1cde 4]$ echo $?<br \/>\n136<\/p>\n<p>\u6ce8:<\/p>\n<p>\u518d\u67e5\u770b\u9000\u51fa\u7801,\u53c8\u4f1a\u4e3a0,\u56e0\u4e3a\u662f\u67e5\u770b\u6700\u8fd1\u4e00\u4e2a\u8fdb\u7a0b\u7684\u9000\u51fa\u7801<\/p>\n<p>  [lcb&#064;hcss-ecs-1cde 4]$ echo $?<br \/>\n0<\/p>\n<p>\u5e38\u89c1\u9000\u51fa\u65b9\u5f0f<\/p>\n<p> <span style=\"color:#1f2329\">\u6b63\u5e38\u7ec8\u2f4c&#xff08;\u53ef\u4ee5\u901a\u8fc7 <\/span><br \/>\n <span style=\"color:#1f2329\">echo $? <\/span><br \/>\n <span style=\"color:#1f2329\">\u67e5\u770b\u8fdb\u7a0b\u9000\u51fa\u7801&#xff09;&#xff1a; <\/span><\/p>\n<p> <span style=\"color:#1456f0\">1. <\/span><br \/>\n <span style=\"color:#646a73\">\u4ecemain\u8fd4\u56de <\/span><\/p>\n<p> <span style=\"color:#1456f0\">2. <\/span><br \/>\n <span style=\"color:#646a73\">\u8c03\u2f64exit <\/span><\/p>\n<p> <span style=\"color:#1456f0\">3. <\/span><br \/>\n <span style=\"color:#646a73\">_exit <\/span><\/p>\n<p> <span style=\"color:#1f2329\">\u5f02\u5e38\u9000\u51fa&#xff1a; <\/span><\/p>\n<p> <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n <span style=\"color:#646a73\">ctrl &#043; c&#xff0c;\u4fe1\u53f7\u7ec8\u2f4c<\/span><\/p>\n<p> <img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"740\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204150454-69836016a429c.png\" width=\"1109\" \/><\/p>\n<h3 id=\"2.2exit%20%26%26%20_exit\">2.2exit &amp;&amp; _exit<\/h3>\n<p>  <span style=\"color:#4078f2\">#<\/span><br \/>\n  <span style=\"color:#a626a4\">include <\/span><br \/>\n  <span style=\"color:#50a14f\">&lt;unistd.h&gt; <\/span><\/p>\n<p>  <span style=\"color:#986801\">void <\/span><br \/>\n  <span style=\"color:#2b2f36\">_exit(<\/span><br \/>\n  <span style=\"color:#986801\">int <\/span><br \/>\n  <span style=\"color:#2b2f36\">status); <\/span><\/p>\n<p>  <span style=\"color:#2b2f36\">\u53c2\u6570&#xff1a;<\/span><br \/>\n  <span style=\"color:#2b2f36\">status <\/span><br \/>\n  <span style=\"color:#2b2f36\">\u5b9a\u4e49\u4e86\u8fdb\u7a0b\u7684\u7ec8\u2f4c\u72b6\u6001&#xff0c;\u2f57\u8fdb\u7a0b\u901a\u8fc7<\/span><br \/>\n  <span style=\"color:#2b2f36\">wait<\/span><br \/>\n  <span style=\"color:#2b2f36\">\u6765\u83b7\u53d6\u8be5\u503c<\/span><\/p>\n<p>   <span style=\"color:#4078f2\">#<\/span><br \/>\n   <span style=\"color:#a626a4\">include <\/span><br \/>\n   <span style=\"color:#50a14f\">&lt;unistd.h&gt; <\/span><\/p>\n<p>   <span style=\"color:#986801\">void <\/span><br \/>\n   <span style=\"color:#4078f2\">exit<\/span><br \/>\n   <span style=\"color:#2b2f36\">(<\/span><br \/>\n   <span style=\"color:#986801\">int <\/span><br \/>\n   <span style=\"color:#2b2f36\">status);<\/span><\/p>\n<p>\u524d\u9762\u6211\u4eec\u5b66\u8fc7,\u5f53\u6709sleep\u65f6,\u4f1a\u5199\u5165\u7f13\u5b58\u533a,\u5f53\\\\n\u53ef\u4ee5\u5237\u65b0\u7f13\u5b58\u533a,\u63a5\u4e0b\u6765\u8ba9\u6211\u4eec\u770b\u8fd9\u4e24\u4e2a,\u4f1a\u53d1\u73b0\u65e0\\\\n\u65f6,_exit\u4e0d\u4f1a\u5237\u65b0\u7f13\u5b58\u533a,\u800cexit\u4f1a<\/p>\n<p>\u539f\u56e0\u5728\u4e8e<\/p>\n<p>  <span style=\"color:#1456f0\">1. <\/span><br \/>\n  <span style=\"color:#646a73\">\u6267\u2f8f\u2f64\u2f3e\u901a\u8fc7 atexit\u6216on_exit\u5b9a\u4e49\u7684\u6e05\u7406\u51fd\u6570\u3002<\/span><\/p>\n<p>  <span style=\"color:#1456f0\">2. <\/span><br \/>\n  <span style=\"color:#646a73\">\u5173\u95ed\u6240\u6709\u6253\u5f00\u7684\u6d41&#xff0c;\u6240\u6709\u7684\u7f13\u5b58\u6570\u636e\u5747\u88ab\u5199\u2f0a <\/span><\/p>\n<p>  <span style=\"color:#1456f0\">3. <\/span><br \/>\n  <span style=\"color:#646a73\">\u8c03\u2f64_exit(\u5e93\u8c03\u7528\u7cfb\u7edf\u8c03\u7528,\u5c01\u88c5\u4e86_exit)<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"143\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204150455-698360174b9e1.png\" width=\"802\" \/><\/p>\n<p>\u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u5f97\u5230\u4e00\u4e2a\u7ed3\u8bba<\/p>\n<p>\u6211\u4eec\u524d\u9762\u6240\u8bf4\u7684\u7f13\u5b58\u533a\u4e0d\u5728\u64cd\u4f5c\u7cfb\u7edf\u5185\u90e8\u7684\u7f13\u5b58\u533a,\u800c\u662f\u5e93\u7684\u7f13\u5b58\u533a<\/p>\n<h3 id=\"%E4%B8%89.%E8%BF%9B%E7%A8%8B%E7%AD%89%E5%BE%85\">\u4e09.\u8fdb\u7a0b\u7b49\u5f85<\/h3>\n<p> <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n <span style=\"color:#646a73\">\u4e4b\u524d\u8bb2\u8fc7&#xff0c;\u2f26\u8fdb\u7a0b\u9000\u51fa&#xff0c;\u2f57\u8fdb\u7a0b\u5982\u679c\u4e0d\u7ba1\u4e0d\u987e&#xff0c;\u5c31\u53ef\u80fd\u9020\u6210\u2018\u50f5\u2f2b\u8fdb\u7a0b\u2019\u7684\u95ee\u9898&#xff0c;\u8fdb\u2f7d\u9020\u6210\u5185\u5b58 <\/span><\/p>\n<p> <span style=\"color:#646a73\">\u6cc4\u6f0f\u3002 <\/span><\/p>\n<p> <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n <span style=\"color:#646a73\">\u53e6\u5916&#xff0c;\u8fdb\u7a0b\u2f00\u65e6\u53d8\u6210\u50f5\u2f2b\u72b6\u6001&#xff0c;\u90a3\u5c31\u2f11\u67aa\u4e0d\u2f0a&#xff0c;\u201c\u6740\u2f08\u4e0d\u7728\u773c\u201d\u7684kill -9 \u4e5f\u2f46\u80fd\u4e3a\u2f12&#xff0c;\u56e0\u4e3a\u8c01\u4e5f <\/span><\/p>\n<p> <span style=\"color:#646a73\">\u6ca1\u6709\u529e\u6cd5\u6740\u6b7b\u2f00\u4e2a\u5df2\u7ecf\u6b7b\u53bb\u7684\u8fdb\u7a0b\u3002 <\/span><\/p>\n<p> <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n <span style=\"color:#646a73\">\u6700\u540e&#xff0c;\u2f57\u8fdb\u7a0b\u6d3e\u7ed9\u2f26\u8fdb\u7a0b\u7684\u4efb\u52a1\u5b8c\u6210\u7684\u5982\u4f55&#xff0c;\u6211\u4eec\u9700\u8981\u77e5\u9053\u3002\u5982&#xff0c;\u2f26\u8fdb\u7a0b\u8fd0\u2f8f\u5b8c\u6210&#xff0c;\u7ed3\u679c\u5bf9\u8fd8\u662f <\/span><\/p>\n<p> <span style=\"color:#646a73\">\u4e0d\u5bf9&#xff0c;\u6216\u8005\u662f\u5426\u6b63\u5e38\u9000\u51fa\u3002 <\/span><\/p>\n<p> <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n <span style=\"color:#646a73\">\u2f57\u8fdb\u7a0b\u901a\u8fc7\u8fdb\u7a0b\u7b49\u5f85\u7684\u2f45\u5f0f&#xff0c;\u56de\u6536\u2f26\u8fdb\u7a0b\u8d44\u6e90&#xff0c;\u83b7\u53d6\u2f26\u8fdb\u7a0b\u9000\u51fa\u4fe1\u606f<\/span><\/p>\n<h4 id=\"3.1%E7%AD%89%E5%BE%85%E6%96%B9%E5%BC%8F\">3.1\u7b49\u5f85\u65b9\u5f0f<\/h4>\n<p>wait<\/p>\n<p>#include&lt;sys\/types.h&gt;<br \/>\n#include&lt;sys\/wait.h&gt;<br \/>\npid_t wait(int* status);<br \/>\n\u8fd4\u56de\u503c&#xff1a;<br \/>\n\u6210\u529f\u8fd4\u56de\u88ab\u7b49\u5f85\u8fdb\u7a0bpid&#xff0c;\u5931\u8d25\u8fd4\u56de-1\u3002<br \/>\n\u53c2\u6570&#xff1a;<br \/>\n\u8f93\u51fa\u578b\u53c2\u6570&#xff0c;\u83b7\u53d6\u2f26\u8fdb\u7a0b\u9000\u51fa\u72b6\u6001,\u4e0d\u5173\u2f3c\u5219\u53ef\u4ee5\u8bbe\u7f6e\u6210\u4e3aNULL <\/p>\n<p>waitpid<\/p>\n<p>pid_ t waitpid(pid_t pid, int *status, int options);<br \/>\n\u8fd4\u56de\u503c&#xff1a;<br \/>\n\u5f53\u6b63\u5e38\u8fd4\u56de\u7684\u65f6\u5019waitpid\u8fd4\u56de\u6536\u96c6\u5230\u7684\u2f26\u8fdb\u7a0b\u7684\u8fdb\u7a0bID&#xff1b;<br \/>\n\u5982\u679c\u8bbe\u7f6e\u4e86\u9009\u9879WNOHANG,\u2f7d\u8c03\u2f64\u4e2dwaitpid\u53d1\u73b0\u6ca1\u6709\u5df2\u9000\u51fa\u7684\u2f26\u8fdb\u7a0b\u53ef\u6536\u96c6,\u5219\u8fd4\u56de0&#xff1b;<br \/>\n\u5982\u679c\u8c03\u2f64\u4e2d\u51fa\u9519,\u5219\u8fd4\u56de-1,\u8fd9\u65f6errno\u4f1a\u88ab\u8bbe\u7f6e\u6210\u76f8\u5e94\u7684\u503c\u4ee5\u6307\u2f70\u9519\u8bef\u6240\u5728&#xff1b;<br \/>\n\u53c2\u6570&#xff1a;<br \/>\npid&#xff1a;<br \/>\nPid&#061;-1,\u7b49\u5f85\u4efb\u2f00\u4e2a\u2f26\u8fdb\u7a0b\u3002\u4e0ewait\u7b49\u6548\u3002<br \/>\nPid&gt;0.\u7b49\u5f85\u5176\u8fdb\u7a0bID\u4e0epid\u76f8\u7b49\u7684\u2f26\u8fdb\u7a0b\u3002<br \/>\nstatus: \u8f93\u51fa\u578b\u53c2\u6570<br \/>\nWIFEXITED(status): \u82e5\u4e3a\u6b63\u5e38\u7ec8\u2f4c\u2f26\u8fdb\u7a0b\u8fd4\u56de\u7684\u72b6\u6001&#xff0c;\u5219\u4e3a\u771f\u3002&#xff08;\u67e5\u770b\u8fdb\u7a0b<br \/>\n\u662f\u5426\u662f\u6b63\u5e38\u9000\u51fa&#xff09;<br \/>\nWEXITSTATUS(status): \u82e5WIFEXITED\u2fae\u96f6&#xff0c;\u63d0\u53d6\u2f26\u8fdb\u7a0b\u9000\u51fa\u7801\u3002&#xff08;\u67e5\u770b\u8fdb\u7a0b<br \/>\n\u7684\u9000\u51fa\u7801&#xff09;<br \/>\noptions:\u9ed8\u8ba4\u4e3a0&#xff0c;\u8868\u2f70\u963b\u585e\u7b49\u5f85<\/p>\n<p>WNOHANG: \u82e5pid\u6307\u5b9a\u7684\u2f26\u8fdb\u7a0b\u6ca1\u6709\u7ed3\u675f&#xff0c;\u5219waitpid()\u51fd\u6570\u8fd4\u56de0&#xff0c;\u4e0d\u4e88\u4ee5\u7b49<br \/>\n\u5f85\u3002\u82e5\u6b63\u5e38\u7ed3\u675f&#xff0c;\u5219\u8fd4\u56de\u8be5\u2f26\u8fdb\u7a0b\u7684ID\u3002 <\/p>\n<h4 id=\"3.2%E8%8E%B7%E5%8F%96status%E5%92%8C%E4%BF%A1%E5%8F%B7\">3.2\u83b7\u53d6status\u548c\u4fe1\u53f7<\/h4>\n<p> <span style=\"color:#646a73\">wait\u548cwaitpid&#xff0c;\u90fd\u6709\u2f00\u4e2astatus\u53c2\u6570&#xff0c;\u8be5\u53c2\u6570\u662f\u2f00\u4e2a\u8f93\u51fa\u578b\u53c2\u6570&#xff0c;\u7531\u64cd\u4f5c\u7cfb\u7edf\u586b\u5145\u3002 <\/span><\/p>\n<p> <span style=\"color:#1456f0\">\u2022 <\/span><\/p>\n<p> <span style=\"color:#646a73\">\u5982\u679c\u4f20\u9012NULL&#xff0c;\u8868\u2f70\u4e0d\u5173\u2f3c\u2f26\u8fdb\u7a0b\u7684\u9000\u51fa\u72b6\u6001\u4fe1\u606f\u3002 <\/span><\/p>\n<p> <span style=\"color:#1456f0\">\u2022 <\/span><\/p>\n<p> <span style=\"color:#646a73\">\u5426\u5219&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u4f1a\u6839\u636e\u8be5\u53c2\u6570&#xff0c;\u5c06\u2f26\u8fdb\u7a0b\u7684\u9000\u51fa\u4fe1\u606f\u53cd\u9988\u7ed9\u2f57\u8fdb\u7a0b\u3002 <\/span><\/p>\n<p> <span style=\"color:#1456f0\">\u2022 <\/span><\/p>\n<p> <span style=\"color:#646a73\">status\u4e0d\u80fd\u7b80\u5355\u7684\u5f53\u4f5c\u6574\u5f62\u6765\u770b\u5f85&#xff0c;\u53ef\u4ee5\u5f53\u4f5c\u4f4d\u56fe\u6765\u770b\u5f85&#xff0c;\u5177\u4f53\u7ec6\u8282\u5982\u4e0b\u56fe&#xff08;\u53ea\u7814\u7a76status\u4f4e16 <\/span><\/p>\n<p> <span style=\"color:#646a73\">\u2f50\u7279\u4f4d&#xff09;&#xff1a;<\/span><\/p>\n<p> <img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"497\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204150455-6983601763707.png\" width=\"1107\" \/><\/p>\n<p>include&lt;stdio.h&gt;<br \/>\n    2 #include&lt;unistd.h&gt;<br \/>\n    3 #include&lt;stdlib.h&gt;<br \/>\n    4 #include&lt;string.h&gt;<br \/>\n    5<br \/>\n    6 int main()<br \/>\n    7 {<br \/>\n    8   pid_t id &#061;fork();<br \/>\n    9   if(id &#061;&#061;0)<br \/>\n   10   {<br \/>\n   11     \/\/\u5b50\u8fdb\u7a0b<br \/>\n   12     int cnt &#061;5;<br \/>\n   13     while(cnt&#8211;)<br \/>\n   14     {<br \/>\n   15       printf(&#034;\u5b50\u8fdb\u7a0b pid:%d ppid%d\\\\n&#034;,getpid(),getppid());<br \/>\n   16       sleep(1);<br \/>\n   17<br \/>\n   18     }<br \/>\n   19     \/\/\u9000\u51fa\u7684\u662f\u5b50\u8fdb\u7a0b\u7684\u7a0b\u5e8f,\u7236\u8fdb\u7a0b\u4e0d\u53d7\u5f71\u54cd<br \/>\n   20   exit(0);<br \/>\n   21<br \/>\n   22   }<br \/>\n   23   \/\/procid_t ret &#061; wait(NULL);<br \/>\n   24   int st&#061;0;<br \/>\nE&gt; 25   pid_t ret &#061; waitpid(id,&amp;st,0);<br \/>\n   26<br \/>\n   27   if(ret &gt;0&amp;&amp; (st&gt;&gt;8)&amp;0XFF&#061;&#061;0)\/\/id\u5339\u914d\u4e0a,\u4e14\u6b63\u5e38\u9000\u51fa<br \/>\n   28   {<br \/>\n   29     printf(&#034;wait success rid:%d,exit code :%d\\\\n&#034;,ret,(st&gt;&gt;8&amp;0XFF));<br \/>\n   30   }<br \/>\n   31   else if(ret&gt;0)\/\/\u5f02\u5e38\u9000\u51fa,\u4fe1\u53f7code\u4e0d\u4e3a0<br \/>\nW&gt; 32     printf(&#034;wait failed rid:%d\\\\n exit code:%d\\\\n&#034;,ret,st&amp;0X7F);<br \/>\n   33   sleep(100);<br \/>\n   34<br \/>\n   35<br \/>\n   36   return 0;<br \/>\n   37 }                                                                                                                                                                  <\/p>\n<h2 id=\"%E5%9B%9B.%E9%98%BB%E5%A1%9E%E9%9D%9E%E9%98%BB%E5%A1%9E%E7%AD%89%E5%BE%85\">\u56db.\u963b\u585e\u975e\u963b\u585e\u7b49\u5f85<\/h2>\n<p>\u963b\u585e\u7b49\u5f85\u5373\u7236\u8fdb\u7a0b\u4f1a\u4e00\u76f4\u7b49\u5f85\u5b50\u8fdb\u7a0b\u5b8c\u6210\u518d\u7ee7\u7eed\u6267\u884c,\u975e\u963b\u585e\u7b49\u5f85\u5219\u662f\u7236\u8fdb\u7a0b\u5728\u7b49\u5f85\u5b50\u8fdb\u7a0b\u8fd4\u56de\u7ed3\u679c\u65f6,\u4e5f\u4f1a\u6267\u884c\u81ea\u5df1\u7684\u7a0b\u5e8f<\/p>\n<p>\u5f53\u7136,\u4e0a\u9762\u592a\u8fc7\u751f\u6da9,\u63a5\u4e0b\u6765\u6211\u4eec\u8bb2\u4e24\u4e2a\u6545\u4e8b\u7406\u89e3<\/p>\n<p>\u975e\u963b\u585e\u7b49\u5f85<\/p>\n<p>\u4e3a\u4e86\u5e94\u5bf9OS\u671f\u672b\u8003\u8bd5,\u5c0f\u660e\u524d\u5f80\u5e76\u6253\u7535\u8bdd\u627e\u5b66\u9738\u5c0f\u674e\u8fdb\u884c\u590d\u4e60\u6307\u5bfc,\u5c0f\u674e\u56de\u590d,\u4ed6\u6b63\u5728\u5e72\u81ea\u5df1\u7684\u4e8b,\u8ba9\u5c0f\u660e\u7b49\u4e2a10\u591a\u5206\u949f,\u540e\u6302\u65ad\u4e86\u7535\u8bdd.<\/p>\n<p>\u5728\u8fd9\u7b49\u5f85\u7684\u8fc7\u7a0b\u4e2d,\u5c0f\u660e\u4e00\u8fb9\u5e72\u81ea\u5df1\u7684\u4e8b(\u770b\u4e66\u7b49),\u4e00\u8fb9\u9694\u4e00\u4f1a\u7ed9\u5c0f\u674e\u6253\u4e2a\u7535\u8bdd,\u5f97\u5230\u5c0f\u674e\u7684\u56de\u590d\u8fd8\u672a\u5e72\u597d,\u7acb\u9a6c\u6302\u6389\u7535\u8bdd<\/p>\n<p>\u5728\u8fd9\u671f\u4e2d,\u5c0f\u660e\u5728\u7b49\u5f85\u5c0f\u674e\u7684\u65f6\u5019,\u8fd8\u81ea\u5df1\u8fdb\u884c\u4e86\u770b\u9519,\u6548\u7387\u63d0\u9ad8<\/p>\n<p>#include&lt;stdio.h&gt;<br \/>\n    2 #include&lt;unistd.h&gt;<br \/>\n    3 #include&lt;stdlib.h&gt;<br \/>\n    4 #include&lt;string.h&gt;<br \/>\n    5 typedef void (*func_t)();<br \/>\n    6 #define NUM 5<br \/>\n    7 func_t handlers[NUM&#043;1];<br \/>\n    8 void download()<br \/>\n    9 {<br \/>\n   10   printf(&#034;\u4e0b\u8f7d\u4efb\u52a1\\\\n&#034;);<br \/>\n   11 }<br \/>\n   12 void up()<br \/>\n   13 {<br \/>\n   14   printf(&#034;\u66f4\u65b0\u4efb\u52a1\\\\n&#034;);<br \/>\n   15 }<br \/>\n   16 void flush()<br \/>\n   17 {<br \/>\n   18   printf(&#034;\u66f4\u65b0\u4efb\u52a1\\\\n&#034;);<br \/>\n   19 }<br \/>\n   20 void regist(func_t h[],func_t f)<br \/>\n   21 {<br \/>\n   22   int i&#061;0;<br \/>\n   23   for(;i&lt;NUM;&#043;&#043;i)<br \/>\n   24   {<br \/>\n   25     if(h[i]&#061;&#061;NULL)break;<br \/>\n   26   }<br \/>\n   27   if(i&#061;&#061;NUM) return;<br \/>\n   28   h[i]&#061;f;<br \/>\n   29   h[i&#043;&#043;]&#061;NULL;<br \/>\n   30 }<br \/>\n   31 int main()<br \/>\n   32 {<br \/>\n   33   regist(handlers,download);<br \/>\n   34   regist(handlers,up);<br \/>\n   35   regist(handlers,flush);<br \/>\n   36   pid_t id &#061;fork();<br \/>\n   37   if(id &#061;&#061;0)<br \/>\n   38   {<br \/>\n   39     \/\/\u5b50\u8fdb\u7a0b<br \/>\n   40     int cnt &#061;5;<br \/>\n   41     while(1)<br \/>\n   42     {<br \/>\n   43       printf(&#034;\u5b50\u8fdb\u7a0b pid:%d ppid%d\\\\n&#034;,getpid(),getppid());<br \/>\n   44       sleep(1);<br \/>\n   45       cnt&#8211;;<br \/>\n   46     }<br \/>\n   47     \/\/\u9000\u51fa\u7684\u662f\u5b50\u8fdb\u7a0b\u7684\u7a0b\u5e8f,\u7236\u8fdb\u7a0b\u4e0d\u53d7\u5f71\u54cd<br \/>\n   48   exit(10);<br \/>\n   49<br \/>\n   50   }<br \/>\n   51   \/\/procid_t ret &#061; wait(NULL);<br \/>\n   52   while(1)<br \/>\n   53   {<br \/>\n   54<br \/>\n   55<br \/>\n   56   int st&#061;0;<br \/>\nE&gt; 57   pid_t ret &#061; waitpid(id,&amp;st,WNOHANG);<br \/>\n   58<br \/>\n   if(ret &gt;0)\/\/id\u5339\u914d\u4e0a,\u4e14\u6b63\u5e38\u9000\u51fa<br \/>\n   60   {<br \/>\n   61     printf(&#034;wait success rid:%d,exit code :%d\\\\n&#034;,ret,(st&gt;&gt;8&amp;0XFF));<br \/>\n   62     break;<br \/>\n   63   }<br \/>\n   64   else if(ret&#061;&#061;0)<br \/>\n   65   {<br \/>\n   66     \/\/\u51fd\u6570\u6307\u9488\u56de\u8c03\u54e6<br \/>\n   67     int i&#061;0;<br \/>\n   68     for(;handlers[i];&#043;&#043;i)<br \/>\n   69       handlers[i]();<br \/>\n   70     printf(&#034;\u672c\u8f6e\u8c03\u7528\u7ed3\u675f\\\\n&#034;);<br \/>\n   71     sleep(1);<br \/>\n   72   }<br \/>\n   73   else<br \/>\n   74   {<br \/>\n   75<br \/>\n   76     printf(&#034;\u8c03\u7528\u5931\u8d25\\\\n&#034;);<br \/>\n   77     break;<br \/>\n   78   }<br \/>\n   79<br \/>\n   80   }<br \/>\n   81   return 0;<br \/>\n   82 }<br \/>\n  ~<\/p>\n<p>\u5728\u4e0a\u9762\u4e2d,\u7236\u8fdb\u7a0b\u5728\u7b49\u5f85\u5b50\u8fdb\u7a0b\u8c03\u7528\u65f6,\u4e5f\u5728\u5e72\u81ea\u5df1\u7684\u4e8b,\u5982\u4e0b\u8f7d,\u5237\u65b0\u7b49,\u6548\u7387\u5f97\u5230\u63d0\u9ad8<\/p>\n<p>\u963b\u585e\u7b49\u5f85<\/p>\n<p>\u5728\u4e0a\u9762\u7684\u901a\u8bdd\u4e2d,\u5c0f\u660e\u89c9\u5f97\u6bcf\u6b21\u6253\u8fc7\u4e8e\u9ebb\u70e6,\u4e8e\u662f\u4e0b\u6b21\u627e\u5c0f\u674e\u590d\u4e60\u65f6,\u8ba9\u5c0f\u674e\u6ca1\u6302\u7535\u8bdd\u4e86,\u4e00\u76f4\u901a\u7535\u8bdd,\u76f4\u5230\u5c0f\u674e\u5e72\u5b8c\u81ea\u5df1\u7684\u4e8b<\/p>\n<p>\u4e0a\u9762\u8fd9\u4f8b\u5b50\u5c31\u5982\u6211\u4eec\u4ee3\u7801\u8fd0\u884c\u5230cin scanf ,\u5fc5\u987b\u6211\u4eec\u8fdb\u884c\u8f93\u5165,\u624d\u4f1a\u5b8c\u6210<\/p>\n<h2 id=\"%E4%BA%94.%E8%BF%9B%E7%A8%8B%E7%A8%8B%E5%BA%8F%E6%9B%BF%E6%8D%A2\">\u4e94.\u8fdb\u7a0b\u7a0b\u5e8f\u66ff\u6362<\/h2>\n<p> <span style=\"color:#1f2329\">\u2f64fork\u521b\u5efa\u2f26\u8fdb\u7a0b\u540e\u6267\u2f8f\u7684\u662f\u548c\u2f57\u8fdb\u7a0b\u76f8\u540c\u7684\u7a0b\u5e8f(\u4f46\u6709\u53ef\u80fd\u6267\u2f8f\u4e0d\u540c\u7684\u4ee3\u7801\u5206\u2f40),\u2f26\u8fdb\u7a0b\u5f80\u5f80\u8981\u8c03\u2f64\u2f00 \u79cd exec <\/span><br \/>\n <span style=\"color:#1f2329\">\u51fd\u6570\u4ee5\u6267\u2f8f\u53e6\u2f00\u4e2a\u7a0b\u5e8f\u3002\u5f53\u8fdb\u7a0b\u8c03\u2f64\u2f00\u79cd <\/span><br \/>\n <span style=\"color:#1f2329\">exec <\/span><br \/>\n <span style=\"color:#1f2329\">\u51fd\u6570\u65f6,\u8be5\u8fdb\u7a0b\u7684\u2f64\u2f3e\u7a7a\u95f4\u4ee3\u7801\u548c\u6570\u636e\u5b8c\u5168\u88ab \u65b0\u7a0b\u5e8f\u66ff\u6362,\u4ece\u65b0\u7a0b\u5e8f\u7684\u542f\u52a8\u4f8b\u7a0b\u5f00\u59cb\u6267\u2f8f\u3002\u8c03\u2f64 exec <\/span><br \/>\n <span style=\"color:#1f2329\">\u5e76\u4e0d\u521b\u5efa\u65b0\u8fdb\u7a0b,\u6240\u4ee5\u8c03\u2f64 <\/span><br \/>\n <span style=\"color:#1f2329\">exec <\/span><br \/>\n <span style=\"color:#1f2329\">\u524d\u540e\u8be5\u8fdb\u7a0b\u7684 id <\/span><br \/>\n <span style=\"color:#1f2329\">\u5e76\u672a\u6539\u53d8\u3002<\/span><\/p>\n<p>\u6ce8,\u8fdb\u7a0b\u7a0b\u5e8f\u66ff\u6362\u540e,\u4f1a\u8fdb\u884c\u8986\u76d6\u4ee3\u7801\u4e8e\u4e0e\u6570\u636e\u6bb5,\u540e\u9762\u7684\u7a0b\u5e8f\u5c06\u4e0d\u518d\u6267\u884c(\u53ea\u8981\u662f\u53ef\u6267\u884c\u7a0b\u5e8f,\u5c31\u53ef\u4ee5\u66ff\u6362,\u5373\u4f7f\u662f\u5176\u4ed6\u8bed\u8a00\u7684)<\/p>\n<h3 id=\"5.1%20%E9%AA%8C%E8%AF%81id%E4%B8%8D%E5%8F%98%E4%B8%8E%E8%A6%86%E7%9B%96%E5%BC%8F%E5%86%99%E5%85%A5\">5.1 \u9a8c\u8bc1id\u4e0d\u53d8\u4e0e\u8986\u76d6\u5f0f\u5199\u5165<\/h3>\n<p>#include&lt;stdio.h&gt;<br \/>\n  2 #include &lt;unistd.h&gt;<br \/>\n  3 #include&lt;sys\/types.h&gt;<br \/>\n  4 int main()<br \/>\n  5 {<br \/>\n  6   if(fork()&#061;&#061;0)<br \/>\n  7   {<br \/>\n  8     printf(&#034;id:%d\\\\n&#034;,getpid());<br \/>\n  9     printf(&#034;\u5b50\u8fdb\u7a0b\u5f00\u59cb\\\\n&#034;);<br \/>\n 10     execl(&#034;.\/test&#034;,&#034;test&#034;,NULL);<br \/>\n 11     printf(&#034;\u5b50\u8fdb\u7a0b\u7ed3\u675f\\\\n&#034;);<br \/>\n 12   }<br \/>\n 13   return 0;<br \/>\n 14 }<\/p>\n<p>\u53d1\u73b0\u786e\u5b9e\u5982\u6b64<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"129\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204150455-69836017acc75.png\" width=\"534\" \/><\/p>\n<h3 id=\"5.2%20%E6%9B%BF%E6%8D%A2%E5%87%BD%E6%95%B0\">5.2 \u66ff\u6362\u51fd\u6570<\/h3>\n<p> <span style=\"color:#1f2329\">\u5176\u5b9e\u6709\u516d\u79cd\u4ee5exec\u5f00\u5934\u7684\u51fd\u6570,\u7edf\u79f0exec\u51fd\u6570:<\/span><\/p>\n<p> #include &lt;unistd.h&gt;<br \/>\nint execl(const char *path, const char *arg, &#8230;);<br \/>\nint execlp(const char *file, const char *arg, &#8230;);<br \/>\nint execle(const char *path, const char *arg, &#8230;,char *const envp[]);<br \/>\nint execv(const char *path, char *const argv[]);<br \/>\nint execvp(const char *file, char *const argv[]);<br \/>\nint execve(const char *path, char *const argv[], char *const envp[]); <\/p>\n<p>\u89e3\u91ca<\/p>\n<p>   <span style=\"color:#1f2329\">\u51fd\u6570\u89e3\u91ca <\/span><\/p>\n<p>   <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n   <span style=\"color:#646a73\">\u8fd9\u4e9b\u51fd\u6570\u5982\u679c\u8c03\u2f64\u6210\u529f\u5219\u52a0\u8f7d\u65b0\u7684\u7a0b\u5e8f\u4ece\u542f\u52a8\u4ee3\u7801\u5f00\u59cb\u6267\u2f8f,\u4e0d\u518d\u8fd4\u56de\u3002 <\/span><\/p>\n<p>   <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n   <span style=\"color:#646a73\">\u5982\u679c\u8c03\u2f64\u51fa\u9519\u5219\u8fd4\u56de -1 <\/span><\/p>\n<p>   <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n   <span style=\"color:#646a73\">\u6240\u4ee5 exec <\/span><br \/>\n   <span style=\"color:#646a73\">\u51fd\u6570\u53ea\u6709\u51fa\u9519\u7684\u8fd4\u56de\u503c\u2f7d\u6ca1\u6709\u6210\u529f\u7684\u8fd4\u56de\u503c,\u6240\u6709\u4e0d\u7528\u5bf9\u8fd4\u56de\u503c\u8fdb\u884c\u5224\u65ad,\u6709\u5c31\u4e00\u5b9a\u51fa\u9519\u4e86<\/span><\/p>\n<h3 id=\"5.3%20%E5%91%BD%E5%90%8D%E7%90%86%E8%A7%A3\"><span style=\"color:#646a73\">5.3 \u547d\u540d\u7406\u89e3<\/span><\/h3>\n<\/p>\n<p>  <span style=\"color:#1f2329\">\u547d\u540d\u7406\u89e3 <\/span><\/p>\n<p>  <span style=\"color:#1f2329\">\u8fd9\u4e9b\u51fd\u6570\u539f\u578b\u770b\u8d77\u6765\u5f88\u5bb9\u6613\u6df7,\u4f46\u53ea\u8981\u638c\u63e1\u4e86\u89c4\u5f8b\u5c31\u5f88\u597d\u8bb0\u3002 <\/span><\/p>\n<p>  <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n  <span style=\"color:#646a73\">l(list) : \u8868\u2f70\u53c2\u6570\u91c7\u2f64\u5217\u8868 <\/span><\/p>\n<p>  <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n  <span style=\"color:#646a73\">v(vector) : \u53c2\u6570\u2f64\u6570\u7ec4 <\/span><\/p>\n<p>  <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n  <span style=\"color:#646a73\">p(path) : \u6709 <\/span><br \/>\n  <span style=\"color:#646a73\">p <\/span><br \/>\n  <span style=\"color:#646a73\">\u2f83\u52a8\u641c\u7d22\u73af\u5883\u53d8\u91cf <\/span><br \/>\n  <span style=\"color:#646a73\">PATH <\/span><\/p>\n<p>  <span style=\"color:#1456f0\">\u2022 <\/span><br \/>\n  <span style=\"color:#646a73\">e(env) : \u8868\u2f70\u2f83\u2f30\u7ef4\u62a4\u73af\u5883\u53d8\u91cf<\/span><\/p>\n<table>\n<tr>\u51fd\u6570\u540d\u53c2\u6570\u683c\u5f0f\u662f\u5426\u5e26\u8def\u5f84\u662f\u5426\u4f7f\u7528\u5f53\u524d\u73af\u5883\u53d8\u91cf\u5178\u578b\u4f7f\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>execl<\/td>\n<td>\u5217\u8868<\/td>\n<td>\u4e0d\u662f<\/td>\n<td>\u662f<\/td>\n<td>\u660e\u786e\u77e5\u9053\u7a0b\u5e8f\u8def\u5f84&#xff0c;\u53c2\u6570\u8f83\u5c11\u7684\u573a\u666f<\/td>\n<\/tr>\n<tr>\n<td>execlp<\/td>\n<td>\u5217\u8868<\/td>\n<td>\u662f<\/td>\n<td>\u662f<\/td>\n<td>\u6267\u884c\u7cfb\u7edf\u547d\u4ee4&#xff08;\u5982ls&#xff09;&#xff0c;\u4f9d\u8d56\u73af\u5883\u53d8\u91cf\u627e\u7a0b\u5e8f<\/td>\n<\/tr>\n<tr>\n<td>execele<\/td>\n<td>\u5217\u8868<\/td>\n<td>\u4e0d\u662f<\/td>\n<td>\u4e0d\u662f&#xff0c;\u987b\u81ea\u5df1\u7ec4\u88c5\u73af\u5883\u53d8\u91cf<\/td>\n<td>\u9700\u8981\u81ea\u5b9a\u4e49\u73af\u5883\u53d8\u91cf\u7684\u573a\u666f<\/td>\n<\/tr>\n<tr>\n<td>execv<\/td>\n<td>\u6570\u7ec4<\/td>\n<td>\u4e0d\u662f<\/td>\n<td>\u662f<\/td>\n<td>\u53c2\u6570\u8f83\u591a&#xff08;\u9700\u5b58\u6570\u7ec4&#xff09;&#xff0c;\u77e5\u9053\u7a0b\u5e8f\u8def\u5f84\u7684\u573a\u666f<\/td>\n<\/tr>\n<tr>\n<td>execvp<\/td>\n<td>\u6570\u7ec4<\/td>\n<td>\u662f<\/td>\n<td>\u662f<\/td>\n<td>\u6267\u884c\u7cfb\u7edf\u547d\u4ee4\u4e14\u53c2\u6570\u8f83\u591a\u7684\u573a\u666f<\/td>\n<\/tr>\n<tr>\n<td>execve<\/td>\n<td>\u6570\u7ec4<\/td>\n<td>\u4e0d\u662f<\/td>\n<td>\u4e0d\u662f&#xff0c;\u987b\u81ea\u5df1\u7ec4\u88c5\u73af\u5883\u53d8\u91cf<\/td>\n<td>\u53c2\u6570\u8f83\u591a\u4e14\u9700\u8981\u81ea\u5b9a\u4e49\u73af\u5883\u53d8\u91cf\u7684\u573a\u666f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"5.4%20%E6%9B%BF%E6%8D%A2%E5%87%BD%E6%95%B0%E4%BD%BF%E7%94%A8\">5.4 \u66ff\u6362\u51fd\u6570\u4f7f\u7528<\/h3>\n<p>\u4e5f\u53ef\u4ee5\u66ff\u6362\u81ea\u5df1\u5199\u7684\u7a0b\u5e8f,\u524d\u9762\u5df2\u7ecf\u9a8c\u8bc1\u4e86<\/p>\n<h4 id=\"5.4.1%20execl\">5.4.1 execl<\/h4>\n<p>int execl(const char *path, const char *arg, &#8230;);<\/p>\n<p>\u7b2c\u4e00\u4e2a\u53c2\u6570\u5199\u8def\u5f84,\u7b2c\u4e8c\u4e2a\u5230\u7b2cn-1\u4e2a\u53c2\u6570\u4e0a\u9762\u662f\u53c2\u6570\u5305,\u4f60\u5c31\u662f\u5199\u4f60\u6b63\u5e38\u5199\u7684\u547d\u4ee4\u7b26,\u6700\u540e\u4e00\u4e2a\u00a0<\/p>\n<p>\u5982\u679c\u4e0d\u7528NULL\u7ed3\u5c3e&#xff0c;execl\u4f1a\u65e0\u9650\u5236\u5730\u8bfb\u53d6\u540e\u7eed\u5185\u5b58\u4e2d\u7684<\/p>\n<p> #include&lt;stdio.h&gt;<br \/>\n  2 #include &lt;unistd.h&gt;<br \/>\n  3 #include&lt;sys\/types.h&gt;<br \/>\n  4 int main()<br \/>\n  5 {<br \/>\n  6   if(fork()&#061;&#061;0)<br \/>\n  7   {<br \/>\n  8     printf(&#034;id:%d\\\\n&#034;,getpid());<br \/>\n  9     printf(&#034;\u5b50\u8fdb\u7a0b\u5f00\u59cb\\\\n&#034;);<br \/>\n 10  \/\/   execl(&#034;.\/test&#034;,&#034;test&#034;,NULL);<br \/>\n 11     printf(&#034;\u5b50\u8fdb\u7a0b\u7ed3\u675f\\\\n&#034;);<br \/>\n 12   }<br \/>\n 13   execl(&#034;user\/bin\/ls&#034;,&#034;ls&#034;,&#034;-a&#034;,&#034;-l&#034;,NULL);<br \/>\n 14   return 0;<br \/>\n 15 }<br \/>\n~<\/p>\n<p>5.4.2 execlp<\/p>\n<p> #include&lt;stdio.h&gt;<br \/>\n  2 #include &lt;unistd.h&gt;<br \/>\n  3 #include&lt;sys\/types.h&gt;<br \/>\n  4 int main()<br \/>\n  5 {<br \/>\n  6   if(fork()&#061;&#061;0)<br \/>\n  7   {<br \/>\n  8     printf(&#034;id:%d\\\\n&#034;,getpid());<br \/>\n  9     printf(&#034;\u5b50\u8fdb\u7a0b\u5f00\u59cb\\\\n&#034;);<br \/>\n 10  \/\/   execl(&#034;.\/test&#034;,&#034;test&#034;,NULL);<br \/>\n 11     printf(&#034;\u5b50\u8fdb\u7a0b\u7ed3\u675f\\\\n&#034;);<br \/>\n 12   }<br \/>\n 13   execlp(&#034;ls&#034;,&#034;-a&#034;,&#034;-l&#034;,NULL);<br \/>\n 14   return 0;<br \/>\n 15 }<br \/>\n~<\/p>\n<h4 id=\"5.4.3%C2%A0execv\">5.4.3\u00a0execv<\/h4>\n<p> #include&lt;stdio.h&gt;<br \/>\n  2 #include &lt;unistd.h&gt;<br \/>\n  3 #include&lt;sys\/types.h&gt;<br \/>\n  4 int main()<br \/>\n  5 {<br \/>\n  6   if(fork()&#061;&#061;0)<br \/>\n  7   {<br \/>\n  8     printf(&#034;id:%d\\\\n&#034;,getpid());<br \/>\n  9     printf(&#034;\u5b50\u8fdb\u7a0b\u5f00\u59cb\\\\n&#034;);<br \/>\n 10  \/\/   execl(&#034;.\/test&#034;,&#034;test&#034;,NULL);<br \/>\n 11     printf(&#034;\u5b50\u8fdb\u7a0b\u7ed3\u675f\\\\n&#034;);<br \/>\n 12   }<br \/>\n       char *const args[] &#061;{&#034;ls&#034;,&#034;-a&#034;,&#034;-l&#034;,&#034;NULL&#034;};<br \/>\n 13   execv(&#034;user\/bin\/ls&#034;,args);<br \/>\n 14   return 0;<br \/>\n 15 }<br \/>\n~<\/p>\n<h4 id=\"5.4.4%C2%A0execvp\">5.4.4\u00a0execvp<\/h4>\n<p> #include&lt;stdio.h&gt;<br \/>\n  2 #include &lt;unistd.h&gt;<br \/>\n  3 #include&lt;sys\/types.h&gt;<br \/>\n  4 int main()<br \/>\n  5 {<br \/>\n  6   if(fork()&#061;&#061;0)<br \/>\n  7   {<br \/>\n  8     printf(&#034;id:%d\\\\n&#034;,getpid());<br \/>\n  9     printf(&#034;\u5b50\u8fdb\u7a0b\u5f00\u59cb\\\\n&#034;);<br \/>\n 10  \/\/   execl(&#034;.\/test&#034;,&#034;test&#034;,NULL);<br \/>\n 11     printf(&#034;\u5b50\u8fdb\u7a0b\u7ed3\u675f\\\\n&#034;);<br \/>\n 12   }<br \/>\n       char *const args[] &#061;{&#034;ls&#034;,&#034;-a&#034;,&#034;-l&#034;,&#034;NULL&#034;};<br \/>\n 13   execv(args);<br \/>\n 14   return 0;<br \/>\n 15 }<br \/>\n~<\/p>\n<h4 id=\"5.4.5%C2%A0execele\">5.4.5\u00a0execele<\/h4>\n<p> #include&lt;stdio.h&gt;<br \/>\n  2 #include &lt;unistd.h&gt;<br \/>\n  3 #include&lt;sys\/types.h&gt;<br \/>\n  4 int main()<br \/>\n  5 {<br \/>\n  6   if(fork()&#061;&#061;0)<br \/>\n  7   {<br \/>\n  8     printf(&#034;id:%d\\\\n&#034;,getpid());<br \/>\n  9     printf(&#034;\u5b50\u8fdb\u7a0b\u5f00\u59cb\\\\n&#034;);<br \/>\n 10  \/\/   execl(&#034;.\/test&#034;,&#034;test&#034;,NULL);<br \/>\n 11     printf(&#034;\u5b50\u8fdb\u7a0b\u7ed3\u675f\\\\n&#034;);<br \/>\n 12   }<br \/>\n        char *const env[]&#061;{(char*const) &#034;MYLE&#061;55555&#034;<br \/>\n        NULL;<br \/>\n    }<br \/>\n 13   execl(&#034;user\/bin\/ls&#034;,&#034;ls&#034;,&#034;-a&#034;,&#034;-l&#034;,NULL,env);<br \/>\n 14   return 0;<br \/>\n 15 }<br \/>\n~<\/p>\n<p>\u6211\u4eec\u524d\u9762\u4e86\u89e3\u5230OS\u4f1a\u81ea\u5e26\u73af\u5883\u53d8\u91cf,\u4f46\u6b64\u5916\u6211\u4eec\u8f93\u51fa,\u53ea\u8981\u6211\u4eec\u5b9a\u4e49\u7684\u73af\u5883\u53d8\u91cfenv<\/p>\n<p>\u89e3\u51b3\u529e\u6cd5\u6709\u4e24\u4e2a,\u4e00\u4e0d\u4f20,OS\u4f1a\u81ea\u5df1\u8c03\u7528\u81ea\u5df1\u7684<\/p>\n<p>\u4e8c:\u4f7f\u7528putenv(\u65b0\u589e\u73af\u5883\u53d8\u91cf)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"266\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204150455-69836017ba5e1.png\" width=\"794\" \/><\/p>\n<p> #include&lt;stdio.h&gt;<br \/>\n  2 #include &lt;unistd.h&gt;<br \/>\n  3 #include&lt;sys\/types.h&gt;<br \/>\n  4 int main()<br \/>\n  5 {<br \/>\n  6   if(fork()&#061;&#061;0)<br \/>\n  7   {<br \/>\n  8     printf(&#034;id:%d\\\\n&#034;,getpid());<br \/>\n  9     printf(&#034;\u5b50\u8fdb\u7a0b\u5f00\u59cb\\\\n&#034;);<br \/>\n 10  \/\/   execl(&#034;.\/test&#034;,&#034;test&#034;,NULL);<br \/>\n 11     printf(&#034;\u5b50\u8fdb\u7a0b\u7ed3\u675f\\\\n&#034;);<br \/>\n 12   }<br \/>\n        char *const env[]&#061;{(char*const) &#034;MYLE&#061;55555&#034;<br \/>\n        NULL;<br \/>\n    }<br \/>\n 13   execl(&#034;user\/bin\/ls&#034;,&#034;ls&#034;,&#034;-a&#034;,&#034;-l&#034;,NULL);<br \/>\n     execl(&#034;user\/bin\/ls&#034;,&#034;ls&#034;,&#034;-a&#034;,&#034;-l&#034;,putenv(env));<br \/>\n 14   return 0;<br \/>\n 15 }<br \/>\n~<\/p>\n<h3 id=\"5.5%20execve\" style=\"background-color:transparent\">5.5 execve<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1398\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204150455-69836017dc6d3.png\" width=\"2559\" \/><\/p>\n<p>\u4ed4\u7ec6\u9605\u8bfbman\u624b\u518c\u53d1\u73b0,execve\u662f\u7cfb\u7edf\u8c03\u7528\u7684,\u4e0a\u9762\u7684\u66ff\u6362\u51fd\u6570\u5176\u5b9e\u662f\u5e93\u51fd\u6570,\u6700\u540e\u90fd\u4f1a\u7cfb\u7edf\u8c03\u7528execve,\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u00a0 \u6709e\u65f6,\u4e0d\u4f20\u73af\u5883\u53d8\u91cf,OS\u4f1a\u4f7f\u7528\u81ea\u5df1\u9ed8\u8ba4\u73af\u5883\u53d8\u91cf\u7684\u539f\u56e0<\/p>\n<p>\u00a0 \u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#x1f525;\u4e2a\u4eba\u4e3b\u9875&#xff1a;Milestone-\u91cc\u7a0b\u7891<br \/>\n\u2744\ufe0f\u4e2a\u4eba\u4e13\u680f:\u00a0&lt;&gt;\u00a0&lt;&gt;&lt;&gt; &lt;&gt;&lt;&gt;<br \/>\n&#x1f31f;\u5fc3\u5411\u5f80\u4e4b\u884c\u5fc5\u80fd\u81f3 \u76ee\u5f55<br \/>\n\u4e00.\u8fdb\u7a0b\u521b\u5efa<br \/>\n1.1\u518d\u8bc6fork<br \/>\n1.2 \u5199\u65f6\u62f7\u8d1d<br \/>\n1.3 fork\u8c03\u7528\u5931\u8d25\u539f\u56e0<br \/>\n\u4e8c.\u8fdb\u7a0b\u7ec8\u6b62<br \/>\n2.1 \u8fdb\u7a0b\u9000\u51fa\u573a\u666f<br \/>\n2.2exit &amp;&amp; _exit<br \/>\n\u4e09.\u8fdb\u7a0b\u7b49\u5f85<br \/>\n3.1\u7b49\u5f85\u65b9\u5f0f<br \/>\n3.2\u83b7\u53d6status\u548c\u4fe1\u53f7<br \/>\n\u56db.\u963b\u585e\u975e\u963b\u585e\u7b49\u5f85<br \/>\n\u4e94<\/p>\n","protected":false},"author":2,"featured_media":72141,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,58,190,1813,43,305,44],"topic":[],"class_list":["post-72148","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-c","tag-linux","tag-190","tag-1813","tag-43","tag-305","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux 18 \u8fdb\u7a0b\u63a7\u5236 - \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\/72148.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux 18 \u8fdb\u7a0b\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"&#x1f525;\u4e2a\u4eba\u4e3b\u9875&#xff1a;Milestone-\u91cc\u7a0b\u7891 \u2744\ufe0f\u4e2a\u4eba\u4e13\u680f:\u00a0&lt;&gt;\u00a0&lt;&gt;&lt;&gt; &lt;&gt;&lt;&gt; &#x1f31f;\u5fc3\u5411\u5f80\u4e4b\u884c\u5fc5\u80fd\u81f3 \u76ee\u5f55 \u4e00.\u8fdb\u7a0b\u521b\u5efa 1.1\u518d\u8bc6fork 1.2 \u5199\u65f6\u62f7\u8d1d 1.3 fork\u8c03\u7528\u5931\u8d25\u539f\u56e0 \u4e8c.\u8fdb\u7a0b\u7ec8\u6b62 2.1 \u8fdb\u7a0b\u9000\u51fa\u573a\u666f 2.2exit &amp;&amp; _exit \u4e09.\u8fdb\u7a0b\u7b49\u5f85 3.1\u7b49\u5f85\u65b9\u5f0f 3.2\u83b7\u53d6status\u548c\u4fe1\u53f7 \u56db.\u963b\u585e\u975e\u963b\u585e\u7b49\u5f85 \u4e94\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/72148.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-04T15:04:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204150454-6983601658f97.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=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72148.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/72148.html\",\"name\":\"Linux 18 \u8fdb\u7a0b\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-04T15:04:58+00:00\",\"dateModified\":\"2026-02-04T15:04:58+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/72148.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/72148.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72148.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux 18 \u8fdb\u7a0b\u63a7\u5236\"}]},{\"@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":"Linux 18 \u8fdb\u7a0b\u63a7\u5236 - \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\/72148.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux 18 \u8fdb\u7a0b\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"&#x1f525;\u4e2a\u4eba\u4e3b\u9875&#xff1a;Milestone-\u91cc\u7a0b\u7891 \u2744\ufe0f\u4e2a\u4eba\u4e13\u680f:\u00a0&lt;&gt;\u00a0&lt;&gt;&lt;&gt; &lt;&gt;&lt;&gt; &#x1f31f;\u5fc3\u5411\u5f80\u4e4b\u884c\u5fc5\u80fd\u81f3 \u76ee\u5f55 \u4e00.\u8fdb\u7a0b\u521b\u5efa 1.1\u518d\u8bc6fork 1.2 \u5199\u65f6\u62f7\u8d1d 1.3 fork\u8c03\u7528\u5931\u8d25\u539f\u56e0 \u4e8c.\u8fdb\u7a0b\u7ec8\u6b62 2.1 \u8fdb\u7a0b\u9000\u51fa\u573a\u666f 2.2exit &amp;&amp; _exit \u4e09.\u8fdb\u7a0b\u7b49\u5f85 3.1\u7b49\u5f85\u65b9\u5f0f 3.2\u83b7\u53d6status\u548c\u4fe1\u53f7 \u56db.\u963b\u585e\u975e\u963b\u585e\u7b49\u5f85 \u4e94","og_url":"https:\/\/www.wsisp.com\/helps\/72148.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-04T15:04:58+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204150454-6983601658f97.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/72148.html","url":"https:\/\/www.wsisp.com\/helps\/72148.html","name":"Linux 18 \u8fdb\u7a0b\u63a7\u5236 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-04T15:04:58+00:00","dateModified":"2026-02-04T15:04:58+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/72148.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/72148.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/72148.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux 18 \u8fdb\u7a0b\u63a7\u5236"}]},{"@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\/72148","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=72148"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72148\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/72141"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=72148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=72148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=72148"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=72148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}