views:

494

answers:

1

I am writing an IPC application using message queues. While using msgget() function to get Message Queue I am getting this error.

The requested operations does not require lot of space on the device and there should be space left as well.

Any ideas. Thank you in advance

+2  A: 

ENOSPC from msgget indicates that the system-wide maximum number of message queues has been reached.

You may be able to configure this limit - eg in Linux you can tweak /proc/sys/kernel/msgmni.

caf
Any workaround if I do not have root access?
Alex Xander
I do not believe so, it is an administratively set resource limit. `echo "Please increase number of message queues." | mail root@localhost` is probably the best you can do ;)
caf
@Alex - if your machine is not configured to support message queues at all, or not enough message queues, someone has to reconfigure it. That person will need root privileges. If it isn't you, speak to the administrator. Or use something other than `msgget()`.
Jonathan Leffler
thanks all! I got root access and edited /proc/sys/kernel/msgmni.
Alex Xander
Be aware that changes to sysctls made through `/proc/` don't survive reboots - to make it permanent add a line to `/etc/sysctl.conf` like `kernel.msgmni = 2000`
caf