--- projects/libstatgrab/src/libstatgrab/statgrab.h 2004/07/02 11:21:30 1.50 +++ projects/libstatgrab/src/libstatgrab/statgrab.h 2010/10/03 18:35:58 1.59 @@ -18,12 +18,16 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA * - * $Id: statgrab.h,v 1.50 2004/07/02 11:21:30 tdb Exp $ + * $Id: statgrab.h,v 1.59 2010/10/03 18:35:58 tdb Exp $ */ #ifndef STATGRAB_H #define STATGRAB_H +#ifdef __cplusplus +extern "C" { +#endif + #include /* FIXME typedefs for 32/64-bit types */ @@ -31,17 +35,22 @@ /* FIXME comments for less obvious fields */ int sg_init(void); +int sg_snapshot(); +int sg_shutdown(); int sg_drop_privileges(void); typedef enum { SG_ERROR_NONE = 0, SG_ERROR_ASPRINTF, + SG_ERROR_DEVICES, SG_ERROR_DEVSTAT_GETDEVS, SG_ERROR_DEVSTAT_SELECTDEVS, + SG_ERROR_DISKINFO, SG_ERROR_ENOENT, SG_ERROR_GETIFADDRS, SG_ERROR_GETMNTINFO, SG_ERROR_GETPAGESIZE, + SG_ERROR_HOST, SG_ERROR_KSTAT_DATA_LOOKUP, SG_ERROR_KSTAT_LOOKUP, SG_ERROR_KSTAT_OPEN, @@ -49,9 +58,16 @@ typedef enum { SG_ERROR_KVM_GETSWAPINFO, SG_ERROR_KVM_OPENFILES, SG_ERROR_MALLOC, + SG_ERROR_MEMSTATUS, SG_ERROR_OPEN, SG_ERROR_OPENDIR, SG_ERROR_PARSE, + SG_ERROR_PDHADD, + SG_ERROR_PDHCOLLECT, + SG_ERROR_PDHOPEN, + SG_ERROR_PDHREAD, + SG_ERROR_PERMISSION, + SG_ERROR_PSTAT, SG_ERROR_SETEGID, SG_ERROR_SETEUID, SG_ERROR_SETMNTENT, @@ -63,12 +79,16 @@ typedef enum { SG_ERROR_SYSCTLNAMETOMIB, SG_ERROR_UNAME, SG_ERROR_UNSUPPORTED, - SG_ERROR_XSW_VER_MISMATCH + SG_ERROR_XSW_VER_MISMATCH, + SG_ERROR_GETMSG, + SG_ERROR_PUTMSG } sg_error; void sg_set_error(sg_error code, const char *arg); +void sg_set_error_with_errno(sg_error code, const char *arg); sg_error sg_get_error(); const char *sg_get_error_arg(); +int sg_get_error_errno(); const char *sg_str_error(sg_error code); typedef struct { @@ -150,6 +170,13 @@ typedef struct { 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; sg_fs_stats *sg_get_fs_stats(int *entries); @@ -195,7 +222,10 @@ typedef enum { typedef struct { char *interface_name; int speed; /* In megabits/sec */ + sg_iface_duplex duplex; +#ifdef SG_ENABLE_DEPRECATED sg_iface_duplex dup; +#endif int up; } sg_network_iface_stats; @@ -212,6 +242,7 @@ typedef struct { sg_page_stats *sg_get_page_stats(); sg_page_stats *sg_get_page_stats_diff(); +/* Recommend to add SG_PROCESS_STATE_IDLE */ typedef enum { SG_PROCESS_STATE_RUNNING, SG_PROCESS_STATE_SLEEPING, @@ -228,10 +259,18 @@ typedef struct { pid_t parent; /* Parent pid */ pid_t pgid; /* process id of process group leader */ +/* Windows does not have uid_t or gid_t types */ +#ifndef WIN32 uid_t uid; uid_t euid; gid_t gid; gid_t egid; +#else + int uid; + int euid; + int gid; + int egid; +#endif unsigned long long proc_size; /* in bytes */ unsigned long long proc_resident; /* in bytes */ @@ -264,6 +303,10 @@ sg_process_count *sg_get_process_count(); #ifdef SG_ENABLE_DEPRECATED #include +#endif + +#ifdef __cplusplus +} #endif #endif