⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svmsg.h

📁 在Linux使用systemV测试消息
💻 H
字号:
#ifndef __SVMSG_H#define __SVMSG_H
#define	MSQ_NET_KEY	0x001234L#define	MSQ_METER_KEY 0x002345L

#define MSQ_NET_TYPE 100L#define MSQ_METER_TYPE 110L
#define CONS_MAXBYTES_MESG 1024

struct Mesg_Struct{
	long iMesgType;	long iMesgLen;	char cMesgData[CONS_MAXBYTES_MESG];};

//Create or get a message queue
//In:
//	i_kMsgKey:
//	iMesgFlag:IPC_CREAT,IPC_EXCL,IPC_NOWAIT
//Return:
//	-1: Error;
//	>0: Message ID
int Mesg_get(key_t i_kMsgKey,int i_iMsgFlag);
//Send a message
//In:
//	i_MesgID:
//	i_strupMesg:
//	iMesgFlag:0,IPC_NOWAIT
//Return:
/* return sent #bytes of data */
/*	-1: Error
	0: sent #bytes of message data successfully
*/
int Mesg_send(int i_MesgId, struct Mesg_Struct *i_strupMesg,int iMesgFlag);

//Receive a message
//In:
//	i_MesgID:
//	io_strupMesg:
//	iMesgFlag:0,IPC_NOWAIT,IPC_EXCEPT,IPC_NOERROR
//Out:
//	io_strupMesg:
//Return:
/* return received #bytes of data */
/*	-1: Error
	0:  EOF
	>0: received #bytes of message data successfully
*/
int Mesg_recv(int i_MesgId, struct Mesg_Struct *io_strupMesg,int iMesgFlag);

//Control a message queue
//In:
//	i_MesgId:
//	i_Cmd: IPC_STAT,IPC_SET,IPC_RMID
//	io_strupMsgid: for PC_SET
//Out:
//	io_strupMsgid: for IPC_STAT
//Return:
//	-1: Error
//	0:  Success
int Mesg_ctrl(int i_MesgId,int i_Cmd,struct msqid_ds *io_strupMsqid);
#endif

⌨️ 快捷键说明

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