# GetMsg

Gets a message from a message port.

### Synopsis

`Item GetMsg( Item mp )`

### Description

This procedure gets the first message in the message queue for the specified message port and removes the message from the queue.

### Arguments

mp
  The item number of the message port from which to get the message.

### Return Value

The procedure returns the item number of the first message in the message queue or an error code (a negative value) if an error occurs. Possible error codes include the following:

0
  The queue is empty.

BADITEM
  The mp argument does not specify a message port.

NOTOWNER
  The message port specified by the mp argument is not owned by this task.

### Implementation

SWI implemented in kernel folio V20.

### Associated Files

msgport.h
  ANSI C Prototype

### See Also

``DeleteMsg`(), GetThisMsg(), ReplyMsg(), ReplySmallMsg(), SendMsg(), SendSmallMsg(), WaitPort()`

#