picotm  0.3.0
Enumerations | Functions
picotm-libc.h File Reference

Public interfaces of picotm's libc module. More...

#include <picotm/compiler.h>
Include dependency graph for picotm-libc.h:

Enumerations

enum  picotm_libc_error_recovery { PICOTM_LIBC_ERROR_RECOVERY_AUTO, PICOTM_LIBC_ERROR_RECOVERY_FULL }
 
enum  picotm_libc_file_type { PICOTM_LIBC_FILE_TYPE_OTHER, PICOTM_LIBC_FILE_TYPE_REGULAR, PICOTM_LIBC_FILE_TYPE_FIFO, PICOTM_LIBC_FILE_TYPE_SOCKET }
 
enum  picotm_libc_cc_mode { PICOTM_LIBC_CC_MODE_NOUNDO, PICOTM_LIBC_CC_MODE_2PL }
 
enum  picotm_libc_validation_mode { PICOTM_LIBC_VALIDATE_OP, PICOTM_LIBC_VALIDATE_DOMAIN, PICOTM_LIBC_VALIDATE_FULL }
 

Functions

PICOTM_NOTHROW void picotm_libc_set_error_recovery (enum picotm_libc_error_recovery recovery)
 
PICOTM_NOTHROW enum picotm_libc_error_recovery picotm_libc_get_error_recovery (void)
 
PICOTM_NOTHROW void picotm_libc_save_errno (void)
 
PICOTM_NOTHROW void picotm_libc_set_file_type_cc_mode (enum picotm_libc_file_type file_type, enum picotm_libc_cc_mode cc_mode)
 
PICOTM_NOTHROW enum picotm_libc_cc_mode picotm_libc_get_file_type_cc_mode (enum picotm_libc_file_type file_type)
 
PICOTM_NOTHROW void picotm_libc_set_validation_mode (enum picotm_libc_validation_mode val_mode)
 
PICOTM_NOTHROW enum picotm_libc_validation_mode picotm_libc_get_validation_mode (void)
 

Enumeration Type Documentation

◆ picotm_libc_cc_mode

Concurrency-control mode for file-descriptor I/O.

Enumerator
PICOTM_LIBC_CC_MODE_NOUNDO 

Set CC mode to irrevocablilty

PICOTM_LIBC_CC_MODE_2PL 

Set CC mode to pessimistic two-phase locking

◆ picotm_libc_error_recovery

The error-recovery strategy for system calls.

Each module detects errors and initiates recovery. Sometimes reported errors are not failures of the component, but expected corner cases. For example 'read()' on non-blocking file descriptors signals EAGAIN if there's no data available.

The libc modules has to distiguish such cases from actual errors to decide when to initiate recovery. enum picotm_libc_error_recovery is a list of possible strategies.

It is recommended to use PICOTM_LIBC_ERROR_RECOVERY_AUTO.

Enumerator
PICOTM_LIBC_ERROR_RECOVERY_AUTO 

Use heuristics to decide which errors to recover from. This is the default.

PICOTM_LIBC_ERROR_RECOVERY_FULL 

Recover from all errors.

◆ picotm_libc_file_type

File-type constants.

Enumerator
PICOTM_LIBC_FILE_TYPE_OTHER 

Any file.

PICOTM_LIBC_FILE_TYPE_REGULAR 

Regular file.

PICOTM_LIBC_FILE_TYPE_FIFO 

FIFO.

PICOTM_LIBC_FILE_TYPE_SOCKET 

Socket.

◆ picotm_libc_validation_mode

Validation mode for optimistic domains.

Enumerator
PICOTM_LIBC_VALIDATE_OP 

Validate the current operation.

PICOTM_LIBC_VALIDATE_DOMAIN 

Validate the current domain.

PICOTM_LIBC_VALIDATE_FULL 

Validate everything.

Function Documentation

◆ picotm_libc_get_error_recovery()

PICOTM_NOTHROW enum picotm_libc_error_recovery picotm_libc_get_error_recovery ( void  )

Returns the strategy for deciding when to recover from errors.

Returns
The current error-recovering strategy.

◆ picotm_libc_get_file_type_cc_mode()

PICOTM_NOTHROW enum picotm_libc_cc_mode picotm_libc_get_file_type_cc_mode ( enum picotm_libc_file_type  file_type)

Returns the currently preferred mode of concurrency control for I/O on a specific file type.

Parameters
file_typeThe file type to get the CC mode from.
Returns
The current CC mode for the given file type.

◆ picotm_libc_get_validation_mode()

PICOTM_NOTHROW enum picotm_libc_validation_mode picotm_libc_get_validation_mode ( void  )

Returns the current mode of validation for optimistic domains.

Returns
The current validation mode.

◆ picotm_libc_save_errno()

PICOTM_NOTHROW void picotm_libc_save_errno ( void  )

Saves the value of 'errno' during a transaction. Module authors should call this function before invoking a function that might modify errno's value.

◆ picotm_libc_set_error_recovery()

PICOTM_NOTHROW void picotm_libc_set_error_recovery ( enum picotm_libc_error_recovery  recovery)

Sets the strategy for deciding when to recover from errors.

Parameters
recoveryThe error-recovering strategy.

◆ picotm_libc_set_file_type_cc_mode()

PICOTM_NOTHROW void picotm_libc_set_file_type_cc_mode ( enum picotm_libc_file_type  file_type,
enum picotm_libc_cc_mode  cc_mode 
)

Sets the preferred mode of concurrency control for I/O on a specific file type.

Parameters
file_typeThe file type to set the CC mode for.
cc_modeThe CC mode.

◆ picotm_libc_set_validation_mode()

PICOTM_NOTHROW void picotm_libc_set_validation_mode ( enum picotm_libc_validation_mode  val_mode)

Sets the mode of validation for optimistic domains.

Parameters
val_modeThe validation mode.