{"id":12328,"date":"2025-04-18T19:27:09","date_gmt":"2025-04-18T11:27:09","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/12328.html"},"modified":"2025-04-18T19:27:09","modified_gmt":"2025-04-18T11:27:09","slug":"%e3%80%90linux%e3%80%91systemv%e6%b6%88%e6%81%af%e9%98%9f%e5%88%97%e5%92%8c%e4%bf%a1%e5%8f%b7%e9%87%8f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/12328.html","title":{"rendered":"\u3010Linux\u3011systemV\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418112707-6802370bd7cc5.jpg\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u4e2a\u4eba\u4e3b\u9875~<\/p>\n<hr \/>\n<h4>\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf<\/h4>\n<ul>\n<li>\u4e00\u3001\u6d88\u606f\u961f\u5217<\/li>\n<li>\n<ul>\n<li>1\u3001\u5b9e\u73b0\u539f\u7406<\/li>\n<li>2\u3001\u7cfb\u7edf\u8c03\u7528\u63a5\u53e3<\/li>\n<li>\n<ul>\n<li>&#xff08;\u4e00&#xff09;\u521b\u5efa\u83b7\u53d6\u4e00\u4e2a\u6d88\u606f\u961f\u5217<\/li>\n<li>&#xff08;\u4e8c&#xff09;\u63a7\u5236\u6d88\u606f\u961f\u5217<\/li>\n<li>&#xff08;\u4e09&#xff09;\u53d1\u9001\u6d88\u606f<\/li>\n<li>&#xff08;\u56db&#xff09;\u5728\u6d88\u606f\u961f\u5217\u4e2d\u83b7\u53d6\u6570\u636e\u5757<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\u4e8c\u3001\u4fe1\u53f7\u91cf<\/li>\n<li>\n<ul>\n<li>1\u3001\u539f\u7406<\/li>\n<li>2\u3001\u7cfb\u7edf\u8c03\u7528\u63a5\u53e3<\/li>\n<li>\n<ul>\n<li>&#xff08;\u4e00&#xff09;\u521b\u5efa\u83b7\u53d6\u4e00\u4e2a\u4fe1\u53f7\u91cf<\/li>\n<li>&#xff08;\u4e8c&#xff09;\u63a7\u5236\u4fe1\u53f7\u91cf<\/li>\n<li>&#xff08;\u4e09&#xff09;PV\u64cd\u4f5c<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\u4e09\u3001systemV IPC\u65b9\u6cd5\u7684\u6bd4\u8f83<\/li>\n<li>\n<ul>\n<li>1\u3001\u63cf\u8ff0IPC\u8d44\u6e90\u7684\u7ed3\u6784\u4f53<\/li>\n<li>2\u3001\u64cd\u4f5c\u7cfb\u7edf\u5bf9IPC\u8d44\u6e90\u8fdb\u884c\u7ba1\u7406<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>\u4e00\u3001\u6d88\u606f\u961f\u5217<\/h2>\n<h3>1\u3001\u5b9e\u73b0\u539f\u7406<\/h3>\n<p>\u64cd\u4f5c\u7cfb\u7edf\u5728\u5185\u6838\u5efa\u7acb\u4e00\u4e2a\u961f\u5217&#xff0c;\u901a\u4fe1\u7684\u4e24\u4e2a\u8fdb\u7a0bAB\u4ee5\u6570\u636e\u5757\u7684\u5f62\u5f0f\u5c06\u9700\u8981\u53d1\u9001\u7684\u6570\u636epushback\u5230\u961f\u5217\u4e2d&#xff0c;\u6570\u636e\u5757\u662f\u4e00\u4e2a\u7ed3\u6784\u4f53&#xff0c;\u5176\u4e2d\u6709\u5b57\u6bb5\u6807\u8bc6\u8be5\u6570\u636e\u5757\u662f\u8c01\u53d1\u9001\u7684&#xff0c;\u6240\u4ee5\u6211\u4eec\u53ea\u8981\u8ba9\u4e0d\u540c\u7684\u8fdb\u7a0b\u770b\u5230\u540c\u4e00\u4e2a\u961f\u5217\u5c31\u53ef\u4ee5\u4e86<\/p>\n<h3>2\u3001\u7cfb\u7edf\u8c03\u7528\u63a5\u53e3<\/h3>\n<h4>&#xff08;\u4e00&#xff09;\u521b\u5efa\u83b7\u53d6\u4e00\u4e2a\u6d88\u606f\u961f\u5217<\/h4>\n<p>msgget\u51fd\u6570\u7684\u4e3b\u8981\u529f\u80fd\u662f\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6d88\u606f\u961f\u5217\u6216\u8005\u83b7\u53d6\u4e00\u4e2a\u5df2\u7ecf\u5b58\u5728\u7684\u6d88\u606f\u961f\u5217\u7684\u6807\u8bc6\u7b26<\/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;sys\/types.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;sys\/ipc.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;sys\/msg.h&gt;<\/span><\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">msgget<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">key_t<\/span> key<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> msgflg<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd4\u56de\u503c&#xff1a;\u6210\u529f\u8fd4\u56de\u4e00\u4e2amsgid&#xff0c;\u5931\u8d25\u8fd4\u56de-1 key&#xff1a;ftok\u51fd\u6570\u7684\u8fd4\u56de\u503c msgflg&#xff1a;\u6807\u8bc6\u7b26<\/p>\n<table>\n<tr>\u51fd\u6570msgflg\u4f5c\u7528\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>msgget<\/td>\n<td>IPC_CREAT<\/td>\n<td>\u5982\u679c\u6307\u5b9a\u952e\u5bf9\u5e94\u7684\u6d88\u606f\u961f\u5217\u4e0d\u5b58\u5728&#xff0c;\u5219\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6d88\u606f\u961f\u5217&#xff1b;\u82e5\u5df2\u5b58\u5728&#xff0c;\u5219\u76f4\u63a5\u8fd4\u56de\u8be5\u6d88\u606f\u961f\u5217\u7684\u6807\u8bc6\u7b26<\/td>\n<td>msgget(key, IPC_CREAT | 0666)<\/td>\n<\/tr>\n<tr>\n<td>msgget<\/td>\n<td>IPC_EXCL<\/td>\n<td>\u901a\u5e38\u4e0e IPC_CREAT \u4e00\u8d77\u4f7f\u7528&#xff0c;\u82e5\u540c\u65f6\u8bbe\u7f6e\u8fd9\u4e24\u4e2a\u6807\u5fd7&#xff0c;\u5f53\u6d88\u606f\u961f\u5217\u5df2\u7ecf\u5b58\u5728\u65f6&#xff0c;msgget \u8c03\u7528\u4f1a\u5931\u8d25\u5e76\u8fd4\u56de -1&#xff0c;errno \u4f1a\u88ab\u8bbe\u7f6e\u4e3a EEXIST<\/td>\n<td>msgget(key, IPC_CREAT | IPC_EXCL | 0666)<\/td>\n<\/tr>\n<tr>\n<td>msgget<\/td>\n<td>0600<\/td>\n<td>\u6d88\u606f\u961f\u5217\u7684\u6240\u6709\u8005\u5177\u6709\u8bfb\u5199\u6743\u9650&#xff0c;\u6240\u5c5e\u7ec4\u548c\u5176\u4ed6\u7528\u6237\u6ca1\u6709\u4efb\u4f55\u6743\u9650<\/td>\n<td>msgget(key, 0600)<\/td>\n<\/tr>\n<tr>\n<td>msgget<\/td>\n<td>0660<\/td>\n<td>\u6d88\u606f\u961f\u5217\u7684\u6240\u6709\u8005\u548c\u6240\u5c5e\u7ec4\u5177\u6709\u8bfb\u5199\u6743\u9650&#xff0c;\u5176\u4ed6\u7528\u6237\u6ca1\u6709\u6743\u9650<\/td>\n<td>msgget(key, 0660)<\/td>\n<\/tr>\n<tr>\n<td>msgget<\/td>\n<td>0666<\/td>\n<td>\u6d88\u606f\u961f\u5217\u7684\u6240\u6709\u8005\u3001\u6240\u5c5e\u7ec4\u548c\u5176\u4ed6\u7528\u6237\u90fd\u5177\u6709\u8bfb\u5199\u6743\u9650<\/td>\n<td>msgget(key, 0666)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>&#xff08;\u4e8c&#xff09;\u63a7\u5236\u6d88\u606f\u961f\u5217<\/h4>\n<p>msgctl\u7528\u4e8e\u63a7\u5236\u6d88\u606f\u961f\u5217\u7684\u7cfb\u7edf\u8c03\u7528\u51fd\u6570&#xff0c;\u901a\u5e38\u7528\u4e8e\u5bf9\u6d88\u606f\u961f\u5217\u6267\u884c\u5404\u79cd\u7ba1\u7406\u64cd\u4f5c&#xff0c;\u5982\u83b7\u53d6\u6d88\u606f\u961f\u5217\u72b6\u6001\u3001\u8bbe\u7f6e\u6d88\u606f\u961f\u5217\u5c5e\u6027\u4ee5\u53ca\u5220\u9664\u6d88\u606f\u961f\u5217\u7b49<\/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;sys\/types.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;sys\/ipc.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;sys\/msg.h&gt;<\/span><\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">msgctl<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> msgid<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> cmd<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">msqid_ds<\/span> <span class=\"token operator\">*<\/span>buf<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd4\u56de\u503c&#xff1a;\u8fd4\u56de0\u8868\u793a\u64cd\u4f5c\u6210\u529f&#xff0c;\u8fd4\u56de-1\u8868\u793a\u64cd\u4f5c\u5931\u8d25 msgid&#xff1a;\u6d88\u606f\u961f\u5217\u6807\u8bc6\u7b26&#xff0c;msgget\u51fd\u6570\u8fd4\u56de\u503c cmd&#xff1a;msgctl\u51fd\u6570\u7684cmd\u53c2\u6570\u5e38\u7528\u547d\u4ee4\u5982\u4e0b&#xff1a;<\/p>\n<table>\n<tr>\u547d\u4ee4\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>IPC_STAT<\/td>\n<td>\u83b7\u53d6\u6d88\u606f\u961f\u5217\u7684\u72b6\u6001\u4fe1\u606f&#xff0c;\u5c06\u4fe1\u606f\u5b58\u50a8\u5728buf\u6307\u5411\u7684msqid_ds\u7ed3\u6784\u4e2d\u3002\u8fd9\u4e9b\u4fe1\u606f\u5305\u62ec\u6d88\u606f\u961f\u5217\u7684\u6743\u9650\u3001\u6240\u6709\u8005\u4fe1\u606f\u3001\u6d88\u606f\u961f\u5217\u7684\u5927\u5c0f\u3001\u5f53\u524d\u6d88\u606f\u6570\u91cf\u7b49<\/td>\n<\/tr>\n<tr>\n<td>IPC_SET<\/td>\n<td>\u6839\u636ebuf\u6307\u5411\u7684msqid_ds\u7ed3\u6784\u4e2d\u7684\u503c&#xff0c;\u8bbe\u7f6e\u6d88\u606f\u961f\u5217\u7684\u5c5e\u6027\u3002\u53ef\u4ee5\u8bbe\u7f6e\u7684\u5c5e\u6027\u5305\u62ec\u6d88\u606f\u961f\u5217\u7684\u6743\u9650\u3001\u961f\u5217\u7684\u6700\u5927\u5b57\u8282\u6570\u7b49<\/td>\n<\/tr>\n<tr>\n<td>IPC_RMID<\/td>\n<td>\u5220\u9664\u6307\u5b9a\u7684\u6d88\u606f\u961f\u5217\u3002\u8c03\u7528\u8be5\u547d\u4ee4\u540e&#xff0c;\u6d88\u606f\u961f\u5217\u5c06\u88ab\u7acb\u5373\u5220\u9664&#xff0c;\u6240\u6709\u6392\u961f\u7684\u6d88\u606f\u90fd\u4f1a\u88ab\u4e22\u5f03&#xff0c;\u5e76\u4e14\u4e0e\u8be5\u6d88\u606f\u961f\u5217\u76f8\u5173\u7684\u8d44\u6e90\u4e5f\u4f1a\u88ab\u91ca\u653e<\/td>\n<\/tr>\n<tr>\n<td>MSG_INFO<\/td>\n<td>\u83b7\u53d6\u4e0e\u6d88\u606f\u961f\u5217\u76f8\u5173\u7684\u7cfb\u7edf\u8d44\u6e90\u4f7f\u7528\u4fe1\u606f&#xff0c;\u4f8b\u5982\u5f53\u524d\u7cfb\u7edf\u4e2d\u6d88\u606f\u961f\u5217\u7684\u603b\u6570\u3001\u7cfb\u7edf\u5141\u8bb8\u7684\u6700\u5927\u6d88\u606f\u961f\u5217\u6570\u7b49<\/td>\n<\/tr>\n<tr>\n<td>MSG_STAT<\/td>\n<td>\u8be5\u547d\u4ee4\u4e0eIPC_STAT\u7c7b\u4f3c&#xff0c;\u4f46\u5b83\u8fd4\u56de\u7684\u662f\u4e00\u4e2a\u6307\u5411struct msg_info\u7ed3\u6784\u7684\u6307\u9488&#xff0c;\u8be5\u7ed3\u6784\u5305\u542b\u4e86\u66f4\u591a\u5173\u4e8e\u6d88\u606f\u961f\u5217\u7684\u7edf\u8ba1\u4fe1\u606f&#xff0c;\u5982\u53d1\u9001\u548c\u63a5\u6536\u6d88\u606f\u7684\u5b57\u8282\u6570\u7b49<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>buf&#xff1a;\u4e00\u4e2a\u6307\u5411msgid_ds\u7ed3\u6784\u4f53\u7684\u6307\u9488&#xff0c;\u7528\u4e8e\u5b58\u50a8\u6216\u63d0\u4f9b\u6d88\u606f\u961f\u5217\u7684\u76f8\u5173\u4fe1\u606f&#xff0c;msqid_ds\u7ed3\u6784\u5305\u542b\u4e86\u6d88\u606f\u961f\u5217\u7684\u5404\u79cd\u5c5e\u6027&#xff0c;\u5982\u961f\u5217\u7684\u6743\u9650\u3001\u6240\u6709\u8005\u4fe1\u606f\u3001\u6d88\u606f\u961f\u5217\u7684\u5927\u5c0f\u7b49<\/p>\n<h4>&#xff08;\u4e09&#xff09;\u53d1\u9001\u6d88\u606f<\/h4>\n<p>msgsnd\u7528\u4e8e\u5411\u6d88\u606f\u961f\u5217\u53d1\u9001\u6d88\u606f\u7684\u7cfb\u7edf\u8c03\u7528\u51fd\u6570&#xff0c;\u5b83\u5141\u8bb8\u8fdb\u7a0b\u5c06\u4e00\u4e2a\u6d88\u606f\u6dfb\u52a0\u5230\u6307\u5b9a\u7684\u6d88\u606f\u961f\u5217\u4e2d<\/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;sys\/types.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;sys\/ipc.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;sys\/msg.h&gt;<\/span><\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">msgsnd<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> msgid<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">const<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token operator\">*<\/span>msgp<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">size_t<\/span> msgsz<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> msgflg<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd4\u56de\u503c&#xff1a;\u6210\u529f\u8fd4\u56de0&#xff0c;\u5931\u8d25\u8fd4\u56de-1 msgid&#xff1a;\u6d88\u606f\u961f\u5217\u6807\u8bc6\u7b26&#xff0c;msgget\u51fd\u6570\u8fd4\u56de\u503c msgp&#xff1a;\u6307\u5411\u8981\u53d1\u9001\u7684\u6d88\u606f\u7ed3\u6784\u4f53\u7684\u6307\u9488&#xff0c;\u8be5\u7ed3\u6784\u4f53\u7684\u7b2c\u4e00\u4e2a\u6210\u5458\u5fc5\u987b\u662f long \u7c7b\u578b&#xff0c;\u7528\u4e8e\u6307\u5b9a\u6d88\u606f\u7684\u7c7b\u578b&#xff0c;\u540e\u7eed\u53ef\u4ee5\u5305\u542b\u6d88\u606f\u7684\u6570\u636e\u90e8\u5206 msgsz&#xff1a;\u6d88\u606f\u6570\u636e\u90e8\u5206\u7684\u957f\u5ea6&#xff0c;\u5373msgp\u6240\u6307\u5411\u7ed3\u6784\u4f53\u4e2d\u9664\u7b2c\u4e00\u4e2along\u7c7b\u578b\u6210\u5458\u4e4b\u5916\u7684\u6570\u636e\u957f\u5ea6 msgflg&#xff1a;\u8be5\u4f4d\u7f6e\u4e3a0\u5c31\u662f\u4e0d\u8bbe\u7f6e<\/p>\n<table>\n<tr>\u51fd\u6570msgflg\u4f5c\u7528\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>msgsnd<\/td>\n<td>IPC_NOWAIT<\/td>\n<td>\u975e\u963b\u585e\u53d1\u9001\u6d88\u606f&#xff0c;\u5f53\u6d88\u606f\u961f\u5217\u5df2\u6ee1&#xff0c;\u65e0\u6cd5\u7acb\u5373\u53d1\u9001\u6d88\u606f\u65f6&#xff0c;\u5982\u679c\u8bbe\u7f6e\u4e86\u8be5\u6807\u5fd7&#xff0c;msgsnd \u51fd\u6570\u4f1a\u7acb\u5373\u8fd4\u56de -1&#xff0c;errno \u88ab\u8bbe\u7f6e\u4e3a EAGAIN&#xff1b;\u82e5\u672a\u8bbe\u7f6e\u8be5\u6807\u5fd7&#xff0c;msgsnd \u51fd\u6570\u4f1a\u963b\u585e&#xff0c;\u76f4\u5230\u6d88\u606f\u961f\u5217\u6709\u7a7a\u95f4\u53ef\u4ee5\u53d1\u9001\u6d88\u606f<\/td>\n<td>msgsnd(msgid, &amp;msgbuf, sizeof(msgbuf.mtext), IPC_NOWAIT)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>&#xff08;\u56db&#xff09;\u5728\u6d88\u606f\u961f\u5217\u4e2d\u83b7\u53d6\u6570\u636e\u5757<\/h4>\n<p>msgrcv\u7528\u4e8e\u4ece\u6d88\u606f\u961f\u5217\u63a5\u6536\u6d88\u606f\u7684\u7cfb\u7edf\u8c03\u7528\u51fd\u6570&#xff0c;\u5b83\u5141\u8bb8\u8fdb\u7a0b\u4ece\u6307\u5b9a\u7684\u6d88\u606f\u961f\u5217\u4e2d\u83b7\u53d6\u6d88\u606f<\/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;sys\/types.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;sys\/ipc.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;sys\/msg.h&gt;<\/span><\/span><br \/>\n<span class=\"token class-name\">ssize_t<\/span> <span class=\"token function\">msgrcv<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> msgid<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token operator\">*<\/span>msgp<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">size_t<\/span> msgsz<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">long<\/span> msgtyp<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> msgflg<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd4\u56de\u503c&#xff1a;\u6210\u529f\u8fd4\u56de\u5b9e\u9645\u6536\u5230\u7684\u6d88\u606f\u6570\u636e\u90e8\u5206\u7684\u5b57\u8282\u6570&#xff0c;\u4e0d\u5305\u62ec\u6700\u524d\u9762\u7684long \u524d\u4e24\u4e2a\u53c2\u6570\u4e0e\u524d\u9762\u76f8\u540c msgsz&#xff1a;\u63a5\u6536\u6d88\u606f\u65f6\u7528\u4e8e\u5b58\u50a8\u6d88\u606f\u6570\u636e\u90e8\u5206\u7684\u7f13\u51b2\u533a\u7684\u6700\u5927\u957f\u5ea6 msgtyp&#xff1a;\u5982\u679c\u7b49\u4e8e0&#xff0c;\u90a3\u8be5\u51fd\u6570\u53ea\u63a5\u6536\u6d88\u606f\u961f\u5217\u4e2d\u7684\u7b2c\u4e00\u6761\u6d88\u606f&#xff0c;\u5982\u679c\u5927\u4e8e0&#xff0c;\u63a5\u6536\u6d88\u606f\u961f\u5217\u4e2d\u6d88\u606f\u7c7b\u578b\u4e3amsgtyp\u7684\u7b2c\u4e00\u6761\u6d88\u606f&#xff0c;\u5982\u679c\u5c0f\u4e8e0&#xff0c;\u63a5\u6536\u6d88\u606f\u961f\u5217\u4e2d\u6d88\u606f\u7c7b\u578b\u5c0f\u4e8e\u7b49\u4e8emsgtyp\u7edd\u5bf9\u503c\u7684\u6700\u5c0f\u7c7b\u578b\u7684\u7b2c\u4e00\u6761\u6d88\u606f msgflg&#xff1a;\u8be5\u4f4d\u7f6e\u4e3a0\u5c31\u662f\u4e0d\u8bbe\u7f6e<\/p>\n<table>\n<tr>\u51fd\u6570msgflg\u4f5c\u7528\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>msgrcv<\/td>\n<td>IPC_NOWAIT<\/td>\n<td>\u5f53\u6d88\u606f\u961f\u5217\u4e2d\u6ca1\u6709\u7b26\u5408\u8981\u6c42\u7684\u6d88\u606f\u65f6&#xff0c;\u5982\u679c\u8bbe\u7f6e\u4e86\u8be5\u6807\u5fd7&#xff0c;msgrcv \u51fd\u6570\u4f1a\u7acb\u5373\u8fd4\u56de -1&#xff0c;errno \u88ab\u8bbe\u7f6e\u4e3a ENOMSG&#xff1b;\u82e5\u672a\u8bbe\u7f6e\u8be5\u6807\u5fd7&#xff0c;msgrcv \u51fd\u6570\u4f1a\u963b\u585e&#xff0c;\u76f4\u5230\u6709\u7b26\u5408\u8981\u6c42\u7684\u6d88\u606f\u8fdb\u5165\u6d88\u606f\u961f\u5217<\/td>\n<td>msgrcv(msgid, &amp;msgbuf, sizeof(msgbuf.mtext), msgtype, IPC_NOWAIT)<\/td>\n<\/tr>\n<tr>\n<td>msgrcv<\/td>\n<td>MSG_NOERROR<\/td>\n<td>\u5982\u679c\u63a5\u6536\u5230\u7684\u6d88\u606f\u957f\u5ea6\u8d85\u8fc7\u4e86\u6307\u5b9a\u7684\u7f13\u51b2\u533a\u5927\u5c0f&#xff0c;\u82e5\u8bbe\u7f6e\u4e86\u8be5\u6807\u5fd7&#xff0c;\u6d88\u606f\u4f1a\u88ab\u622a\u65ad\u4e3a\u7f13\u51b2\u533a\u5927\u5c0f&#xff0c;\u591a\u4f59\u90e8\u5206\u4f1a\u88ab\u4e22\u5f03&#xff0c;msgrcv \u51fd\u6570\u6b63\u5e38\u8fd4\u56de&#xff1b;\u82e5\u672a\u8bbe\u7f6e\u8be5\u6807\u5fd7&#xff0c;msgrcv \u51fd\u6570\u4f1a\u8fd4\u56de -1&#xff0c;errno \u88ab\u8bbe\u7f6e\u4e3a E2BIG<\/td>\n<td>msgrcv(msgid, &amp;msgbuf, sizeof(msgbuf.mtext), msgtype, MSG_NOERROR)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u4e8c\u3001\u4fe1\u53f7\u91cf<\/h2>\n<h3>1\u3001\u539f\u7406<\/h3>\n<p>\u4fe1\u53f7\u91cf\u662f\u4e00\u79cd\u7528\u4e8e\u5b9e\u73b0\u8fdb\u7a0b\u95f4\u540c\u6b65\u4e0e\u4e92\u65a5\u7684\u673a\u5236&#xff0c;\u4fe1\u53f7\u91cf\u672c\u8d28\u4e0a\u662f\u4e00\u4e2a\u6574\u6570\u53d8\u91cf&#xff0c;\u7528\u4e8e\u63a7\u5236\u5bf9\u5171\u4eab\u8d44\u6e90\u7684\u8bbf\u95ee&#xff0c;\u5b83\u53ef\u4ee5\u770b\u4f5c\u662f\u4e00\u79cd\u7279\u6b8a\u7684\u8ba1\u6570\u5668&#xff0c;\u5176\u503c\u8868\u793a\u5f53\u524d\u53ef\u7528\u7684\u5171\u4eab\u8d44\u6e90\u6570\u91cf&#xff0c;\u4fe1\u53f7\u91cf\u7684\u503c\u53ef\u4ee5\u88ab\u591a\u4e2a\u8fdb\u7a0b\u6216\u7ebf\u7a0b\u8bfb\u53d6\u548c\u4fee\u6539&#xff0c;\u901a\u8fc7\u5bf9\u4fe1\u53f7\u91cf\u7684\u64cd\u4f5c&#xff0c;\u8fdb\u7a0b\u6216\u7ebf\u7a0b\u53ef\u4ee5\u534f\u8c03\u5bf9\u5171\u4eab\u8d44\u6e90\u7684\u8bbf\u95ee<\/p>\n<p>\u4fe1\u53f7\u91cf\u7684\u5de5\u4f5c\u57fa\u4e8e\u4e24\u4e2a\u57fa\u672c\u64cd\u4f5c&#xff1a;P\u64cd\u4f5c&#xff08;wait\u64cd\u4f5c&#xff09;\u548cV\u64cd\u4f5c&#xff08;signal\u64cd\u4f5c&#xff09; P\u64cd\u4f5c&#xff1a;\u5f53\u4e00\u4e2a\u8fdb\u7a0b\u6216\u7ebf\u7a0b\u9700\u8981\u8bbf\u95ee\u5171\u4eab\u8d44\u6e90\u65f6&#xff0c;\u5b83\u4f1a\u6267\u884c P \u64cd\u4f5c\u3002P \u64cd\u4f5c\u4f1a\u5c06\u4fe1\u53f7\u91cf\u7684\u503c\u51cf 1&#xff0c;\u5982\u679c\u51cf 1 \u540e\u4fe1\u53f7\u91cf\u7684\u503c\u5927\u4e8e\u7b49\u4e8e 0&#xff0c;\u8868\u793a\u5f53\u524d\u6709\u53ef\u7528\u7684\u8d44\u6e90&#xff0c;\u8fdb\u7a0b\u6216\u7ebf\u7a0b\u53ef\u4ee5\u7ee7\u7eed\u8bbf\u95ee&#xff1b;\u5982\u679c\u51cf 1 \u540e\u4fe1\u53f7\u91cf\u7684\u503c\u5c0f\u4e8e 0&#xff0c;\u8868\u793a\u6ca1\u6709\u53ef\u7528\u7684\u8d44\u6e90&#xff0c;\u8fdb\u7a0b\u6216\u7ebf\u7a0b\u4f1a\u88ab\u963b\u585e&#xff0c;\u76f4\u5230\u6709\u5176\u4ed6\u8fdb\u7a0b\u6216\u7ebf\u7a0b\u91ca\u653e\u8d44\u6e90<\/p>\n<p>V \u64cd\u4f5c&#xff1a;\u5f53\u4e00\u4e2a\u8fdb\u7a0b\u6216\u7ebf\u7a0b\u4f7f\u7528\u5b8c\u5171\u4eab\u8d44\u6e90\u540e&#xff0c;\u5b83\u4f1a\u6267\u884c V \u64cd\u4f5c&#xff0c;V \u64cd\u4f5c\u4f1a\u5c06\u4fe1\u53f7\u91cf\u7684\u503c\u52a0 1&#xff0c;\u5982\u679c\u52a0 1 \u540e\u4fe1\u53f7\u91cf\u7684\u503c\u5c0f\u4e8e\u7b49\u4e8e 0&#xff0c;\u8868\u793a\u6709\u5176\u4ed6\u8fdb\u7a0b\u6216\u7ebf\u7a0b\u6b63\u5728\u7b49\u5f85\u8be5\u8d44\u6e90&#xff0c;\u6b64\u65f6\u4f1a\u5524\u9192\u4e00\u4e2a\u7b49\u5f85\u7684\u8fdb\u7a0b\u6216\u7ebf\u7a0b<\/p>\n<h3>2\u3001\u7cfb\u7edf\u8c03\u7528\u63a5\u53e3<\/h3>\n<h4>&#xff08;\u4e00&#xff09;\u521b\u5efa\u83b7\u53d6\u4e00\u4e2a\u4fe1\u53f7\u91cf<\/h4>\n<p>semget\u662f\u7528\u4e8e\u521b\u5efa\u6216\u83b7\u53d6\u4fe1\u53f7\u91cf\u96c6\u7684\u7cfb\u7edf\u8c03\u7528\u51fd\u6570<\/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;sys\/types.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;sys\/ipc.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;sys\/sem.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">semget<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">key_t<\/span> key<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> nsems<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> semflg<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd4\u56de\u503c&#xff1a;\u6210\u529f\u8fd4\u56de\u4fe1\u53f7\u91cf\u6807\u8bc6\u7b26semid&#xff0c;\u5931\u8d25\u8fd4\u56de-1 nsems&#xff1a;\u8868\u793a\u8981\u521b\u5efa\u6216\u83b7\u53d6\u7684\u4fe1\u53f7\u91cf\u96c6\u4e2d\u4fe1\u53f7\u91cf\u7684\u6570\u91cf&#xff0c;\u5982\u679c\u662f\u521b\u5efa\u65b0\u7684\u4fe1\u53f7\u91cf\u96c6\u5219\u5fc5\u987b\u5927\u4e8e 0&#xff0c;\u5982\u679c\u662f\u83b7\u53d6\u5df2\u6709\u7684\u4fe1\u53f7\u91cf\u96c6\u5219\u53ef\u4ee5\u4e3a0 semflg&#xff1a;\u6807\u5fd7\u4f4d&#xff0c;\u7528\u4e8e\u6307\u5b9a\u521b\u5efa\u6216\u83b7\u53d6\u4fe1\u53f7\u91cf\u96c6\u7684\u65b9\u5f0f\u548c\u6743\u9650<\/p>\n<h4>&#xff08;\u4e8c&#xff09;\u63a7\u5236\u4fe1\u53f7\u91cf<\/h4>\n<p>semctl\u662f\u7528\u4e8e\u63a7\u5236\u4fe1\u53f7\u91cf\u96c6\u7684\u7cfb\u7edf\u8c03\u7528\u51fd\u6570&#xff0c;\u5b83\u53ef\u4ee5\u5bf9\u4fe1\u53f7\u91cf\u96c6\u8fdb\u884c\u591a\u79cd\u64cd\u4f5c&#xff0c;\u5982\u521d\u59cb\u5316\u4fe1\u53f7\u91cf\u7684\u503c\u3001\u83b7\u53d6\u4fe1\u53f7\u91cf\u7684\u72b6\u6001\u3001\u5220\u9664\u4fe1\u53f7\u91cf\u96c6\u7b49<\/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;sys\/types.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;sys\/ipc.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;sys\/sem.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">semctl<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> semid<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> semnum<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">int<\/span> cmd<span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd4\u56de\u503c&#xff1a;\u53d6\u51b3\u4e8ecmd\u7684\u5f53\u524d\u503c&#xff0c;\u5bf9\u4e8e GETVAL \u547d\u4ee4&#xff0c;\u8fd4\u56de\u6307\u5b9a\u4fe1\u53f7\u91cf\u7684\u5f53\u524d\u503c&#xff0c;\u5bf9\u4e8e IPC_STAT\u3001IPC_SET \u548c IPC_RMID \u7b49\u547d\u4ee4&#xff0c;\u8fd4\u56de 0 \u8868\u793a\u6210\u529f semid&#xff1a;\u4fe1\u53f7\u91cf\u6807\u8bc6\u7b26&#xff0c;semget\u51fd\u6570\u8fd4\u56de semnum&#xff1a;\u4fe1\u53f7\u91cf\u96c6\u4e2d\u4fe1\u53f7\u91cf\u7684\u7f16\u53f7&#xff0c;\u7f16\u53f7\u4ece 0 \u5f00\u59cb&#xff0c;\u5982\u679c cmd \u64cd\u4f5c\u4e0d\u9700\u8981\u9488\u5bf9\u7279\u5b9a\u7684\u4fe1\u53f7\u91cf&#xff08;\u5982\u5220\u9664\u6574\u4e2a\u4fe1\u53f7\u91cf\u96c6&#xff09;&#xff0c;\u5219\u53ef\u4ee5\u5ffd\u7565\u8be5\u53c2\u6570&#xff0c;\u901a\u5e38\u5c06\u5176\u8bbe\u4e3a 0 cmd&#xff1a;\u8981\u6267\u884c\u7684\u547d\u4ee4&#xff0c;\u6307\u5b9a\u4e86\u5bf9\u4fe1\u53f7\u91cf\u96c6\u6216\u7279\u5b9a\u4fe1\u53f7\u91cf\u7684\u64cd\u4f5c\u7c7b\u578b<\/p>\n<h4>&#xff08;\u4e09&#xff09;PV\u64cd\u4f5c<\/h4>\n<p>semop\u7528\u4e8e\u5bf9\u4fe1\u53f7\u91cf\u96c6\u6267\u884c\u64cd\u4f5c\u7684\u7cfb\u7edf\u8c03\u7528\u51fd\u6570&#xff0c;\u5b83\u5141\u8bb8\u8fdb\u7a0b\u5bf9\u4e00\u4e2a\u6216\u591a\u4e2a\u4fe1\u53f7\u91cf\u8fdb\u884c\u539f\u5b50\u6027\u7684 P\u548c V\u64cd\u4f5c&#xff0c;\u4ece\u800c\u5b9e\u73b0\u8fdb\u7a0b\u95f4\u7684\u540c\u6b65\u4e0e\u4e92\u65a5<\/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;sys\/types.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;sys\/ipc.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;sys\/sem.h&gt;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">int<\/span> <span class=\"token function\">semop<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> semid<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">sembuf<\/span> <span class=\"token operator\">*<\/span>sops<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">unsigned<\/span> nsops<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd4\u56de\u503c&#xff1a;\u6210\u529f\u8fd4\u56de0&#xff0c;\u5931\u8d25\u8fd4\u56de-1 sops&#xff1a;\u6307\u5411struct sembuf\u7ed3\u6784\u4f53\u6570\u7ec4\u7684\u6307\u9488&#xff0c;\u8be5\u6570\u7ec4\u5305\u542b\u4e86\u8981\u5bf9\u4fe1\u53f7\u91cf\u96c6\u6267\u884c\u7684\u64cd\u4f5c\u5e8f\u5217 nsops&#xff1a;sops\u6570\u7ec4\u4e2d\u5143\u7d20\u7684\u6570\u91cf&#xff0c;\u5373\u8981\u6267\u884c\u7684\u64cd\u4f5c\u5e8f\u5217\u7684\u957f\u5ea6<\/p>\n<h2>\u4e09\u3001systemV IPC\u65b9\u6cd5\u7684\u6bd4\u8f83<\/h2>\n<h3>1\u3001\u63cf\u8ff0IPC\u8d44\u6e90\u7684\u7ed3\u6784\u4f53<\/h3>\n<p>\u63cf\u8ff0\u5171\u4eab\u5185\u5b58IPC\u8d44\u6e90\u7ed3\u6784\u4f53&#xff1a;<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">shmid_kernel<\/span> <span class=\"token comment\">\/* private to the kernel *\/<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">kern_ipc_perm<\/span>shm_perm<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">file<\/span> <span class=\"token operator\">*<\/span>    shm_file<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">int<\/span>id<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span>shm_nattch<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span>shm_segsz<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">time_t<\/span>shm_atim<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">time_t<\/span>shm_dtim<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">time_t<\/span>shm_ctim<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">pid_t<\/span>shm_cprid<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">pid_t<\/span>shm_lprid<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">user_struct<\/span><span class=\"token operator\">*<\/span>mlock_user<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u63cf\u8ff0\u6d88\u606f\u961f\u5217IPC\u8d44\u6e90\u7ed3\u6784\u4f53&#xff1a;<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">msg_queue<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">kern_ipc_perm<\/span> q_perm<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">time_t<\/span>  q_stime<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* last msgsnd time *\/<\/span><br \/>\n<span class=\"token class-name\">time_t<\/span>  q_rtime<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* last msgrcv time *\/<\/span><br \/>\n<span class=\"token class-name\">time_t<\/span> q_ctime<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* last change time *\/<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span>  q_cbytes<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* current number of bytes on queue *\/<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span> q_qnum<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* number of messages in queue *\/<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span> q_qbytes<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* max number of bytes on queue *\/<\/span><br \/>\n<span class=\"token class-name\">pid_t<\/span> q_lspid<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* pid of last msgsnd *\/<\/span><br \/>\n<span class=\"token class-name\">pid_t<\/span> q_lrpid<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* last receive pid *\/<\/span><\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">list_head<\/span>  q_messages<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">list_head<\/span> q_receivers<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">list_head<\/span> q_senders<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u63cf\u8ff0\u4fe1\u53f7\u91cfIPC\u8d44\u6e90\u7ed3\u6784\u4f53&#xff1a;<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">sem_array<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">kern_ipc_perm<\/span>sem_perm<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* permissions .. see ipc.h *\/<\/span><br \/>\n<span class=\"token class-name\">time_t<\/span>sem_otime<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* last semop time *\/<\/span><br \/>\n<span class=\"token class-name\">time_t<\/span>sem_ctime<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* last change time *\/<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">sem<\/span><span class=\"token operator\">*<\/span>sem_base<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* ptr to first semaphore in array *\/<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">sem_queue<\/span><span class=\"token operator\">*<\/span>sem_pending<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* pending operations to be processed *\/<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">sem_queue<\/span><span class=\"token operator\">*<\/span><span class=\"token operator\">*<\/span>sem_pending_last<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/* last pending operation *\/<\/span><br \/>\n<span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">sem_undo<\/span><span class=\"token operator\">*<\/span>undo<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* undo requests on this array *\/<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span>sem_nsems<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/* no. of semaphores in array *\/<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u4ed6\u4eec\u6709\u4e00\u4e2a\u540c\u6837\u7684\u7279\u70b9\u5c31\u662f\u7b2c\u4e00\u4e2a\u53c2\u6570\u90fd\u662fstruct kern_ipc_perm\u7c7b\u578b\u7684<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">kern_ipc_perm<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token class-name\">spinlock_t<\/span>lock<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">int<\/span>deleted<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">key_t<\/span>key<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">uid_t<\/span>uid<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">gid_t<\/span>gid<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">uid_t<\/span>cuid<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">gid_t<\/span>cgid<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">mode_t<\/span>mode<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">long<\/span>seq<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">void<\/span><span class=\"token operator\">*<\/span>security<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h3>2\u3001\u64cd\u4f5c\u7cfb\u7edf\u5bf9IPC\u8d44\u6e90\u8fdb\u884c\u7ba1\u7406<\/h3>\n<p>\u6240\u6709\u7684IPC\u8d44\u6e90\u90fd\u6709\u4e00\u4e2astruct kern_ipc_perm\u7ed3\u6784&#xff0c;\u6240\u4ee5\u64cd\u4f5c\u7cfb\u7edf\u901a\u8fc7\u6570\u7ec4\u5c06\u8fd9\u4e9bstruct kern_ipc_perm\u7ed3\u6784\u7ec4\u7ec7\u8d77\u6765<\/p>\n<p>ipc_ids\u662f Linux \u5185\u6838\u4e2d\u7528\u4e8e\u7ba1\u7406IPC\u8d44\u6e90\u7684\u6838\u5fc3\u6570\u636e\u7ed3\u6784<\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">ipc_ids<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">int<\/span>             in_use<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u8bb0\u5f55\u5f53\u524d\u7cfb\u7edf\u4e2d\u6b63\u5728\u4f7f\u7528\u7684IPC\u8d44\u6e90\u7684\u6570\u91cf<\/span><br \/>\n    <span class=\"token keyword\">int<\/span>             max_id<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u8868\u793a\u7cfb\u7edf\u4e2d\u5141\u8bb8\u7684\u6700\u5927IPC\u6807\u8bc6\u7b26\u503c<\/span><br \/>\n    <span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">short<\/span>  seq<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u662f\u4e00\u4e2a\u5e8f\u5217\u53f7&#xff0c;\u7528\u4e8e\u751f\u6210\u552f\u4e00\u7684IPC\u6807\u8bc6\u7b26<\/span><br \/>\n    <span class=\"token keyword\">unsigned<\/span> <span class=\"token keyword\">short<\/span>  seq_max<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u662f\u5e8f\u5217\u53f7\u7684\u6700\u5927\u503c<\/span><br \/>\n    <span class=\"token keyword\">struct<\/span>          <span class=\"token class-name\">semaphore<\/span> sem<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u8fd9\u662f\u4e00\u4e2a\u4fe1\u53f7\u91cf&#xff0c;\u7528\u4e8e\u5bf9IPC\u8d44\u6e90\u7684\u5e76\u53d1\u8bbf\u95ee\u8fdb\u884c\u540c\u6b65\u63a7\u5236    <\/span><br \/>\n    <span class=\"token keyword\">struct<\/span>          <span class=\"token class-name\">ipc_id_ary<\/span> nullentry<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u4e00\u4e2a\u7a7a\u7684ipc_id_ary\u7ed3\u6784<\/span><br \/>\n    <span class=\"token keyword\">struct<\/span>          <span class=\"token class-name\">ipc_id_ary<\/span><span class=\"token operator\">*<\/span> entries<span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u6307\u5411ipc_id_ary\u7ed3\u6784\u4f53\u7684\u6307\u9488<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">ipc_id_ary<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">int<\/span>    size<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">struct<\/span> <span class=\"token class-name\">kern_ipc_perm<\/span> <span class=\"token operator\">*<\/span>p<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8fd9\u91cc\u7684\u67d4\u6027\u6570\u7ec4p\u7684\u4f5c\u7528\u5c31\u662f\u7ef4\u62a4\u5f53\u524d\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u6240\u6709IPC\u8d44\u6e90&#xff0c;\u6211\u4eec\u901a\u8fc7\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u6765\u901a\u8fc7\u8fd9\u4e2a\u6570\u7ec4\u91cc\u5b58\u7684struct ipc_id_ary*\u627e\u5230\u5177\u4f53\u7684IPC\u5bf9\u8c61&#xff0c;\u56e0\u4e3akern_ipc_perm\u662f\u8fd9\u4e09\u4e2a\u7ed3\u6784\u4f53\u4e2d\u7684\u7b2c\u4e00\u4e2a\u6210\u5458&#xff0c;\u6211\u4eec\u53ea\u8981\u77e5\u9053\u4e86\u4e00\u4e2akern_ipc_perm\u7684\u5730\u5740&#xff0c;\u5c31\u76f8\u5f53\u4e8e\u77e5\u9053\u4e86\u67d0\u4e2a\u5177\u4f53IPC\u5bf9\u8c61\u7684\u8d77\u59cb\u5730\u5740&#xff0c;\u7136\u540e\u901a\u8fc7\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u5c31\u53ef\u4ee5\u8bbf\u95ee\u5230\u8be5IPC\u5bf9\u8c61\u4e2d\u7684\u6240\u6709\u6210\u5458\u5c5e\u6027&#xff0c;\u8fd9\u6837\u5c31\u5b9e\u73b0\u4e86\u5bf9\u4e00\u4e2a\u5177\u4f53IPC\u5bf9\u8c61\u7684\u8bbf\u95ee&#xff0c;\u5982((struct shmid_kernel*)p[0])-&gt;q_stime&#xff0c;\u5728kern_ipc_perm\u4e2d\u6709\u5b57\u6bb5\u6765\u6807\u8bc6\u8be5kern_ipc_perm\u662f\u5c5e\u4e8e\u54ea\u79cdIPC\u8d44\u6e90&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u5c31\u77e5\u9053\u8981\u5c06\u5176\u5f3a\u5236\u8f6c\u5316\u6210\u4ec0\u4e48\u7c7b\u578b\u4e86&#xff0c;\u6211\u4eec\u5728\u7528\u6237\u5c42\u9762\u4e0a\u4f7f\u7528\u7684&#xff1a;shmid\u3001msqid\u3001semid\u5728\u5185\u6838\u4e0a\u770b\u5c31\u662fp\u6570\u7ec4\u7684\u4e0b\u6807<\/p>\n<p>ipc_id_arry\u5c5e\u4e8e\u64cd\u4f5c\u7cfb\u7edf&#xff0c;\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u8fdb\u7a0b&#xff0c;\u6570\u7ec4\u4e0b\u6807\u662f\u7ebf\u6027\u9012\u589e\u7684&#xff0c;\u4f46\u4e0d\u4f1a\u56e0\u4e3aIPC\u8d44\u6e90\u7684\u91ca\u653e\u800c\u6539\u53d8\u5b83\u7684\u9012\u589e\u5c5e\u6027&#xff0c;\u5373\u5f53\u524d\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u6700\u540e\u4e00\u4e2aIPC\u8d44\u6e90\u7684\u4e0b\u6807\u662f100&#xff0c;\u91ca\u653e\u6389\u8fd9\u4e2aIPC\u8d44\u6e90&#xff0c;\u4e0b\u4e00\u6b21\u518d\u521b\u5efaIPC\u8d44\u6e90\u7684\u65f6\u5019\u5b83\u7684\u4e0b\u6807\u662f101&#xff0c;\u800c\u4e0d\u662f100&#xff0c;\u5f53\u9012\u589e\u5230\u4e00\u5b9a\u503c\u7684\u65f6\u5019&#xff0c;\u4f1a\u56de\u52300<\/p>\n<hr \/>\n<p>\u4eca\u65e5\u5206\u4eab\u5c31\u5230\u8fd9\u91cc\u4e86~<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418112707-6802370bec9a4.jpg\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb2.3k\u6b21\uff0c\u70b9\u8d5e79\u6b21\uff0c\u6536\u85cf57\u6b21\u3002systemV\u6807\u51c6\u7684IPC\u901a\u4fe1\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf\uff0c\u7136\u540e\u6bd4\u8f83\u4e86\u4ed6\u4eec\u4fe9\u4ee5\u53ca\u5171\u4eab\u5185\u5b58\u7684\u5173\u7cfb<\/p>\n","protected":false},"author":2,"featured_media":12326,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,371,123,43,305,124,44],"topic":[],"class_list":["post-12328","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-371","tag-123","tag-43","tag-305","tag-124","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010Linux\u3011systemV\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf - \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\/12328.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010Linux\u3011systemV\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb2.3k\u6b21\uff0c\u70b9\u8d5e79\u6b21\uff0c\u6536\u85cf57\u6b21\u3002systemV\u6807\u51c6\u7684IPC\u901a\u4fe1\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf\uff0c\u7136\u540e\u6bd4\u8f83\u4e86\u4ed6\u4eec\u4fe9\u4ee5\u53ca\u5171\u4eab\u5185\u5b58\u7684\u5173\u7cfb\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/12328.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-18T11:27:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418112707-6802370bd7cc5.jpg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/12328.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/12328.html\",\"name\":\"\u3010Linux\u3011systemV\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T11:27:09+00:00\",\"dateModified\":\"2025-04-18T11:27:09+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/12328.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/12328.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/12328.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010Linux\u3011systemV\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf\"}]},{\"@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\u3011systemV\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf - \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\/12328.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010Linux\u3011systemV\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb2.3k\u6b21\uff0c\u70b9\u8d5e79\u6b21\uff0c\u6536\u85cf57\u6b21\u3002systemV\u6807\u51c6\u7684IPC\u901a\u4fe1\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf\uff0c\u7136\u540e\u6bd4\u8f83\u4e86\u4ed6\u4eec\u4fe9\u4ee5\u53ca\u5171\u4eab\u5185\u5b58\u7684\u5173\u7cfb","og_url":"https:\/\/www.wsisp.com\/helps\/12328.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T11:27:09+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418112707-6802370bd7cc5.jpg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/12328.html","url":"https:\/\/www.wsisp.com\/helps\/12328.html","name":"\u3010Linux\u3011systemV\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T11:27:09+00:00","dateModified":"2025-04-18T11:27:09+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/12328.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/12328.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/12328.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010Linux\u3011systemV\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf"}]},{"@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\/12328","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=12328"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/12328\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/12326"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=12328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=12328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=12328"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=12328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}