Next: Kernel msqid_ds structure Up: Internal and User Data Previous: Message buffer

#### Kernel `msg` structure

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 */
     };

`msg_next`

  This is a pointer to the next message in the queue. They are stored as a singly linked list within kernel addressing space.

`msg_type`

  This is the message type, as assigned in the user structure `msgbuf`.

`msg_spot`

  A pointer to the beginning of the message body.

`msg_ts`

  The length of the message text, or body.