-   Linux - Newbie (
-   -   Not enough memory for Posix message queues... ulimit -q doesnt work ?? (

marconap 02-21-2008 08:02 AM

Not enough memory for Posix message queues... ulimit -q doesnt work ??
Hi, I am modifying an existing application, running on openSUSE 10.3 (i586) - Kernel, in order to use Posix message queues instead of older Pipes.
According to linux documentation, the total requested size for an mqueue depends from the following formula:

Bytes needed = mq_maxmsg*sizeof(struct msg_msg*)+ mq_maxmsg*mq_msgsize

In my mind, sizeof(struct msg_msg*) is reserved for an "internal header" of the message.
The output of the command "ulimit -q" is 819200, so if I try to create a queue with the following parameters:

attr.mq_flags = 0;
attr.mq_maxmsg = 99;
attr.mq_msgsize = 8192;
attr.mq_curmsgs = 0;

everything works fine, because 99*4+99*8192 = 811404 (less than 819200).
Obviously, I am not able to create a bigger queue, unless I am root.
I tried to increase the available memory with the command "ulimit -q unlimited" or "ulimit -q 10000000" (as root).
Nothing seems change, the limit for the user process is stuck to 819200 and if I log out the root session and log it in again, the output value of ulimit -q comes back to 819200.
How can I change the systemwide limit?
I tried to put the "ulimit -q" command in /etc/rc.local or in /etc/security/limits.conf, but with no appreciable results.

Thanks un advance

marconap 02-22-2008 05:26 AM

Found the right way
I appended the following lines to /etc/security/limits.conf:

* hard msgqueue 8192000
* soft msgqueue 8192000

This set the systemwide limit and now everything works fine!

All times are GMT -5. The time now is 05:38 AM.