Re: POSIX message queues should not allocate memory on send

From: Chris Wright
Date: Fri May 14 2004 - 11:59:36 EST


* Martijn Sipkema (m.j.w.sipkema@xxxxxxxxxxxxxxxxxx) wrote:
> You are correct; defaults are indeed needed. The current default value
> for mq_msgsize seems rather large considering that mq_msgsize*mq_maxmsg
> bytes will have to be allocated on queue creation. If variable sized large
> payload messages are needed one might consider using shared memory in
> combination with a message queue.

The defaults have been reduced in -mm tree which should make it to
mainline in relative near future.

#define DFLT_MSGMAX 10 /* max number of messages in each queue */
#define DFLT_MSGSIZEMAX 8192 /* max message size */

> My main point was that mq_send()/mq_timedsend() may not return ENOMEM
> and I am positive I did not misread the standard on that.

I'm not sure it's that clear, however, we somewhat adhered to this
principle when adding rlimits to mqueues, so rlimit checks are enforced
on mq_open() as if whole thing was pre-allocated.

thanks,
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/