LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-21-2008, 09:02 AM   #1
marconap
LQ Newbie
 
Registered: Feb 2008
Posts: 12

Rep: Reputation: 0
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 2.6.22.5-31, 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
Marco
 
Old 02-22-2008, 06:26 AM   #2
marconap
LQ Newbie
 
Registered: Feb 2008
Posts: 12

Original Poster
Rep: Reputation: 0
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!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Posix Message Queues culin Programming 3 04-08-2007 08:01 AM
POSIX message queues(Solaris) to SYS V message queues(Linux) devershetty Programming 1 01-22-2007 11:15 AM
Message Queues naga_presin Linux - Networking 1 05-20-2006 04:26 PM
Posix Message queues? gdipierro Programming 20 07-26-2005 05:59 PM
POSIX message queues... infamous41md Programming 6 05-25-2004 03:53 PM


All times are GMT -5. The time now is 07:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration