
\u6700\u8fd1\u5728\u770b\u300a unix \u7cfb\u7edf\u7f16\u7a0b\u624b\u518c\u300b\u548c\u300a unix \u73af\u5883\u9ad8\u7ea7\u7f16\u7a0b\u300b\n\u770b\u5230 IO \u7f13\u51b2\u533a\u8fd9\u5757\u6709\u70b9\u7591\u95ee\uff0c\u4e66\u4e0a\u597d\u591a\u5730\u65b9\u6709\u63d0\u5230\u7f13\u51b2\u533a\uff0c\u4f46\u4e66\u4e0a\u4e5f\u6ca1\u7ec6\u8bf4\u662f\u5185\u6838\u7f13\u51b2\u533a\u8fd8\u662f\u7528\u6237\u7f13\u51b2\u533a\n\u7ffb\u4e00\u4e0b\u7f51\u4e0a\u7684\u5e16\u5b50\uff0c\u53d1\u73b0\u4e5f\u662f\u5982\u6b64\u3002
\n\u6211\u6309\u7167\u4e2a\u4eba\u7406\u89e3\u753b\u4e86\u4e0b\u9762\u51e0\u5e45\u56fe\uff0c\u5927\u5bb6\u5e2e\u6211\u770b\u4e0b\u6211\u7406\u89e3\u7684\u5bf9\u5417\uff1f
\n
read \u51fd\u6570\uff1a\u6bcf\u6b21\u8c03\u7528\u90fd\u6267\u884c\u4e00\u6b21 read \u7cfb\u7edf\u8c03\u7528\uff0c\u6ca1\u6709\u7f13\u5b58
\n
fread \u51fd\u6570\uff1a
\n
write \u51fd\u6570\uff1a\u6bcf\u6b21\u8c03\u7528\u90fd\u4f1a\u6267\u884c\u4e00\u6b21 write \u7cfb\u7edf\u8c03\u7528\uff0c\u6ca1\u6709\u7f13\u5b58
\n
fwrite \u51fd\u6570\uff1a
\n\u6211\u4e0a\u9762\u63cf\u8ff0\u7684\u5bf9\u5417\uff1f
\n\u8f93\u5165\u8f93\u51fa\u7f13\u51b2\u533a\u662f\u4f4d\u4e8e\u5185\u6838\u7a7a\u95f4\u5417\uff1f
\nfopen \u8fd4\u56de\u7684 FILE \u7ed3\u6784\u4f53\u662f\u5305\u542b\u7740\u7528\u6237\u7f13\u51b2\u533a\u662f\u5417\uff1f
\n\u5982\u679c fopen \u4ee5\u8bfb\u5199\u65b9\u5f0f\u6253\u5f00\u6587\u4ef6\uff0c\u90a3\u662f\u4e0d\u662f\u4f1a\u5728\u7528\u6237\u7a7a\u95f4\u540c\u65f6\u5efa\u7acb\u4e24\u4e2a\u7f13\u51b2\u533a\uff0c\u4e00\u4e2a\u7528\u4e8e\u8bfb\uff0c\u4e00\u4e2a\u7528\u4e8e\u5199\uff1f
\nfopen \u6253\u5f00\u6587\u4ef6\u8fd4\u56de\u7684\u5bf9\u8c61\u79f0\u4e4b\u4e3a stream \uff0cstream \u662f\u4e2a\u5565\uff1f\u662f\u4e0d\u662f\u5176\u7279\u70b9\u5c31\u662f\u5e26\u6709\u7f13\u51b2\u533a\uff0c\u53ef\u4ee5\u7528\u4e8e\u7f13\u51b2 IO \uff0c\u5408\u5e76\u7cfb\u7edf\u8c03\u7528\uff1f
\n\u5982\u679c\u4f7f\u7528 setvbuf \u628a fread \u4e2d\u7684\u7528\u6237\u7f13\u51b2\u533a\u6539\u4e3a\u884c\u7f13\u51b2\u6a21\u5f0f\uff0c\u90a3\u7b2c\u4e00\u6b21 read \u65f6\u662f\u4e0d\u662f\u53ea\u4ece\u8f93\u5165\u7f13\u51b2\u533a\u8bfb\u53d6\u4e00\u884c\u6570\u636e\u800c\u4e0d\u662f 2k \uff1f
\ntest.txt \u5185\u5bb9\u5982\u4e0b\nab\ncd\n\n\nFILE *file = fopen(\"test.txt\", \"r+\");\nchar buf_cache[512];\nsetvbuf(file, buf_cache, _IOLBF, 512);\nchar c;\nsleep(5);\nfread(&c, 1, 1, file);\nfread(&c, 1, 1, file);\nfread(&c, 1, 1, file);\nfread(&c, 1, 1, file);\nfread(&c, 1, 1, file);\nfclose(file);\n\n\n\u90a3\u4ee5\u4e0a\u4ee3\u7801\u6211\u7528 strace \u8ffd\u8e2a\u4e3a\u5565\u8fd8\u662f\u53ea\u8c03\u7528\u4e86\u4e00\u6b21 read \u7cfb\u7edf\u8c03\u7528\u5462\uff1f\u6309\u7406\u8bf4\u4e0d\u5e94\u8be5\u662f\u56e0\u4e3a\u6709\u4e24\u884c\u6570\u636e\u6267\u884c\u4e24\u6b21 read \u5417\uff1f
\n", "date_published": "2023-10-30T09:51:27+00:00", "title": "\u8bf7\u6559\u4e0b\u5173\u4e8e IO \u7f13\u51b2\u7684\u4e00\u70b9\u7591\u95ee", "id": "t/986797" }, { "author": { "url": "member/Zien", "name": "Zien", "avatar": "https://cdn.v2ex.com/avatar/9153/9772/354209_large.png?m=1744315960" }, "url": "t/795445", "title": "mv \u547d\u4ee4\u6587\u4ef6\u5939\u540e\u9762\u52a0\u659c\u6760\u771f\u7684\u6ca1\u6709\u610f\u4e49\u5417\uff1f", "id": "t/795445", "date_published": "2021-08-12T14:30:29+00:00", "content_html": "\u5927\u90e8\u5206\u90fd\u8bf4\u6ca1\u6709\u4f5c\u7528\uff08\u6211\u4ee5\u524d\u4e5f\u662f\u8fd9\u6837\u8ba4\u4e3a\u7684\uff09\uff0c\u4f46\u770b\u5230\u4e00\u4e2a\u56de\u7b54\u5efa\u8bae source \u540e\u4e0d\u52a0\u659c\u6760\uff0c\u9632\u6b62 symlink \u7684\u95ee\u9898\uff1b\ntarget \u6700\u597d\u52a0\u659c\u6760\uff0c\u9632\u6b62\u9519\u62fc\u5bfc\u81f4\u7684\u95ee\u9898\u3002
\nhttps://stackoverflow.com/a/24925767
\n\u611f\u89c9\u6709\u70b9\u6ca1\u5403\u900f\uff0c\u6709\u6ca1\u6709\u5927\u624b\u5b50\u80fd\u89e3\u91ca\u4e0b\u3002
\n" }, { "author": { "url": "member/cloudL", "name": "cloudL", "avatar": "https://cdn.v2ex.com/avatar/74b7/c28d/215021_large.png?m=1487058482" }, "url": "t/346482", "date_modified": "2017-03-10T08:11:19+00:00", "content_html": "\u5b89\u88c5\u5b8c\u7cfb\u7edf\u540e\uff0c\u6267\u884c\u4ee5\u4e0b\u4ee3\u7801\u540e\u5173\u673a\u3002\u7136\u540e\u628a\u7cfb\u7edf\u5236\u4f5c\u6210\u955c\u50cf\u5373\u53ef
\n\u4fdd\u5b58\u4e3a\u4e00\u4e2a\u53ef\u6267\u884c\u7684 bash \u6587\u4ef6\uff0c\u6700\u597d\u5728 screen \u4e2d\u8fd0\u884c
\n#\u628a\u4e0b\u9762\u7684 key \u6362\u6210\u6709\u6548\u7684 Plesk key
\nkey=A00100-C11604-BP7806-BP7662-SE5R68
\n#\u4e00\u952e\u5b89\u88c5 Plesk
\nsh <(curl https://autoinstall.plesk.com/one-click-installer || wget -O - https://autoinstall.plesk.com/one-click-installer)
\n#\u83b7\u53d6\u4e00\u4e2a\u672c\u673a ip \u5730\u5740
\nip=ifconfig eth0 | grep \"inet addr\" | awk '{ print $2}' | awk -F: '{print $2}'
if [ \"$ip\" = \"\" ]; then
\nip=`ifconfig eth0 | grep \"inet\" | awk '{ print $2}'`\n\nfi
\n#\u521d\u59cb\u5316\u914d\u7f6e Plesk
\nplesk bin init_conf --init -default-ip $ip -netmask 255.255.255.0 -iface eth0 -ip-type shared -license_agreed true -hostname example.com -shared_ips add:$ip -name \"John Doe\" -passwd mypass -phone 555-5555 -fax 333-3333 -email admin@example.com -company \"Megacompany Inc.\" -address \"45 Trail street\" -city \"New York\" -zip 10292 -country US -state NY
\n#\u6fc0\u6d3b key
\nplesk bin license -i $key
\n#\u8bbe\u7f6e Plesk \u9ed8\u8ba4\u8bed\u8a00
\nplesk bin locales --set-default zh-CN
\n#\u66f4\u6539\u57df\u540d\u6ce8\u518c\u6216\u57df\u540d\u7ba1\u7406\u7684\u94fe\u63a5
\nif [ ! -f \"/etc/centos-release\" ]; then
\npath='/opt'\n\nelse
\npath='/usr/local'\n\nfi
\n$path/psa/bin/panel_gui -p -domain_registration_url https://www.bisend.cn/domain
\n$path/psa/bin/panel_gui -p -domain_management_url https://my.bisend.cn
\n#\u4e0d\u663e\u793a Facebook Like \u94fe\u63a5\u4ee5\u52a0\u5feb Plesk \u9875\u9762\u52a0\u8f7d\u901f\u5ea6
\nsed 's/;showLikeLink/showLikeLink/' $path/psa/admin/conf/panel.ini.sample >\n$path/psa/admin/conf/panel.ini
\n#\u5b89\u88c5\u989d\u5916\u7684 extension
\nwget https://my.bisend.cn/downloads/trustasiassltool-1.1.9-10.zip -P /root/
\nplesk bin extension --install /root/trustasiassltool-1.1.9-10.zip
\n#\u6e05\u9664\u5b89\u88c5 Key \u7684\u4fe1\u606f
\nplesk bin cloning -u -prepare-public-image true -reset-license true -reset-init-conf true -skip-update true
\n#\u4e0b\u6b21\u542f\u52a8 Plesk \u7684\u65f6\u5019\u91cd\u65b0\u6620\u5c04 ip
\nplesk bin ipmanage --auto-remap-ip-addresses true
\n#\u7d42\u308f\u308a
\necho \"finished\"
\nwindows \u4e2d\u53ea\u628a\u90e8\u5206\u64cd\u4f5c\u811a\u672c\u5316
\n#\u6d4f\u89c8\u5668\u4e0b\u8f7d http://autoinstall-win.plesk.com/plesk-installer.exe
\n#\u53cc\u51fb\u6253\u5f00\u6216\u8005 cmd \u6253\u5f00 plesk-installer.exe --console
\n#LINUX: sh <(curl https://autoinstall.plesk.com/one-click-installer || wget -O - https://autoinstall.plesk.com/one-click-installer)
\n#ip=ifconfig eth0 | grep \"inet addr\" | awk '{ print $2}' | awk -F: '{print $2}'\n#\u624b\u52a8\u83b7\u5f97 ip \u5e76\u66ff\u6362\u4e0b\u9762\u547d\u4ee4\u4e2d\u7684 ip
plesk bin init_conf --init -license_agreed true -hostname example.com -shared_ips add:172.31.34.196 -name \"John Doe\" -passwd MyPass@123 -phone 555-5555 -fax 333-3333 -email admin@example.com -company \"Megacompany Inc.\" -address \"45 Trail street\" -city \"New York\" -zip 10292 -country US -state NY
\nplesk bin license -i A00100-C11604-BP7806-BP7662-SE5R68
\nplesk bin locales --set-default zh-CN #\u8bbe\u7f6e\u4e2d\u6587\u4e3a\u9ed8\u8ba4\u8bed\u8a00
\n\"C:\\Program Files (x86)\\Plesk\\bin\\panel_gui\" -p -domain_registration_url https://www.bisend.cn/domain
\n\"C:\\Program Files (x86)\\Plesk\\bin\\panel_gui\" -p -domain_management_url https://my.bisend.cn
\n#\u624b\u52a8\u64cd\u4f5c\u4ee3\u66ff\u4e0b\u9762\u7684\u53e5\u5b50
\n#sed \"s/;showLikeLink/showLikeLink/\" \"C:\\Program Files (x86)\\Plesk\\admin\\conf\\panel.ini.sample\" > \"C:\\Program Files (x86)\\Plesk\\admin\\conf\\panel.ini\"
\n#\u624b\u52a8\u64cd\u4f5c\u4ee3\u66ff\u4e0b\u9762\u7684\u53e5\u5b50
\n#wget https://my.bisend.cn/downloads/trustasiassltool-1.1.9-10.zip -P /root/
\n#plesk bin extension --install /root/trustasiassltool-1.1.9-10.zip
\nplesk bin cloning -u -prepare-public-image true -reset-license true -reset-init-conf true -skip-update true
\nplesk bin ipmanage --auto-remap-ip-addresses true
\n#windows \u4e2d\u4e0d\u9700\u8981
\n#-default-ip 172.31.34.196 -netmask 255.255.255.0 -iface eth0 -ip-type shared
\n", "date_published": "2017-03-10T08:08:40+00:00", "title": "Plesk \u955c\u50cf\u5236\u4f5c(\u811a\u672c)", "id": "t/346482" }, { "author": { "url": "member/hatcloud", "name": "hatcloud", "avatar": "https://cdn.v2ex.com/avatar/d7a9/d8cd/65310_large.png?m=1402926643" }, "url": "t/141387", "date_modified": "2014-10-25T03:07:44+00:00", "content_html": "\u81ea\u5df1\u60f3\u5199\u4e00\u4e2a\u81ea\u52a8\u4eceGitHub\u4e0a\u66f4\u65b0\u6700\u65b0\u7684Hosts\u6587\u4ef6\u5230\u672c\u5730\u7684\u811a\u672c\uff0c\u5948\u4f55\u5b8c\u5168\u4e0d\u4f1aUnix\u7684\u811a\u672c\u7f16\u5199\u3002