{"id":9298,"date":"2025-04-18T17:19:15","date_gmt":"2025-04-18T09:19:15","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/9298.html"},"modified":"2025-04-18T17:19:15","modified_gmt":"2025-04-18T09:19:15","slug":"%e3%80%90linux%e3%80%91%e6%b5%85%e8%b0%88%e7%8e%af%e5%a2%83%e5%8f%98%e9%87%8f%e5%92%8c%e8%bf%9b%e7%a8%8b%e5%9c%b0%e5%9d%80%e7%a9%ba%e9%97%b4","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/9298.html","title":{"rendered":"\u3010Linux\u3011\u6d45\u8c08\u73af\u5883\u53d8\u91cf\u548c\u8fdb\u7a0b\u5730\u5740\u7a7a\u95f4"},"content":{"rendered":"<h3>\u4e00\u3001\u73af\u5883\u53d8\u91cf<\/h3>\n<h4>\u57fa\u672c\u6982\u5ff5<\/h4>\n<p>\u73af\u5883\u53d8\u91cf&#xff08;Environment Variables&#xff09;\u662f\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u7684\u4e00\u79cd\u673a\u5236&#xff0c;\u7528\u4e8e\u5b58\u50a8\u548c\u4f20\u9012\u914d\u7f6e\u4fe1\u606f\u3001\u7cfb\u7edf\u53c2\u6570\u3001\u7528\u6237\u504f\u597d\u8bbe\u7f6e\u7b49\u3002<\/p>\n<h5>\u73af\u5883\u53d8\u91cf\u7684\u4f5c\u7528<\/h5>\n<li>\u914d\u7f6e\u7a0b\u5e8f\u884c\u4e3a&#xff1a; \u7a0b\u5e8f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u83b7\u53d6\u914d\u7f6e\u4fe1\u606f&#xff0c;\u4f8b\u5982\u65e5\u5fd7\u7ea7\u522b\u3001\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f\u3001API \u5bc6\u94a5\u7b49\u3002 \u4f8b\u5982&#xff0c;LOG_LEVEL&#061;DEBUG \u53ef\u4ee5\u8bbe\u7f6e\u7a0b\u5e8f\u7684\u65e5\u5fd7\u7ea7\u522b\u4e3a\u8c03\u8bd5\u6a21\u5f0f\u3002<\/li>\n<li>\u6307\u5b9a\u7cfb\u7edf\u8def\u5f84&#xff1a; \u73af\u5883\u53d8\u91cf\u53ef\u4ee5\u6307\u5b9a\u7a0b\u5e8f\u6216\u5e93\u7684\u8def\u5f84&#xff0c;\u4f8b\u5982 PATH \u73af\u5883\u53d8\u91cf\u7528\u4e8e\u6307\u5b9a\u7cfb\u7edf\u53ef\u6267\u884c\u6587\u4ef6\u7684\u641c\u7d22\u8def\u5f84\u3002 \u4f8b\u5982&#xff0c;PATH&#061;\/usr\/bin:\/bin:\/usr\/local\/bin \u8868\u793a\u7cfb\u7edf\u4f1a\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u67e5\u627e\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/li>\n<li>\u4f20\u9012\u7528\u6237\u504f\u597d\u8bbe\u7f6e&#xff1a; \u73af\u5883\u53d8\u91cf\u53ef\u4ee5\u5b58\u50a8\u7528\u6237\u7684\u504f\u597d\u8bbe\u7f6e&#xff0c;\u4f8b\u5982\u8bed\u8a00\u73af\u5883&#xff08;LANG&#xff09;\u3001\u65f6\u533a&#xff08;TZ&#xff09;\u7b49\u3002 \u4f8b\u5982&#xff0c;LANG&#061;en_US.UTF-8 \u8bbe\u7f6e\u4e86\u7cfb\u7edf\u7684\u8bed\u8a00\u73af\u5883\u4e3a\u7f8e\u56fd\u82f1\u8bed&#xff0c;\u4f7f\u7528 UTF-8 \u7f16\u7801\u3002<\/li>\n<li>\u52a8\u6001\u914d\u7f6e&#xff1a; \u73af\u5883\u53d8\u91cf\u53ef\u4ee5\u5728\u8fd0\u884c\u65f6\u52a8\u6001\u8bbe\u7f6e\u548c\u4fee\u6539&#xff0c;\u800c\u65e0\u9700\u91cd\u65b0\u7f16\u8bd1\u7a0b\u5e8f\u3002 \u4f8b\u5982&#xff0c;\u53ef\u4ee5\u5728\u542f\u52a8\u811a\u672c\u4e2d\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf&#xff0c;\u4ee5\u63a7\u5236\u7a0b\u5e8f\u7684\u884c\u4e3a\u3002<\/li>\n<h4>\u5e38\u89c1\u7684\u73af\u5883\u53d8\u91cf<\/h4>\n<li>PATH \u7528\u9014&#xff1a;\u6307\u5b9a\u7cfb\u7edf\u53ef\u6267\u884c\u6587\u4ef6\u7684\u641c\u7d22\u8def\u5f84\u3002 \u793a\u4f8b&#xff1a;PATH&#061;\/usr\/bin:\/bin:\/usr\/local\/bin \u8bf4\u660e&#xff1a;\u5f53\u7528\u6237\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u547d\u4ee4\u65f6&#xff0c;\u7cfb\u7edf\u4f1a\u5728 PATH \u6307\u5b9a\u7684\u76ee\u5f55\u4e2d\u67e5\u627e\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/li>\n<li>HOME \u7528\u9014&#xff1a;\u6307\u5b9a\u5f53\u524d\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u8def\u5f84\u3002 \u793a\u4f8b&#xff1a;HOME&#061;\/home\/user \u8bf4\u660e&#xff1a;\u7a0b\u5e8f\u53ef\u4ee5\u4f7f\u7528 HOME \u73af\u5883\u53d8\u91cf\u6765\u8bbf\u95ee\u7528\u6237\u7684\u4e3b\u76ee\u5f55&#xff0c;\u4f8b\u5982\u4fdd\u5b58\u914d\u7f6e\u6587\u4ef6\u3002<\/li>\n<li>LANG \u7528\u9014&#xff1a;\u6307\u5b9a\u7cfb\u7edf\u7684\u8bed\u8a00\u73af\u5883\u3002 \u793a\u4f8b&#xff1a;LANG&#061;en_US.UTF-8 \u8bf4\u660e&#xff1a;\u8bbe\u7f6e\u7cfb\u7edf\u7684\u8bed\u8a00\u73af\u5883\u548c\u5b57\u7b26\u7f16\u7801&#xff0c;\u5f71\u54cd\u7a0b\u5e8f\u7684\u8f93\u51fa\u548c\u56fd\u9645\u5316\u884c\u4e3a\u3002<\/li>\n<li>TZ \u7528\u9014&#xff1a;\u6307\u5b9a\u7cfb\u7edf\u7684\u65f6\u533a\u3002 \u793a\u4f8b&#xff1a;TZ&#061;America\/New_York \u8bf4\u660e&#xff1a;\u8bbe\u7f6e\u7cfb\u7edf\u7684\u65f6\u533a&#xff0c;\u5f71\u54cd\u7a0b\u5e8f\u4e2d\u65e5\u671f\u548c\u65f6\u95f4\u7684\u663e\u793a\u3002<\/li>\n<li>LD_LIBRARY_PATH \u7528\u9014&#xff1a;\u6307\u5b9a\u52a8\u6001\u94fe\u63a5\u5668\u641c\u7d22\u52a8\u6001\u5e93\u7684\u8def\u5f84\u3002 \u793a\u4f8b&#xff1a;LD_LIBRARY_PATH&#061;\/usr\/local\/lib:\/opt\/lib \u8bf4\u660e&#xff1a;\u52a8\u6001\u94fe\u63a5\u5668\u4f1a\u5728 LD_LIBRARY_PATH \u6307\u5b9a\u7684\u76ee\u5f55\u4e2d\u67e5\u627e\u52a8\u6001\u5e93\u3002<\/li>\n<li>USER \u7528\u9014&#xff1a;\u6307\u5b9a\u5f53\u524d\u767b\u5f55\u7684\u7528\u6237\u540d\u3002 \u793a\u4f8b&#xff1a;USER&#061;zzx \u8bf4\u660e&#xff1a;\u7a0b\u5e8f\u53ef\u4ee5\u4f7f\u7528 USER \u73af\u5883\u53d8\u91cf\u83b7\u53d6\u5f53\u524d\u7528\u6237\u7684\u540d\u79f0\u3002<\/li>\n<h4>\u67e5\u770b\u73af\u5883\u53d8\u91cf<\/h4>\n<p>echo $NAME \u5176\u4e2dNAME\u4e3a\u4f60\u8981\u67e5\u627e\u7684\u73af\u5883\u53d8\u91cf\u540d\u79f0&#xff0c;\u6bd4\u5982PATH&#xff0c;USER\u7b49 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418091913-68021911613dc.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h4>\u53ef\u6267\u884c\u6587\u4ef6\u7684\u9ed8\u8ba4\u6267\u884c\u8def\u5f84<\/h4>\n<p>\u6211\u4eec\u5148\u5199\u4e00\u4e2a\u7b80\u5355\u7a0b\u5e8f<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;hello world&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u5bf9\u4e0a\u9762\u7684\u6e90\u4ee3\u7801\u7f16\u8bd1\u5f62\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6 hello &#xff0c;\u5f53\u6211\u4eec\u5728\u547d\u4ee4\u884c\u8f93\u5165 hello \u6765\u6267\u884c\u8fd9\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u65f6\u5019\u53d1\u73b0\u6267\u884c\u4e0d\u4e86&#xff0c;\u62a5\u9519 Command &#039;hello&#039; not found \u8fd9\u662f\u4e3a\u4ec0\u4e48\u5462&#xff1f; \u5176\u5b9e\u5728 Linux \u548c\u7c7b Unix \u7cfb\u7edf\u4e2d&#xff0c;\u53ef\u6267\u884c\u6587\u4ef6\u7684\u9ed8\u8ba4\u6267\u884c\u8def\u5f84\u662f\u7531\u73af\u5883\u53d8\u91cf PATH \u51b3\u5b9a\u7684\u3002PATH \u73af\u5883\u53d8\u91cf\u662f\u4e00\u4e2a\u4ee5\u5192\u53f7&#xff08;:&#xff09;\u5206\u9694\u7684\u76ee\u5f55\u5217\u8868&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u4f1a\u5728\u8fd9\u4e9b\u76ee\u5f55\u4e2d\u6309\u987a\u5e8f\u67e5\u627e\u53ef\u6267\u884c\u6587\u4ef6&#xff0c;\u800c hello \u8fd9\u4e2a\u547d\u4ee4\u6211\u4eec\u9ed8\u8ba4\u6267\u884c\u8def\u5f84\u4e5f\u5c31\u662fPATH\u6307\u5b9a\u7684\u8def\u5f84&#xff0c;\u800c\u4e0d\u662f\u5f53\u524d\u8def\u5f84\u3002 \u89e3\u51b3\u65b9\u6cd5&#xff1a;<\/p>\n<li>\u6307\u5b9a\u5f53\u524d\u8def\u5f84&#xff0c;\u6267\u884c\u547d\u4ee4 .\/hello<\/li>\n<li>\u4e34\u65f6\u4fee\u6539 PATH \u73af\u5883\u53d8\u91cf\u3002\u5c06\u5f53\u524d\u8def\u5f84\u6dfb\u52a0\u5230 PATH \u73af\u5883\u53d8\u91cf\u4e2d&#xff0c;expot PATH&#061;$PATH:hello<\/li>\n<li>\u6c38\u4e45\u4fee\u6539 PATH \u73af\u5883\u53d8\u91cf&#xff0c;\u901a\u8fc7\u4fee\u6539 shell \u914d\u7f6e\u6587\u4ef6&#xff0c;\u6211\u4eec\u53ef\u4ee5\u5728\u914d\u7f6e\u6587\u4ef6~\/.bashrc \u4e2d\u6dfb\u52a0\u4e0b\u9762\u8fd9\u6bb5\u4ee3\u7801<\/li>\n<p><span class=\"token keyword\">export<\/span> PATH<span class=\"token operator\">&#061;<\/span>$PATH<span class=\"token operator\">:<\/span>\u4f60\u7684\u53ef\u6267\u884c\u6587\u4ef6\u6240\u5904\u8def\u5f84<\/p>\n<p>\u7136\u540e\u518d\u6267\u884c source ~\/.bashrc \u662f\u914d\u7f6e\u6587\u4ef6\u751f\u6548<\/p>\n<li>\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\u5230\u5df2\u6709\u7684 PATH \u76ee\u5f55\u3002<\/li>\n<p>ln <span class=\"token operator\">&#8211;<\/span>s <span class=\"token operator\">\/<\/span>path<span class=\"token operator\">\/<\/span>to<span class=\"token operator\">\/<\/span>your<span class=\"token operator\">\/<\/span>program<span class=\"token operator\">\/<\/span>your_executable <span class=\"token operator\">\/<\/span>usr<span class=\"token operator\">\/<\/span>local<span class=\"token operator\">\/<\/span>bin<span class=\"token operator\">\/<\/span>your_executable<\/p>\n<p>\u5982\u679c\u5728 \/usr\/local\/bin \u4e2d\u627e\u5230\u4e86\u7b26\u53f7\u94fe\u63a5 your_executable&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u4f1a\u89e3\u6790\u8fd9\u4e2a\u7b26\u53f7\u94fe\u63a5&#xff0c;\u627e\u5230\u5b83\u6307\u5411\u7684\u5b9e\u9645\u6587\u4ef6 \/path\/to\/your\/program\/your_executable&#xff0c;\u5e76\u8fd0\u884c\u8be5\u6587\u4ef6\u3002<\/p>\n<li>\u4f7f\u7528 alias \u4e3a\u7a0b\u5e8f\u521b\u5efa\u4e00\u4e2a\u7b80\u5316\u7684\u547d\u4ee4\u3002<\/li>\n<p>alias myprogram<span class=\"token operator\">&#061;<\/span>&#039;<span class=\"token operator\">\/<\/span>path<span class=\"token operator\">\/<\/span>to<span class=\"token operator\">\/<\/span>your<span class=\"token operator\">\/<\/span>program<span class=\"token operator\">\/<\/span>your_executable<span class=\"token number\">&#039;<\/span><\/p>\n<p>\u5c06\u4e0a\u8ff0\u547d\u4ee4\u6dfb\u52a0\u5230\u4f60\u7684 shell \u914d\u7f6e\u6587\u4ef6\u4e2d&#xff08;\u5982 ~\/.bashrc \u6216 ~\/.zshrc&#xff09;&#xff0c;\u4ee5\u6c38\u4e45\u751f\u6548\u3002<\/p>\n<h4>\u73af\u5883\u53d8\u91cf\u76f8\u5173\u547d\u4ee4<\/h4>\n<ul>\n<li>export : \u5728\u5168\u5c40\u73af\u5883\u53d8\u91cf\u8868\u4e2d\u8bbe\u7f6e\u4e00\u4e2a\u5168\u65b0\u7684\u73af\u5883\u53d8\u91cf<\/li>\n<li>env : \u663e\u793a\u6240\u6709\u73af\u5883\u53d8\u91cf<\/li>\n<li>unset : \u6e05\u695a\u73af\u5883\u53d8\u91cf<\/li>\n<li>set : \u663e\u793a\u672c\u5730\u5b9a\u4e49\u7684shell\u53d8\u91cf\u548c\u73af\u5883\u53d8\u91cf<\/li>\n<\/ul>\n<h4>\u73af\u5883\u53d8\u91cf\u7684\u7ec4\u7ec7\u65b9\u5f0f<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418091913-680219116dde2.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u6bcf\u4e2a\u7a0b\u5e8f\u90fd\u6709\u4e00\u4e2a\u73af\u5883\u53d8\u91cf\u8868&#xff0c;\u73af\u5883\u53d8\u91cf\u8868\u662f\u4e00\u4e2a\u5b57\u7b26\u6307\u9488\u6570\u7ec4&#xff0c;\u6bcf\u4e2a\u6307\u9488\u6307\u5411\u4e00\u4e2a\u4ee5\u2018 \\\\0 \u2019 \u7ed3\u5c3e\u7684\u73af\u5883\u5b57\u7b26\u4e32<\/p>\n<h4>\u4ee3\u7801\u83b7\u53d6\u73af\u5883\u53d8\u91cf<\/h4>\n<ul>\n<li>\u547d\u4ee4\u2f8f\u7b2c\u4e09\u4e2a\u53c2\u6570<\/li>\n<\/ul>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> argc<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">char<\/span> <span class=\"token operator\">*<\/span>argv<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">char<\/span> <span class=\"token operator\">*<\/span>env<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">int<\/span> i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">for<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">;<\/span> env<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;%s\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> env<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<ul>\n<li>\u901a\u8fc7 extern \u7b2c\u4e09\u65b9\u53d8\u91cf environ \u83b7\u53d6<\/li>\n<\/ul>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> argc<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">char<\/span> <span class=\"token operator\">*<\/span>argv<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">extern<\/span> <span class=\"token keyword\">char<\/span> <span class=\"token operator\">*<\/span><span class=\"token operator\">*<\/span>environ<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">int<\/span> i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">for<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">;<\/span> environ<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;%s\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> environ<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>\u901a\u8fc7\u7cfb\u7edf\u8c03\u7528\u83b7\u53d6<\/h4>\n<p>\u901a\u8fc7\u7cfb\u7edf\u8c03\u7528 getenv(name) \u6765\u83b7\u53d6\u73af\u5883\u53d8\u91cf&#xff0c;\u5176\u5b9e\u73b0\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 man \u624b\u518c\u6765\u67e5\u627e&#xff08;man getenv&#xff09; <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418091913-6802191195d49.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdlib.h&gt;<\/span><\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;%s\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token function\">getenv<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;PATH&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>\u5b50\u8fdb\u7a0b\u7ee7\u627f\u73af\u5883\u53d8\u91cf<\/h4>\n<ul>\n<li class=\"task-list-item\"> \u73af\u5883\u53d8\u91cf\u901a\u5e38\u5177\u6709\u5168\u5c40\u5c5e\u6027&#xff0c;\u53ef\u4ee5\u88ab\u5b50\u8fdb\u7a0b\u7ee7\u627f\u4e0b\u53bb\u3002<\/li>\n<\/ul>\n<h5>\u4ee3\u7801\u6f14\u793a<\/h5>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdlib.h&gt;<\/span><\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;%s\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token function\">getenv<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;PATH&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u7531\u6211\u4eec\u5728\u7f16\u8bd1\u4e0a\u9762\u4ee3\u7801\u5f62\u6210\u53ef\u6267\u884c\u7a0b\u5e8f&#xff0c;\u5728\u8fd0\u884c\u65f6\u5c31\u4f1a\u5e2e\u6211\u4eec\u6253\u5370 PATH \u73af\u5883\u53d8\u91cf\u53ef\u77e5&#xff0c;\u73af\u5883\u53d8\u91cf\u662f\u4f1a\u88ab\u5b50\u8fdb\u7a0b\u7ee7\u627f\u7684&#xff08;\u6ce8\u610f&#xff1a; \u4efb\u4f55\u5728\u547d\u4ee4\u884c\u6267\u884c\u7684\u53ef\u6267\u884c\u6587\u4ef6\u90fd\u662f\u7531 shell \u8fdb\u884c fork() \u521b\u5efa\u7684\u5b50\u8fdb\u7a0b&#xff0c;\u5728\u901a\u8fc7 \u8fdb\u7a0b\u5207\u6362 \u6267\u884c\u7684\u547d\u4ee4&#xff0c;\u6240\u4ee5\u4e0a\u9762\u53ef\u8fdb\u7a0b\u5c31\u662f shell \u7684\u5b50\u8fdb\u7a0b&#xff09;<\/p>\n<h3>\u7a0b\u5e8f\u5730\u5740\u7a7a\u95f4<\/h3>\n<p>\u7a0b\u5e8f\u5730\u5740\u7a7a\u95f4\u5e03\u5c40&#xff1a; <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418091913-680219119f1d6.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u4f46\u4e0a\u9762\u7684\u5730\u5740\u7a7a\u95f4\u5e03\u5c40\u5c31\u662f\u7269\u7406\u5730\u5740\u7a7a\u95f4\u5e03\u5c40\u5417&#xff0c;\u7b54\u6848\u662f\u4e0d\u662f\u7684\u3002 \u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e00\u6bb5\u7a0b\u5e8f\u9a8c\u8bc1<\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdio.h&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;unistd.h&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdlib.h&gt;<\/span><\/span><br \/>\n<span class=\"token keyword\">int<\/span> g_val <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n    pid_t id <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">fork<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">if<\/span><span class=\"token punctuation\">(<\/span>id <span class=\"token operator\">&lt;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token function\">perror<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;fork&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">else<\/span> <span class=\"token keyword\">if<\/span><span class=\"token punctuation\">(<\/span>id <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token punctuation\">{<\/span> <span class=\"token comment\">\/\/child<\/span><br \/>\n        <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;child pid %d : %d : %p\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token function\">getpid<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> g_val<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">&amp;<\/span>g_val<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">else<\/span><br \/>\n    <span class=\"token punctuation\">{<\/span> <span class=\"token comment\">\/\/parent<\/span><br \/>\n        <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;parent pid %d : %d : %p\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token function\">getpid<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> g_val<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">&amp;<\/span>g_val<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token function\">sleep<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8f93\u51fa\u7ed3\u679c&#xff1a;<\/p>\n<p>parent pid <span class=\"token number\">4635<\/span> <span class=\"token operator\">:<\/span> <span class=\"token number\">0<\/span> <span class=\"token operator\">:<\/span> <span class=\"token number\">0x56436823f014<\/span><br \/>\nchild pid <span class=\"token number\">4636<\/span> <span class=\"token operator\">:<\/span> <span class=\"token number\">0<\/span> <span class=\"token operator\">:<\/span> <span class=\"token number\">0x56436823f014<\/span><\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u770b\u89c1\u7236\u5b50\u8fdb\u7a0b\u7684 gval \u7684\u503c\u662f\u4e0d\u4e00\u6837\u7684&#xff0c;\u4f46\u5730\u5740\u786e\u5b9e\u4e00\u6837\u7684&#xff0c;\u6211\u4eec\u5c31\u53ef\u4ee5\u5f97\u51fa\u4e00\u4e0b\u7ed3\u8bba&#xff1a;<\/p>\n<ul>\n<li>\u6211\u4eec\u770b\u5230\u7684\u5730\u5740\u503c\u7edd\u5bf9\u4e0d\u662f\u7269\u7406\u5730\u5740&#xff0c;\u800c\u662f\u865a\u62df\u5730\u5740&#xff0c;\u5373\u6211\u4eec\u5728C\/C&#043;&#043;\u8bed\u8a00\u4e2d\u770b\u5230\u7684\u5730\u5740\u90fd\u662f\u865a\u62df\u5730\u5740&#xff01;\u800c\u4e0d\u662f\u7269\u7406\u5730\u5740&#xff0c;\u7269\u7406\u5730\u5740\u7528\u6237\u662f\u770b\u4e0d\u5230\u7684&#xff0c;\u7edf\u4e00\u7531\u64cd\u4f5c\u7cfb\u7edf\u7ba1\u7406<\/li>\n<li>OS\u5fc5\u987b\u8d1f\u8d23\u865a\u62df\u5730\u5740\u5e26\u7269\u7406\u5730\u5740\u7684\u8f6c\u6362<\/li>\n<\/ul>\n<h3>\u8fdb\u7a0b\u5730\u5740\u7a7a\u95f4<\/h3>\n<p>\u7531\u4e0a\u9762\u53ef\u77e5 \u7a0b\u5e8f\u5730\u5740\u7a7a\u95f4 \u7684\u8bf4\u6cd5\u4e0d\u51c6\u786e&#xff0c;\u90a3\u5e94\u8be5\u4e3a\u4ec0\u4e48\u5462&#xff0c;\u51c6\u786e\u6765\u8bf4\u5e94\u8be5\u4e3a \u8fdb\u7a0b\u5730\u5740\u7a7a\u95f4<\/p>\n<h4>\u865a\u62df\u5730\u5740\u8f6c\u6362\u4e3a\u7269\u7406\u5730\u5740<\/h4>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418091913-68021911b661e.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u901a\u8fc7\u8fd9\u4e2a\u6211\u4eec\u5c31\u53ef\u4ee5\u770b\u51fa&#xff0c;\u540c\u4e00\u4e2a\u53d8\u91cf\u5730\u5740\u76f8\u540c&#xff0c;\u5185\u5bb9\u4e0d\u540c&#xff0c;\u5176\u5b9e\u662f\u865a\u62df\u5730\u5740\u7a7a\u95f4\u76f8\u540c&#xff0c;\u4f46\u662f\u7269\u7406\u5185\u5b58\u4e0a\u7684\u5730\u5740\u5176\u5b9e\u662f\u4e0d\u540c\u7684\u3002 \u4e5f\u5c31\u662f\u76f8\u5f53\u4e8e\u64cd\u4f5c\u7cfb\u7edf\u7ed9\u7f16\u8bd1\u5668\u753b\u4e86\u4e00\u5f20\u5927\u997c&#xff0c;\u544a\u8bc9\u7f16\u8bd1\u5668\u8fd9\u91cc\u7684\u7a7a\u95f4\u4f60\u5168\u90e8\u53ef\u4ee5\u7528&#xff0c;\u4f46\u5176\u662f\u5e76\u4e0d\u662f\u5168\u90e8\u53ef\u4ee5\u7528&#xff0c;\u4f60\u7533\u8bf7\u7a7a\u95f4\u65f6 \u64cd\u4f5c\u7cfb\u7edf \u5c31\u4f1a\u770b\u4f60\u7533\u8bf7\u7684\u7a7a\u95f4\u7269\u7406\u5185\u5b58\u662f\u5426\u8db3\u591f\u5bb9\u7eb3\u7684\u4e0b&#xff0c;\u5982\u679c\u5bb9\u7eb3\u4e0d\u4e0b&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u5c31\u4e0d\u4f1a\u5e2e\u4f60\u7533\u8bf7&#xff0c;\u76f4\u63a5\u6253\u56de\u4f60\u7684\u7533\u8bf7&#xff0c;\u5c31\u50cf\u4f60\u5144\u5f1f\u544a\u8bc9\u4f60\u6211\u6709100\u5757&#xff0c;\u4f60\u8bf4\u7ed9\u6211200\u5757&#xff0c;\u4f60\u5144\u5f1f\u8bf4\u4e0d\u884c\u4e00\u6837<\/p>\n<h4>\u6d45\u8c08\u865a\u62df\u5185\u5b58\u7ba1\u7406<\/h4>\n<p>\u90a3\u4e48\u65e2\u7136\u6709\u865a\u62df\u5185\u5b58&#xff0c;\u90a3\u4e48\u64cd\u4f5c\u7cfb\u7edf\u5c31\u9700\u8981\u5bf9\u865a\u62df\u5185\u5b58\u7ba1\u7406&#xff0c;\u90a3\u64cd\u4f5c\u7cfb\u7edf\u662f\u600e\u4e48\u5bf9\u865a\u62df\u5185\u5b58\u7ba1\u7406\u7684\u5462&#xff1f; \u548c\u8fdb\u7a0b\u4e00\u6837&#xff0c;\u4e5f\u662f\u5148\u63cf\u8ff0&#xff0c;\u518d\u7ec4\u7ec7<\/p>\n<h5>\u63cf\u8ff0<\/h5>\n<p>\u6bcf\u4e00\u4e2a\u8fdb\u7a0b\u90fd\u6709\u4e00\u4e2a task_struct &#xff0c;\u5728 task_struct \u4e2d\u5c31\u6709\u4e00\u4e2a\u63cf\u8ff0\u8fdb\u7a0b\u5730\u5740\u7a7a\u95f4\u7684\u7ed3\u6784\u4f53 mm_struct &#xff08;\u5185\u5b58\u63cf\u8ff0\u7b26&#xff09;<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">task_struct<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token comment\">\/*&#8230;*\/<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">mm_struct<\/span> <span class=\"token operator\">*<\/span>mm<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/\u5bf9\u4e8e\u666e\u901a\u7684\u2f64\u2f3e\u8fdb\u7a0b\u6765\u8bf4\u8be5\u5b57\u6bb5\u6307\u5411\u4ed6\u7684<\/span><br \/>\n<span class=\"token comment\">\/\/\u865a\u62df\u5730\u5740\u7a7a\u95f4\u7684\u2f64\u2f3e\u7a7a\u95f4\u90e8\u5206&#xff0c;\u5bf9\u4e8e\u5185\u6838\u7ebf\u7a0b\u6765\u8bf4\u8fd9\u90e8\u5206\u4e3aNULL\u3002<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">mm_struct<\/span> <span class=\"token operator\">*<\/span>active_mm<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u8be5\u5b57\u6bb5\u662f\u5185\u6838\u7ebf\u7a0b\u4f7f\u2f64\u7684\u3002\u5f53\u8be5\u8fdb\u7a0b\u662f\u5185\u6838\u7ebf\u7a0b\u65f6&#xff0c;<\/span><br \/>\n<span class=\"token comment\">\/\/\u5b83\u7684mm\u5b57\u6bb5\u4e3aNULL&#xff0c;\u8868\u2f70\u6ca1\u6709\u5185\u5b58\u5730\u5740\u7a7a\u95f4&#xff0c;\u53ef\u4e5f\u5e76\u4e0d\u662f\u771f\u6b63\u7684\u6ca1\u6709&#xff0c;\u8fd9\u662f\u56e0\u4e3a\u6240\u6709\u8fdb\u7a0b\u5173<\/span><br \/>\n<span class=\"token comment\">\/\/\u4e8e\u5185\u6838\u7684\u6620\u5c04\u90fd\u662f\u2f00\u6837\u7684&#xff0c;\u5185\u6838\u7ebf\u7a0b\u53ef\u4ee5\u4f7f\u2f64\u4efb\u610f\u8fdb\u7a0b\u7684\u5730\u5740\u7a7a\u95f4\u3002<\/span><br \/>\n<span class=\"token comment\">\/*&#8230;*\/<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">mm_struct<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token comment\">\/*&#8230;*\/<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">vm_area_struct<\/span> <span class=\"token operator\">*<\/span>mmap<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/* \u6307\u5411\u865a\u62df\u533a\u95f4(VMA)\u94fe\u8868 *\/<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">rb_root<\/span> mm_rb<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/* red_black\u6811 *\/<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span> task_size<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/*\u5177\u6709\u8be5\u7ed3\u6784\u4f53\u7684\u8fdb\u7a0b\u7684\u865a\u62df\u5730\u5740\u7a7a\u95f4\u7684\u2f24\u2f29*\/<\/span><br \/>\n<span class=\"token comment\">\/*&#8230;*\/<\/span><br \/>\n<span class=\"token comment\">\/\/ \u4ee3\u7801\u6bb5\u3001\u6570\u636e\u6bb5\u3001\u5806\u6808\u6bb5\u3001\u53c2\u6570\u6bb5\u53ca\u73af\u5883\u6bb5\u7684\u8d77\u59cb\u548c\u7ed3\u675f\u5730\u5740\u3002<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span> start_code<span class=\"token punctuation\">,<\/span> end_code<span class=\"token punctuation\">,<\/span> start_data<span class=\"token punctuation\">,<\/span> end_data<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span> start_brk<span class=\"token punctuation\">,<\/span> brk<span class=\"token punctuation\">,<\/span> start_stack<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span> arg_start<span class=\"token punctuation\">,<\/span> arg_end<span class=\"token punctuation\">,<\/span> env_start<span class=\"token punctuation\">,<\/span> env_end<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/*&#8230;*\/<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u6bcf\u4e00\u4e2a\u8fdb\u7a0b\u90fd\u6709\u72ec\u7acb\u7684 mm_struct &#xff0c;\u8fd9\u6837\u4fdd\u8bc1\u4e86\u8fdb\u7a0b\u4e4b\u95f4\u7684\u72ec\u7acb\u6027\u3002<\/p>\n<h5>\u7ec4\u7ec7<\/h5>\n<p>\u865a\u62df\u5730\u5740\u7ec4\u7ec7\u65b9\u5f0f\u6709\u4e24\u79cd&#xff1a;<\/p>\n<li>\u5f53\u865a\u62df\u533a\u8f83\u5c11\u65f6\u91c7\u53d6\u5355\u94fe\u8868&#xff0c;\u7531 mmap \u6307\u9488\u6307\u5411\u8fd9\u4e2a\u94fe\u8868<\/li>\n<li>\u5f53\u865a\u62df\u533a\u95f4\u591a\u65f6\u91c7\u53d6\u7ea2\u9ed1\u6811\u8fdb\u884c\u7ba1\u7406&#xff0c;\u7531 mm_rb \u6307\u5411\u8fd9\u68f5\u6811<\/li>\n<p>linux\u5185\u6838\u4f7f\u7528 vm_area_struct \u7ed3\u6784\u6765\u8868\u793a\u4e00\u4e2a\u72ec\u7acb\u7684\u865a\u62df\u5185\u5b58\u533a\u57df&#xff08;VMA&#xff09;,\u4e00\u4e2a\u8fdb\u7a0b\u4f7f\u7528\u591a\u4e2a vm_area_struct \u6765\u8868\u793a\u4e0d\u540c\u4f4d\u7f6e\u7684\u865a\u62df\u5185\u5b58\u533a\u57df\u3002<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">vm_area_struct<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span> vm_start<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/\u865a\u5b58\u533a\u8d77\u59cb<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span> vm_end<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/\u865a\u5b58\u533a\u7ed3\u675f<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">vm_area_struct<\/span><span class=\"token operator\">*<\/span> vm_next<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">*<\/span> vm_prev<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/\u524d\u540e\u6307\u9488<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">rb_node<\/span> vm_rb<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/\u7ea2\u2fca\u6811\u4e2d\u7684\u4f4d\u7f6e<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span> rb_subtree_gap<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">mm_struct<\/span><span class=\"token operator\">*<\/span> vm_mm<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/\u6240\u5c5e\u7684 mm_struct<\/span><br \/>\npgprot_t vm_page_prot<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span> vm_flags<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/\u6807\u5fd7\u4f4d<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">rb_node<\/span> rb<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span> rb_subtree_last<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span> shared<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">list_head<\/span> anon_vma_chain<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">anon_vma<\/span><span class=\"token operator\">*<\/span> anon_vma<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">const<\/span> <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">vm_operations_struct<\/span><span class=\"token operator\">*<\/span> vm_ops<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/vma\u5bf9\u5e94\u7684\u5b9e\u9645\u64cd\u4f5c<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span> vm_pgoff<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/\u2f42\u4ef6\u6620\u5c04\u504f\u79fb\u91cf<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">file<\/span><span class=\"token operator\">*<\/span> vm_file<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/\u6620\u5c04\u7684\u2f42\u4ef6<\/span><br \/>\n<span class=\"token keyword\">void<\/span><span class=\"token operator\">*<\/span> vm_private_data<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/\/\u79c1\u6709\u6570\u636e<\/span><br \/>\natomic_long_t swap_readahead_info<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">ifndef<\/span> <span class=\"token expression\">CONFIG_MMU<\/span><\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">vm_region<\/span><span class=\"token operator\">*<\/span> vm_region<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/* NOMMU mapping region *\/<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">endif<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">ifdef<\/span> <span class=\"token expression\">CONFIG_NUMA<\/span><\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">mempolicy<\/span><span class=\"token operator\">*<\/span> vm_policy<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">\/* NUMA policy for the VMA *\/<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">endif<\/span><\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">vm_userfaultfd_ctx<\/span> vm_userfaultfd_ctx<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span> __randomize_layout<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u901a\u8fc7\u4e0a\u9762\u7684\u63cf\u8ff0&#xff0c;\u6211\u4eec\u53ef\u4ee5\u7528\u56fe\u6765\u8868\u793a\u4ee5\u4e0a\u7ed3\u6784&#xff1a; <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418091914-6802191200b56.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418091914-680219122899b.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>\u4e3a\u4ec0\u4e48\u8981\u6709\u865a\u62df\u5730\u5740\u7a7a\u95f4<\/h3>\n<li>\u5b89\u5168\u98ce\u9669&#xff0c;\u5982\u679c\u6bcf\u4e2a\u8fdb\u7a0b\u90fd\u53ef\u4ee5\u8bbf\u95ee\u4efb\u610f\u5185\u5b58\u7a7a\u95f4&#xff0c;\u90a3\u4e48\u5c31\u610f\u5473\u7740\u4efb\u610f\u4e00\u4e2a\u8fdb\u7a0b\u90fd\u80fd\u591f\u8bfb\u5199\u7cfb\u7edf\u5148\u5173\u7684\u5185\u5b58\u533a\u57df&#xff0c;\u5982\u679c\u662f\u4e00\u4e2a\u6728\u9a6c\u75c5\u6bd2&#xff0c;\u5c31\u610f\u5473\u7740\u53ef\u4ee5\u968f\u610f\u4fee\u6539\u5185\u5b58\u7a7a\u95f4&#xff0c;\u5bfc\u81f4\u5f88\u591a\u4e0d\u7f3a\u5b9a\u56e0\u7d20<\/li>\n<li>\u5730\u5740\u4e0d\u786e\u5b9a&#xff0c;\u5982\u679c\u4f7f\u7528\u7684\u662f\u7269\u7406\u5730\u5740&#xff0c;\u6bcf\u6b21\u8fd0\u884c\u7684\u7a0b\u5e8f\u7684\u5730\u5740\u662f\u4e0d\u786e\u5b9a\u7684&#xff0c;\u56e0\u4e3a\u6bcf\u6b21\u8fd0\u884c\u7684\u7a0b\u5e8f\u4e2a\u6570\u90fd\u4e0d\u4e00\u6837<\/li>\n<li>\u6548\u7387\u4f4e&#xff0c;\u5982\u679c\u76f4\u63a5\u4f7f\u7528\u7269\u7406\u5185\u5b58\u7684\u8bdd&#xff0c;\u4e00\u4e2a\u8fdb\u7a0b\u5c31\u662f\u4f5c\u4e3a\u4e00\u4e2a\u6574\u4f53&#xff08;\u5185\u5b58\u5757&#xff09;\u64cd\u4f5c\u7684&#xff0c;\u5982\u679c\u51fa\u73b0\u5185\u5b58\u4e0d\u591f\u7528&#xff0c;\u5c31\u53ea\u80fd\u5c06\u4e0d\u5e38\u7528\u7684\u8fdb\u7a0b\u62f7\u8d1d\u5230\u78c1\u76d8\u7684\u4ea4\u6362\u5206\u533a\u4e2d&#xff0c;\u7b49\u4e0b\u6b21\u5185\u5b58\u591f\u4e86&#xff0c;\u5728\u52a0\u8f7d\u56de\u6765&#xff0c;\u5982\u679c\u662f\u865a\u62df\u5730\u5740\u7a7a\u95f4&#xff0c;\u5c31\u53ef\u4ee5\u901a\u8fc7\u5206\u9875\u7ba1\u7406\u548c\u9875\u8868\u6620\u5c04\u5206\u6279\u52a0\u8f7d\u8fdb\u7a0b&#xff0c;\u5927\u5927\u51cf\u5c0f\u4e86\u5185\u5b58\u7684\u538b\u529b&#xff0c;\u4f7f\u5185\u5b58\u80fd\u591f\u4ee5\u66f4\u5c0f\u7684\u7a7a\u95f4\u505a\u66f4\u591a\u7684\u4e8b<\/li>\n<li>\u5730\u5740\u7a7a\u95f4\u548c\u9875\u8868\u90fd\u662fOS\u6765\u7ef4\u62a4\u7684&#xff0c;\u4e5f\u5c31\u610f\u5473\u7740\u60f3\u8981\u4f7f\u7528\u5730\u5740\u7a7a\u95f4\u548c\u9875\u8868\u6620\u5c04&#xff0c;\u5c31\u9700\u8981OS\u6765\u76d1\u7763&#xff0c;\u8fd9\u4e5f\u5c31\u4fdd\u62a4\u4e86\u7269\u7406\u5185\u5b58\u4e2d\u7684\u5408\u6cd5\u6570\u636e&#xff0c;\u5305\u62ec\u5404\u4e2a\u8fdb\u7a0b\u4ee5\u53ca\u5185\u6838\u7684\u6709\u6548\u6570\u636e<\/li>\n<li>\u7531\u9875\u8868\u548c\u5730\u5740\u7a7a\u95f4\u7684\u5b58\u5728&#xff0c;\u4e5f\u5c31\u610f\u5473\u7740\u7269\u7406\u5185\u5b58\u7684\u5206\u914d\u548c\u8fdb\u7a0b\u7684\u7ba1\u7406\u6ca1\u6709\u5173\u7cfb\u4e86&#xff0c;\u8fdb\u7a0b\u7ba1\u7406\u6a21\u5757\u548c\u5185\u5b58\u7ba1\u7406\u6a21\u5757\u5c31\u5b8c\u6210\u4e86\u89e3\u8026<\/li>\n<li>\u6709\u4e86\u9875\u8868&#xff0c;\u7a0b\u5e8f\u5728\u7269\u7406\u5185\u5b58\u4e2d\u7406\u8bba\u4e0a\u5c31\u53ef\u4ee5\u5728\u4efb\u610f\u4f4d\u7f6e\u4e0a\u52a0\u8f7d\u3002\u4f46\u5b83\u53ef\u4ee5\u5c06\u5730\u5740\u7a7a\u95f4\u4e0a\u7684\u865a\u62df\u5730\u5740\u7a7a\u95f4\u548c\u7269\u7406\u5730\u5740\u7a7a\u95f4\u8fdb\u7a0b\u6620\u5c04&#xff0c;\u6240\u4ee5\u5728\u8fdb\u7a0b\u89c6\u89d2\u6240\u6709\u7684\u5185\u5b58\u5206\u5e03\u90fd\u662f\u6709\u5e8f\u7684<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.3k\u6b21\uff0c\u70b9\u8d5e71\u6b21\uff0c\u6536\u85cf63\u6b21\u3002\u5982\u679c\u5728 \/usr\/local\/bin \u4e2d\u627e\u5230\u4e86\u7b26\u53f7\u94fe\u63a5 your_executable\uff0c\u64cd\u4f5c\u7cfb\u7edf\u4f1a\u89e3\u6790\u8fd9\u4e2a\u7b26\u53f7\u94fe\u63a5\uff0c\u627e\u5230\u5b83\u6307\u5411\u7684\u5b9e\u9645\u6587\u4ef6 \/path\/to\/your\/program\/your_executable\uff0c\u5e76\u8fd0\u884c\u8be5\u6587\u4ef6\u3002\u5c31\u4f1a\u770b\u4f60\u7533\u8bf7\u7684\u7a7a\u95f4\u7269\u7406\u5185\u5b58\u662f\u5426\u8db3\u591f\u5bb9\u7eb3\u7684\u4e0b\uff0c\u5982\u679c\u5bb9\u7eb3\u4e0d\u4e0b\uff0c\u64cd\u4f5c\u7cfb\u7edf\u5c31\u4e0d\u4f1a\u5e2e\u4f60\u7533\u8bf7\uff0c\u76f4\u63a5\u6253\u56de\u4f60\u7684\u7533\u8bf7\uff0c\u5c31\u50cf\u4f60\u5144\u5f1f\u544a\u8bc9\u4f60\u6211\u6709100\u5757\uff0c\u4f60\u8bf4\u7ed9\u6211200\u5757\uff0c\u4f60\u5144\u5f1f\u8bf4\u4e0d\u884c\u4e00\u6837\u3002\u901a\u8fc7\u8fd9\u4e2a\u6211\u4eec\u5c31\u53ef\u4ee5\u770b\u51fa\uff0c\u540c\u4e00\u4e2a\u53d8\u91cf\u5730\u5740\u76f8\u540c\uff0c\u5185\u5bb9\u4e0d\u540c\uff0c\u5176\u5b9e\u662f\u865a\u62df\u5730\u5740\u7a7a\u95f4\u76f8\u540c\uff0c\u4f46\u662f\u7269\u7406\u5185\u5b58\u4e0a\u7684\u5730\u5740\u5176\u5b9e\u662f\u4e0d\u540c\u7684\u3002_linux tz\u73af\u5883\u53d8\u91cf<\/p>\n","protected":false},"author":2,"featured_media":9291,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,100,43],"topic":[],"class_list":["post-9298","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-100","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010Linux\u3011\u6d45\u8c08\u73af\u5883\u53d8\u91cf\u548c\u8fdb\u7a0b\u5730\u5740\u7a7a\u95f4 - \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\/9298.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010Linux\u3011\u6d45\u8c08\u73af\u5883\u53d8\u91cf\u548c\u8fdb\u7a0b\u5730\u5740\u7a7a\u95f4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.3k\u6b21\uff0c\u70b9\u8d5e71\u6b21\uff0c\u6536\u85cf63\u6b21\u3002\u5982\u679c\u5728 \/usr\/local\/bin \u4e2d\u627e\u5230\u4e86\u7b26\u53f7\u94fe\u63a5 your_executable\uff0c\u64cd\u4f5c\u7cfb\u7edf\u4f1a\u89e3\u6790\u8fd9\u4e2a\u7b26\u53f7\u94fe\u63a5\uff0c\u627e\u5230\u5b83\u6307\u5411\u7684\u5b9e\u9645\u6587\u4ef6 \/path\/to\/your\/program\/your_executable\uff0c\u5e76\u8fd0\u884c\u8be5\u6587\u4ef6\u3002\u5c31\u4f1a\u770b\u4f60\u7533\u8bf7\u7684\u7a7a\u95f4\u7269\u7406\u5185\u5b58\u662f\u5426\u8db3\u591f\u5bb9\u7eb3\u7684\u4e0b\uff0c\u5982\u679c\u5bb9\u7eb3\u4e0d\u4e0b\uff0c\u64cd\u4f5c\u7cfb\u7edf\u5c31\u4e0d\u4f1a\u5e2e\u4f60\u7533\u8bf7\uff0c\u76f4\u63a5\u6253\u56de\u4f60\u7684\u7533\u8bf7\uff0c\u5c31\u50cf\u4f60\u5144\u5f1f\u544a\u8bc9\u4f60\u6211\u6709100\u5757\uff0c\u4f60\u8bf4\u7ed9\u6211200\u5757\uff0c\u4f60\u5144\u5f1f\u8bf4\u4e0d\u884c\u4e00\u6837\u3002\u901a\u8fc7\u8fd9\u4e2a\u6211\u4eec\u5c31\u53ef\u4ee5\u770b\u51fa\uff0c\u540c\u4e00\u4e2a\u53d8\u91cf\u5730\u5740\u76f8\u540c\uff0c\u5185\u5bb9\u4e0d\u540c\uff0c\u5176\u5b9e\u662f\u865a\u62df\u5730\u5740\u7a7a\u95f4\u76f8\u540c\uff0c\u4f46\u662f\u7269\u7406\u5185\u5b58\u4e0a\u7684\u5730\u5740\u5176\u5b9e\u662f\u4e0d\u540c\u7684\u3002_linux tz\u73af\u5883\u53d8\u91cf\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/9298.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T09:19:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418091913-68021911613dc.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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/9298.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/9298.html\",\"name\":\"\u3010Linux\u3011\u6d45\u8c08\u73af\u5883\u53d8\u91cf\u548c\u8fdb\u7a0b\u5730\u5740\u7a7a\u95f4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T09:19:15+00:00\",\"dateModified\":\"2025-04-18T09:19:15+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/9298.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/9298.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/9298.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010Linux\u3011\u6d45\u8c08\u73af\u5883\u53d8\u91cf\u548c\u8fdb\u7a0b\u5730\u5740\u7a7a\u95f4\"}]},{\"@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":"\u3010Linux\u3011\u6d45\u8c08\u73af\u5883\u53d8\u91cf\u548c\u8fdb\u7a0b\u5730\u5740\u7a7a\u95f4 - \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\/9298.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010Linux\u3011\u6d45\u8c08\u73af\u5883\u53d8\u91cf\u548c\u8fdb\u7a0b\u5730\u5740\u7a7a\u95f4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.3k\u6b21\uff0c\u70b9\u8d5e71\u6b21\uff0c\u6536\u85cf63\u6b21\u3002\u5982\u679c\u5728 \/usr\/local\/bin \u4e2d\u627e\u5230\u4e86\u7b26\u53f7\u94fe\u63a5 your_executable\uff0c\u64cd\u4f5c\u7cfb\u7edf\u4f1a\u89e3\u6790\u8fd9\u4e2a\u7b26\u53f7\u94fe\u63a5\uff0c\u627e\u5230\u5b83\u6307\u5411\u7684\u5b9e\u9645\u6587\u4ef6 \/path\/to\/your\/program\/your_executable\uff0c\u5e76\u8fd0\u884c\u8be5\u6587\u4ef6\u3002\u5c31\u4f1a\u770b\u4f60\u7533\u8bf7\u7684\u7a7a\u95f4\u7269\u7406\u5185\u5b58\u662f\u5426\u8db3\u591f\u5bb9\u7eb3\u7684\u4e0b\uff0c\u5982\u679c\u5bb9\u7eb3\u4e0d\u4e0b\uff0c\u64cd\u4f5c\u7cfb\u7edf\u5c31\u4e0d\u4f1a\u5e2e\u4f60\u7533\u8bf7\uff0c\u76f4\u63a5\u6253\u56de\u4f60\u7684\u7533\u8bf7\uff0c\u5c31\u50cf\u4f60\u5144\u5f1f\u544a\u8bc9\u4f60\u6211\u6709100\u5757\uff0c\u4f60\u8bf4\u7ed9\u6211200\u5757\uff0c\u4f60\u5144\u5f1f\u8bf4\u4e0d\u884c\u4e00\u6837\u3002\u901a\u8fc7\u8fd9\u4e2a\u6211\u4eec\u5c31\u53ef\u4ee5\u770b\u51fa\uff0c\u540c\u4e00\u4e2a\u53d8\u91cf\u5730\u5740\u76f8\u540c\uff0c\u5185\u5bb9\u4e0d\u540c\uff0c\u5176\u5b9e\u662f\u865a\u62df\u5730\u5740\u7a7a\u95f4\u76f8\u540c\uff0c\u4f46\u662f\u7269\u7406\u5185\u5b58\u4e0a\u7684\u5730\u5740\u5176\u5b9e\u662f\u4e0d\u540c\u7684\u3002_linux tz\u73af\u5883\u53d8\u91cf","og_url":"https:\/\/www.wsisp.com\/helps\/9298.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T09:19:15+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418091913-68021911613dc.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/9298.html","url":"https:\/\/www.wsisp.com\/helps\/9298.html","name":"\u3010Linux\u3011\u6d45\u8c08\u73af\u5883\u53d8\u91cf\u548c\u8fdb\u7a0b\u5730\u5740\u7a7a\u95f4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T09:19:15+00:00","dateModified":"2025-04-18T09:19:15+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/9298.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/9298.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/9298.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010Linux\u3011\u6d45\u8c08\u73af\u5883\u53d8\u91cf\u548c\u8fdb\u7a0b\u5730\u5740\u7a7a\u95f4"}]},{"@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\/9298","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=9298"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/9298\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/9291"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=9298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=9298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=9298"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=9298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}