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

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

#include <picotm/compiler.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_CHRDEV, PICOTM_LIBC_FILE_TYPE_FIFO, PICOTM_LIBC_FILE_TYPE_REGULAR, PICOTM_LIBC_FILE_TYPE_DIR,
  PICOTM_LIBC_FILE_TYPE_SOCKET
}
 
enum  picotm_libc_cc_mode { PICOTM_LIBC_CC_MODE_NOUNDO, PICOTM_LIBC_CC_MODE_2PL }
 
enum  picotm_libc_write_mode { PICOTM_LIBC_WRITE_BACK, PICOTM_LIBC_WRITE_THROUGH }
 

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)
 

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_CHRDEV 

Character device.

PICOTM_LIBC_FILE_TYPE_FIFO 

FIFO.

PICOTM_LIBC_FILE_TYPE_REGULAR 

Regular file.

PICOTM_LIBC_FILE_TYPE_DIR 

Directory.

PICOTM_LIBC_FILE_TYPE_SOCKET 

Socket.

◆ picotm_libc_write_mode

File-descriptor I/O write mode.

Enumerator
PICOTM_LIBC_WRITE_BACK 

Write-back mode.

PICOTM_LIBC_WRITE_THROUGH 

Write-through mode.

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_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.