The kernel stores each message in the queue within the framework of the msg structure. It is defined for us in linux/msg.h as follows:
/* one msg structure for each message */
struct msg {
struct msg *msg_next; /* next message on queue */
long msg_type;
char *msg_spot; /* message text address */
short msg_ts; /* message text size */
};
This is a pointer to the next message in the queue. They are stored as a singly linked list within kernel addressing space.
This is the message type, as assigned in the user structure msgbuf.
A pointer to the beginning of the message body.
The length of the message text, or body.