1.增加消息队列大小

This commit is contained in:
payton 2023-07-05 10:21:02 +08:00
parent 5bab92b379
commit 1a7f9c9714

View File

@ -66,14 +66,29 @@ static SINT32 message_queue_create(SF_CHAR *pathname,SINT32 *pMsgQueueId)
printf("[%s:%d] ftok error\n", __FUNCTION__, __LINE__); printf("[%s:%d] ftok error\n", __FUNCTION__, __LINE__);
return SF_FAILURE; return SF_FAILURE;
} }
if ((*pMsgQueueId = msgget(key, IPC_CREAT | 0660)) == -1) if ((*pMsgQueueId = msgget(key, IPC_CREAT | 0666)) == -1)
{ {
printf("[%s:%d] MsgQueueId = %#x msgget failed errno.%02d is: %s\n", __FUNCTION__, __LINE__,*pMsgQueueId, errno, strerror(errno)); printf("[%s:%d] MsgQueueId = %#x msgget failed errno.%02d is: %s\n", __FUNCTION__, __LINE__,*pMsgQueueId, errno, strerror(errno));
//MLOGI("MsgQueueId = %#x\n"); //MLOGI("MsgQueueId = %#x\n");
//MLOGI("msgget failed errno.%02d is: %s\n"); //MLOGI("msgget failed errno.%02d is: %s\n");
return SF_FAILURE; return SF_FAILURE;
} }
printf("[%s:%d] MsgQueueId = %#x\n", __FUNCTION__, __LINE__,*pMsgQueueId);
struct msqid_ds buf;
if (msgctl(*pMsgQueueId, IPC_STAT, &buf) == -1) {
perror("msgctl IPC_STAT");
return SF_FAILURE;
}
//printf("[%s:%d] key:%d buf.msg_qbytes:%d\n", __FUNCTION__, __LINE__, key, buf.msg_qbytes);
buf.msg_qbytes = 32768;
if (msgctl(*pMsgQueueId, IPC_SET, &buf) == -1) {
perror("msgctl IPC_SET");
return SF_FAILURE;
}
printf("[%s:%d] MsgQueueId = %d\n", __FUNCTION__, __LINE__,*pMsgQueueId);
//MLOGI("\n"); //MLOGI("\n");
return SF_SUCCESS; return SF_SUCCESS;
} }