Hello all,
We have a application where two processes communicate via IPC.
We are currently using Message Queue for this communication.
The problem that we are facing is that the Max message that we are able to send through Message Q is only 2048 bytes!
As soon as we send data more than 2048 bytes, msgsend returns -1 with error code: 22 [Invalid arguments].
We tried increasing the Message Q size using msgctl system call, but to no avail.
Even though msgctl for msgsize > 2048 returns success, the message Q size remains 2048 only.
Sample program that i wrote to increase the Message Q size is as follows:
**********************************************
msgid = msgget((key_t)1234, 0666 | IPC_CREAT);
if(-1==msgctl(msgid,IPC_STAT,&queue_ds))
{
printf("\nFailure in msgctl() 1");
}
printf("Queue size: %d", (int) queue_ds.msg_qbytes);
/* Increase Queue size */
queue_ds.msg_qbytes = 5000;
if(-1==msgctl(msgid,IPC_SET,&queue_ds))
{
printf("\nFailure in msgctl()");
}
else
{
printf("Queue size updated to: %d", (int) queue_ds.msg_qbytes);
}
if(-1==msgctl(msgid,IPC_STAT,&queue_ds))
{
printf("\nFailure in msgctl() 2");
}
printf("Modified Queue size: %d", (int) queue_ds.msg_qbytes);
*************************************************
Output:
Queue size: 2048
Queue size updated to: 5000
Modified Queue size: 2048
Any idea why we are not able to increase the Message Q size?
Is this a limitation on Mac OS X?
Appreciate any help/pointers in this regard.
Cheers!
We have a application where two processes communicate via IPC.
We are currently using Message Queue for this communication.
The problem that we are facing is that the Max message that we are able to send through Message Q is only 2048 bytes!
As soon as we send data more than 2048 bytes, msgsend returns -1 with error code: 22 [Invalid arguments].
We tried increasing the Message Q size using msgctl system call, but to no avail.
Even though msgctl for msgsize > 2048 returns success, the message Q size remains 2048 only.
Sample program that i wrote to increase the Message Q size is as follows:
**********************************************
msgid = msgget((key_t)1234, 0666 | IPC_CREAT);
if(-1==msgctl(msgid,IPC_STAT,&queue_ds))
{
printf("\nFailure in msgctl() 1");
}
printf("Queue size: %d", (int) queue_ds.msg_qbytes);
/* Increase Queue size */
queue_ds.msg_qbytes = 5000;
if(-1==msgctl(msgid,IPC_SET,&queue_ds))
{
printf("\nFailure in msgctl()");
}
else
{
printf("Queue size updated to: %d", (int) queue_ds.msg_qbytes);
}
if(-1==msgctl(msgid,IPC_STAT,&queue_ds))
{
printf("\nFailure in msgctl() 2");
}
printf("Modified Queue size: %d", (int) queue_ds.msg_qbytes);
*************************************************
Output:
Queue size: 2048
Queue size updated to: 5000
Modified Queue size: 2048
Any idea why we are not able to increase the Message Q size?
Is this a limitation on Mac OS X?
Appreciate any help/pointers in this regard.
Cheers!