ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
And following function simply resizes a message queue to a user-defined value, namely, "size":
Code:
bool resizeMessageQueue(int mqId, struct msqid_ds* buf, int size)
{
/* Modify the message queue features */
buf->msg_perm.uid = geteuid();
buf->msg_perm.gid = getegid();
buf->msg_perm.mode = 0660;
buf->msg_qbytes = size; // The new size for the message queue
if(msgctl(mqId, IPC_SET, buf) == -1)
{
return false;
}
return true;
}
My question is if there is a theoretical limit on user-defined message queue sizes.
To put in other words, is it possible to increase the default message queue size to any user-defined value as long as that certain value does not exceed the size of system's physical memory ?
And following function simply resizes a message queue to a user-defined value, namely, "size":
Code:
bool resizeMessageQueue(int mqId, struct msqid_ds* buf, int size)
{
/* Modify the message queue features */
buf->msg_perm.uid = geteuid();
buf->msg_perm.gid = getegid();
buf->msg_perm.mode = 0660;
buf->msg_qbytes = size; // The new size for the message queue
if(msgctl(mqId, IPC_SET, buf) == -1)
{
return false;
}
return true;
}
My question is if there is a theoretical limit on user-defined message queue sizes.
To put in other words, is it possible to increase the default message queue size to any user-defined value as long as that certain value does not exceed the size of system's physical memory ?
I have not looked at the source, but Bovet & Cesati, in Understanding the Linux Kernel talk about the message queues.
Quote:
"To avoid resource exhaustion, there are some limits on the number of IPC message queue resources allowed (by default, 16), on the size of each message (by default, 8,192 bytes), and on the maximum total size of the messages in a queue (by default, 16,384 bytes). As usual, however, the system administrator can tune these values by writing into the /proc/sys/kernel/msgmni, /proc/sys/kernel/msgmnb, and /proc/sys/kernel/msgmax files, respectively."
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.