Data Structures | Functions
picotm-error.h File Reference

Contains struct picotm_error and helper functions. More...

#include "picotm/config/picotm-config.h"
#include <signal.h>
#include <stdbool.h>
#include <stddef.h>
#include "compiler.h"
#include "picotm-error-base.h"

Data Structures

struct  picotm_error
 

Functions

PICOTM_NOTHROW void picotm_error_clear (struct picotm_error *error)
 
PICOTM_NOTHROW const char * picotm_error_get_description (const struct picotm_error *error)
 
PICOTM_NOTHROW bool picotm_error_is_conflicting (const struct picotm_error *error)
 
PICOTM_NOTHROW bool picotm_error_is_error (const struct picotm_error *error)
 
PICOTM_NOTHROW bool picotm_error_is_revocable (const struct picotm_error *error)
 
static bool picotm_error_is_set (const struct picotm_error *error)
 
PICOTM_NOTHROW void picotm_error_mark_as_non_recoverable (struct picotm_error *error)
 
PICOTM_NOTHROW void picotm_error_set_conflicting (struct picotm_error *error, struct picotm_rwlock *conflicting_lock)
 
PICOTM_NOTHROW void picotm_error_set_description (struct picotm_error *error, const char *description)
 
PICOTM_NOTHROW void picotm_error_set_errno (struct picotm_error *error, int errno_hint)
 
PICOTM_NOTHROW void picotm_error_set_error_code (struct picotm_error *error, enum picotm_error_code error_hint)
 
PICOTM_NOTHROW void picotm_error_set_kern_return_t (struct picotm_error *error, kern_return_t value)
 
PICOTM_NOTHROW void picotm_error_set_revocable (struct picotm_error *error)
 
PICOTM_NOTHROW void picotm_error_set_siginfo_t (struct picotm_error *error, const siginfo_t *info)
 

Function Documentation

◆ picotm_error_clear()

PICOTM_NOTHROW void picotm_error_clear ( struct picotm_error error)

Clears an error structure.

Parameters
errorThe error to clear.

◆ picotm_error_get_description()

PICOTM_NOTHROW const char* picotm_error_get_description ( const struct picotm_error error)

Returns an error's description.

Parameters
errorThe error.
Returns
The error description if set, or NULL otherwise.

◆ picotm_error_is_conflicting()

PICOTM_NOTHROW bool picotm_error_is_conflicting ( const struct picotm_error error)

Tests if an error has been set to CONFLICTING status.

Parameters
errorThe error to set.
Returns
True if an error has been set to CONFLICTING, or false otherwise.

◆ picotm_error_is_error()

PICOTM_NOTHROW bool picotm_error_is_error ( const struct picotm_error error)

Tests if an error has been set to an error status.

Parameters
errorThe error to set.
Returns
True if an error has been set to an error status, or false otherwise.

◆ picotm_error_is_revocable()

PICOTM_NOTHROW bool picotm_error_is_revocable ( const struct picotm_error error)

Tests if an error has been set to REVOCABLE status.

Parameters
errorThe error to set.
Returns
True if an error has been set to REVOCABLE, or false otherwise.

◆ picotm_error_is_set()

static bool picotm_error_is_set ( const struct picotm_error error)
inlinestatic

Tests if an error has been set.

Parameters
errorThe error to set.
Returns
True if an error has been set, or false otherwise.

◆ picotm_error_mark_as_non_recoverable()

PICOTM_NOTHROW void picotm_error_mark_as_non_recoverable ( struct picotm_error error)

Marks an error as non-recoverable.

By default, errors are expected to recoverable. For irrevocable transactions or after applying events from the transaction log, errors cannot easily be recovered, because the program state is undefined in these situations. An errors that happens under such conditions is marked as being non-recoverable.

Normally, modules should not care baout this flag. The commit logic within picotm will set this flag if appropriate.

Parameters
errorThe error to mark as non-recoverable.

◆ picotm_error_set_conflicting()

PICOTM_NOTHROW void picotm_error_set_conflicting ( struct picotm_error error,
struct picotm_rwlock conflicting_lock 
)

Sets an error of type PICOTM_CONFLICTING.

Parameters
errorThe error to set.
conflicting_lockThe conflicting lock if known, or NULL otherwise.

◆ picotm_error_set_description()

PICOTM_NOTHROW void picotm_error_set_description ( struct picotm_error error,
const char *  description 
)

Sets an error's description.

Parameters
errorThe error.
descriptionA descriptive string.

◆ picotm_error_set_errno()

PICOTM_NOTHROW void picotm_error_set_errno ( struct picotm_error error,
int  errno_hint 
)

Sets an error of type PICOTM_ERRNO.

Parameters
errorThe error to set.
errno_hintThe errno code if known, or 0 otherwise.

◆ picotm_error_set_error_code()

PICOTM_NOTHROW void picotm_error_set_error_code ( struct picotm_error error,
enum picotm_error_code  error_hint 
)

Sets an error of type PICOTM_ERROR_CODE.

Parameters
errorThe error to set.
error_hintThe picotm error code if known, or PICOTM_GENERAL_ERROR otherwise.

◆ picotm_error_set_kern_return_t()

PICOTM_NOTHROW void picotm_error_set_kern_return_t ( struct picotm_error error,
kern_return_t  value 
)

Sets an error of type PICOTM_KERN_RETURN_T.

Parameters
errorThe error to set.
valueThe kern_return_t value.

◆ picotm_error_set_revocable()

PICOTM_NOTHROW void picotm_error_set_revocable ( struct picotm_error error)

Sets an error of type PICOTM_REVOCABLE.

Parameters
errorThe error to set.

◆ picotm_error_set_siginfo_t()

PICOTM_NOTHROW void picotm_error_set_siginfo_t ( struct picotm_error error,
const siginfo_t *  info 
)

Sets an error of type PICOTM_SIGINFO_T.

Parameters
[in,out]errorThe error to set.
[in]infoThe signal information.