views:

261

answers:

3

I am using msgget() function in my IPC based application. How can I clean up the queue filled up with old message queues?

+1  A: 

A work around is to increase MSGMNI System wide maximum number of message queues: policy dependent (on Linux, this limit can be read and modified via /proc/sys/kernel/msgmni).

AJ
+2  A: 

To delete a queue, use the following command:

msgctl(msgQID, IPC_RMID, NULL);

SYSTEM CALL: msgctl()

jitter
A: 

These persistent resource allocation issues (there's a similar one with shared memory) are why the System V APIs are generally considered deprecated. In this case, have you considered using a unix domain socket or FIFO instead of a message queue? Those appear in the filesystem, and can be "cleaned up" when no longer used with tools like rm.

Andy Ross