getrlimit.2: Since Linux 3.5, the accounting formula for RLIMIT_MSGQUEUE has changed

Reported-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2014-10-01 09:47:42 +02:00
parent 1aa06521e9
commit e15dc33869
1 changed files with 22 additions and 6 deletions

View File

@ -250,8 +250,19 @@ Each message queue that the user creates counts (until it is removed)
against this limit according to the formula: against this limit according to the formula:
.nf .nf
bytes = attr.mq_maxmsg * sizeof(struct msg_msg *) + Since Linux 3.5:
attr.mq_maxmsg * attr.mq_msgsize bytes = attr.mq_maxmsg * sizeof(struct msg_msg) +
min(attr.mq_maxmsg, MQ_PRIO_MAX) *
sizeof(struct posix_msg_tree_node)+
/* For overhead */
attr.mq_maxmsg * attr.mq_msgsize;
/* For message data */
Linux 3.4 and earlier:
bytes = attr.mq_maxmsg * sizeof(struct msg_msg *) +
/* For overhead */
attr.mq_maxmsg * attr.mq_msgsize;
/* For message data */
.fi .fi
where where
@ -259,11 +270,16 @@ where
is the is the
.I mq_attr .I mq_attr
structure specified as the fourth argument to structure specified as the fourth argument to
.BR mq_open (3). .BR mq_open (3),
and the
.I msg_msg
and
.I posix_msg_tree_node
structures are kernel-internal structures.
The first addend in the formula, which includes The "overhead" addend in the formula accounts for overhead
.I "sizeof(struct msg_msg\ *)" bytes required by the implementation
(4 bytes on Linux/i386), ensures that the user cannot and ensures that the user cannot
create an unlimited number of zero-length messages (such messages create an unlimited number of zero-length messages (such messages
nevertheless each consume some system memory for bookkeeping overhead). nevertheless each consume some system memory for bookkeeping overhead).
.TP .TP