950 Chapter 46
if (argc != 3 || strcmp(argv[1], "--help") == 0)
usageErr("%s msqid max-bytes\n", argv[0]);
/* Retrieve copy of associated data structure from kernel */
msqid = getInt(argv[1], 0, "msqid");
if (msgctl(msqid, IPC_STAT, &ds) == -1)
errExit("msgctl");
ds.msg_qbytes = getInt(argv[2], 0, "max-bytes");
/* Update associated data structure in kernel */
if (msgctl(msqid, IPC_SET, &ds) == -1)
errExit("msgctl");
exit(EXIT_SUCCESS);
}
––––––––––––––––––––––––––––––––––––––––––––––––––––svmsg/svmsg_chqbytes.c
46.5 Message Queue Limits
Most UNIX implementations impose various limits on the operation of System V
message queues. Here, we describe the limits under Linux and note a few differ-
ences from other UNIX implementations.
The following limits are enforced on Linux. The system call affected by the
limit and the error that results if the limit is reached are noted in parentheses.
MSGMNI
This is a system-wide limit on the number of message queue identifiers (in
other words, message queues) that can be created. (msgget(), ENOSPC)
MSGMAX
This is a system-wide limit specifying the maximum number of (mtext) bytes
that can be written in a single message. (msgsnd(), EINVAL)
MSGMNB
This is the maximum number of (mtext) bytes that can be held in a message
queue at one time. This limit is a system-wide parameter that is used to ini-
tialize the msg_qbytes field of the msqid_ds data structure associated with this
message queue. Subsequently, the msg_qbytes value can be modified on a
per-queue basis, as described in Section 46.4. If a queue’s msg_qbytes limit is
reached, then msgsnd() blocks, or fails with the error EAGAIN if IPC_NOWAIT was set.
Some UNIX implementations also define the following further limits:
MSGTQL
This is a system-wide limit on the number of messages that can be placed
on all message queues on the system.
MSGPOOL
This is a system-wide limit on the size of the buffer pool that is used to hold
data in all message queues on the system.