Loading...
Searching...
No Matches
Error Handling
Base API » Object Invocation

Error handling for L4 object invocation. More...

Collaboration diagram for Error Handling:

## Enumerations

enum

l4_ipc_tcr_error_t {
L4_IPC_ERROR_MASK = 0x1F , L4_IPC_SND_ERR_MASK = 0x01 , L4_IPC_ENOT_EXISTENT = 0x04 , L4_IPC_RETIMEOUT = 0x03 ,
L4_IPC_SETIMEOUT = 0x02 , L4_IPC_RECANCELED = 0x07 , L4_IPC_SECANCELED = 0x06 , L4_IPC_REMAPFAILED = 0x11 ,
L4_IPC_SEMAPFAILED = 0x10 , L4_IPC_RESNDPFTO = 0x0b , L4_IPC_SESNDPFTO = 0x0a , L4_IPC_RERCVPFTO = 0x0d ,
L4_IPC_SERCVPFTO = 0x0c , L4_IPC_REABORTED = 0x0f , L4_IPC_SEABORTED = 0x0e , L4_IPC_REMSGCUT = 0x09 ,
L4_IPC_SEMSGCUT = 0x08
}

| Error codes in the error TCR. More...

## Functions

l4_umword_t | l4_ipc_error (l4_msgtag_t tag, l4_utcb_t *utcb) L4_NOTHROW
| Get the IPC error code for an IPC operation.
long | l4_error (l4_msgtag_t tag) L4_NOTHROW
| Get IPC error code if any or message tag label otherwise for an IPC call.
int | l4_ipc_is_snd_error (l4_utcb_t *utcb) L4_NOTHROW
| Returns whether an error occurred in send phase of an invocation.
int | l4_ipc_is_rcv_error (l4_utcb_t *utcb) L4_NOTHROW
| Returns whether an error occurred in receive phase of an invocation.
int | l4_ipc_error_code (l4_utcb_t *utcb) L4_NOTHROW
| Get the error condition of the last invocation from the TCR.

## Detailed Description

Error handling for L4 object invocation.

Include File
  #include <l4/sys/ipc.h>

## Enumeration Type Documentation

## l4_ipc_tcr_error_t

enum l4_ipc_tcr_error_t

Error codes in the error TCR.

The error codes are accessible via the error TCR, see l4_thread_regs_t.error.

Enumerator
L4_IPC_ERROR_MASK | Mask for error bits.
L4_IPC_SND_ERR_MASK | Send error mask.
L4_IPC_ENOT_EXISTENT | Non-existing destination or source.
L4_IPC_RETIMEOUT | Timeout during receive operation.
L4_IPC_SETIMEOUT | Timeout during send operation.
L4_IPC_RECANCELED | Receive operation canceled.
L4_IPC_SECANCELED | Send operation canceled.
L4_IPC_REMAPFAILED | Map flexpage failed in receive operation.
L4_IPC_SEMAPFAILED | Map flexpage failed in send operation.
L4_IPC_RESNDPFTO | Send-pagefault timeout in receive operation.
L4_IPC_SESNDPFTO | Send-pagefault timeout in send operation.
L4_IPC_RERCVPFTO | Receive-pagefault timeout in receive operation.
L4_IPC_SERCVPFTO | Receive-pagefault timeout in send operation.
L4_IPC_REABORTED | Receive operation aborted.
L4_IPC_SEABORTED | Send operation aborted.
L4_IPC_REMSGCUT | Received message truncated. Usually returned when the typed items to be sent by the IPC partner exceed the buffer registers of the respective types.
L4_IPC_SEMSGCUT | Sent message truncated. Usually returned when the typed items to be sent exceed the IPC partner’s buffer registers of the respective types.

Definition at line 81 of file ipc.h.

## Function Documentation

## l4_error()

long l4_error | ( | l4_msgtag_t | tag | ) |

inline

Get IPC error code if any or message tag label otherwise for an IPC call.

