ctl.c

来自「《UNIX进程间通信》中的代码」· C语言 代码 · 共 26 行

C
26
字号
#include	"unpipc.h"intmain(int argc, char **argv){	int				msqid;	struct msqid_ds	info;	struct msgbuf	buf;	msqid = Msgget(IPC_PRIVATE, SVMSG_MODE | IPC_CREAT);	buf.mtype = 1;	buf.mtext[0] = 1;	Msgsnd(msqid, &buf, 1, 0);	Msgctl(msqid, IPC_STAT, &info);	printf("read-write: %03o, cbytes = %lu, qnum = %lu, qbytes = %lu\n",		   info.msg_perm.mode & 0777, (ulong_t) info.msg_cbytes,		   (ulong_t) info.msg_qnum, (ulong_t) info.msg_qbytes);	system("ipcs -q");	Msgctl(msqid, IPC_RMID, NULL);	exit(0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?