NAME

lkmi_memoryswap


SYNOPSIS

#include <lkmi.h >

int lkmi_memoryswap (kmi_memory_t *mem_info, kmi_swap_t *swap_info)


PARAMETERS

mem_info
Pointer to structure which is described below.

swap_info
Pointer to structure which is described below.


DESCRIPTION

lkmi_memory obtains informations about real memory space usage and about swap space usage usage from /proc/meminfo file and and puts it in lkmi_memory_t and lkmi_swap_t structure.

Description of lkmi_memory_t structure.

total
Amount of memory which may be used by applications and dynamic kernel structures.

used
Amount of memory which is currently used by applications.

free
Currently unused real memory.

shared
Total amount of shared memory (I don't know exactly).

Note: Kernel version 2.4 doesn't have this number set in /proc/meminfo file

buffers
Memory which is currently used for file buffers by kernel.

Description of lkmi_swap_t structure.

total
Amount of swap space(s) which may be used.

used
Amount of disk swap space which is currently used.

free
currently unused swap space.


RETURN VALUE

If function ends successfully then returns 0. In some conditions this function can return 0 although one structure is not filled. In this case the unknown values are set to -1. If call fails, functions returns -1 and sets errno value to:

EINVAL
NULL pointer assigned as parameter mem_info or swap_info.

ENOENT
If the /proc/meminfo if doesn't contain Mem: line.

The lkmi_memoryswap function may also fail and set errno for any of the errors specified for the routine fopen(3).


BUGS REPORTING

Please use the SourceForge Reporting page which is located here:

Bug Report


COPYRIGHT

This function is written as part of lkmi library for Linux system and may be freely distributed under GPL terms.

Copyright (c) 1995, 2002 David Doubrava (linux_monitor(at)volny(dot)cz).


SEE ALSO

Origin of values description is in Linux kernel source.

lkmi, lkmi_cpu, lkmi_files, lkmi_filesys, lkmi_hdd, lkmi_hw_intr, lkmi_inodes, lkmi_memory, lkmi_memoryswap, lkmi_net, lkmi_proc, lkmi_readprocesses, lkmi_swap, lkmi_swapex, lkmi_system