Data Structures | Functions

Memory interface

Data Structures

struct  sa_memory
struct  sa_swap

Functions

SA_EXPORT int sa_open_memory (void)
SA_EXPORT int sa_close_memory (void)
SA_EXPORT int sa_get_memory (struct sa_memory *dst)
SA_EXPORT int sa_count_swaps (uint16_t *number)
SA_EXPORT int sa_get_swap (uint16_t index, struct sa_swap *dst)
SA_EXPORT int sa_get_swaps (struct sa_swap *dst, uint16_t dst_size, uint16_t *written)

Function Documentation

SA_EXPORT int sa_open_memory ( void   ) 

Prepares the resources needed for retrieving memory statistics. This function exists (and is needed) only when SA_OPEN_MEMORY is defined.

Returns:
If successful 0 is returned, otherwise an error code is returned. If the operative system is not supported the return value will be ENOTSUP.
See also:
sa_close_memory()
SA_EXPORT int sa_close_memory ( void   ) 

This function closes the resources used for retrieving memory statistics. You should call it even when there was a previous error in another function of this API. This function exists (and is needed) only when SA_CLOSE_MEMORY is defined.

Returns:
If successful 0 is returned, otherwise an error code is returned.
See also:
sa_open_memory()
SA_EXPORT int sa_get_memory ( struct sa_memory dst  ) 

Retrieves statistics about the usage of the memory.

Parameters:
dst Where the statistics will be stored.
Returns:
If successful 0 is returned, otherwise an error code is returned.
SA_EXPORT int sa_count_swaps ( uint16_t *  number  ) 

Gives the total number of swap file systems.

Parameters:
number The number will be stored here
Returns:
If successful 0 is returned, otherwise an error code is returned.
SA_EXPORT int sa_get_swap ( uint16_t  index,
struct sa_swap dst 
)

Retrieves statistics from a given swap index.

Parameters:
index The swap index. It starts from 0.
dst Where the statistics will be stored.
Returns:
If successful 0 is returned, otherwise an error code is returned. ENODEV is returned when the requested swap index was out of range.
SA_EXPORT int sa_get_swaps ( struct sa_swap dst,
uint16_t  dst_size,
uint16_t *  written 
)

Retrieves statistics from as many swap fs as possible.

Parameters:
dst A buffer where the statistics will be stored.
dst_size The number of swap fs that fits in the dst buffer. If it's not big enough dst will be filled but ENOMEM will be returned.
written The amount of swap fs statistics written.
Returns:
If successful 0 is returned, otherwise an error code is returned.
 All Data Structures Variables