{"id":167464,"date":"2020-01-02T11:18:16","date_gmt":"2020-01-02T03:18:16","guid":{"rendered":"https:\/\/gulass.cn\/?p=167464"},"modified":"2019-12-23T11:19:57","modified_gmt":"2019-12-23T03:19:57","slug":"software-deploy-strace-debug","status":"publish","type":"post","link":"https:\/\/gulass.cn\/software-deploy-strace-debug.html","title":{"rendered":"\u5982\u4f55\u5728\u8f6f\u4ef6\u90e8\u7f72\u4e2d\u4f7f\u7528 strace \u8fdb\u884c\u8c03\u8bd5"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n<\/p>\n

\u6211\u7684\u5927\u90e8\u5206\u5de5\u4f5c\u90fd\u6d89\u53ca\u5230\u90e8\u7f72\u8f6f\u4ef6\u7cfb\u7edf\uff0c\u8fd9\u610f\u5473\u7740\u6211\u9700\u8981\u82b1\u8d39\u5f88\u591a\u65f6\u95f4\u6765\u89e3\u51b3\u4ee5\u4e0b\u95ee\u9898\uff1a\u8fd9\u4e2a\u8f6f\u4ef6\u53ef\u4ee5\u5728\u539f\u5f00\u53d1\u8005\u7684\u673a\u5668\u4e0a\u5de5\u4f5c\uff0c\u4f46\u662f\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u5728\u6211\u8fd9\u91cc\u8fd0\u884c\uff1f\u8fd9\u4e2a\u8f6f\u4ef6\u6628\u5929\u53ef\u4ee5\u5728\u6211\u7684\u673a\u5668\u4e0a\u5de5\u4f5c\uff0c\u4f46\u662f\u4e3a\u4ec0\u4e48\u4eca\u5929\u5c31\u4e0d\u884c\uff1f\u8fd9\u662f\u4e00\u79cd\u8c03\u8bd5\u7684\u7c7b\u578b\uff0c\u4f46\u662f\u4e0e\u4e00\u822c\u7684\u8f6f\u4ef6\u8c03\u8bd5\u6709\u6240\u4e0d\u540c\u3002\u4e00\u822c\u7684\u8c03\u8bd5\u901a\u5e38\u53ea\u5173\u5fc3\u4ee3\u7801\u7684\u903b\u8f91\uff0c\u4f46\u662f\u5728\u8f6f\u4ef6\u90e8\u7f72\u4e2d\u7684\u8c03\u8bd5\u5173\u6ce8\u7684\u662f\u7a0b\u5e8f\u7684\u4ee3\u7801\u548c\u5b83\u6240\u5728\u7684\u8fd0\u884c\u73af\u5883\u4e4b\u95f4\u7684\u76f8\u4e92\u5f71\u54cd\u3002\u5373\u4fbf\u95ee\u9898\u7684\u6839\u6e90\u662f\u4ee3\u7801\u7684\u903b\u8f91\u9519\u8bef\uff0c\u4f46\u8f6f\u4ef6\u663e\u7136\u53ef\u4ee5\u5728\u522b\u7684\u673a\u5668\u4e0a\u8fd0\u884c\u7684\u4e8b\u5b9e\u610f\u5473\u7740\u8fd9\u7c7b\u95ee\u9898\u4e0e\u8fd0\u884c\u73af\u5883\u5bc6\u5207\u76f8\u5173\u3002\u6240\u4ee5\uff0c\u5728\u8f6f\u4ef6\u90e8\u7f72\u8fc7\u7a0b\u4e2d\uff0c\u6211\u6ca1\u6709\u4f7f\u7528\u4f20\u7edf\u7684\u8c03\u8bd5\u5de5\u5177\uff0c\u800c\u662f\u9009\u62e9\u4e86\u5176\u5b83\u5de5\u5177\u8fdb\u884c\u8c03\u8bd5\u3002\u6211\u6700\u559c\u6b22\u7684\u7528\u6765\u89e3\u51b3\u201c\u4e3a\u4ec0\u4e48\u8fd9\u4e2a\u8f6f\u4ef6\u65e0\u6cd5\u5728\u8fd9\u53f0\u673a\u5668\u4e0a\u8fd0\u884c\uff1f\u201d\u8fd9\u7c7b\u95ee\u9898\u7684\u5de5\u5177\u5c31\u662fstrace\u3002<\/p>\n

<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u4ec0\u4e48\u662f strace\uff1f<\/strong><\/div>\n

strace\u662f\u4e00\u4e2a\u7528\u6765\u201c\u8ffd\u8e2a\u7cfb\u7edf\u8c03\u7528\u201d\u7684\u5de5\u5177\u3002\u5b83\u4e3b\u8981\u662f\u4e00\u4e2a Linux \u5de5\u5177\uff0c\u4f46\u662f\u4f60\u4e5f\u53ef\u4ee5\u5728\u5176\u5b83\u7cfb\u7edf\u4e0a\u4f7f\u7528\u7c7b\u4f3c\u7684\u5de5\u5177\u3002<\/p>\n

\u5b83\u7684\u57fa\u672c\u7528\u6cd5\u975e\u5e38\u7b80\u5355\u3002\u53ea\u9700\u8981\u5728strace\u00a0\u540e\u9762\u8ddf\u4e0a\u4f60\u9700\u8981\u8fd0\u884c\u7684\u547d\u4ee4\uff0c\u5b83\u5c31\u4f1a\u663e\u793a\u51fa\u8be5\u547d\u4ee4\u89e6\u53d1\u7684\u6240\u6709\u7cfb\u7edf\u8c03\u7528\uff08\u4f60\u53ef\u80fd\u9700\u8981\u5148\u5b89\u88c5\u597dstrace)\uff1a<\/p>\n

$ strace echo Hello\r\n...Snip lots of stuff...\r\nwrite(1, \"Hello\\n\", 6)                  = 6\r\nclose(1)                                = 0\r\nclose(2)                                = 0\r\nexit_group(0)                           = ?\r\n+++ exited with 0 +++<\/pre>\n

\u8fd9\u4e9b\u7cfb\u7edf\u8c03\u7528\u90fd\u662f\u4ec0\u4e48\uff1f\u5b83\u4eec\u5c31\u50cf\u662f\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838\u63d0\u4f9b\u7684 API\u3002\u5f88\u4e45\u4ee5\u524d\uff0c\u8f6f\u4ef6\u62e5\u6709\u76f4\u63a5\u8bbf\u95ee\u786c\u4ef6\u7684\u6743\u9650\u3002\u5982\u679c\u8f6f\u4ef6\u9700\u8981\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u4e00\u4e9b\u4e1c\u897f\uff0c\u5b83\u5c06\u4f1a\u4e0e\u89c6\u9891\u786c\u4ef6\u7684\u7aef\u53e3\u548c\u5185\u5b58\u6620\u5c04\u5bc4\u5b58\u5668\u7ea0\u7f20\u4e0d\u6e05\u3002\u5f53\u591a\u4efb\u52a1\u64cd\u4f5c\u7cfb\u7edf\u53d8\u5f97\u6d41\u884c\u4ee5\u540e\uff0c\u8fd9\u5c31\u5bfc\u81f4\u4e86\u6df7\u4e71\u7684\u5c40\u9762\uff0c\u56e0\u4e3a\u4e0d\u540c\u7684\u5e94\u7528\u7a0b\u5e8f\u5c06\u201c\u4e89\u593a\u201d\u786c\u4ef6\uff0c\u5e76\u4e14\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7684\u9519\u8bef\u53ef\u80fd\u81f4\u4f7f\u5176\u5b83\u5e94\u7528\u7a0b\u5e8f\u5d29\u6e83\uff0c\u751a\u81f3\u5bfc\u81f4\u6574\u4e2a\u7cfb\u7edf\u5d29\u6e83\u3002\u6240\u4ee5 CPU \u5f00\u59cb\u652f\u6301\u591a\u79cd\u4e0d\u540c\u7684\u7279\u6743\u6a21\u5f0f\uff08\u6216\u8005\u79f0\u4e3a\u201c\u4fdd\u62a4\u73af\u201d\uff09\u3002\u5b83\u4eec\u8ba9\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838\u5728\u5177\u6709\u5b8c\u5168\u786c\u4ef6\u8bbf\u95ee\u6743\u9650\u7684\u6700\u9ad8\u7279\u6743\u6a21\u5f0f\u4e0b\u8fd0\u884c\uff0c\u4e8e\u6b64\u540c\u65f6\uff0c\u5176\u5b83\u5728\u4f4e\u7279\u6743\u6a21\u5f0f\u4e0b\u8fd0\u884c\u7684\u5e94\u7528\u7a0b\u5e8f\u5fc5\u987b\u901a\u8fc7\u5411\u5185\u6838\u53d1\u8d77\u7cfb\u7edf\u8c03\u7528\u624d\u80fd\u591f\u4e0e\u786c\u4ef6\u8fdb\u884c\u4ea4\u4e92\u3002<\/p>\n

\u5728\u4e8c\u8fdb\u5236\u7ea7\u522b\u4e0a\uff0c\u53d1\u8d77\u7cfb\u7edf\u8c03\u7528\u76f8\u6bd4\u7b80\u5355\u7684\u51fd\u6570\u8c03\u7528\u6709\u4e00\u4e9b\u533a\u522b\uff0c\u4f46\u662f\u5927\u90e8\u5206\u7a0b\u5e8f\u90fd\u4f7f\u7528\u6807\u51c6\u5e93\u63d0\u4f9b\u7684\u5c01\u88c5\u51fd\u6570\u3002\u4f8b\u5982\uff0cPOSIX C \u6807\u51c6\u5e93\u5305\u542b\u4e00\u4e2a\u00a0write()<\/code>\u00a0\u51fd\u6570\uff0c\u8be5\u51fd\u6570\u5305\u542b\u7528\u4e8e\u8fdb\u884c\u00a0write<\/code>\u00a0\u7cfb\u7edf\u8c03\u7528\u7684\u6240\u6709\u4e0e\u786c\u4ef6\u4f53\u7cfb\u7ed3\u6784\u76f8\u5173\u7684\u4ee3\u7801\u3002<\/p>\n

\u7b80\u5355\u6765\u8bf4\uff0c\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u4e0e\u5176\u73af\u5883\uff08\u8ba1\u7b97\u673a\u7cfb\u7edf\uff09\u7684\u4ea4\u4e92\u90fd\u662f\u901a\u8fc7\u7cfb\u7edf\u8c03\u7528\u6765\u5b8c\u6210\u7684\u3002\u6240\u4ee5\u5f53\u8f6f\u4ef6\u5728\u4e00\u53f0\u673a\u5668\u4e0a\u53ef\u4ee5\u5de5\u4f5c\u4f46\u662f\u5728\u53e6\u4e00\u53f0\u673a\u5668\u65e0\u6cd5\u5de5\u4f5c\u7684\u65f6\u5019\uff0c\u8ffd\u8e2a\u7cfb\u7edf\u8c03\u7528\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u67e5\u9519\u65b9\u6cd5\u3002\u5177\u4f53\u5730\u8bf4\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u8ffd\u8e2a\u7cfb\u7edf\u8c03\u7528\u5206\u6790\u4ee5\u4e0b\u5178\u578b\u64cd\u4f5c\uff1a
\n\u63a7\u5236\u53f0\u8f93\u5165\u4e0e\u8f93\u51fa (IO)
\n\u7f51\u7edc IO
\n\u6587\u4ef6\u7cfb\u7edf\u8bbf\u95ee\u4ee5\u53ca\u6587\u4ef6 IO
\n\u8fdb\u7a0b\/\u7ebf\u7a0b\u751f\u547d\u5468\u671f\u7ba1\u7406
\n\u539f\u59cb\u5185\u5b58\u7ba1\u7406
\n\u8bbf\u95ee\u7279\u5b9a\u7684\u8bbe\u5907\u9a71\u52a8<\/p>\n

\u4ec0\u4e48\u65f6\u5019\u53ef\u4ee5\u4f7f\u7528 strace\uff1f<\/strong><\/div>\n

\u7406\u8bba\u4e0a\uff0cstrace\u00a0\u9002\u7528\u4e8e\u4efb\u4f55\u7528\u6237\u7a7a\u95f4\u7a0b\u5e8f\uff0c\u56e0\u4e3a\u6240\u6709\u7684\u7528\u6237\u7a7a\u95f4\u7a0b\u5e8f\u90fd\u9700\u8981\u8fdb\u884c\u7cfb\u7edf\u8c03\u7528\u3002strace\u5bf9\u4e8e\u5df2\u7f16\u8bd1\u7684\u4f4e\u7ea7\u7a0b\u5e8f\u6700\u6709\u6548\u679c\uff0c\u4f46\u5982\u679c\u4f60\u53ef\u4ee5\u907f\u514d\u8fd0\u884c\u65f6\u73af\u5883\u548c\u89e3\u91ca\u5668\u5e26\u6765\u7684\u5927\u91cf\u989d\u5916\u8f93\u51fa\uff0c\u5219\u4ecd\u7136\u53ef\u4ee5\u4e0e Python \u7b49\u9ad8\u7ea7\u8bed\u8a00\u7a0b\u5e8f\u4e00\u8d77\u4f7f\u7528\u3002<\/p>\n

\u5f53\u8f6f\u4ef6\u5728\u4e00\u53f0\u673a\u5668\u4e0a\u6b63\u5e38\u5de5\u4f5c\uff0c\u4f46\u5728\u53e6\u4e00\u53f0\u673a\u5668\u4e0a\u5374\u4e0d\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u540c\u65f6\u629b\u51fa\u4e86\u6709\u5173\u6587\u4ef6\u3001\u6743\u9650\u6216\u8005\u4e0d\u80fd\u8fd0\u884c\u67d0\u67d0\u547d\u4ee4\u7b49\u6a21\u7cca\u7684\u9519\u8bef\u4fe1\u606f\u65f6\uff0cstrace\u00a0\u5f80\u5f80\u80fd\u5927\u663e\u8eab\u624b\u3002\u4e0d\u5e78\u7684\u662f\uff0c\u5b83\u4e0d\u80fd\u8bca\u65ad\u9ad8\u7b49\u7ea7\u7684\u95ee\u9898\uff0c\u4f8b\u5982\u6570\u5b57\u8bc1\u4e66\u9a8c\u8bc1\u9519\u8bef\u7b49\u3002\u8fd9\u4e9b\u95ee\u9898\u901a\u5e38\u9700\u8981\u7ec4\u5408\u4f7f\u7528strace\uff08\u6709\u65f6\u5019\u662fltrace\uff09\u548c\u5176\u5b83\u9ad8\u7ea7\u5de5\u5177\uff08\u4f8b\u5982\u4f7f\u7528openssl\u547d\u4ee4\u884c\u5de5\u5177\u8c03\u8bd5\u6570\u5b57\u8bc1\u4e66\u9519\u8bef\uff09\u3002<\/p>\n

\u672c\u6587\u4e2d\u7684\u793a\u4f8b\u57fa\u4e8e\u72ec\u7acb\u7684\u670d\u52a1\u5668\uff0c\u4f46\u662f\u5bf9\u7cfb\u7edf\u8c03\u7528\u7684\u8ffd\u8e2a\u901a\u5e38\u4e5f\u53ef\u4ee5\u5728\u66f4\u590d\u6742\u7684\u90e8\u7f72\u5e73\u53f0\u4e0a\u5b8c\u6210\uff0c\u4ec5\u9700\u8981\u627e\u5230\u5408\u9002\u7684\u5de5\u5177\u3002<\/p>\n

\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50<\/strong><\/div>\n

\u5047\u8bbe\u4f60\u6b63\u5728\u5c1d\u8bd5\u8fd0\u884c\u4e00\u4e2a\u53eb\u505afoo\u7684\u670d\u52a1\u5668\u5e94\u7528\u7a0b\u5e8f\uff0c\u4f46\u662f\u53d1\u751f\u4e86\u4ee5\u4e0b\u60c5\u51b5\uff1a<\/p>\n

\r\n$ foo\r\nError opening configuration file: No such file or directory\r\n<\/pre>\n

\u663e\u7136\uff0c\u5b83\u6ca1\u6709\u627e\u5230\u4f60\u5df2\u7ecf\u5199\u597d\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u4e4b\u6240\u4ee5\u4f1a\u53d1\u751f\u8fd9\u79cd\u60c5\u51b5\uff0c\u662f\u56e0\u4e3a\u5305\u7ba1\u7406\u5de5\u5177\u6709\u65f6\u5019\u5728\u7f16\u8bd1\u5e94\u7528\u7a0b\u5e8f\u65f6\u6307\u5b9a\u4e86\u81ea\u5b9a\u4e49\u7684\u8def\u5f84\uff0c\u6240\u4ee5\u4f60\u5e94\u5f53\u9075\u5faa\u7279\u5b9a\u53d1\u884c\u7248\u63d0\u4f9b\u7684\u5b89\u88c5\u6307\u5357\u3002\u5982\u679c\u9519\u8bef\u4fe1\u606f\u544a\u8bc9\u4f60\u6b63\u786e\u7684\u914d\u7f6e\u6587\u4ef6\u5e94\u8be5\u5728\u4ec0\u4e48\u5730\u65b9\uff0c\u4f60\u5c31\u53ef\u4ee5\u5728\u51e0\u79d2\u949f\u5185\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u4f46\u5982\u679c\u6ca1\u6709\u544a\u8bc9\u4f60\u5462\uff1f\u4f60\u8be5\u5982\u4f55\u627e\u5230\u6b63\u786e\u7684\u8def\u5f84\uff1f<\/p>\n

\u5982\u679c\u4f60\u6709\u6743\u8bbf\u95ee\u6e90\u4ee3\u7801\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u9605\u8bfb\u6e90\u4ee3\u7801\u6765\u89e3\u51b3\u95ee\u9898\u3002\u8fd9\u662f\u4e00\u4e2a\u597d\u7684\u5907\u7528\u8ba1\u5212\uff0c\u4f46\u4e0d\u662f\u6700\u5feb\u7684\u89e3\u51b3\u65b9\u6848\u3002\u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528\u7c7b\u4f3cgdb\u7684\u5355\u6b65\u8c03\u8bd5\u5668\u6765\u89c2\u5bdf\u7a0b\u5e8f\u7684\u884c\u4e3a\uff0c\u4f46\u4f7f\u7528\u4e13\u95e8\u7528\u4e8e\u5c55\u793a\u7a0b\u5e8f\u4e0e\u7cfb\u7edf\u73af\u5883\u4ea4\u4e92\u4f5c\u7528\u7684\u5de5\u5177strace\u66f4\u52a0\u6709\u6548\u3002<\/p>\n

\u4e00\u5f00\u59cb\uff0cstrace\u00a0\u4ea7\u751f\u7684\u5927\u91cf\u8f93\u51fa\u53ef\u80fd\u4f1a\u8ba9\u4f60\u4e0d\u77e5\u6240\u63aa\uff0c\u5e78\u597d\u4f60\u53ef\u4ee5\u5ffd\u7565\u5176\u4e2d\u5927\u90e8\u5206\u7684\u65e0\u7528\u4fe1\u606f\u3002\u6211\u7ecf\u5e38\u4f7f\u7528-o\u53c2\u6570\u628a\u8f93\u51fa\u7684\u8ffd\u8e2a\u7ed3\u679c\u4fdd\u5b58\u5230\u5355\u72ec\u7684\u6587\u4ef6\u91cc\uff1a<\/p>\n

$ strace -o \/tmp\/trace foo\r\nError opening configuration file: No such file or directory\r\n$ cat \/tmp\/trace\r\nexecve(\"foo\", [\"foo\"], 0x7ffce98dc010 \/* 16 vars *\/) = 0\r\nbrk(NULL)                               = 0x56363b3fb000\r\naccess(\"\/etc\/ld.so.preload\", R_OK)      = -1 ENOENT (No such file or directory)\r\nopenat(AT_FDCWD, \"\/etc\/ld.so.cache\", O_RDONLY|O_CLOEXEC) = 3\r\nfstat(3, {st_mode=S_IFREG|0644, st_size=25186, ...}) = 0\r\nmmap(NULL, 25186, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2f12cf1000\r\nclose(3)                                = 0\r\nopenat(AT_FDCWD, \"\/lib\/x86_64-linux-gnu\/libc.so.6\", O_RDONLY|O_CLOEXEC) = 3\r\nread(3, \"\\177ELF\\2\\1\\1\\3\\0\\0\\0\\0\\0\\0\\0\\0\\3\\0>\\0\\1\\0\\0\\0\\260A\\2\\0\\0\\0\\0\\0\"..., 832) = 832\r\nfstat(3, {st_mode=S_IFREG|0755, st_size=1824496, ...}) = 0\r\nmmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2f12cef000\r\nmmap(NULL, 1837056, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2f12b2e000\r\nmprotect(0x7f2f12b50000, 1658880, PROT_NONE) = 0\r\nmmap(0x7f2f12b50000, 1343488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f2f12b50000\r\nmmap(0x7f2f12c98000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16a000) = 0x7f2f12c98000\r\nmmap(0x7f2f12ce5000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b6000) = 0x7f2f12ce5000\r\nmmap(0x7f2f12ceb000, 14336, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2f12ceb000\r\nclose(3)                                = 0\r\narch_prctl(ARCH_SET_FS, 0x7f2f12cf0500) = 0\r\nmprotect(0x7f2f12ce5000, 16384, PROT_READ) = 0\r\nmprotect(0x56363b08b000, 4096, PROT_READ) = 0\r\nmprotect(0x7f2f12d1f000, 4096, PROT_READ) = 0\r\nmunmap(0x7f2f12cf1000, 25186)           = 0\r\nopenat(AT_FDCWD, \"\/etc\/foo\/config.json\", O_RDONLY) = -1 ENOENT (No such file or directory)\r\ndup(2)                                  = 3\r\nfcntl(3, F_GETFL)                       = 0x2 (flags O_RDWR)\r\nbrk(NULL)                               = 0x56363b3fb000\r\nbrk(0x56363b41c000)                     = 0x56363b41c000\r\nfstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x8), ...}) = 0\r\nwrite(3, \"Error opening configuration file\"..., 60) = 60\r\nclose(3)                                = 0\r\nexit_group(1)                           = ?\r\n+++ exited with 1 +++<\/pre>\n

strace<\/code>\u00a0\u8f93\u51fa\u7684\u7b2c\u4e00\u9875\u901a\u5e38\u662f\u4f4e\u7ea7\u7684\u8fdb\u7a0b\u542f\u52a8\u8fc7\u7a0b\u3002\uff08\u4f60\u53ef\u4ee5\u770b\u5230\u5f88\u591a\u00a0mmap<\/code>\u3001mprotect<\/code>\u3001brk<\/code>\u00a0\u8c03\u7528\uff0c\u8fd9\u662f\u7528\u6765\u5206\u914d\u539f\u59cb\u5185\u5b58\u548c\u6620\u5c04\u52a8\u6001\u94fe\u63a5\u5e93\u7684\u3002\uff09\u5b9e\u9645\u4e0a\uff0c\u5728\u67e5\u627e\u9519\u8bef\u65f6\uff0c\u6700\u597d\u4ece\u4e0b\u5f80\u4e0a\u9605\u8bfb\u00a0strace<\/code>\u00a0\u7684\u8f93\u51fa\u3002\u4f60\u53ef\u4ee5\u770b\u5230\u00a0write<\/code>\u00a0\u8c03\u7528\u5728\u6700\u540e\u8fd4\u56de\u4e86\u9519\u8bef\u4fe1\u606f\u3002\u5982\u679c\u4f60\u5411\u4e0a\u627e\uff0c\u4f60\u5c06\u4f1a\u770b\u5230\u7b2c\u4e00\u4e2a\u5931\u8d25\u7684\u7cfb\u7edf\u8c03\u7528\u662f\u00a0openat<\/code>\uff0c\u5b83\u5728\u5c1d\u8bd5\u6253\u5f00\u00a0\/etc\/foo\/config.json<\/code>\u00a0\u65f6\u629b\u51fa\u4e86\u00a0ENOENT<\/code>\u00a0(\u201cNo such file or directory\u201d)\u7684\u9519\u8bef\u3002\u73b0\u5728\u6211\u4eec\u5df2\u7ecf\u77e5\u9053\u4e86\u914d\u7f6e\u6587\u4ef6\u5e94\u8be5\u653e\u5728\u54ea\u91cc\u3002<\/p>\n

\u8fd9\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u4f46\u6211\u6562\u8bf4\u5728 90% \u7684\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528\u00a0strace<\/code>\u00a0\u8fdb\u884c\u8c03\u8bd5\u4e0d\u9700\u8981\u66f4\u591a\u590d\u6742\u7684\u5de5\u4f5c\u3002\u4ee5\u4e0b\u662f\u5b8c\u6574\u7684\u8c03\u8bd5\u6b65\u9aa4\uff1a
\n\u4ece\u7a0b\u5e8f\u4e2d\u83b7\u5f97\u542b\u7cca\u4e0d\u6e05\u7684\u9519\u8bef\u4fe1\u606f
\n\u4f7f\u7528 strace \u8fd0\u884c\u7a0b\u5e8f
\n\u5728\u8f93\u51fa\u4e2d\u627e\u5230\u9519\u8bef\u4fe1\u606f
\n\u5f80\u524d\u8ffd\u6eaf\u5e76\u627e\u5230\u7b2c\u4e00\u4e2a\u5931\u8d25\u7684\u7cfb\u7edf\u8c03\u7528
\n\u7b2c\u56db\u6b65\u4e2d\u7684\u7cfb\u7edf\u8c03\u7528\u5f88\u53ef\u80fd\u5411\u4f60\u663e\u793a\u51fa\u95ee\u9898\u6240\u5728\u3002<\/p>\n

\u5c0f\u6280\u5de7<\/strong><\/div>\n

\u5728\u5f00\u59cb\u66f4\u52a0\u590d\u6742\u7684\u8c03\u8bd5\u4e4b\u524d\uff0c\u8fd9\u91cc\u6709\u4e00\u4e9b\u6709\u7528\u7684\u8c03\u8bd5\u6280\u5de7\u5e2e\u52a9\u4f60\u9ad8\u6548\u4f7f\u7528\u00a0strace<\/code>\uff1a<\/p>\n

man \u662f\u4f60\u7684\u670b\u53cb<\/strong><\/span><\/div>\n

\u5728\u5f88\u591a *nix \u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u00a0man syscalls<\/code>\u00a0\u67e5\u770b\u7cfb\u7edf\u8c03\u7528\u7684\u5217\u8868\u3002\u4f60\u5c06\u4f1a\u770b\u5230\u7c7b\u4f3c\u4e8e\u00a0brk(2)<\/code>\u00a0\u4e4b\u7c7b\u7684\u4e1c\u897f\uff0c\u8fd9\u610f\u5473\u7740\u4f60\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c\u00a0man 2 brk<\/code>\u00a0\u5f97\u5230\u4e0e\u6b64\u76f8\u5173\u7684\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n

\u4e00\u4e2a\u5c0f\u95ee\u9898\uff1aman 2 fork<\/code>\u00a0\u4f1a\u663e\u793a\u51fa\u5728 GNU\u00a0libc<\/code>\u00a0\u91cc\u5c01\u88c5\u7684\u00a0fork()<\/code>\u00a0\u624b\u518c\u9875\uff0c\u800c\u00a0fork()<\/code>\u00a0\u73b0\u5728\u5b9e\u9645\u4e0a\u662f\u7531\u00a0clone<\/code>\u00a0\u7cfb\u7edf\u8c03\u7528\u5b9e\u73b0\u7684\u3002fork<\/code>\u00a0\u7684\u8bed\u4e49\u4e0e\u00a0clone<\/code>\u00a0\u76f8\u540c\uff0c\u4f46\u662f\u5982\u679c\u6211\u5199\u4e86\u4e00\u4e2a\u542b\u6709\u00a0fork()<\/code>\u00a0\u7684\u7a0b\u5e8f\u5e76\u4f7f\u7528\u00a0strace<\/code>\u00a0\u53bb\u8c03\u8bd5\u5b83\uff0c\u6211\u5c06\u627e\u4e0d\u5230\u4efb\u4f55\u5173\u4e8e\u00a0fork<\/code>\u00a0\u8c03\u7528\u7684\u4fe1\u606f\uff0c\u53ea\u80fd\u770b\u5230\u00a0clone<\/code>\u00a0\u8c03\u7528\u3002\u5982\u679c\u5c06\u6e90\u4ee3\u7801\u4e0e\u00a0strace<\/code>\u00a0\u7684\u8f93\u51fa\u8fdb\u884c\u6bd4\u8f83\u7684\u65f6\u5019\uff0c\u50cf\u8fd9\u79cd\u95ee\u9898\u4f1a\u8ba9\u4eba\u611f\u5230\u56f0\u60d1\u3002<\/p>\n

\u4f7f\u7528 -o \u5c06\u8f93\u51fa\u4fdd\u5b58\u5230\u6587\u4ef6<\/strong><\/span><\/div>\n

strace<\/code>\u00a0\u53ef\u4ee5\u751f\u6210\u5f88\u591a\u8f93\u51fa\uff0c\u6240\u4ee5\u5c06\u8f93\u51fa\u4fdd\u5b58\u5230\u5355\u72ec\u7684\u6587\u4ef6\u662f\u5f88\u6709\u5e2e\u52a9\u7684\uff08\u5c31\u50cf\u4e0a\u9762\u7684\u4f8b\u5b50\u4e00\u6837\uff09\u3002\u5b83\u8fd8\u80fd\u591f\u5728\u63a7\u5236\u53f0\u4e2d\u907f\u514d\u7a0b\u5e8f\u81ea\u8eab\u7684\u8f93\u51fa\u4e0e\u00a0strace<\/code>\u00a0\u7684\u8f93\u51fa\u53d1\u751f\u6df7\u6dc6\u3002<\/p>\n

\u4f7f\u7528 -s \u67e5\u770b\u66f4\u591a\u7684\u53c2\u6570<\/strong><\/span><\/div>\n

\u4f60\u53ef\u80fd\u5df2\u7ecf\u6ce8\u610f\u5230\uff0c\u9519\u8bef\u4fe1\u606f\u7684\u7b2c\u4e8c\u90e8\u5206\u6ca1\u6709\u51fa\u73b0\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\u3002\u8fd9\u662f\u56e0\u4e3a\u00a0strace<\/code>\u00a0\u9ed8\u8ba4\u4ec5\u663e\u793a\u5b57\u7b26\u4e32\u53c2\u6570\u7684\u524d 32 \u4e2a\u5b57\u8282\u3002\u5982\u679c\u4f60\u9700\u8981\u6355\u83b7\u66f4\u591a\u53c2\u6570\uff0c\u8bf7\u5411\u00a0strace<\/code>\u00a0\u8ffd\u52a0\u7c7b\u4f3c\u4e8e\u00a0-s 128<\/code>\u00a0\u4e4b\u7c7b\u7684\u53c2\u6570\u3002<\/p>\n

-y \u4f7f\u5f97\u8ffd\u8e2a\u6587\u4ef6\u6216\u5957\u63a5\u5b57\u66f4\u52a0\u5bb9\u6613<\/strong><\/span><\/div>\n

\u201c\u4e00\u5207\u7686\u6587\u4ef6\u201d\u610f\u5473\u7740 *nix \u7cfb\u7edf\u901a\u8fc7\u6587\u4ef6\u63cf\u8ff0\u7b26\u8fdb\u884c\u6240\u6709 IO \u64cd\u4f5c\uff0c\u4e0d\u7ba1\u662f\u771f\u5b9e\u7684\u6587\u4ef6\u8fd8\u662f\u901a\u8fc7\u7f51\u7edc\u6216\u8005\u8fdb\u7a0b\u95f4\u7ba1\u9053\u3002\u8fd9\u5bf9\u4e8e\u7f16\u7a0b\u800c\u8a00\u662f\u5f88\u65b9\u4fbf\u7684\uff0c\u4f46\u662f\u5728\u8ffd\u8e2a\u7cfb\u7edf\u8c03\u7528\u65f6\uff0c\u4f60\u5c06\u5f88\u96be\u5206\u8fa8\u51fa\u00a0read<\/code>\u00a0\u548c\u00a0write<\/code>\u00a0\u7684\u771f\u5b9e\u884c\u4e3a\u3002<\/p>\n

-y<\/code>\u00a0\u53c2\u6570\u4f7f\u00a0strace<\/code>\u00a0\u5728\u6ce8\u91ca\u4e2d\u6ce8\u660e\u6bcf\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\u7684\u5177\u4f53\u6307\u5411\u3002<\/p>\n

\u4f7f\u7528 -p \u9644\u52a0\u5230\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u4e2d<\/strong><\/span><\/div>\n

\u6b63\u5982\u6211\u4eec\u5c06\u5728\u540e\u9762\u7684\u4f8b\u5b50\u4e2d\u770b\u5230\u7684\uff0c\u6709\u65f6\u5019\u4f60\u60f3\u8ffd\u8e2a\u4e00\u4e2a\u6b63\u5728\u8fd0\u884c\u7684\u7a0b\u5e8f\u3002\u5982\u679c\u4f60\u77e5\u9053\u8fd9\u4e2a\u7a0b\u5e8f\u7684\u8fdb\u7a0b\u53f7\u4e3a 1337 \uff08\u53ef\u4ee5\u901a\u8fc7\u00a0ps<\/code>\u00a0\u67e5\u8be2\uff09\uff0c\u5219\u53ef\u4ee5\u8fd9\u6837\u64cd\u4f5c\uff1a<\/p>\n

$ strace -p 1337\r\n...system call trace output...<\/pre>\n

\u4f60\u53ef\u80fd\u9700\u8981 root \u6743\u9650\u624d\u80fd\u8fd0\u884c\u3002<\/p>\n

\u4f7f\u7528 -f \u8ffd\u8e2a\u5b50\u8fdb\u7a0b<\/strong><\/span><\/div>\n

strace<\/code>\u00a0\u9ed8\u8ba4\u53ea\u8ffd\u8e2a\u4e00\u4e2a\u8fdb\u7a0b\u3002\u5982\u679c\u8fd9\u4e2a\u8fdb\u7a0b\u4ea7\u751f\u4e86\u4e00\u4e2a\u5b50\u8fdb\u7a0b\uff0c\u4f60\u5c06\u4f1a\u770b\u5230\u521b\u5efa\u5b50\u8fdb\u7a0b\u7684\u7cfb\u7edf\u8c03\u7528\uff08\u4e00\u822c\u662f\u00a0clone<\/code>\uff09\uff0c\u4f46\u662f\u4f60\u770b\u4e0d\u5230\u5b50\u8fdb\u7a0b\u5185\u89e6\u53d1\u7684\u4efb\u4f55\u8c03\u7528\u3002<\/p>\n

\u5982\u679c\u4f60\u8ba4\u4e3a\u5728\u5b50\u8fdb\u7a0b\u4e2d\u5b58\u5728\u9519\u8bef\uff0c\u5219\u9700\u8981\u4f7f\u7528\u00a0-f<\/code>\u00a0\u53c2\u6570\u542f\u7528\u5b50\u8fdb\u7a0b\u8ffd\u8e2a\u529f\u80fd\u3002\u8fd9\u6837\u505a\u7684\u7f3a\u70b9\u662f\u8f93\u51fa\u7684\u5185\u5bb9\u4f1a\u8ba9\u4eba\u66f4\u52a0\u56f0\u60d1\u3002\u5f53\u8ffd\u8e2a\u4e00\u4e2a\u8fdb\u7a0b\u65f6\uff0cstrace<\/code>\u00a0\u663e\u793a\u7684\u662f\u5355\u4e2a\u8c03\u7528\u4e8b\u4ef6\u6d41\u3002\u5f53\u8ffd\u8e2a\u591a\u4e2a\u8fdb\u7a0b\u7684\u65f6\u5019\uff0c\u4f60\u5c06\u4f1a\u770b\u5230\u4ee5\u00a0<unfinished ...><\/code>\u00a0\u5f00\u59cb\u7684\u521d\u59cb\u8c03\u7528\uff0c\u63a5\u7740\u662f\u4e00\u7cfb\u5217\u9488\u5bf9\u5176\u5b83\u7ebf\u7a0b\u7684\u8c03\u7528\uff0c\u6700\u540e\u624d\u51fa\u73b0\u4ee5\u00a0<... foocall resumed><\/code>\u00a0\u7ed3\u675f\u7684\u521d\u59cb\u8c03\u7528\u3002\u6b64\u5916\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u00a0-ff<\/code>\u00a0\u53c2\u6570\u5c06\u6240\u6709\u7684\u8c03\u7528\u5206\u79bb\u5230\u4e0d\u540c\u7684\u6587\u4ef6\u4e2d\uff08\u67e5\u770b\u00a0strace \u624b\u518c<\/a>\u00a0\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\uff09\u3002<\/p>\n

\u4f7f\u7528 -e \u8fdb\u884c\u8fc7\u6ee4<\/strong><\/span><\/div>\n

\u6b63\u5982\u4f60\u6240\u770b\u5230\u7684\uff0c\u9ed8\u8ba4\u7684\u8ffd\u8e2a\u8f93\u51fa\u662f\u6240\u6709\u7684\u7cfb\u7edf\u8c03\u7528\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u00a0-e<\/code>\u00a0\u53c2\u6570\u8fc7\u6ee4\u4f60\u9700\u8981\u8ffd\u8e2a\u7684\u8c03\u7528\uff08\u67e5\u770bstrace \u624b\u518c\uff09\u3002\u8fd9\u6837\u505a\u7684\u597d\u5904\u662f\u8fd0\u884c\u8fc7\u6ee4\u540e\u7684\u00a0strace<\/code>\u00a0\u6bd4\u8d77\u4f7f\u7528\u00a0grep<\/code>\u00a0\u8fdb\u884c\u4e8c\u6b21\u8fc7\u6ee4\u8981\u66f4\u5feb\u3002\u8001\u5b9e\u8bf4\uff0c\u6211\u5927\u90e8\u5206\u65f6\u95f4\u90fd\u4e0d\u4f1a\u88ab\u6253\u6270\u3002<\/p>\n

\u5e76\u975e\u6240\u6709\u7684\u9519\u8bef\u90fd\u662f\u4e0d\u597d\u7684<\/strong><\/span><\/div>\n

\u4e00\u4e2a\u7b80\u5355\u800c\u5e38\u7528\u7684\u4f8b\u5b50\u662f\u4e00\u4e2a\u7a0b\u5e8f\u5728\u591a\u4e2a\u4f4d\u7f6e\u641c\u7d22\u6587\u4ef6\uff0c\u4f8b\u5982 shell \u641c\u7d22\u54ea\u4e2a\u00a0bin\/<\/code>\u00a0\u76ee\u5f55\u5305\u542b\u53ef\u6267\u884c\u6587\u4ef6\uff1a<\/p>\n

\r\n$ strace sh -c uname\r\n...\r\nstat(\"\/home\/user\/bin\/uname\", 0x7ffceb817820) = -1 ENOENT (No such file or directory)\r\nstat(\"\/usr\/local\/bin\/uname\", 0x7ffceb817820) = -1 ENOENT (No such file or directory)\r\nstat(\"\/usr\/bin\/uname\", {st_mode=S_IFREG|0755, st_size=39584, ...}) = 0\r\n...\r\n<\/pre>\n

\u201c\u9519\u8bef\u4fe1\u606f\u4e4b\u524d\u7684\u6700\u540e\u4e00\u6b21\u5931\u8d25\u8c03\u7528\u201d\u8fd9\u79cd\u542f\u53d1\u5f0f\u65b9\u6cd5\u975e\u5e38\u9002\u5408\u4e8e\u67e5\u627e\u9519\u8bef\u3002\u65e0\u8bba\u5982\u4f55\uff0c\u81ea\u4e0b\u800c\u4e0a\u5730\u67e5\u627e\u662f\u6709\u9053\u7406\u7684\u3002<\/p>\n

C \u7f16\u7a0b\u6307\u5357\u975e\u5e38\u6709\u52a9\u4e8e\u7406\u89e3\u7cfb\u7edf\u8c03\u7528<\/strong><\/span><\/div>\n

\u6807\u51c6 C \u5e93\u51fd\u6570\u8c03\u7528\u4e0d\u5c5e\u4e8e\u7cfb\u7edf\u8c03\u7528\uff0c\u4f46\u5b83\u4eec\u4ec5\u662f\u7cfb\u7edf\u8c03\u7528\u4e4b\u4e0a\u7684\u552f\u4e00\u4e00\u4e2a\u8584\u5c42\u3002\u6240\u4ee5\u5982\u679c\u4f60\u4e86\u89e3\uff08\u751a\u81f3\u53ea\u662f\u7565\u77e5\u4e00\u4e8c\uff09\u5982\u4f55\u4f7f\u7528 C \u8bed\u8a00\uff0c\u90a3\u4e48\u9605\u8bfb\u7cfb\u7edf\u8c03\u7528\u8ffd\u8e2a\u4fe1\u606f\u5c31\u975e\u5e38\u5bb9\u6613\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u5728\u8c03\u8bd5\u7f51\u7edc\u7cfb\u7edf\u8c03\u7528\uff0c\u4f60\u53ef\u4ee5\u5c1d\u8bd5\u7565\u8bfb\u00a0Beej \u7ecf\u5178\u7684\u300a\u7f51\u7edc\u7f16\u7a0b\u6307\u5357\u300b\u3002<\/p>\n

\u4e00\u4e2a\u66f4\u590d\u6742\u7684\u8c03\u8bd5\u4f8b\u5b50<\/strong><\/div>\n

\u5c31\u50cf\u6211\u8bf4\u7684\u90a3\u6837\uff0c\u7b80\u5355\u7684\u8c03\u8bd5\u4f8b\u5b50\u8868\u73b0\u4e86\u6211\u5728\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\u5982\u4f55\u4f7f\u7528\u00a0strace<\/code>\u3002\u7136\u800c\uff0c\u6709\u65f6\u5019\u9700\u8981\u4e00\u4e9b\u66f4\u52a0\u7ec6\u81f4\u7684\u5de5\u4f5c\uff0c\u6240\u4ee5\u8fd9\u91cc\u6709\u4e00\u4e2a\u7a0d\u5fae\u590d\u6742\uff08\u4e14\u771f\u5b9e\uff09\u7684\u4f8b\u5b50\u3002<\/p>\n

bcron\u00a0\u662f\u4e00\u4e2a\u4efb\u52a1\u8c03\u5ea6\u5668\uff0c\u5b83\u662f\u7ecf\u5178 *nix\u00a0cron<\/code>\u00a0\u5b88\u62a4\u7a0b\u5e8f\u7684\u53e6\u4e00\u79cd\u5b9e\u73b0\u3002\u5b83\u5df2\u7ecf\u88ab\u5b89\u88c5\u5230\u4e00\u53f0\u670d\u52a1\u5668\u4e0a\uff0c\u4f46\u662f\u5f53\u6709\u4eba\u5c1d\u8bd5\u7f16\u8f91\u4f5c\u4e1a\u65f6\u95f4\u8868\u65f6\uff0c\u53d1\u751f\u4e86\u4ee5\u4e0b\u60c5\u51b5\uff1a<\/p>\n

# crontab -e -u logs\r\nbcrontab: Fatal: Could not create temporary file<\/pre>\n

\u597d\u7684\uff0c\u73b0\u5728 bcron \u5c1d\u8bd5\u5199\u5165\u4e00\u4e9b\u6587\u4ef6\uff0c\u4f46\u662f\u5b83\u5931\u8d25\u4e86\uff0c\u4e5f\u6ca1\u6709\u544a\u8bc9\u6211\u4eec\u539f\u56e0\u3002\u4ee5\u4e0b\u662f\u00a0strace<\/code>\u00a0\u7684\u8f93\u51fa\uff1a<\/p>\n

# strace -o \/tmp\/trace crontab -e -u logs\r\nbcrontab: Fatal: Could not create temporary file\r\n# cat \/tmp\/trace\r\n...\r\nopenat(AT_FDCWD, \"bcrontab.14779.1573691864.847933\", O_RDONLY) = 3\r\nmmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82049b4000\r\nread(3, \"#Ansible: logsagg\\n20 14 * * * lo\"..., 8192) = 150\r\nread(3, \"\", 8192)                       = 0\r\nmunmap(0x7f82049b4000, 8192)            = 0\r\nclose(3)                                = 0\r\nsocket(AF_UNIX, SOCK_STREAM, 0)         = 3\r\nconnect(3, {sa_family=AF_UNIX, sun_path=\"\/var\/run\/bcron-spool\"}, 110) = 0\r\nmmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82049b4000\r\nwrite(3, \"156:Slogs\\0#Ansible: logsagg\\n20 1\"..., 161) = 161\r\nread(3, \"32:ZCould not create temporary f\"..., 8192) = 36\r\nmunmap(0x7f82049b4000, 8192)            = 0\r\nclose(3)                                = 0\r\nwrite(2, \"bcrontab: Fatal: Could not creat\"..., 49) = 49\r\nunlink(\"bcrontab.14779.1573691864.847933\") = 0\r\nexit_group(111)                         = ?\r\n+++ exited with 111 +++<\/pre>\n

\u5728\u7a0b\u5e8f\u7ed3\u675f\u4e4b\u524d\u6709\u4e00\u4e2a\u00a0write<\/code>\u00a0\u7684\u9519\u8bef\u4fe1\u606f\uff0c\u4f46\u662f\u8fd9\u6b21\u6709\u4e9b\u4e0d\u540c\u3002\u9996\u5148\uff0c\u5728\u6b64\u4e4b\u524d\u6ca1\u6709\u4efb\u4f55\u76f8\u5173\u7684\u5931\u8d25\u7cfb\u7edf\u8c03\u7528\u3002\u5176\u6b21\uff0c\u6211\u4eec\u770b\u5230\u8fd9\u4e2a\u9519\u8bef\u4fe1\u606f\u662f\u7531\u00a0read<\/code>\u00a0\u4ece\u522b\u7684\u5730\u65b9\u8bfb\u53d6\u800c\u6765\u7684\u3002\u8fd9\u770b\u8d77\u6765\u50cf\u662f\u771f\u6b63\u7684\u9519\u8bef\u53d1\u751f\u5728\u522b\u7684\u5730\u65b9\uff0c\u800c\u00a0bcrontab<\/code>\u00a0\u53ea\u662f\u5728\u8f6c\u64ad\u8fd9\u4e9b\u4fe1\u606f\u3002<\/p>\n

\u5982\u679c\u4f60\u67e5\u9605\u4e86\u00a0man 2 read<\/code>\uff0c\u4f60\u5c06\u4f1a\u770b\u5230\u00a0read<\/code>\u00a0\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570 (3<\/code>) \u662f\u4e00\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\uff0c\u8fd9\u662f *nix \u64cd\u4f5c\u7cfb\u7edf\u7528\u4e8e\u6240\u6709 IO \u64cd\u4f5c\u7684\u53e5\u67c4\u3002\u4f60\u8be5\u5982\u4f55\u77e5\u9053\u6587\u4ef6\u63cf\u8ff0\u7b26 3 \u4ee3\u8868\u4ec0\u4e48\uff1f\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u00a0-y<\/code>\u00a0\u53c2\u6570\u8fd0\u884c\u00a0strace<\/code>\uff08\u5982\u4e0a\u6587\u6240\u8ff0\uff09\uff0c\u5b83\u5c06\u4f1a\u5728\u6ce8\u91ca\u91cc\u544a\u8bc9\u4f60\u6587\u4ef6\u63cf\u8ff0\u7b26\u7684\u5177\u4f53\u6307\u5411\uff0c\u4f46\u662f\u4e86\u89e3\u5982\u4f55\u4ece\u4e0a\u9762\u8fd9\u79cd\u8f93\u51fa\u4e2d\u5206\u6790\u8ffd\u8e2a\u7ed3\u679c\u662f\u5f88\u6709\u7528\u7684\u3002<\/p>\n

\u4e00\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\u53ef\u4ee5\u6765\u81ea\u4e8e\u8bb8\u591a\u7cfb\u7edf\u8c03\u7528\u4e4b\u4e00\uff08\u8fd9\u53d6\u51b3\u4e8e\u5b83\u662f\u7528\u4e8e\u63a7\u5236\u53f0\u3001\u7f51\u7edc\u5957\u63a5\u5b57\u8fd8\u662f\u771f\u5b9e\u6587\u4ef6\u7b49\u7684\u63cf\u8ff0\u7b26\uff09\uff0c\u4f46\u4e0d\u8bba\u5982\u4f55\uff0c\u6211\u4eec\u90fd\u53ef\u4ee5\u641c\u7d22\u8fd4\u56de\u503c\u4e3a\u00a03<\/code>\u00a0\u7684\u7cfb\u7edf\u8c03\u7528\uff08\u4f8b\u5982\uff0c\u5728\u00a0strace<\/code>\u00a0\u7684\u8f93\u51fa\u4e2d\u67e5\u627e\u00a0=3<\/code>\uff09\u3002\u5728\u8fd9\u6b21\u00a0strace<\/code>\u00a0\u4e2d\u53ef\u4ee5\u770b\u5230\u6709\u4e24\u4e2a\u8fd9\u6837\u7684\u8c03\u7528\uff1a\u6700\u4e0a\u9762\u7684\u00a0openat<\/code>\u00a0\u4ee5\u53ca\u4e2d\u95f4\u7684\u00a0socket<\/code>\u3002openat<\/code>\u00a0\u6253\u5f00\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u662f\u7d27\u63a5\u7740\u7684\u00a0close(3)<\/code>\u00a0\u8868\u660e\u5176\u5df2\u7ecf\u88ab\u5173\u95ed\u3002\uff08\u6ce8\u610f\uff1a\u6587\u4ef6\u63cf\u8ff0\u7b26\u53ef\u4ee5\u5728\u6253\u5f00\u5e76\u5173\u95ed\u540e\u91cd\u590d\u4f7f\u7528\u3002\uff09\u6240\u4ee5\u00a0socket<\/code>\u00a0\u8c03\u7528\u624d\u662f\u4e0e\u6b64\u76f8\u5173\u7684\uff08\u5b83\u662f\u5728\u00a0read<\/code>\u00a0\u4e4b\u524d\u7684\u6700\u540e\u4e00\u4e2a\uff09\uff0c\u8fd9\u544a\u8bc9\u6211\u4eec\u00a0brcontab<\/code>\u00a0\u6b63\u5728\u4e0e\u4e00\u4e2a\u7f51\u7edc\u5957\u63a5\u5b57\u901a\u4fe1\u3002\u5728\u4e0b\u4e00\u884c\uff0cconnect<\/code>\u00a0\u8868\u660e\u6587\u4ef6\u63cf\u8ff0\u7b26 3 \u662f\u4e00\u4e2a\u8fde\u63a5\u5230\u00a0\/var\/run\/bcron-spool<\/code>\u00a0\u7684 Unix \u57df\u5957\u63a5\u5b57\u3002<\/p>\n

\u56e0\u6b64\uff0c\u6211\u4eec\u9700\u8981\u5f04\u6e05\u695a Unix \u5957\u63a5\u5b57\u7684\u53e6\u4e00\u4fa7\u662f\u54ea\u4e2a\u8fdb\u7a0b\u5728\u76d1\u542c\u3002\u6709\u4e24\u4e2a\u5de7\u5999\u7684\u6280\u5de7\u9002\u7528\u4e8e\u5728\u670d\u52a1\u5668\u90e8\u7f72\u4e2d\u8c03\u8bd5\u3002\u4e00\u4e2a\u662f\u4f7f\u7528\u00a0netstat<\/code>\u00a0\u6216\u8005\u8f83\u65b0\u7684\u00a0ss<\/code>\u3002\u8fd9\u4e24\u4e2a\u547d\u4ee4\u90fd\u63cf\u8ff0\u4e86\u5f53\u524d\u7cfb\u7edf\u4e2d\u6d3b\u8dc3\u7684\u7f51\u7edc\u5957\u63a5\u5b57\uff0c\u4f7f\u7528\u00a0-l<\/code>\u00a0\u53c2\u6570\u53ef\u4ee5\u663e\u793a\u51fa\u5904\u4e8e\u76d1\u542c\u72b6\u6001\u7684\u5957\u63a5\u5b57\uff0c\u800c\u4f7f\u7528\u00a0-p<\/code>\u00a0\u53c2\u6570\u53ef\u4ee5\u5f97\u5230\u6b63\u5728\u4f7f\u7528\u8be5\u5957\u63a5\u5b57\u7684\u7a0b\u5e8f\u4fe1\u606f\u3002\uff08\u5b83\u4eec\u8fd8\u6709\u66f4\u591a\u6709\u7528\u7684\u9009\u9879\uff0c\u4f46\u662f\u8fd9\u4e24\u4e2a\u5df2\u7ecf\u8db3\u591f\u5b8c\u6210\u5de5\u4f5c\u4e86\u3002\uff09<\/p>\n

# ss -pl | grep \/var\/run\/bcron-spool\r\nu_str LISTEN 0   128   \/var\/run\/bcron-spool 1466637   * 0   users:((\"unixserver\",pid=20629,fd=3))<\/pre>\n

\u8fd9\u544a\u8bc9\u6211\u4eec\u00a0\/var\/run\/bcron-spool<\/code>\u00a0\u5957\u63a5\u5b57\u7684\u76d1\u542c\u7a0b\u5e8f\u662f\u00a0unixserver<\/code>\u00a0\u8fd9\u4e2a\u547d\u4ee4\uff0c\u5b83\u7684\u8fdb\u7a0b ID \u4e3a 20629\u3002\uff08\u5de7\u5408\u7684\u662f\uff0c\u8fd9\u4e2a\u7a0b\u5e8f\u4e5f\u4f7f\u7528\u6587\u4ef6\u63cf\u8ff0\u7b26\u00a03<\/code>\u00a0\u53bb\u8fde\u63a5\u8fd9\u4e2a\u5957\u63a5\u5b57\u3002\uff09<\/p>\n

\u7b2c\u4e8c\u4e2a\u5e38\u7528\u7684\u5de5\u5177\u5c31\u662f\u4f7f\u7528\u00a0lsof<\/code>\u00a0\u67e5\u627e\u76f8\u540c\u7684\u4fe1\u606f\u3002\u5b83\u53ef\u4ee5\u5217\u51fa\u5f53\u524d\u7cfb\u7edf\u4e2d\u6253\u5f00\u7684\u6240\u6709\u6587\u4ef6\uff08\u6216\u6587\u4ef6\u63cf\u8ff0\u7b26\uff09\u3002\u6216\u8005\uff0c\u6211\u4eec\u53ef\u4ee5\u5f97\u5230\u4e00\u4e2a\u5177\u4f53\u6587\u4ef6\u7684\u4fe1\u606f\uff1a<\/p>\n

# lsof \/var\/run\/bcron-spool\r\nCOMMAND   PID   USER  FD  TYPE  DEVICE              SIZE\/OFF  NODE    NAME\r\nunixserve 20629 cron  3u  unix  0x000000005ac4bd83  0t0       1466637 \/var\/run\/bcron-spool type=STREAM<\/pre>\n

\u8fdb\u7a0b 20629 \u662f\u4e00\u4e2a\u5e38\u9a7b\u8fdb\u7a0b\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u00a0strace -o \/tmp\/trace -p 20629<\/code>\u00a0\u53bb\u67e5\u770b\u8be5\u8fdb\u7a0b\u7684\u7cfb\u7edf\u8c03\u7528\u3002\u5982\u679c\u6211\u4eec\u5728\u53e6\u4e00\u4e2a\u7ec8\u7aef\u5c1d\u8bd5\u7f16\u8f91 cron \u7684\u8ba1\u5212\u4efb\u52a1\u8868\uff0c\u5c31\u53ef\u4ee5\u5728\u9519\u8bef\u53d1\u751f\u65f6\u6355\u83b7\u5230\u4ee5\u4e0b\u4fe1\u606f\uff1a<\/p>\n

accept(3, NULL, NULL)                   = 4\r\nclone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7faa47c44810) = 21181\r\nclose(4)                                = 0\r\naccept(3, NULL, NULL)                   = ? ERESTARTSYS (To be restarted if SA_RESTART is set)\r\n--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=21181, si_uid=998, si_status=0, si_utime=0, si_stime=0} ---\r\nwait4(0, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED, NULL) = 21181\r\nwait4(0, 0x7ffe6bc36764, WNOHANG|WSTOPPED, NULL) = -1 ECHILD (No child processes)\r\nrt_sigaction(SIGCHLD, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, 8) = 0\r\nrt_sigreturn({mask=[]})                 = 43\r\naccept(3, NULL, NULL)                   = 4\r\nclone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7faa47c44810) = 21200\r\nclose(4)                                = 0\r\naccept(3, NULL, NULL)                   = ? ERESTARTSYS (To be restarted if SA_RESTART is set)\r\n--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=21200, si_uid=998, si_status=111, si_utime=0, si_stime=0} ---\r\nwait4(0, [{WIFEXITED(s) && WEXITSTATUS(s) == 111}], WNOHANG|WSTOPPED, NULL) = 21200\r\nwait4(0, 0x7ffe6bc36764, WNOHANG|WSTOPPED, NULL) = -1 ECHILD (No child processes)\r\nrt_sigaction(SIGCHLD, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, 8) = 0\r\nrt_sigreturn({mask=[]})                 = 43\r\naccept(3, NULL, NULL<\/pre>\n

\uff08\u6700\u540e\u4e00\u4e2a\u00a0accept<\/code>\u00a0\u8c03\u7528\u6ca1\u6709\u5728\u8ffd\u8e2a\u671f\u95f4\u5b8c\u6210\u3002\uff09\u4e0d\u5e78\u7684\u662f\uff0c\u8fd9\u6b21\u8ffd\u8e2a\u6ca1\u6709\u5305\u542b\u6211\u4eec\u60f3\u8981\u7684\u9519\u8bef\u4fe1\u606f\u3002\u6211\u4eec\u6ca1\u6709\u89c2\u5bdf\u5230\u00a0bcrontan<\/code>\u00a0\u5f80\u5957\u63a5\u5b57\u53d1\u9001\u6216\u63a5\u53d7\u7684\u4efb\u4f55\u4fe1\u606f\u3002\u7136\u800c\uff0c\u6211\u4eec\u770b\u5230\u4e86\u5f88\u591a\u8fdb\u7a0b\u7ba1\u7406\u64cd\u4f5c\uff08clone<\/code>\u3001wait4<\/code>\u3001SIGCHLD<\/code>\uff0c\u7b49\u7b49\uff09\u3002\u8fd9\u4e2a\u8fdb\u7a0b\u4ea7\u751f\u4e86\u5b50\u8fdb\u7a0b\uff0c\u6211\u4eec\u731c\u6d4b\u771f\u5b9e\u7684\u5de5\u4f5c\u662f\u7531\u5b50\u8fdb\u7a0b\u5b8c\u6210\u7684\u3002\u5982\u679c\u6211\u4eec\u60f3\u6355\u83b7\u5b50\u8fdb\u7a0b\u7684\u8ffd\u8e2a\u4fe1\u606f\uff0c\u5c31\u5fc5\u987b\u5f80\u00a0strace<\/code>\u00a0\u8ffd\u52a0\u00a0-f<\/code>\u00a0\u53c2\u6570\u3002\u4ee5\u4e0b\u662f\u6211\u4eec\u6700\u7ec8\u4f7f\u7528\u00a0strace -f -o \/tmp\/trace -p 20629<\/code>\u00a0\u627e\u5230\u7684\u9519\u8bef\u4fe1\u606f\uff1a<\/p>\n

21470 openat(AT_FDCWD, \"tmp\/spool.21470.1573692319.854640\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied)\r\n21470 write(1, \"32:ZCould not create temporary f\"..., 36) = 36\r\n21470 write(2, \"bcron-spool[21470]: Fatal: logs:\"..., 84) = 84\r\n21470 unlink(\"tmp\/spool.21470.1573692319.854640\") = -1 ENOENT (No such file or directory)\r\n21470 exit_group(111)                   = ?\r\n21470 +++ exited with 111 +++<\/pre>\n

\u73b0\u5728\u6211\u4eec\u77e5\u9053\u4e86\u8fdb\u7a0b ID 21470 \u5728\u5c1d\u8bd5\u521b\u5efa\u6587\u4ef6\u00a0tmp\/spool.21470.1573692319.854640<\/code>\u00a0\uff08\u76f8\u5bf9\u4e8e\u5f53\u524d\u7684\u5de5\u4f5c\u76ee\u5f55\uff09\u65f6\u5f97\u5230\u4e86\u4e00\u4e2a\u6ca1\u6709\u6743\u9650\u7684\u9519\u8bef\u3002\u5982\u679c\u6211\u4eec\u77e5\u9053\u5f53\u524d\u7684\u5de5\u4f5c\u76ee\u5f55\uff0c\u5c31\u53ef\u4ee5\u5f97\u5230\u5b8c\u6574\u8def\u5f84\u5e76\u80fd\u6307\u51fa\u4e3a\u4ec0\u4e48\u8be5\u8fdb\u7a0b\u65e0\u6cd5\u5728\u6b64\u5904\u521b\u5efa\u4e34\u65f6\u6587\u4ef6\u3002\u4e0d\u5e78\u7684\u662f\uff0c\u8fd9\u4e2a\u8fdb\u7a0b\u5df2\u7ecf\u9000\u51fa\u4e86\uff0c\u6240\u4ee5\u6211\u4eec\u4e0d\u80fd\u4f7f\u7528\u00a0lsof -p 21470<\/code>\u00a0\u53bb\u627e\u51fa\u5f53\u524d\u7684\u5de5\u4f5c\u76ee\u5f55\uff0c\u4f46\u662f\u6211\u4eec\u53ef\u4ee5\u5f80\u524d\u8ffd\u6eaf\uff0c\u67e5\u627e\u8fdb\u7a0b ID 21470 \u4f7f\u7528\u54ea\u4e2a\u7cfb\u7edf\u8c03\u7528\u6539\u53d8\u4e86\u5b83\u7684\u5de5\u4f5c\u76ee\u5f55\u3002\u8fd9\u4e2a\u7cfb\u7edf\u8c03\u7528\u662f\u00a0chdir<\/code>\uff08\u53ef\u4ee5\u5728\u641c\u7d22\u5f15\u64ce\u5f88\u8f7b\u677e\u5730\u627e\u5230\uff09\u3002\u4ee5\u4e0b\u662f\u4e00\u76f4\u5f80\u524d\u8ffd\u6eaf\u5230\u670d\u52a1\u5668\u8fdb\u7a0b ID 20629 \u7684\u7ed3\u679c\uff1a<\/p>\n

20629 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7faa47c44810) = 21470\r\n...\r\n21470 execve(\"\/usr\/sbin\/bcron-spool\", [\"bcron-spool\"], 0x55d2460807e0 \/* 27 vars *\/) = 0\r\n...\r\n21470 chdir(\"\/var\/spool\/cron\")          = 0\r\n...\r\n21470 openat(AT_FDCWD, \"tmp\/spool.21470.1573692319.854640\", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied)\r\n21470 write(1, \"32:ZCould not create temporary f\"..., 36) = 36\r\n21470 write(2, \"bcron-spool[21470]: Fatal: logs:\"..., 84) = 84\r\n21470 unlink(\"tmp\/spool.21470.1573692319.854640\") = -1 ENOENT (No such file or directory)\r\n21470 exit_group(111)                   = ?\r\n21470 +++ exited with 111 +++<\/pre>\n

\u73b0\u5728 PID \u4e3a 20629 \u7684\u670d\u52a1\u5668\u8fdb\u7a0b\u6ca1\u6709\u6743\u9650\u5728\u00a0\/var\/spool\/cron\/tmp\/spool.21470.1573692319.854640<\/code>\u00a0\u521b\u5efa\u6587\u4ef6\u3002\u6700\u53ef\u80fd\u7684\u539f\u56e0\u5c31\u662f\u5178\u578b\u7684 *nix \u6587\u4ef6\u7cfb\u7edf\u6743\u9650\u8bbe\u7f6e\u3002\u8ba9\u6211\u4eec\u68c0\u67e5\u4e00\u4e0b\uff1a<\/p>\n

# ls -ld \/var\/spool\/cron\/tmp\/\r\ndrwxr-xr-x 2 root root 4096 Nov  6 05:33 \/var\/spool\/cron\/tmp\/\r\n# ps u -p 20629\r\nUSER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND\r\ncron     20629  0.0  0.0   2276   752 ?        Ss   Nov14   0:00 unixserver -U \/var\/run\/bcron-spool -- bcron-spool<\/pre>\n

\u8fd9\u5c31\u662f\u95ee\u9898\u6240\u5728\uff01\u8fd9\u4e2a\u670d\u52a1\u8fdb\u7a0b\u4ee5\u00a0cron<\/code>\u00a0\u7528\u6237\u8fd0\u884c\uff0c\u4f46\u662f\u53ea\u6709\u00a0root<\/code>\u00a0\u7528\u6237\u624d\u6709\u5411\u00a0\/var\/spool\/cron\/tmp\/<\/code>\u00a0\u76ee\u5f55\u5199\u5165\u7684\u6743\u9650\u3002\u4e00\u4e2a\u7b80\u5355\u00a0chown cron \/var\/spool\/cron\/tmp\/<\/code>\u00a0\u547d\u4ee4\u5c31\u80fd\u8ba9\u00a0bcron<\/code>\u00a0\u6b63\u5e38\u5de5\u4f5c\u3002\uff08\u5982\u679c\u4e0d\u662f\u8fd9\u4e2a\u95ee\u9898\uff0c\u90a3\u4e48\u4e0b\u4e00\u4e2a\u6700\u6709\u53ef\u80fd\u7684\u6000\u7591\u5bf9\u8c61\u662f\u8bf8\u5982 SELinux \u6216\u8005 AppArmor \u4e4b\u7c7b\u7684\u5185\u6838\u5b89\u5168\u6a21\u5757\uff0c\u56e0\u6b64\u6211\u5c06\u4f1a\u4f7f\u7528\u00a0dmesg<\/code>\u00a0\u68c0\u67e5\u5185\u6838\u65e5\u5fd7\u3002\uff09<\/p>\n

<\/p>\n

<\/strong>\u603b\u7ed3<\/strong><\/div>\n

<\/strong><\/p>\n

\u6700\u521d\uff0c\u7cfb\u7edf\u8c03\u7528\u8ffd\u8e2a\u53ef\u80fd\u4f1a\u8ba9\u4eba\u4e0d\u77e5\u6240\u63aa\uff0c\u4f46\u662f\u6211\u5e0c\u671b\u6211\u5df2\u7ecf\u8bc1\u660e\u5b83\u4eec\u662f\u8c03\u8bd5\u4e00\u6574\u5957\u5e38\u89c1\u90e8\u7f72\u95ee\u9898\u7684\u5feb\u901f\u65b9\u6cd5\u3002\u4f60\u53ef\u4ee5\u8bbe\u60f3\u4e00\u4e0b\u5c1d\u8bd5\u7528\u5355\u6b65\u8c03\u8bd5\u5668\u53bb\u8c03\u8bd5\u591a\u8fdb\u7a0b\u7684\u00a0bcron<\/code>\u00a0\u95ee\u9898\u3002<\/p>\n

\u901a\u8fc7\u4e00\u8fde\u4e32\u7684\u7cfb\u7edf\u8c03\u7528\u89e3\u51b3\u95ee\u9898\u662f\u9700\u8981\u7ec3\u4e60\u7684\uff0c\u4f46\u6b63\u5982\u6211\u8bf4\u7684\u90a3\u6837\uff0c\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u6211\u53ea\u9700\u8981\u4f7f\u7528\u00a0strace<\/code>\u00a0\u4ece\u4e0b\u5f80\u4e0a\u8ffd\u8e2a\u5e76\u67e5\u627e\u9519\u8bef\u3002\u4e0d\u7ba1\u600e\u6837\uff0cstrace<\/code>\u00a0\u8282\u7701\u4e86\u6211\u5f88\u591a\u7684\u8c03\u8bd5\u65f6\u95f4\u3002\u6211\u5e0c\u671b\u8fd9\u4e5f\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n

 <\/p>\n

via:\u00a0https:\/\/theartofmachinery.com\/2019\/11\/14\/deployment_debugging_strace.html<\/a><\/p>\n

\u4f5c\u8005\uff1aSimon Arneaud<\/a>\u00a0\u9009\u9898\uff1alujun9972<\/a>\u00a0\u8bd1\u8005\uff1ahanwckf<\/a>\u00a0\u6821\u5bf9\uff1awxy<\/a><\/p>\n

\u672c\u6587\u7531\u00a0LCTT<\/a>\u00a0\u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd<\/a>\u00a0\u8363\u8a89\u63a8\u51fa<\/p>\n","protected":false},"excerpt":{"rendered":"

strace\u662f\u4e00\u4e2a\u7528\u6765\u201c\u8ffd\u8e2a\u7cfb\u7edf\u8c03\u7528\u201d\u7684\u5de5\u5177\u3002\u5b83\u4e3b\u8981\u662f\u4e00\u4e2a Linux \u5de5\u5177\uff0c\u4f46\u662f\u4f60\u4e5f\u53ef\u4ee5\u5728\u5176\u5b83\u7cfb\u7edf\u4e0a\u4f7f\u7528\u7c7b\u4f3c […]<\/p>\n","protected":false},"author":1920,"featured_media":147202,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-167464","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/167464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1920"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=167464"}],"version-history":[{"count":9,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/167464\/revisions"}],"predecessor-version":[{"id":167856,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/167464\/revisions\/167856"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/147202"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=167464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=167464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=167464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}