Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sg_get_fs_stats(3) [debian man page]

sg_get_fs_stats(3)					     Library Functions Manual						sg_get_fs_stats(3)

NAME
sg_get_fs_stats - get filesystem statistics SYNOPSIS
#include <statgrab.h> sg_fs_stats *sg_get_fs_stats(int *entries); DESCRIPTION
The sg_get_fs_stats takes a pointer to an int, entries, which is filled with the number of mounted file systems the machine has. The return value is a pointer to the first member of an array of sg_fs_stats structures; the number of entries in the array is returned in entries. The function returns statistics about mounted filesystems, including free space and inode usage. RETURN VALUES
sg_get_fs_stats returns a pointer to a structure of type sg_fs_stats. typedef struct { char *device_name; char *fs_type; char *mnt_point; long long size; long long used; long long avail; long long total_inodes; long long used_inodes; long long free_inodes; long long avail_inodes; long long io_size; long long block_size; long long total_blocks; long long free_blocks; long long used_blocks; long long avail_blocks; } sg_fs_stats; device_name The name known to the operating system. (eg. on linux it might be hda) fs_type The type of the filesystem. mnt_point The mount point of the file system. size The size, in bytes, of the file system. used The amount of space, in bytes, used on the filesystem. avail The amount of space, in bytes, available on the filesystem. total_inodes The total number of inodes in the filesystem. used_inodes The number of used inodes in the filesystem. free_inodes The number of free inodes in the filesystem. avail_inodes The number of free inodes available to non-privileged processes. io_size A suggested optimal block size for IO operations -- if you're reading or writing lots of data, do it in chunks of this size. block_size How big blocks actually are on the underlying filesystem (typically for purposes of stats reporting). total_blocks The total number of blocks in the filesystem. free_blocks The number of free blocks in the filesystem. used_blocks The number of used blocks in the filesystem. avail_blocks The number of free blocks available to non-privileged processes. SEE ALSO
statgrab(3) WEBSITE
http://www.i-scream.org/libstatgrab/ i-scream $Date: 2005/07/13 13:01:23 $ sg_get_fs_stats(3)

Check Out this Related Man Page

sg_get_network_io_stats(3)				     Library Functions Manual					sg_get_network_io_stats(3)

NAME
sg_get_network_io_stats, sg_get_network_io_stats_diff - get network statistics SYNOPSIS
#include <statgrab.h> sg_network_io_stats *sg_get_network_io_stats(int *entries); sg_network_io_stats *sg_get_network_io_stats_diff(int *entries); DESCRIPTION
Both calls take a pointer to an int, entries, which is filled with the number of network interfaces the machine has. This is needed to know how many sg_network_io_stats structures have been returned. A pointer is returned to the first sg_network_io_stats. sg_get_network_io_stats returns the network traffic stored in the kernel which holds the amount of data transferred since bootup. On some platforms, such as Solaris 7, this value is stored in a 32bit int, so wraps around when it reaches 4GB. Other platforms, such as Solaris 8, hold the value in a 64bit int, which wraps somewhere near 17 million terabytes. sg_get_network_io_stats also returns the number of packets sent and received, and the number of errors that have occured. It also makes the number of collisions available. sg_get_network_io_stats_diff is the same as sg_get_network_io_stats except it will return the difference since the last call. So, for instance a call to sg_get_network_io_stats_diff is made, and called again 5 seconds later. Over that time, 20 bytes of traffic was trans- mitted and 10 bytes received. Tx will store 20, rx will store 10 and systime will store 5. This function copes with wrap arounds by the O/S so should be seemless to use. RETURN VALUES
All network statistics return a pointer to a structure of type sg_network_io_stats. typedef struct{ char *interface_name; long long tx; long long rx; long long ipackets; long long opackets; long long ierrors; long long oerrors; long long collisions; time_t systime; }sg_network_io_stats; interface_name The name known to the operating system. (eg. on linux it might be eth0) tx The number of bytes transmitted. rx The number of bytes received. ipackets The number of packets received. opackets The number of packets transmitted. ierrors The number of receive errors. oerrors The number of transmit errors. collisions The number of collisions. systime The time period over which tx and rx were transferred. BUGS
On the very first call sg_get_network_io_stats_diff will return the same as sg_get_network_io_stats. After the first call it will always return the difference. On operating system that hold only 32bits of data there is a problem if the values wrap twice. For example, on Solaris 7 if 9GB is trans- ferred and the operating system wraps at 4GB, the sg_get_network_io_stats_diff function will return 5GB. SEE ALSO
statgrab(3) WEBSITE
http://www.i-scream.org/libstatgrab/ i-scream $Date: 2005/04/25 11:25:45 $ sg_get_network_io_stats(3)
Man Page