This function shall only be used if the IPC operation includes a receive phase (usually a call operation), otherwise no tag label is received and the return value of this function is undefined.

Parameters

  tag | Message tag returned by the IPC call.

Returns
  In case of an IPC error, a negative error code in the range of L4_EIPC_LO to L4_EIPC_HI (see l4_ipc_to_errno() and l4_ipc_tcr_error_t), otherwise the tag label. By convention, the callee can signal errors via a negative tag label (negated value from l4_error_code_t) and success via a non-negative value.

Examples
  examples/libs/l4re/streammap/client.cc, examples/sys/aliens/main.c, examples/sys/isr/main.c, examples/sys/migrate/thread_migrate.cc, examples/sys/singlestep/main.c, examples/sys/start-with-exc/main.c, and examples/sys/utcb-ipc/main.c.

Definition at line 646 of file ipc.h.

References L4_NOTHROW, and l4_utcb().

Referenced by L4Re::Mem_alloc::alloc(), L4virtio::Driver::Device::bind_notification_irq(), L4virtio::Driver::Virtio_net_device::bind_rx_notification_irq(), L4::cap_dynamic_cast(), L4virtio::Driver::Device::driver_connect(), fiasco_dump_kmem_stats(), fiasco_tbuf_log(), fiasco_tbuf_log_3val(), fiasco_tbuf_log_binary(), L4Re::Util::Event_t< Default_event_payload >::init(), l4_vcon_write_u(), L4Re::Util::Event_buffer_consumer_t< Default_event_payload >::process(), and L4virtio::Driver::Virtio_net_device::setup_device().

Here is the call graph for this function:
Here is the caller graph for this function:

## l4_ipc_error()

l4_umword_t l4_ipc_error | ( | l4_msgtag_t | tag,
|  | l4_utcb_t * | utcb )

inline

Get the IPC error code for an IPC operation.

Parameters

  tag | Message tag returned by the IPC operation.
  utcb | UTCB that was used for the IPC operation.

Returns
  0 if no error condition is set, error code otherwise (see l4_ipc_tcr_error_t).

Examples
  examples/sys/ipc/ipc_example.c, and examples/sys/start-with-exc/main.c.

Definition at line 629 of file ipc.h.

References L4_IPC_ERROR_MASK, L4_LIKELY, l4_msgtag_has_error(), and L4_NOTHROW.

Referenced by l4util_ioport_map(), L4Re::Util::Event_buffer_consumer_t< Default_event_payload >::process(), and L4virtio::Driver::Device::wait().

Here is the call graph for this function:
Here is the caller graph for this function:

## l4_ipc_error_code()

int l4_ipc_error_code | ( | l4_utcb_t * | utcb | ) |

inline

Get the error condition of the last invocation from the TCR.

Precondition
  l4_msgtag_has_error(tag) == true

Parameters

  utcb | UTCB to check.

Returns
  Error condition of type l4_ipc_tcr_error_t.

Definition at line 658 of file ipc.h.

References L4_INLINE, L4_IPC_ERROR_MASK, and L4_NOTHROW.

## l4_ipc_is_rcv_error()

int l4_ipc_is_rcv_error | ( | l4_utcb_t * | utcb | ) |

inline

Returns whether an error occurred in receive phase of an invocation.

Precondition
  l4_msgtag_has_error(tag) == true

Parameters

  utcb | UTCB to check.

Returns
  Boolean value.

Definition at line 655 of file ipc.h.

References L4_INLINE, and L4_NOTHROW.

## l4_ipc_is_snd_error()

int l4_ipc_is_snd_error | ( | l4_utcb_t * | utcb | ) |

inline

Returns whether an error occurred in send phase of an invocation.

Precondition
  l4_msgtag_has_error(tag) == true

Parameters

  utcb | UTCB to check.

Returns
  Boolean value.

Definition at line 652 of file ipc.h.

References L4_INLINE, and L4_NOTHROW.