{"id":279898,"date":"2023-08-10T04:05:07","date_gmt":"2023-08-09T20:05:07","guid":{"rendered":"https:\/\/lrxjmw.cn\/cglbczswjwjy.html"},"modified":"2023-08-10T04:05:07","modified_gmt":"2023-08-09T20:05:07","slug":"cglbczswjwjy","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/cglbczswjwjy.html","title":{"rendered":"\u5e38\u89c4Linux\u7f16\u7a0b\u77e5\u8bc6\u6587\u4ef6\u6587\u4ef6\u4e0e\u76ee\u5f55\u64cd\u4f5c\u6807\u51c6\u5e93"},"content":{"rendered":"

\u6587\u7ae0\u76ee\u5f55<\/p>\n

Linux<\/a>\u7cfb\u7edf<\/a>\u5f00\u53d1\u4f1a\u7528\u5230\u54ea\u4e9b\uff1f<\/p>\n

C\u8bed\u8a00\u57fa\u7840<\/p>\n

shell\u811a\u672c<\/p>\n

\u6e10\u6e10\u5b66\u4f1a\u4f7f\u7528Makefile<\/p>\n

\u5e38\u89c4Linux\u7cfb\u7edf\u7f16\u7a0b\u77e5\u8bc6\u90fd\u6709\u54ea\u4e9b\uff1f\u4ec0\u4e48\u5e38\u7528\uff1f\u4ec0\u4e48\u4e0d\u5e38\u7528\uff1f<\/p>\n

\u5e38\u89c4Linux\u7f16\u7a0b\u77e5\u8bc6<\/p>\n

\u6587\u4ef6IO<\/p>\n

\u6587\u4ef6\u4e0e\u76ee\u5f55\u64cd\u4f5c<\/p>\n

\u6807\u51c6IO\u5e93<\/p>\n

\u8fdb\u7a0b\u63a7\u5236<\/p>\n

\u7ebf\u7a0b\u7f16\u7a0b<\/p>\n

\u4e2d\u7ea7IO<\/p>\n

\u8fdb\u7a0b\u95f4\u901a\u8baf<\/p>\n

\u6570\u636e\u5e93<\/p>\n

\u5e76\u53e3\u7f16\u7a0b<\/p>\n

\u7f51\u8def\u7f16\u7a0b<\/p>\n

\u7ed3\u675f\u8bed<\/p>\n

Linux\u7cfb\u7edf\u5f00\u53d1\u4f1a\u7528\u5230\u54ea\u4e9b\uff1f<\/p>\n

C\u8bed\u8a00\u57fa\u7840<\/p>\n

Linux\u7cfb\u7edf\u5185\u6838\u662fC\u8bed\u8a00\u7f16\u64b0\u7684\uff0c\u6240\u4ee5\uff0cLinux\u7cfb\u7edf\u5f00\u53d1\u53ef\u80fd\u4f1a\u548c\u597d\u591a\u7cfb\u7edfAPI\u6253\u4ea4\u9053\uff0c\u987b\u8981\u628a\u63e1C\u8bed\u8a00\u57fa\u7840\uff0cC\u8bed\u8a00\u662fLinux\u6700\u57fa\u7840\u7684\u5f00\u53d1\u8bed\u8a00\uff0c\u5176\u5b9e\u4e5f\u53ef\u4ee5\u7528C++\u3002\u901a\u5e38\u505a\u4e0e\u7cfb\u7edf\u4ea4\u4e92\u7684\u6a21\u5757\u65f6\uff0c\u7528C\u8bed\u8a00\u591a\u4e00\u4e9b\uff0c\u505a\u4e0b\u5c42\u4e1a\u52a1\u5e94\u7528\u65f6\uff0c\u4e3a\u4e86\u5f00\u53d1\u6548\u7387\uff0c\u4f1a\u4f7f\u7528C++\u6765\u5f00\u53d1\uff0c\u867d\u7136C++\u662f\u9762\u5411\u5bf9\u8c61\u7684\u5f00\u53d1\u8bed\u8a00\uff0c\u9002\u5b9c\u5c0f\u578b\u9879\u76ee\u7684\u5f00\u53d1\uff0c\u4fbf\u6377\u6a21\u5757\u5316linux\u7cfb\u7edf\u5927\u5c0f<\/strong>\uff0c\u4ee3\u7801\u590d\u7528\u7387\u9ad8\u3002<\/p>\n

shell\u811a\u672c<\/p>\n

shell\u811a\u672c\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528Linux\u7cfb\u7edf\u4e0b\u7684\u4e00\u7cfb\u5217\u547d\u4ee4<\/a>\uff0c\u6709\u673a\u7ec4\u5408\u5728\u4e00\u8d77\uff0c\u800c\u5b8c\u6210\u9884\u671f\u7684\u529f\u80fd\u3002Linux\u8bbe\u8ba1\u601d\u60f3\u662f\u201c\u5c0f\u5373\u662f\u7f8e\u201d\uff0c\u8fd9\u4e00\u601d\u60f3\u662fshell\u811a\u672c\u7f16\u7a0b\u7684\u5b8c\u7f8e\u5f70\u663e\u3002\u6bcf\u4f4d\u547d\u4ee4\u53ea\u5b8c\u6210\u4e00\u79cd\u529f\u80fd\uff0c\u4e0d\u540c\u7684\u547d\u4ee4\u7ec4\u5408\u5728\u4e00\u8d77\uff0c\u5374\u53ef\u4ee5\u5b9e\u73b0\u590d\u6742\u7684\u529f\u80fd\u3002\u505aLinux\u4e0b\u5f00\u53d1\uff0c\u514d\u4e0d\u4e86\u8981\u4e0e\u811a\u672c\u6253\u4ea4\u9053\uff08\u4f8b\u5982\u6d4b\u8bd5\u3001\u5206\u6790\u6570\u636e\u7b49\uff09\u3002<\/p>\n

\u6e10\u6e10\u5b66\u4f1a\u4f7f\u7528Makefile<\/p>\n

Makefile\u662fLinux\u7a0b\u5e8f\u5f00\u53d1\u65f6\u5fc5\u4e0d\u53ef\u5c11\u7684\u7f16\u8bd1\u7ba1\u7406\u811a\u672c\uff0c\u8fd9\u4e2a\u4e0a\u9762\u4e1c\u897f\u4e5f\u597d\u591a\uff0c\u4e0d\u8fc7\u521a\u5f00\u59cb\u53ef\u4ee5\u7b80\u5355\u77a7\u77a7\uff0c\u591f\u7528\u5c31\u884c\uff0c\u968f\u7740\u9879\u76ee\u7684\u8d8a\u505a\u8d8a\u5927\uff0c\u4ee3\u7801\u6587\u4ef6\u4e0e\u76ee\u5f55\u8d8a\u6765\u8d8a\u590d\u6742\uff0c\u8fd9\u65f6\u4faf\u7684Makefile\u53ef\u80fd\u8fd8\u4f1a\u590d\u6742\u4e00\u4e9b\uff0c\u7275\u6d89\u5230\u4e0d\u540c\u76ee\u5f55\u7684Makefile\u7684\u4e92\u76f8\u8c03\u7528\u6216\u5219\u534f\u8c03\u3002<\/p>\n

\u4f8b\u5982\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u901a\u5e38\u4e0d\u6b62\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\uff0c\u53ef\u80fd\u4f1a\u6709\u591a\u4e2a\u7a0b\u5e8f\uff0c\u5728\u6574\u4f53\u7f16\u8bd1\u65f6\uff0c\u4f1a\u5305\u62ec\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n

\u5404\u4e2a\u5e94\u7528\u7a0b\u5e8f\u6a21\u5757\u7684\u7f16\u8bd1\uff08\u987b\u8981\u5224\u5b9a\u662f\u5426\u7f16\u8bd1\u6210\u529f\uff0c\u51fa\u73b0\u7f16\u8bd1\u5931\u8d25\u7684\u60c5\u51b5\u505c\u51fa\u6765\uff0c\u629b\u51fa\u9519\u8bef\u4fe1\u606f\uff09<\/p>\n

\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\uff08\u5f04\u6210\u538b\u7f29\u5305\u6216\u5219\u5206\u533a\u955c\u50cf\uff09<\/p>\n

\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\u6253\u5305<\/p>\n

uboot\u3001\u5185\u6838\u3001\u6587\u4ef6\u7cfb\u7edf\u3001\u5e94\u7528\u7a0b\u5e8f\u6574\u4f53\u6253\u5305\u6210\u4e00\u4e2a\u955c\u50cf\u6587\u4ef6\uff0c\u5927\u5c0f\u5bf9\u5e94flash\u5206\u533a\u7684\u5927\u5c0f\uff08\u5927\u5c0f\u4e0d\u8db3\u987b\u8981\u586b\u5145\u7a7a\u6570\u636e\uff0c\u4fdd\u8bc1\u4e0e\u5206\u533a\u5bf9\u5e94\uff09\u3002<\/p>\n

\u624b\u52a8\u7248\u672c\u7ba1\u7406\uff0c\u5728\u7f16\u8bd1\u5b8c\u6210\uff0c\u6253\u5305\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u811a\u672c\u6765\u624b\u52a8\u6309\u7167\u65f6\u95f4\u751f\u6210\u7248\u672c\u53f7\u3002<\/p>\n

\u8fd9\u79cd\u4e1c\u897f\u505a\u4e0a\u53bb\u4f3c\u4e4e\u633a\u590d\u6742\u7684\uff0c\u987b\u8981Makefile\u4e0eshell\u811a\u672c\u642d\u914d\u5b8c\u6210\u3002<\/p>\n

\u5e38\u89c4Linux\u7cfb\u7edf\u7f16\u7a0b\u77e5\u8bc6\u90fd\u6709\u54ea\u4e9b\uff1f\u4ec0\u4e48\u5e38\u7528\uff1f\u4ec0\u4e48\u4e0d\u5e38\u7528\uff1f<\/p>\n

\u5e38\u89c4Linux\u7f16\u7a0b\u77e5\u8bc6<\/p>\n

\u6587\u4ef6IO<\/p>\n

\u6bd4\u8f83\u5e38\u7528<\/p>\n

Linux\u7cfb\u7edf\u4e0b\uff0c\u6240\u6709\u7684\u8d44\u6e90\u90fd\u662f\u4ee5\u6587\u4ef6\u7684\u65b9\u5f0f\u8bbf\u95ee\u7684\uff0c\u8bbe\u5907\u88ab\u5177\u8c61\u4e3a\u8bbe\u5907\u6587\u4ef6\uff0c\u653e\u4e8e\/dev\u76ee\u5f55\u4e0b\u3002<\/p>\n

\u57fa\u672c\u7684\u8bbf\u95ee\u51fd\u6570\uff1a<\/p>\n

\u51fd\u6570\u540d\u7b80\u4ecb\u901a\u5e38\u5982\u4f55\u7528<\/p>\n

open\u6253\u5f00\u8bbe\u5907\u6587\u4ef6\u8bbf\u95ee\u8bbe\u5907\u6587\u4ef6\uff0c\u9996\u5148\u8981\u5148\u6253\u5f00\u8bbe\u5907<\/p>\n

close\u5173\u6389\u8bbe\u5907\u6587\u4ef6\u6587\u4ef6\u8bbf\u95ee\u7ed3\u675f\u540e\uff0c\u987b\u8981\u8c03\u7528\u8be5\u63d2\u53e3\uff0c\u5018\u82e5\u4e0d\u5173\u6389\uff0c\u4f1a\u9020fb\u7528\u5c3d<\/p>\n

read\u8bfb\u53d6\u6570\u636e\u8bfb\u53d6\u6570\u636e\uff0c\u53ef\u4ee5\u662f\u6587\u672c\u6587\u4ef6\u5185\u5bb9\uff0c\u4e5f\u53ef\u4ee5\u662f\u6444\u50cf\u5934\u6570\u636e\u7b49<\/p>\n

write\u5199\u5165\u6570\u636e\u5411\u8bbe\u5907\u5199\u6570\u636e\uff0c\u4f8b\u5982\u5e76\u53e3\u901a\u8baf\u65f6\uff0c\u53ef\u4ee5\u7528write\u53d1\u9001\u6570\u636e<\/p>\n

ioctlIO\u64cd\u4f5c\u51fd\u6570\u8be5\u51fd\u6570\u529f\u80fd\u6bd4\u8f83\u591a\uff0c\u88ab\u53eb\u505a\u6742\u7269\u7bb1~\uff0c\u53ef\u4ee5\u8bfb\u3001\u5199\u6570\u636e\uff0c\u505a\u9a71\u52a8\u7684\u670b\u53cb\u5e94\u5f53\u5f88\u4e86\u89e3<\/p>\n

fcntl\u5c5e\u6027\u8bbe\u7f6e\u51fd\u6570\u5bf9\u65e9\u5df2\u6253\u5f00\u7684\u8bbe\u5907\uff0c\u8bbe\u7f6e\u5c5e\u6027linux\u670d\u52a1\u5668\u7cfb\u7edf\uff0c\u4f8b\u5982\u53ef\u4ee5\u8bbe\u7f6e\u5e76\u53e3\u8bfb\u6570\u636e\u7684\u963b\u585e\u548c\u975e\u963b\u585e\u5c5e\u6027<\/p>\n

lseek\u6539\u53d8\u504f\u659c\u91cf\u901a\u5e38\u7528\u4e8e\u5bf9\u5df2\u6253\u5f00\u7684\u6587\u4ef6\u8bfb\u5199\u4f4d\u7f6e\u7684\u504f\u659c\u91cf\u66f4\u6539<\/p>\n

\u6587\u4ef6\u4e0e\u76ee\u5f55\u64cd\u4f5c<\/p>\n

\u5e38\u7528<\/p>\n

\u7cfb\u7edf\u7f16\u7a0b\u5c11\u4e0d\u4e86\u6587\u4ef6\u4e0e\u76ee\u5f55\u7684\u8bbf\u95ee\uff0c\u4f8b\u5982\u4f60\u8981\u8bfb\u53d6\u67d0\u4e2a\u76ee\u5f55\u4e0b\u7684\u6240\u6709\u6587\u4ef6\u540d\u5b50\uff0c\u6216\u5219\u66f4\u6539\u6587\u4ef6\u540d\u3001\u4fee\u6539\u76ee\u5f55\uff0c\u8054\u901a\u6587\u4ef6\u7b49\u7b49\u3002<\/p>\n

\u51fd\u6570\u540d\u7b80\u4ecb\u901a\u5e38\u5982\u4f55\u7528<\/p>\n

stat\u3001fstat\u3001lstat\u83b7\u53d6\u6587\u4ef6\u72b6\u6001\u53ef\u4ee5\u83b7\u53d6\u5230\u6587\u4ef6\u7684\u521b\u5efa\u3001\u8bbf\u95ee\u65f6\u95f4\uff0c\u6587\u4ef6\u5927\u5c0f\u7b49<\/p>\n

\u5927\u5c0f\u7cfb\u7edf\u6848\u4f8b_linux\u7cfb\u7edf\u5927\u5c0f_\u5927\u5c0f\u7cfb\u7edf\u5faa\u73af\u7535\u52a8\u6a21\u578b<\/p>\n

access\u68c0\u67e5\u6587\u4ef6\u5c5e\u6027\u5e38\u7528\u4e8e\u5224\u5b9a\u6587\u4ef6\u662f\u5426\u5b58\u5728<\/p>\n

chmod\u66f4\u6539\u6587\u4ef6\u6743\u9650\u901a\u5e38\u6d89\u53ca\u5230\u6587\u4ef6\u8bbf\u95ee\u6743\u9650\u66f4\u6539\u65f6\uff0c\u4f1a\u7528\u5230\uff0c\u4f8b\u5982\u964d\u4f4e\u53ef\u6267\u884c\u6743\u9650<\/p>\n

mkdir\u521b\u5efa\u76ee\u5f55\u901a\u5e38\u5728\u7a0b\u5e8f\u91cc\u5224\u5b9a\u5230\u987b\u8981\u7528\u5230\u7684\u76ee\u5f55\u4e0d\u5b58\u5728\u65f6\uff0c\u7528\u6b64\u51fd\u6570\u521b\u5efa<\/p>\n

rmdir\u5220\u6389\u76ee\u5f55\u987b\u8981\u5220\u6389\u76ee\u5f55\u65f6\u4f7f\u7528\uff0c\u901a\u5e38\u6781\u5c11\u7528\u5230<\/p>\n

opendir\u6253\u5f00\u76ee\u5f55\u5728\u8bfb\u53d6\u76ee\u5f55\u4fe1\u606f\u4e4b\u524d\uff0c\u987b\u8981\u5148\u6253\u5f00\u76ee\u5f55\uff08\u7c7b\u4e2d\u4e0e\u6587\u4ef6\u8bbf\u95ee\uff09<\/p>\n

readdir\u8bfb\u53d6\u76ee\u5f55\u5185\u5bb9\u5728\u68c0\u7d22\u6587\u4ef6\u65f6\uff0c\u4f1a\u7528\u5230linux\u7cfb\u7edf\u5927\u5c0f<\/strong>\uff0c\u8bfb\u53d6\u76ee\u5f55\u4e0b\u6587\u4ef6\u5217\u8868<\/p>\n

closedir\u5173\u6389\u76ee\u5f55\u5728\u8bfb\u53d6\u5b8c\u6210\u540e\uff0c\u8bb0\u5f97\u5173\u6389\u76ee\u5f55<\/p>\n

sync\u540c\u6b65\u6570\u636e\u5230c\u76d8\u8fd9\u4e2a\u51fd\u6570\u901a\u5e38\u5728\u66f4\u6539\u6587\u4ef6\uff0c\u5199\u5165\u6570\u636e\u540e\u8c03\u7528\uff0c\u8ba9\u7cfb\u7edf\u628a\u6570\u636e\u540c\u6b65\u5230c\u76d8<\/p>\n

\u6807\u51c6IO\u5e93<\/p>\n

\u6bd4\u8f83\u5e38\u7528<\/p>\n

\u6240\u8c13\u6807\u51c6IO\u5e93\uff0c\u5f53\u7136\u662fC\u8bed\u8a00\u91cc\u7684\u6587\u4ef6IO\uff0c\u53e6\u5916\u8fd9\u513f\u9762\u7684IO\u4e0e\u4e0a\u9762\u63d0\u53ca\u7684\u201c\u6587\u4ef6IO\u201d\u5728\u6587\u4ef6\u7684\u8bfb\u5199\u4e0a\u6709\u4e2a\u533a\u522b\uff0c\u6807\u51c6IO\u662f\u6709\u7f13\u5b58\u7684\uff0c\u800cLinux\u7cfb\u7edf\u7684\u6587\u4ef6IO\u51fd\u6570\u662f\u65e0\u7f13\u5b58\u7684\u3002<\/p>\n

\u4e3b\u8981\u662f\u6587\u4ef6\u64cd\u4f5c\u51fd\u6570\uff1a<\/p>\n

\u51fd\u6570\u540d\u7b80\u4ecb\u901a\u5e38\u5982\u4f55\u7528<\/p>\n

fopen\u6253\u5f00\u6587\u4ef6\u653e\u6587\u4ef6\u6587\u4ef6\u524d\u5148\u8c03\u7528fopen\u83b7\u53d6\u6587\u4ef6\u53e5\u67c4<\/p>\n

fclose\u5173\u6389\u6587\u4ef6\u6587\u4ef6\u8bbf\u95ee\u7ed3\u675f\u540e\uff0c\u8bb0\u5f97\u5173\u6389\u6587\u4ef6\uff0c\u5426\u5219\u81f4\u4f7f\u663e\u5b58\u6cc4\u6f0f<\/p>\n

fread\u8bfb\u53d6\u6587\u4ef6\u8bfb\u53d6\u6587\u4ef6\u6570\u636e<\/p>\n

fseek\u66f4\u6539\u6587\u4ef6\u8bfb\u5199\u4f4d\u7f6e\u7528\u4e8e\u66f4\u6539\u6587\u4ef6\u8bfb\u5199\u7684\u4f4d\u7f6e\u504f\u659c\u91cf<\/p>\n

\u8fdb\u7a0b\u63a7\u5236<\/p>\n

\u901a\u5e38<\/p>\n

\u5047\u5982\u4f60\u4e0d\u4f7f\u7528\u591a\u8fdb\u7a0b\u7f16\u7a0b\u7684\u8bdd\uff0c\u8fd9\u4e00\u9879\u53ef\u80fd\u5c31\u7528\u7684\u4e0d\u591a\uff0c\u6211\u7684\u4ee3\u7801\u91cc\u7528\u7684\u4e5f\u4e0d\u662f\u592a\u591a\u3002<\/p>\n

\u8fd9\u4e2a\u77e5\u8bc6\u70b9\u4e3b\u8981\u662f\u8fdb\u7a0b\u7684\u521b\u5efa\u3001\u5b50\u8fdb\u7a0b\u7ba1\u7406\u3001\u8fdb\u7a0b\u9000\u51fa\u8d44\u6e90\u91ca\u653e\u7b49\u7b49\u3002<\/p>\n

\u7ebf\u7a0b\u7f16\u7a0b<\/p>\n

\u6bd4\u8f83\u5e38\u7528<\/p>\n

\u4e0a\u4e86\u7cfb\u7edf\uff0c\u901a\u5e38\u8dd1\u7684\u4efb\u52a1\u90fd\u4f1a\u6bd4\u8f83\u591a\uff0c\u7ebf\u7a0b\u662f\u6bd4\u8f83\u5e38\u7528\u7684\uff0c\u901a\u5e38\u53ef\u4ee5\u5206\u4e3a\u4e24\u79cd\uff0c\u4e00\u79cd\u662f\u957f\u65f6\u95f4\u8fd0\u884c\u7684\u4efb\u52a1\uff0c\u4e00\u79cd\u662f\u6267\u884c\u5b8c\u4efb\u52a1\u81ea\u884c\u9000\u51fa\u3002\u73b0\u4ecaC++11\u65e9\u5df2\u652f\u6301\u4e86\u7ebf\u7a0b\uff0c\u4f7f\u7528\u4e0a\u53bb\u5341\u5206\u4fbf\u6377\u3002\u4e4b\u524d\u6ca1\u6709C++11\u65f6linux shell\uff0c\u4e3a\u4e86\u4fbf\u6377\u4f7f\u7528\uff0c\u90fd\u662f\u5bf9pthrea_\u7c07\u51fd\u6570\u8fdb\u884c\u4e86\u4e8c\u6b21\u5c01\u88c5\u3002<\/p>\n

\u4e2d\u7ea7IO<\/p>\n

\u5e38\u7528<\/p>\n

\u53ef\u80fd\u4f60\u4f1a\u6bd4\u8f83\u5947\u602a\uff0c\u4e3a\u4f55\u5982\u6b64\u591a\u201cIO\u201d\u76f8\u5173\u7684\u4e1c\u897f\uff1a\u6587\u4ef6IO\u3001\u6807\u51c6\u6587\u4ef6IO\u3001\u9ad8\u7ea7IO\uff01<\/p>\n

\u662f\u7684\uff0c\u8fd9\u513f\u7684IO\u6bd4\u8f83\u591a\uff0c\u524d\u4e24\u4e2a\u201cIO\u201d\u8fd8\u6709\u70b9\u76f8\u50cf\uff0c\u8fd9\u4e2a\u4e2d\u7ea7IO\u548c\u4e0a\u9762\u4e24\u4e2a\u6709\u70b9\u4e0d\u592a\u4e00\u6837\u3002<\/p>\n

\u4e2d\u7ea7IO\u91cc\u4e3b\u8981\u662f\u8bb2\u7684IO\u64cd\u4f5c\u7684\u65b9\u6cd5\uff1a\u963b\u585e\u3001\u975e\u963b\u585e\u63a7\u5236\uff0c\u6700\u4e3b\u8981\u7684\u662f\u901a\u8fc7select\u548cpoll\u5b9e\u73b0IO\u591a\u8def\u590d\u7528\uff0c\u8fd9\u6837\u53ef\u4ee5\u5b9e\u73b0\u7a0b\u5e8f\u7684\u5f02\u6b65\u6267\u884c\u3002\u73b0\u4eca\u7528\u7684\u6bd4\u8f83\u591a\u7684Nginx\uff0c\u5c31\u662f\u4f7f\u7528\u7684epoll\u6a21\u578b\uff0c\u5b9e\u73b0\u7684\u9ad8\u5e76\u53d1\u3002<\/p>\n

\u8fdb\u7a0b\u95f4\u901a\u8baf<\/p>\n

\u5341\u5206\u5e38\u7528<\/p>\n

\u901a\u5e38\u5728linux\u7cfb\u7edf\u4e0b\u8fb9\uff0c\u65e2\u7136\u662f\u7cfb\u7edf\uff0c\u5c31\u4e0d\u6b62\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u5728\u8fd0\u884c\uff0c\u90a3\u591a\u4e2a\u5e94\u7528\u7a0b\u5e8f\uff0c\u90fd\u4f1a\u987b\u8981\u6570\u636e\u4ea4\u4e92\uff0c\u8fd9\u4e48\uff0c\u5c31\u7528\u5230\u4e86\u8fdb\u7a0b\u95f4\u901a\u8baf\uff0c\u8fdb\u7a0b\u95f4\u901a\u8baf\u6709\u8bb8\u591a\u5f00\u6e90\u7684\u5de5\u5177\uff08\u4f8b\u5982DBUS\uff09\uff0c\u8fd9\u513f\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b\u7cfb\u7edf\u91cc\u63d0\u4f9b\u7684\u901a\u8baf\u65b9\u6cd5\uff1a<\/p>\n

\u540d\u79f0\u7b80\u4ecb<\/p>\n

\u7ba1\u7ebf\u901a\u5e38\u7528\u4e8e\u6bcd\u5b50\u8fdb\u7a0b\u95f4\u901a\u8baf\uff0c\u6709\u540d\u7ba1\u7ebf\u53ef\u4ee5\u8de8\u7a0b\u5e8f<\/p>\n

\u6d88\u606f\u961f\u5217\u6d88\u606f\u961f\u5217\u53ef\u4ee5\u5206\u7c7b\u578b\uff0c\u9002\u7528\u4e8e\u6570\u636e\u91cf\u5c0f\u7684\uff0c\u7b80\u5355\u901a\u8baf<\/p>\n

\u8baf\u53f7\u91cfPV\u64cd\u4f5c\uff0c\u7528\u4e8e\u540c\u6b65\uff0c\u53ef\u4ee5\u4e0e\u5171\u4eab\u663e\u5b58\u642d\u914d\u7528\uff0c\u5199\u5b8c\u6570\u636e\uff0c\u544a\u8bc9\u53e6\u4e00\u4e2a\u7ebf\u7a0b\u53ef\u4ee5\u8bfb\u53d6\u4e86<\/p>\n

\u5171\u4eab\u663e\u5b58\u9002\u7528\u4e8e\u5927\u6570\u636e\u91cf\u7684\u4f20\u8f93<\/p>\n

socketsocke\u9664\u4e86\u662f\u7f51\u8def\u901a\u8baf\u7684\u63d2\u53e3\uff0c\u4e5f\u53ef\u4ee5\u662f\u672c\u5730\u8fdb\u7a0b\u95f4\u901a\u8baf\uff08UNIXsocke\uff09\uff0c\u8fd9\u4e9b\u65b9\u6cd5\u5f88\u5e38\u7528<\/p>\n

\u6570\u636e\u5e93<\/p>\n

\u5e38\u7528<\/p>\n

\u5047\u5982\u662f\u50a8\u5b58\u914d\u7f6e\u53c2\u6570\uff0c\u6211\u4e0d\u592a\u63a8\u8350\u7528\u6570\u636e\u5e93\uff0c\u7528json\u5c31\u5f88\u597d\u3002\u6570\u636e\u901a\u5e38\u7528\u4e8e\u50a8\u5b58\u6bd4\u8f83\u89c4\u5219\u7684\u6570\u636e\uff0c\u8fd9\u6837\u4fbf\u6377\u6570\u636e\u7684\u7ba1\u7406\u3002\u5728\u5d4c\u5165\u5f0f\u7cfb\u7edf\uff0c\u7528\u7684\u6bd4\u8f83\u591a\u7684\u662fsqlite\u6570\u636e\u5e93\u3002<\/p>\n

\u5e76\u53e3\u7f16\u7a0b<\/p>\n

\u6bd4\u8f83\u5e38\u7528<\/p>\n

\u5728Linux\u4e0b\uff0c\u975e\u5e38\u662f\u505a\u5d4c\u5165\u5f0f\u7cfb\u7edf\uff0c\u8fd9\u4e2a\u53ef\u80fd\u662f\u5c11\u4e0d\u4e86\u7684\uff0c\u6bd4\u8f83\u5e38\u7528\u3002\u867d\u7136\u5e76\u53e3\u7f16\u7a0b\u4e5f\u5f88\u7b80\u5355\uff0c\u53ef\u80fd200\u884c\u4ee3\u7801\u5c31\u53ef\u4ee5\u628a\u5e76\u53e3\u901a\u8baf\u6784\u5efa\u4e0a\u53bb\u4e86\u3002\u5e94\u7528\u5c42\u7684\u6570\u636e\u901a\u8baf\uff0c\u5c31\u662f\u4f7f\u7528write\u3001\u548cread\u51fd\u6570\u64cd\u4f5c\uff0c\u800c\u4e14\u5047\u5982\u60f3\u505a\u7684\u6bd4\u8f83\u597d\u4e00\u4e9b\uff0c\u5c31\u987b\u8981\u82b1\u70b9\u65f6\u95f4\u53bb\u505a\u4e2a\u8f6f\u4ef6\u6846\u67b6\uff0c\u4f8b\u5982\u501f\u52a9\u4e0a\u9762\u63d0\u53ca\u7684select\u5b9e\u73b0\u5f02\u6b65\u64cd\u4f5c\uff08\u524d\u9762\u6587\u7ae0\u4f1a\u4ecb\u7ecd\u5b9e\u73b0\u65b9\u6cd5\u4ee5\u53ca\u5e76\u53e3\u7684\u5c01\u88c5\uff09\u3002<\/p>\n

\u7f51\u8def\u7f16\u7a0b<\/p>\n

\u8d85\u7ea7\u5e38\u7528<\/p>\n

\u76f8\u4fe1\u73b0\u4eca\u7684\u5d4c\u5165\u5f0f\u8bbe\u5907\u57fa\u672c\u4e0a\u90fd\u987b\u8981\u7f51\u8def\u901a\u8baf\u529f\u80fd\uff0c\u6240\u4ee5\uff0c\u7f51\u8def\u7f16\u7a0b\u81ea\u7136\u662f\u5341\u5206\u5e38\u7528\u7684\u3002\u7279\u5907\u662f\u73b0\u4eca\u7269\u8054\u7f51\u7684\u53d1\u5c55\uff0c\u4e07\u7269\u4e92\u8054\u3002Linux\u4e0b\u7684\u7f51\u8def\u7f16\u7a0b\uff0c\u6709\u4e00\u7cfb\u5217\u7684API\u51fd\u6570\uff0c\u633a\u591a\u7684\uff0c\u53c2\u6570\u914d\u7f6e\u4e5f\u6bd4\u8f83\u591a\uff0c\u521a\u5f00\u59cb\u4f1a\u8ba9\u4eba\u5f88\u96be\u53d7\uff0c\u4e0d\u6653\u5f97\u90a3\u4e2a\u53c2\u6570\u8bbe\u7f6e\u4e2a\u54ea\u4e9b\u503c\u5408\u9002\uff08\u6211\u4eec\u90fd\u662f\u6e10\u6e10\u8bd5\u9519\u8bd5\u4e0b\u6765\u7684\uff09\u3002\u8fd9\u4e2a\u4e5f\u4e0d\u7528\u62c5\u5fe7\uff0c\u6211\u65c1\u8fb9\u4f1a\u7ed9\u4f60\u4eec\u5206\u4eab\u4e0b\u6765\u6211\u7528C++\u5c01\u88c5\u597d\u7684\u7f51\u8def\u901a\u8baf\u5e93\uff0c\u5305\u62ecTCP\u3001UPD\u3001UDP\u7ec4\u64ad\u3001\u57df\u5957\u63a5\u5b57\uff08\u672c\u5730\uff09\u7b49\u7684\u5c01\u88c5\u3002<\/p>\n

\u7ed3\u675f\u8bed<\/p>\n

\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/p>\n

\u7248\u6743\u7533\u660e\uff1a\u672c\u6587\u4e3aCSDN\u535a\u4e3b\u300cfensnote\u300d\u7684\u539f\u521b\u6587\u7ae0\uff0c\u9075\u5b88CC4.0BY-SA\u7248\u6743\u5408\u540c\uff0c\u8f6c\u8f7d\u8bf7\u9644\u4e0a\u539f\u6587\u51fa\u5904\u94fe\u63a5\u53ca\u672c\u7533\u660e\u3002<\/p>\n

\u539f\u6587\u94fe\u63a5\uff1a<\/p>\n","protected":false},"excerpt":{"rendered":"

Linux\u7cfb\u7edf\u5185\u6838\u662fC\u8bed\u8a00\u7f16\u5199\u7684\uff0c\u6240\u4ee5\uff0cLinux\u7cfb\u7edf\u5f00\u53d1\u53ef\u80fd\u4f1a\u548c\u5f88\u591a\u7cfb\u7edfAPI\u6253\u4ea4\u9053\uff0c\u9700\u8981\u638c\u63e1C\u8bed\u8a00\u57fa\u7840\uff0cC\u8bed\u8a00\u662fLinux\u6700\u57fa\u7840\u7684\u5f00\u53d1\u8bed\u8a00\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u7528C++\u3002<\/p>\n","protected":false},"author":1,"featured_media":279899,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-279898","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/279898","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=279898"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/279898\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/279899"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=279898"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=279898"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=279898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}