.TH sg_get_mem_stats 3 $Date:\ 2005/04/25\ 11:25:45\ $ i\-scream .SH NAME sg_get_mem_stats, sg_get_swap_stats \- get VM statistics .SH SYNOPSIS .nf #include .fi .sp 1 .PP sg_mem_stats *\fIsg_get_mem_stats\fR(void); .PP sg_swap_stats *\fIsg_get_swap_stats\fR(void); .SH DESCRIPTION Memory statistics are accessed through the sg_get_mem_stats function. It returns a pointer to a static sg_mem_stats. .PP The sg_get_swap_stats returns returns swap statistics. It returns a pointer to a static sg_swap_stats. .PP On the FreeBSD operating system elevated privileges are required to access the swap statistics. Making the program setgid kmem should be sufficient. Programs running as root will not have this problem. .SH RETURN\ VALUES The VM system calls can return a pointer to either a sg_mem_stats or a sg_swap_stats. .PP .nf typedef struct{ long long total; long long free; long long used; long long cache; }sg_mem_stats; .fi .TP total The total amount of memory in bytes. .TP free The total free memory in bytes. .TP used The total used memory in bytes. .TP cache The amount of cache used in bytes. .PP .nf typedef struct{ long long total; long long used; long long free; }sg_swap_stats; .fi .TP total The total swap space in bytes. .TP used The used swap in bytes. .TP free The free swap in bytes. .SH TODO Add a function to hold open the file descriptor to the kernel memory structures. Doing this would allow the elevated privileges to be dropped early on. .SH SEE\ ALSO \fBstatgrab\fR(3) .SH WEBSITE http://www.i\-scream.org/libstatgrab/