Humm... now this make me think that you did not change the MSGMNBI was afraid that it might break user space applications that queue a few kb of messages.
value when you changed MSGMNI and MSGMAX.
Maybe that was on purpose?
if (msgsz + msq->q_cbytes <= msq->q_qbytes &&It's possible to send 0-byte messages even if the message queue is full [except that you can't send more than MSGMNB messages].
1 + msq->q_qnum <= msq->q_qbytes) {
break;
}