diff options
author | Carlos Perelló Marín <carlos@gnome.org> | 2003-10-19 16:10:39 +0000 |
---|---|---|
committer | Carlos Perelló Marín <carlos@src.gnome.org> | 2003-10-19 16:10:39 +0000 |
commit | bae16b467f90df94d80feae41dceb7e816f16c61 (patch) | |
tree | 1c98f8b6769b7ca7a97a3de111e52f748a79ebe8 /include | |
parent | 5e28a552185df50f96b7ffce9c26755cff8c47d0 (diff) | |
download | libgtop-bae16b467f90df94d80feae41dceb7e816f16c61.tar.gz |
libgtop-GNOME-2-0-branch moved to HEAD.
2003-10-19 Carlos Perelló Marín <carlos@gnome.org>
* libgtop-GNOME-2-0-branch moved to HEAD.
Diffstat (limited to 'include')
36 files changed, 824 insertions, 741 deletions
diff --git a/include/glibtop/.cvsignore b/include/glibtop/.cvsignore index 1b076f70..282522db 100644 --- a/include/glibtop/.cvsignore +++ b/include/glibtop/.cvsignore @@ -1,3 +1,2 @@ Makefile Makefile.in -call-vector.h diff --git a/include/glibtop/Makefile.am b/include/glibtop/Makefile.am index 60482991..6dc4ede6 100644 --- a/include/glibtop/Makefile.am +++ b/include/glibtop/Makefile.am @@ -1,25 +1,10 @@ -glibtopdir = $(includedir)/glibtop +glibtopdir = $(includedir)/libgtop-2.0/glibtop glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.h \ - sem_limits.h uptime.h mem.h proclist.h \ - proctime.h shm_limits.h cpu.h msg_limits.h \ - procmem.h procuid.h swap.h error.h open.h \ - procsegment.h sysdeps.h xmalloc.h global.h \ - procsignal.h union.h types.h proccwd.h \ - mountlist.h fsusage.h procmap.h signal.h \ - inodedb.h sysinfo.h ppp.h procargs.h netload.h \ - netinfo.h interfaces.h limits.h array.h compat_10.h \ - glib-arrays.h call-vector.h \ - glibtop-client.h glibtop-server.h glibtop-backend.h \ - glibtop-backend-info.h errors.h - -BUILT_SOURCES = call-vector.h - -call-vector.h: call-vector.pl call-vector.h.in $(top_builddir)/config.h $(top_srcdir)/features.def $(top_srcdir)/scripts/c_types.pl - $(PERL) -I $(top_srcdir)/scripts $(srcdir)/call-vector.pl $(top_srcdir)/features.def $(srcdir)/call-vector.h.in > tmp-t - mv tmp-t call-vector.h - -EXTRA_DIST = call-vector.pl call-vector.h.in - -CLEANFILES = $(BUILT_SOURCES) - + sem_limits.h uptime.h command.h mem.h proclist.h \ + proctime.h shm_limits.h version.h cpu.h msg_limits.h \ + procmem.h procuid.h swap.h write.h error.h open.h \ + procsegment.h read.h sysdeps.h xmalloc.h global.h \ + procsignal.h read_data.h union.h types.h gnuserv.h \ + parameter.h mountlist.h fsusage.h procmap.h signal.h \ + inodedb.h sysinfo.h ppp.h procargs.h netload.h diff --git a/include/glibtop/close.h b/include/glibtop/close.h index 0bc15cc6..98bde6cd 100644 --- a/include/glibtop/close.h +++ b/include/glibtop/close.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -28,13 +26,13 @@ #include <glibtop.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS void glibtop_close_r (glibtop *server); -void glibtop_close_s (glibtop_server *server); -void glibtop_close_p (glibtop_server *server); +void glibtop_close_s (glibtop *server); +void glibtop_close_p (glibtop *server); -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/cpu.h b/include/glibtop/cpu.h index 19bb471c..96dd6200 100644 --- a/include/glibtop/cpu.h +++ b/include/glibtop/cpu.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,7 +27,7 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_CPU_TOTAL 0 #define GLIBTOP_CPU_USER 1 @@ -38,48 +36,51 @@ G_BEGIN_DECLS #define GLIBTOP_CPU_IDLE 4 #define GLIBTOP_CPU_FREQUENCY 5 -#define GLIBTOP_CPU_XCPU_TOTAL 6 -#define GLIBTOP_CPU_XCPU_USER 7 -#define GLIBTOP_CPU_XCPU_NICE 8 -#define GLIBTOP_CPU_XCPU_SYS 9 -#define GLIBTOP_CPU_XCPU_IDLE 10 -#define GLIBTOP_CPU_XCPU_FLAGS 11 +#define GLIBTOP_XCPU_TOTAL 6 +#define GLIBTOP_XCPU_USER 7 +#define GLIBTOP_XCPU_NICE 8 +#define GLIBTOP_XCPU_SYS 9 +#define GLIBTOP_XCPU_IDLE 10 + +#define GLIBTOP_MAX_CPU 11 -#define GLIBTOP_MAX_CPU 12 +/* Nobody should really be using more than 4 processors. */ +#define GLIBTOP_NCPU 4 typedef struct _glibtop_cpu glibtop_cpu; struct _glibtop_cpu { - u_int64_t flags, - total, /* GLIBTOP_CPU_TOTAL */ - user, /* GLIBTOP_CPU_USER */ - nice, /* GLIBTOP_CPU_NICE */ - sys, /* GLIBTOP_CPU_SYS */ - idle, /* GLIBTOP_CPU_IDLE */ - frequency, /* GLIBTOP_CPU_FREQUENCY */ - xcpu_total [GLIBTOP_NCPU], /* GLIBTOP_CPU_XCPU_TOTAL */ - xcpu_user [GLIBTOP_NCPU], /* GLIBTOP_CPU_XCPU_USER */ - xcpu_nice [GLIBTOP_NCPU], /* GLIBTOP_CPU_XCPU_NICE */ - xcpu_sys [GLIBTOP_NCPU], /* GLIBTOP_CPU_XCPU_SYS */ - xcpu_idle [GLIBTOP_NCPU], /* GLIBTOP_CPU_XCPU_IDLE */ - xcpu_flags; /* GLIBTOP_CPU_XCPU_FLAGS */ + u_int64_t flags, + total, /* GLIBTOP_CPU_TOTAL */ + user, /* GLIBTOP_CPU_USER */ + nice, /* GLIBTOP_CPU_NICE */ + sys, /* GLIBTOP_CPU_SYS */ + idle, /* GLIBTOP_CPU_IDLE */ + frequency, /* GLIBTOP_CPU_FREQUENCY */ + xcpu_total [GLIBTOP_NCPU], /* GLIBTOP_XCPU_TOTAL */ + xcpu_user [GLIBTOP_NCPU], /* GLIBTOP_XCPU_USER */ + xcpu_nice [GLIBTOP_NCPU], /* GLIBTOP_XCPU_NICE */ + xcpu_sys [GLIBTOP_NCPU], /* GLIBTOP_XCPU_SYS */ + xcpu_idle [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_IDLE */ }; +#define glibtop_get_cpu(cpu) glibtop_get_cpu_l(glibtop_global_server, cpu) + #if GLIBTOP_SUID_CPU #define glibtop_get_cpu_r glibtop_get_cpu_p #else #define glibtop_get_cpu_r glibtop_get_cpu_s #endif -int glibtop_get_cpu_l (glibtop_client *client, glibtop_cpu *buf); +void glibtop_get_cpu_l (glibtop *server, glibtop_cpu *buf); #if GLIBTOP_SUID_CPU -int glibtop_init_cpu_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_cpu_p (glibtop_server *server, glibtop_closure *closure, glibtop_cpu *buf); +void glibtop_init_cpu_p (glibtop *server); +void glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf); #else -int glibtop_init_cpu_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_cpu_s (glibtop_server *server, glibtop_closure *closure, glibtop_cpu *buf); +void glibtop_init_cpu_s (glibtop *server); +void glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf); #endif #ifdef GLIBTOP_NAMES @@ -93,6 +94,6 @@ extern const char *glibtop_descriptions_cpu []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/error.h b/include/glibtop/error.h index a3c077c2..1434e495 100644 --- a/include/glibtop/error.h +++ b/include/glibtop/error.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -28,19 +26,111 @@ #include <glibtop.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS + +#ifndef G_GNUC_UNUSED +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) +#define G_GNUC_UNUSED \ + __attribute__((unused)) +#else /* !__GNUC__ */ +#define G_GNUC_UNUSED +#endif /* !__GNUC__ */ +#endif /* defined G_GNUC_UNUSED */ + +void glibtop_error_vr (glibtop *server, char *format, va_list args); +void glibtop_warn_vr (glibtop *server, char *format, va_list args); + +void glibtop_error_io_vr (glibtop *server, char *format, int, va_list args); +void glibtop_warn_io_vr (glibtop *server, char *format, int, va_list args); + +static void G_GNUC_UNUSED +glibtop_error_r (glibtop *server, char *format, ...) +{ + va_list args; + + va_start (args, format); + glibtop_error_vr (server, format, args); + va_end (args); +} + +static void G_GNUC_UNUSED +glibtop_warn_r (glibtop *server, char *format, ...) +{ + va_list args; + + va_start (args, format); + glibtop_warn_vr (server, format, args); + va_end (args); +} + +static void G_GNUC_UNUSED +glibtop_error_io_r (glibtop *server, char *format, ...) +{ + va_list args; + + va_start (args, format); + glibtop_error_io_vr (server, format, errno, args); + va_end (args); +} + +static void G_GNUC_UNUSED +glibtop_warn_io_r (glibtop *server, char *format, ...) +{ + va_list args; + + va_start (args, format); + glibtop_warn_io_vr (server, format, errno, args); + va_end (args); +} + +#ifdef __GNUC__ + +#define glibtop_error(p1, args...) glibtop_error_r(glibtop_global_server , p1 , ## args) +#define glibtop_warn(p1, args...) glibtop_warn_r(glibtop_global_server , p1 , ## args) + +#define glibtop_error_io(p1, args...) glibtop_error_io_r(glibtop_global_server , p1 , ## args) +#define glibtop_warn_io(p1, args...) glibtop_warn_io_r(glibtop_global_server , p1 , ## args) + +#else /* no __GNUC__ */ + +static void +glibtop_error (char *format, ...) +{ + va_list args; + va_start (args, format); + glibtop_error_vr (glibtop_global_server, format, args); + va_end (args); +} + +static void +glibtop_warn (char *format, ...) +{ + va_list args; + va_start (args, format); + glibtop_warn_vr (glibtop_global_server, format, args); + va_end (args); +} -void glibtop_error_vr (glibtop_server *server, char *format, va_list args); -void glibtop_warn_vr (glibtop_server *server, char *format, va_list args); +static void +glibtop_error_io (char *format, ...) +{ + va_list args; + va_start (args, format); + glibtop_error_io_vr (glibtop_global_server, format, errno, args); + va_end (args); +} -void glibtop_error_io_vr (glibtop_server *server, char *format, int, va_list args); -void glibtop_warn_io_vr (glibtop_server *server, char *format, int, va_list args); +static void +glibtop_warn_io (char *format, ...) +{ + va_list args; + va_start (args, format); + glibtop_warn_io_vr (glibtop_global_server, format, errno, args); + va_end (args); +} -void glibtop_error_r (glibtop_server *server, char *format, ...); -void glibtop_warn_r (glibtop_server *server, char *format, ...); -void glibtop_error_io_r (glibtop_server *server, char *format, ...); -void glibtop_warn_io_r (glibtop_server *server, char *format, ...); +#endif /* no __GNUC__ */ -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/fsusage.h b/include/glibtop/fsusage.h index a9c43071..2b90552c 100644 --- a/include/glibtop/fsusage.h +++ b/include/glibtop/fsusage.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,7 +27,7 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_FSUSAGE_BLOCKS 0 #define GLIBTOP_FSUSAGE_BFREE 1 @@ -43,16 +41,20 @@ typedef struct _glibtop_fsusage glibtop_fsusage; struct _glibtop_fsusage { - u_int64_t flags, - blocks, /* Total blocks. */ - bfree, /* Free blocks available to superuser. */ - bavail, /* Free blocks available to non-superuser. */ - files, /* Total file nodes. */ - ffree; /* Free file nodes. */ + u_int64_t flags, + blocks, /* Total blocks. */ + bfree, /* Free blocks available to superuser. */ + bavail, /* Free blocks available to non-superuser. */ + files, /* Total file nodes. */ + ffree; /* Free file nodes. */ }; -int glibtop_get_fsusage_l (glibtop_client *client, glibtop_fsusage *buf, const char *mount_dir); -int glibtop_get_fsusage_s (glibtop_server *server, glibtop_closure *closure, glibtop_fsusage *buf, const char *mount_dir); +#define glibtop_get_fsusage(fsusage,disk) glibtop_get_fsusage_l(glibtop_global_server, fsusage, disk) + +#define glibtop_get_fsusage_r glibtop_get_fsusage_s + +void glibtop_get_fsusage_l (glibtop *server, glibtop_fsusage *buf, const char *mount_dir); +void glibtop_get_fsusage_s (glibtop *server, glibtop_fsusage *buf, const char *mount_dir); #ifdef GLIBTOP_NAMES @@ -65,6 +67,6 @@ extern const char *glibtop_descriptions_fsusage []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/global.h b/include/glibtop/global.h index ed01b6f7..65ff0544 100644 --- a/include/glibtop/global.h +++ b/include/glibtop/global.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -30,24 +28,40 @@ #include <config.h> #endif -#include <stdio.h> -#include <stdlib.h> -#include <sys/param.h> - -#include <stdarg.h> - -#ifdef HAVE_UNISTD_H -#include <unistd.h> +/* + * All declarations are enclosed in BEGIN_LIBGTOP_DECLS and + * END_LIBGTOP_DECLS so that C++ compilers don't mangle their names. + * + */ + +#undef BEGIN_LIBGTOP_DECLS +#undef END_LIBGTOP_DECLS +#ifdef __cplusplus +# define BEGIN_LIBGTOP_DECLS extern "C" { +# define END_LIBGTOP_DECLS } +#else +# define BEGIN_LIBGTOP_DECLS /* empty */ +# define END_LIBGTOP_DECLS /* empty */ #endif -#ifdef HAVE_MEMORY_H -#include <memory.h> -#endif +#ifdef _IN_LIBGTOP -#include <string.h> -#include <sys/types.h> +/* Provide macros to feature the GCC function attribute. + */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) +#define G_GNUC_NORETURN \ + __attribute__((noreturn)) +#define G_GNUC_CONST \ + __attribute__((const)) +#define G_GNUC_UNUSED \ + __attribute__((unused)) +#else /* !__GNUC__ */ +#define G_GNUC_NORETURN +#define G_GNUC_CONST +#define G_GNUC_UNUSED +#endif /* !__GNUC__ */ -#include <glib/gmacros.h> +#endif /* _IN_LIBGTOP */ #if TIME_WITH_SYS_TIME # include <sys/time.h> @@ -60,11 +74,6 @@ # endif #endif -/* For Tru64 UNIX */ -#ifdef HAVE_SYS_BITYPES_H -#include <sys/bitypes.h> -#endif - #ifdef NEED_GNOMESUPPORT_H #include <gnomesupport.h> #endif @@ -86,8 +95,25 @@ #endif #endif +#include <stdio.h> +#include <stdlib.h> + +#include <stdarg.h> + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#ifdef HAVE_MEMORY_H +#include <memory.h> +#endif + +#include <string.h> + #ifdef _IN_LIBGTOP +#include <sys/types.h> +#include <sys/param.h> #include <sys/socket.h> #include <sys/stat.h> @@ -98,10 +124,10 @@ #ifdef _IN_LIBGTOP -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #ifndef _ -#define _(String) dgettext (LIBGTOP_PACKAGE, String) +#define _(String) dgettext (PACKAGE, String) #define N_(String) (String) #endif @@ -109,7 +135,7 @@ G_BEGIN_DECLS char *strerror (int errno); #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif /* _IN_LIBGTOP */ diff --git a/include/glibtop/inodedb.h b/include/glibtop/inodedb.h index 2d1999c6..5dc0017d 100644 --- a/include/glibtop/inodedb.h +++ b/include/glibtop/inodedb.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* Copyright (C) 1998-99 Martin Baulig This file is part of LibGTop 1.0. @@ -33,7 +31,7 @@ #define GLIBTOP_INODEDB_ALL 7 -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS typedef struct _glibtop_inodedb glibtop_inodedb; @@ -41,25 +39,29 @@ typedef struct _glibtop_inodedb_key glibtop_inodedb_key; struct _glibtop_inodedb_key { - u_int64_t device, inode; + u_int64_t device, inode; }; struct _glibtop_inodedb { - GDBM_FILE system_dbf, user_dbf; + GDBM_FILE system_dbf, user_dbf; }; +#define glibtop_inodedb_open(p1,p2) glibtop_inodedb_open_s(glibtop_global_server, p1, p2) +#define glibtop_inodedb_lookup(p1,p2,p3) glibtop_inodedb_lookup_s(glibtop_global_server, p1, p2, p3) +#define glibtop_inodedb_close(p1) glibtop_inodedb_close_s(glibtop_global_server) + glibtop_inodedb * -glibtop_inodedb_open_s (glibtop_server *server, unsigned databases, unsigned long cache_size); +glibtop_inodedb_open_s (glibtop *server, unsigned databases, unsigned long cache_size); const char * -glibtop_inodedb_lookup_s (glibtop_server *server, +glibtop_inodedb_lookup_s (glibtop *server, glibtop_inodedb *inodedb, u_int64_t device, u_int64_t inode); void -glibtop_inodedb_close_s (glibtop_server *server, glibtop_closure *closure, glibtop_inodedb *inodedb); +glibtop_inodedb_close_s (glibtop *server, glibtop_inodedb *inodedb); -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/loadavg.h b/include/glibtop/loadavg.h index 6ff2a8e4..ddcd08e6 100644 --- a/include/glibtop/loadavg.h +++ b/include/glibtop/loadavg.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,7 +27,7 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_LOADAVG_LOADAVG 0 #define GLIBTOP_LOADAVG_NR_RUNNING 1 @@ -42,27 +40,29 @@ typedef struct _glibtop_loadavg glibtop_loadavg; struct _glibtop_loadavg { - u_int64_t flags; - double loadavg [3]; /* GLIBTOP_LOADAVG_LOADAVG */ - u_int64_t nr_running, /* GLIBTOP_LOADAVG_NR_RUNNING */ - nr_tasks, /* GLIBTOP_LOADAVG_NR_TASKS */ - last_pid; /* GLIBTOP_LOADAVG_LAST_PID */ + u_int64_t flags; + double loadavg [3]; /* GLIBTOP_LOADAVG_LOADAVG */ + u_int64_t nr_running, /* GLIBTOP_LOADAVG_NR_RUNNING */ + nr_tasks, /* GLIBTOP_LOADAVG_NR_TASKS */ + last_pid; /* GLIBTOP_LOADAVG_LAST_PID */ }; +#define glibtop_get_loadavg(loadavg) glibtop_get_loadavg_l(glibtop_global_server, loadavg) + #if GLIBTOP_SUID_LOADAVG #define glibtop_get_loadavg_r glibtop_get_loadavg_p #else #define glibtop_get_loadavg_r glibtop_get_loadavg_s #endif -int glibtop_get_loadavg_l (glibtop_client *client, glibtop_loadavg *buf); +void glibtop_get_loadavg_l (glibtop *server, glibtop_loadavg *buf); #if GLIBTOP_SUID_LOADAVG -int glibtop_init_loadavg_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_loadavg_p (glibtop_server *server, glibtop_closure *closure, glibtop_loadavg *buf); +void glibtop_init_loadavg_p (glibtop *server); +void glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf); #else -int glibtop_init_loadavg_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_loadavg_s (glibtop_server *server, glibtop_closure *closure, glibtop_loadavg *buf); +void glibtop_init_loadavg_s (glibtop *server); +void glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf); #endif #ifdef GLIBTOP_NAMES @@ -76,6 +76,6 @@ extern const char *glibtop_descriptions_loadavg []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/mem.h b/include/glibtop/mem.h index 737efc8d..2ae4d4b2 100644 --- a/include/glibtop/mem.h +++ b/include/glibtop/mem.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,7 +27,7 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_MEM_TOTAL 0 #define GLIBTOP_MEM_USED 1 @@ -46,31 +44,33 @@ typedef struct _glibtop_mem glibtop_mem; struct _glibtop_mem { - u_int64_t flags, - total, /* GLIBTOP_MEM_TOTAL */ - used, /* GLIBTOP_MEM_USED */ - free, /* GLIBTOP_MEM_FREE */ - shared, /* GLIBTOP_MEM_SHARED */ - buffer, /* GLIBTOP_MEM_BUFFER */ - cached, /* GLIBTOP_MEM_CACHED */ - user, /* GLIBTOP_MEM_USER */ - locked; /* GLIBTOP_MEM_LOCKED */ + u_int64_t flags, + total, /* GLIBTOP_MEM_TOTAL */ + used, /* GLIBTOP_MEM_USED */ + free, /* GLIBTOP_MEM_FREE */ + shared, /* GLIBTOP_MEM_SHARED */ + buffer, /* GLIBTOP_MEM_BUFFER */ + cached, /* GLIBTOP_MEM_CACHED */ + user, /* GLIBTOP_MEM_USER */ + locked; /* GLIBTOP_MEM_LOCKED */ }; +#define glibtop_get_mem(mem) glibtop_get_mem_l(glibtop_global_server, mem) + #if GLIBTOP_SUID_MEM #define glibtop_get_mem_r glibtop_get_mem_p #else #define glibtop_get_mem_r glibtop_get_mem_s #endif -int glibtop_get_mem_l (glibtop_client *client, glibtop_mem *buf); +void glibtop_get_mem_l (glibtop *server, glibtop_mem *buf); #if GLIBTOP_SUID_MEM -int glibtop_init_mem_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_mem_p (glibtop_server *server, glibtop_closure *closure, glibtop_mem *buf); +void glibtop_init_mem_p (glibtop *server); +void glibtop_get_mem_p (glibtop *server, glibtop_mem *buf); #else -int glibtop_init_mem_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_mem_s (glibtop_server *server, glibtop_closure *closure, glibtop_mem *buf); +void glibtop_init_mem_s (glibtop *server); +void glibtop_get_mem_s (glibtop *server, glibtop_mem *buf); #endif #ifdef GLIBTOP_NAMES @@ -84,6 +84,6 @@ extern const char *glibtop_descriptions_mem []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/mountlist.h b/include/glibtop/mountlist.h index 60c46fb1..2927b5a7 100644 --- a/include/glibtop/mountlist.h +++ b/include/glibtop/mountlist.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,28 +27,43 @@ #include <glibtop.h> #include <glibtop/global.h> -#include <glibtop/compat_10.h> -#include <glibtop/array.h> +BEGIN_LIBGTOP_DECLS + +#define GLIBTOP_MOUNTLIST_NUMBER 0 +#define GLIBTOP_MOUNTLIST_TOTAL 1 +#define GLIBTOP_MOUNTLIST_SIZE 2 -G_BEGIN_DECLS +#define GLIBTOP_MAX_MOUNTLIST 3 typedef struct _glibtop_mountentry glibtop_mountentry; +typedef struct _glibtop_mountlist glibtop_mountlist; + struct _glibtop_mountentry { - u_int64_t dev; - char devname [GLIBTOP_MOUNTENTRY_LEN+1]; - char mountdir [GLIBTOP_MOUNTENTRY_LEN+1]; - char type [GLIBTOP_MOUNTENTRY_LEN+1]; + u_int64_t dev; + char devname [GLIBTOP_MOUNTENTRY_LEN+1]; + char mountdir [GLIBTOP_MOUNTENTRY_LEN+1]; + char type [GLIBTOP_MOUNTENTRY_LEN+1]; }; +struct _glibtop_mountlist +{ + u_int64_t flags, + number, /* GLIBTOP_MOUNTLIST_NUMBER */ + total, /* GLIBTOP_MOUNTLIST_TOTAL */ + size; /* GLIBTOP_MOUNTLIST_SIZE */ +}; + +#define glibtop_get_mountlist(mountlist,all_fs) glibtop_get_mountlist_l(glibtop_global_server, mountlist, all_fs) + #define glibtop_get_mountlist_r glibtop_get_mountlist_s glibtop_mountentry * -glibtop_get_mountlist_l (glibtop_client *client, glibtop_array *array, int all_fs); +glibtop_get_mountlist_l (glibtop *server, glibtop_mountlist *buf, int all_fs); glibtop_mountentry * -glibtop_get_mountlist_s (glibtop_server *server, glibtop_closure *closure, glibtop_array *array, int all_fs); +glibtop_get_mountlist_s (glibtop *server, glibtop_mountlist *buf, int all_fs); #ifdef GLIBTOP_NAMES @@ -63,6 +76,6 @@ extern const char *glibtop_descriptions_mountlist []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/msg_limits.h b/include/glibtop/msg_limits.h index 14f9d305..b9208721 100644 --- a/include/glibtop/msg_limits.h +++ b/include/glibtop/msg_limits.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,46 +27,48 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS -#define GLIBTOP_MSG_LIMITS_MSGPOOL 0 -#define GLIBTOP_MSG_LIMITS_MSGMAP 1 -#define GLIBTOP_MSG_LIMITS_MSGMAX 2 -#define GLIBTOP_MSG_LIMITS_MSGMNB 3 -#define GLIBTOP_MSG_LIMITS_MSGMNI 4 -#define GLIBTOP_MSG_LIMITS_MSGSSZ 5 -#define GLIBTOP_MSG_LIMITS_MSGTQL 6 +#define GLIBTOP_IPC_MSGPOOL 0 +#define GLIBTOP_IPC_MSGMAP 1 +#define GLIBTOP_IPC_MSGMAX 2 +#define GLIBTOP_IPC_MSGMNB 3 +#define GLIBTOP_IPC_MSGMNI 4 +#define GLIBTOP_IPC_MSGSSZ 5 +#define GLIBTOP_IPC_MSGTQL 6 -#define GLIBTOP_MAX_MSG_LIMITS 7 +#define GLIBTOP_MAX_MSG_LIMITS 7 typedef struct _glibtop_msg_limits glibtop_msg_limits; struct _glibtop_msg_limits { - u_int64_t flags, - msgpool, /* GLIBTOP_MSG_LIMITS_MSGPOOL */ - msgmap, /* GLIBTOP_MSG_LIMITS_MSGMAP */ - msgmax, /* GLIBTOP_MSG_LIMITS_MSGMAX */ - msgmnb, /* GLIBTOP_MSG_LIMITS_MSGMNB */ - msgmni, /* GLIBTOP_MSG_LIMITS_MSGMNI */ - msgssz, /* GLIBTOP_MSG_LIMITS_MSGSSZ */ - msgtql; /* GLIBTOP_MSG_LIMITS_MSGTQL */ + u_int64_t flags, + msgpool, /* GLIBTOP_IPC_MSGPOOL */ + msgmap, /* GLIBTOP_IPC_MSGMAP */ + msgmax, /* GLIBTOP_IPC_MSGMAX */ + msgmnb, /* GLIBTOP_IPC_MSGMNB */ + msgmni, /* GLIBTOP_IPC_MSGMNI */ + msgssz, /* GLIBTOP_IPC_MSGSSZ */ + msgtql; /* GLIBTOP_IPC_MSGTQL */ }; +#define glibtop_get_msg_limits(msg) glibtop_get_msg_limits_l(glibtop_global_server, msg) + #if GLIBTOP_SUID_MSG_LIMITS #define glibtop_get_msg_limits_r glibtop_get_msg_limits_p #else #define glibtop_get_msg_limits_r glibtop_get_msg_limits_s #endif -int glibtop_get_msg_limits_l (glibtop_client *client, glibtop_msg_limits *buf); +void glibtop_get_msg_limits_l (glibtop *server, glibtop_msg_limits *buf); #if GLIBTOP_SUID_MSG_LIMITS -int glibtop_init_msg_limits_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_msg_limits_p (glibtop_server *server, glibtop_closure *closure, glibtop_msg_limits *buf); +void glibtop_init_msg_limits_p (glibtop *server); +void glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf); #else -int glibtop_init_msg_limits_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_msg_limits_s (glibtop_server *server, glibtop_closure *closure, glibtop_msg_limits *buf); +void glibtop_init_msg_limits_s (glibtop *server); +void glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf); #endif #ifdef GLIBTOP_NAMES @@ -82,7 +82,7 @@ extern const char *glibtop_descriptions_msg_limits []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/netload.h b/include/glibtop/netload.h index 1188d910..90c09a5a 100644 --- a/include/glibtop/netload.h +++ b/include/glibtop/netload.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,54 +27,81 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS - -#define GLIBTOP_NETLOAD_PACKETS_IN 0 -#define GLIBTOP_NETLOAD_PACKETS_OUT 1 -#define GLIBTOP_NETLOAD_PACKETS_TOTAL 2 -#define GLIBTOP_NETLOAD_BYTES_IN 3 -#define GLIBTOP_NETLOAD_BYTES_OUT 4 -#define GLIBTOP_NETLOAD_BYTES_TOTAL 5 -#define GLIBTOP_NETLOAD_ERRORS_IN 6 -#define GLIBTOP_NETLOAD_ERRORS_OUT 7 -#define GLIBTOP_NETLOAD_ERRORS_TOTAL 8 -#define GLIBTOP_NETLOAD_COLLISIONS 9 - -#define GLIBTOP_MAX_NETLOAD 10 +BEGIN_LIBGTOP_DECLS + +#define GLIBTOP_NETLOAD_IF_FLAGS 0 +#define GLIBTOP_NETLOAD_MTU 1 +#define GLIBTOP_NETLOAD_SUBNET 2 +#define GLIBTOP_NETLOAD_ADDRESS 3 +#define GLIBTOP_NETLOAD_PACKETS_IN 4 +#define GLIBTOP_NETLOAD_PACKETS_OUT 5 +#define GLIBTOP_NETLOAD_PACKETS_TOTAL 6 +#define GLIBTOP_NETLOAD_BYTES_IN 7 +#define GLIBTOP_NETLOAD_BYTES_OUT 8 +#define GLIBTOP_NETLOAD_BYTES_TOTAL 9 +#define GLIBTOP_NETLOAD_ERRORS_IN 10 +#define GLIBTOP_NETLOAD_ERRORS_OUT 11 +#define GLIBTOP_NETLOAD_ERRORS_TOTAL 12 +#define GLIBTOP_NETLOAD_COLLISIONS 13 + +#define GLIBTOP_MAX_NETLOAD 14 typedef struct _glibtop_netload glibtop_netload; -#include <glibtop/interfaces.h> +enum { + GLIBTOP_IF_FLAGS_UP = 1, + GLIBTOP_IF_FLAGS_BROADCAST, + GLIBTOP_IF_FLAGS_DEBUG, + GLIBTOP_IF_FLAGS_LOOPBACK, + GLIBTOP_IF_FLAGS_POINTOPOINT, + GLIBTOP_IF_FLAGS_RUNNING, + GLIBTOP_IF_FLAGS_NOARP, + GLIBTOP_IF_FLAGS_PROMISC, + GLIBTOP_IF_FLAGS_ALLMULTI, + GLIBTOP_IF_FLAGS_OACTIVE, + GLIBTOP_IF_FLAGS_SIMPLEX, + GLIBTOP_IF_FLAGS_LINK0, + GLIBTOP_IF_FLAGS_LINK1, + GLIBTOP_IF_FLAGS_LINK2, + GLIBTOP_IF_FLAGS_ALTPHYS, + GLIBTOP_IF_FLAGS_MULTICAST +}; struct _glibtop_netload { - u_int64_t flags, - packets_in, /* GLIBTOP_NETLOAD_PACKETS_IN */ - packets_out, /* GLIBTOP_NETLOAD_PACKETS_OUT */ - packets_total, /* GLIBTOP_NETLOAD_PACKETS_TOTAL*/ - bytes_in, /* GLIBTOP_NETLOAD_BYTES_IN */ - bytes_out, /* GLIBTOP_NETLOAD_BYTES_OUT */ - bytes_total, /* GLIBTOP_NETLOAD_BYTES_TOTAL */ - errors_in, /* GLIBTOP_NETLOAD_ERRORS_IN */ - errors_out, /* GLIBTOP_NETLOAD_ERRORS_OUT */ - errors_total, /* GLIBTOP_NETLOAD_ERRORS_TOTAL */ - collisions; /* GLIBTOP_NETLOAD_COLLISIONS */ + u_int64_t flags, + if_flags, /* GLIBTOP_NETLOAD_IF_FLAGS */ + mtu, /* GLIBTOP_NETLOAD_MTU */ + subnet, /* GLIBTOP_NETLOAD_SUBNET */ + address, /* GLIBTOP_NETLOAD_ADDRESS */ + packets_in, /* GLIBTOP_NETLOAD_PACKETS_IN */ + packets_out, /* GLIBTOP_NETLOAD_PACKETS_OUT */ + packets_total, /* GLIBTOP_NETLOAD_PACKETS_TOTAL*/ + bytes_in, /* GLIBTOP_NETLOAD_BYTES_IN */ + bytes_out, /* GLIBTOP_NETLOAD_BYTES_OUT */ + bytes_total, /* GLIBTOP_NETLOAD_BYTES_TOTAL */ + errors_in, /* GLIBTOP_NETLOAD_ERRORS_IN */ + errors_out, /* GLIBTOP_NETLOAD_ERRORS_OUT */ + errors_total, /* GLIBTOP_NETLOAD_ERRORS_TOTAL */ + collisions; /* GLIBTOP_NETLOAD_COLLISIONS */ }; +#define glibtop_get_netload(netload,interface) glibtop_get_netload_l(glibtop_global_server, netload, interface) + #if GLIBTOP_SUID_NETLOAD -#define glibtop_get_netload_r glibtop_get_netload_p +#define glibtop_get_netload_r glibtop_get_netload_p #else -#define glibtop_get_netload_r glibtop_get_netload_s +#define glibtop_get_netload_r glibtop_get_netload_s #endif -int glibtop_get_netload_l (glibtop_client *client, glibtop_netload *buf, const char *interface, unsigned transport, unsigned protocol); +void glibtop_get_netload_l (glibtop *server, glibtop_netload *buf, const char *interface); #if GLIBTOP_SUID_NETLOAD -int glibtop_init_netload_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_netload_p (glibtop_server *server, glibtop_closure *closure, glibtop_netload *buf, const char *interface, unsigned transport, unsigned protocol); +void glibtop_init_netload_p (glibtop *server); +void glibtop_get_netload_p (glibtop *server, glibtop_netload *buf, const char *interface); #else -int glibtop_init_netload_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_netload_s (glibtop_server *server, glibtop_closure *closure, glibtop_netload *buf, const char *interface, unsigned transport, unsigned protocol); +void glibtop_init_netload_s (glibtop *server); +void glibtop_get_netload_s (glibtop *server, glibtop_netload *buf, const char *interface); #endif #ifdef GLIBTOP_NAMES @@ -90,6 +115,6 @@ extern const char *glibtop_descriptions_netload []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/open.h b/include/glibtop/open.h index 9631e8a4..6c898dc2 100644 --- a/include/glibtop/open.h +++ b/include/glibtop/open.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* Copyright (C) 1998-99 Martin Baulig This file is part of LibGTop 1.0. @@ -25,8 +23,10 @@ #define __GLIBTOP_OPEN_H__ #include <glibtop.h> +#include <glibtop/read.h> +#include <glibtop/error.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define _GLIBTOP_INIT_STATE_INIT 0x10000 #define _GLIBTOP_INIT_STATE_OPEN 0x20000 @@ -52,7 +52,7 @@ G_BEGIN_DECLS #define GLIBTOP_ERROR_METHOD_DEFAULT GLIBTOP_ERROR_METHOD_WARN_ONCE void -glibtop_open_l (glibtop_client *client, const char *backend_name, +glibtop_open_l (glibtop *server, const char *program_name, const unsigned long features, const unsigned flags); void @@ -60,22 +60,14 @@ glibtop_init_p (glibtop *server, const unsigned long features, const unsigned flags); void -glibtop_open_p (glibtop_server *server, glibtop_closure *closure, +glibtop_open_p (glibtop *server, const char *program_name, const unsigned long features, const unsigned flags); void -glibtop_open_s (glibtop_server *server, glibtop_closure *closure, +glibtop_open_s (glibtop *server, const char *program_name, const unsigned long features, const unsigned flags); -#ifdef _IN_LIBGTOP - -void -_glibtop_open_sysdeps (glibtop_client *client, const char *program_name, - const u_int64_t features, const char **backend_args, - GError **opt_error); - -#endif /* _IN_LIBGTOP */ -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/parameter.h b/include/glibtop/parameter.h index c574dcaa..1c09a406 100644 --- a/include/glibtop/parameter.h +++ b/include/glibtop/parameter.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* Copyright (C) 1998-99 Martin Baulig This file is part of LibGTop 1.0. @@ -27,39 +25,27 @@ #include <glibtop.h> #include <glibtop/open.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS -#define GLIBTOP_PARAM_ERROR_METHOD 1 +#define GLIBTOP_PARAM_METHOD 1 #define GLIBTOP_PARAM_FEATURES 2 -#define GLIBTOP_PARAM_NCPU 3 -#define GLIBTOP_PARAM_OS_VERSION_CODE 4 -#define GLIBTOP_PARAM_REQUIRED 5 - -typedef struct _glibtop_parameter glibtop_parameter; - -struct _glibtop_parameter -{ - unsigned error_method; /* Error Method */ - u_int64_t features; /* Server is required for this features */ - unsigned ncpu; /* Number of CPUs, zero if single-processor */ - u_int64_t os_version_code; /* Version code of the operating system */ - glibtop_sysdeps required; /* Required feature list */ -}; +#define GLIBTOP_PARAM_COMMAND 3 +#define GLIBTOP_PARAM_HOST 4 +#define GLIBTOP_PARAM_PORT 5 +#define GLIBTOP_PARAM_ERROR_METHOD 6 +#define GLIBTOP_PARAM_REQUIRED 7 #define glibtop_get_parameter(p1,p2,p3) glibtop_get_parameter_l(glibtop_global_server,p1,p2,p3) #define glibtop_set_parameter(p1,p2,p3) glibtop_set_parameter_l(glibtop_global_server,p1,p2,p3) -ssize_t +size_t glibtop_get_parameter_l (glibtop *server, const unsigned parameter, void *data_ptr, size_t data_size); -int -glibtop_get_parameter_size_l (glibtop *server, const unsigned parameter); - -int +void glibtop_set_parameter_l (glibtop *server, const unsigned parameter, const void *data_ptr, size_t data_size); -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/ppp.h b/include/glibtop/ppp.h index e046ee54..1a4ec64a 100644 --- a/include/glibtop/ppp.h +++ b/include/glibtop/ppp.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,7 +27,7 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_PPP_STATE 0 #define GLIBTOP_PPP_BYTES_IN 1 @@ -40,33 +38,35 @@ G_BEGIN_DECLS typedef struct _glibtop_ppp glibtop_ppp; enum { - GLIBTOP_PPP_STATE_UNKNOWN = 0, - GLIBTOP_PPP_STATE_HANGUP, - GLIBTOP_PPP_STATE_ONLINE + GLIBTOP_PPP_STATE_UNKNOWN = 0, + GLIBTOP_PPP_STATE_HANGUP, + GLIBTOP_PPP_STATE_ONLINE }; struct _glibtop_ppp { - u_int64_t flags, - state, /* GLIBTOP_PPP_STATE */ - bytes_in, /* GLIBTOP_PPP_BYTES_IN */ - bytes_out; /* GLIBTOP_PPP_BYTES_OUT */ + u_int64_t flags, + state, /* GLIBTOP_PPP_STATE */ + bytes_in, /* GLIBTOP_PPP_BYTES_IN */ + bytes_out; /* GLIBTOP_PPP_BYTES_OUT */ }; +#define glibtop_get_ppp(ppp,device) glibtop_get_ppp_l(glibtop_global_server, ppp, device) + #if GLIBTOP_SUID_PPP #define glibtop_get_ppp_r glibtop_get_ppp_p #else #define glibtop_get_ppp_r glibtop_get_ppp_s #endif -int glibtop_get_ppp_l (glibtop_client *client, glibtop_ppp *buf, unsigned short device, unsigned short use_isdn); +void glibtop_get_ppp_l (glibtop *server, glibtop_ppp *buf, unsigned short device); #if GLIBTOP_SUID_PPP -int glibtop_init_ppp_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_ppp_p (glibtop_server *server, glibtop_closure *closure, glibtop_ppp *buf, unsigned short device, unsigned short use_isdn); +void glibtop_init_ppp_p (glibtop *server); +void glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf, unsigned short device); #else -int glibtop_init_ppp_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_ppp_s (glibtop_server *server, glibtop_closure *closure, glibtop_ppp *buf, unsigned short device, unsigned short use_isdn); +void glibtop_init_ppp_s (glibtop *server); +void glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device); #endif #ifdef GLIBTOP_NAMES @@ -80,6 +80,6 @@ extern const char *glibtop_descriptions_ppp []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/procargs.h b/include/glibtop/procargs.h index aa4de181..c1a6016e 100644 --- a/include/glibtop/procargs.h +++ b/include/glibtop/procargs.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,10 +27,21 @@ #include <glibtop.h> #include <glibtop/global.h> -#include <glibtop/compat_10.h> -#include <glibtop/array.h> +BEGIN_LIBGTOP_DECLS + +#define GLIBTOP_PROC_ARGS_SIZE 0 + +#define GLIBTOP_MAX_PROC_ARGS 1 + +typedef struct _glibtop_proc_args glibtop_proc_args; + +struct _glibtop_proc_args +{ + u_int64_t flags, + size; /* GLIBTOP_PROC_ARGS_SIZE */ +}; -G_BEGIN_DECLS +#define glibtop_get_proc_args(proc_args,pid,max_len) glibtop_get_proc_args_l(glibtop_global_server, proc_args, pid, max_len) #if GLIBTOP_SUID_PROC_ARGS #define glibtop_get_proc_args_r glibtop_get_proc_args_p @@ -40,19 +49,22 @@ G_BEGIN_DECLS #define glibtop_get_proc_args_r glibtop_get_proc_args_s #endif -char ** -glibtop_get_proc_args_l (glibtop_client *client, glibtop_array *array, pid_t pid); +char * +glibtop_get_proc_args_l (glibtop *server, glibtop_proc_args *buf, + pid_t pid, unsigned max_len); #if GLIBTOP_SUID_PROC_ARGS -int glibtop_init_proc_args_p (glibtop_server *server, glibtop_closure *closure); +void glibtop_init_proc_args_p (glibtop *server); -char ** -glibtop_get_proc_args_p (glibtop_server *server, glibtop_closure *closure, glibtop_array *array, pid_t pid); +char * +glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf, + pid_t pid, unsigned max_len); #else -int glibtop_init_proc_args_s (glibtop_server *server, glibtop_closure *closure); +void glibtop_init_proc_args_s (glibtop *server); -char ** -glibtop_get_proc_args_s (glibtop_server *server, glibtop_closure *closure, glibtop_array *array, pid_t pid); +char * +glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf, + pid_t pid, unsigned max_len); #endif #ifdef GLIBTOP_NAMES @@ -66,6 +78,6 @@ extern const char *glibtop_descriptions_proc_args []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/prockernel.h b/include/glibtop/prockernel.h index 2650945a..09d6ad31 100644 --- a/include/glibtop/prockernel.h +++ b/include/glibtop/prockernel.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,7 +27,7 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_PROC_KERNEL_K_FLAGS 0 #define GLIBTOP_PROC_KERNEL_MIN_FLT 1 @@ -43,54 +41,45 @@ G_BEGIN_DECLS #define GLIBTOP_MAX_PROC_KERNEL 9 -/* Constants for the `k_flags' field. */ -#define GLIBTOP_KFLAGS_STARTING 1 /* being created */ -#define GLIBTOP_KFLAGS_EXITING 2 /* getting shut down */ -#define GLIBTOP_KFLAGS_PTRACED 4 /* set if ptrace (0) has - been called */ -#define GLIBTOP_KFLAGS_TRACESYS 8 /* tracing system calls */ -#define GLIBTOP_KFLAGS_FORKNOEXEC 16 /* forked but didn't exec */ -#define GLIBTOP_KFLAGS_SUPERPRIV 32 /* used super-user privileges */ -#define GLIBTOP_KFLAGS_DUMPEDCORE 64 /* dumped core */ -#define GLIBTOP_KFLAGS_SIGNALED 128 /* killed by a signal */ - typedef struct _glibtop_proc_kernel glibtop_proc_kernel; /* Kernel stuff */ struct _glibtop_proc_kernel { - u_int64_t flags; - u_int64_t k_flags, /* kernel flags for the process */ - min_flt, /* number of minor page faults since - * process start */ - maj_flt, /* number of major page faults since - * process start */ - cmin_flt, /* cumulative min_flt of process and - * child processes */ - cmaj_flt, /* cumulative maj_flt of process and - * child processes */ - kstk_esp, /* kernel stack pointer */ - kstk_eip, /* kernel stack pointer */ - nwchan; /* address of kernel wait channel - * proc is sleeping in */ - char wchan [40]; + u_int64_t flags; + u_int64_t k_flags, /* kernel flags for the process */ + min_flt, /* number of minor page faults since + * process start */ + maj_flt, /* number of major page faults since + * process start */ + cmin_flt, /* cumulative min_flt of process and + * child processes */ + cmaj_flt, /* cumulative maj_flt of process and + * child processes */ + kstk_esp, /* kernel stack pointer */ + kstk_eip, /* kernel stack pointer */ + nwchan; /* address of kernel wait channel + * proc is sleeping in */ + char wchan [40]; }; +#define glibtop_get_proc_kernel(p1, p2) glibtop_get_proc_kernel_l(glibtop_global_server, p1, p2) + #if GLIBTOP_SUID_PROC_KERNEL #define glibtop_get_proc_kernel_r glibtop_get_proc_kernel_p #else #define glibtop_get_proc_kernel_r glibtop_get_proc_kernel_s #endif -int glibtop_get_proc_kernel_l (glibtop_client *client, glibtop_proc_kernel *buf, pid_t pid); +void glibtop_get_proc_kernel_l (glibtop *server, glibtop_proc_kernel *buf, pid_t pid); #if GLIBTOP_SUID_PROC_KERNEL -int glibtop_init_proc_kernel_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_kernel_p (glibtop_server *server, glibtop_closure *closure, glibtop_proc_kernel *buf, pid_t pid); +void glibtop_init_proc_kernel_p (glibtop *server); +void glibtop_get_proc_kernel_p (glibtop *server, glibtop_proc_kernel *buf, pid_t pid); #else -int glibtop_init_proc_kernel_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_kernel_s (glibtop_server *server, glibtop_closure *closure, glibtop_proc_kernel *buf, pid_t pid); +void glibtop_init_proc_kernel_s (glibtop *server); +void glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf, pid_t pid); #endif #ifdef GLIBTOP_NAMES @@ -104,6 +93,6 @@ extern const char *glibtop_descriptions_proc_kernel []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/proclist.h b/include/glibtop/proclist.h index 5d44ca67..00d3beed 100644 --- a/include/glibtop/proclist.h +++ b/include/glibtop/proclist.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,10 +27,13 @@ #include <glibtop.h> #include <glibtop/global.h> -#include <glibtop/compat_10.h> -#include <glibtop/array.h> +BEGIN_LIBGTOP_DECLS + +#define GLIBTOP_PROCLIST_NUMBER 0 +#define GLIBTOP_PROCLIST_TOTAL 1 +#define GLIBTOP_PROCLIST_SIZE 2 -G_BEGIN_DECLS +#define GLIBTOP_MAX_PROCLIST 3 /* You can use the folowing constants as the `which' member of * glibtop_get_proclist () to specify which processes to fetch. */ @@ -44,7 +45,6 @@ G_BEGIN_DECLS #define GLIBTOP_KERN_PROC_TTY 4 #define GLIBTOP_KERN_PROC_UID 5 #define GLIBTOP_KERN_PROC_RUID 6 -#define GLIBTOP_KERN_PROC_PPID 7 #define GLIBTOP_KERN_PROC_MASK 15 @@ -52,6 +52,18 @@ G_BEGIN_DECLS #define GLIBTOP_EXCLUDE_SYSTEM 0x2000 #define GLIBTOP_EXCLUDE_NOTTY 0x4000 +typedef struct _glibtop_proclist glibtop_proclist; + +struct _glibtop_proclist +{ + u_int64_t flags, + number, /* GLIBTOP_PROCLIST_NUMBER */ + total, /* GLIBTOP_PROCLIST_TOTAL */ + size; /* GLIBTOP_PROCLIST_SIZE */ +}; + +#define glibtop_get_proclist(proclist,which,arg) glibtop_get_proclist_l(glibtop_global_server, proclist, which, arg) + #if GLIBTOP_SUID_PROCLIST #define glibtop_get_proclist_r glibtop_get_proclist_p #else @@ -59,20 +71,20 @@ G_BEGIN_DECLS #endif unsigned * -glibtop_get_proclist_l (glibtop_client *client, glibtop_array *array, +glibtop_get_proclist_l (glibtop *server, glibtop_proclist *buf, int64_t which, int64_t arg); #if GLIBTOP_SUID_PROCLIST -int glibtop_init_proclist_p (glibtop_server *server, glibtop_closure *closure); +void glibtop_init_proclist_p (glibtop *server); unsigned * -glibtop_get_proclist_p (glibtop_server *server, glibtop_closure *closure, glibtop_array *array, +glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf, int64_t which, int64_t arg); #else -int glibtop_init_proclist_s (glibtop_server *server, glibtop_closure *closure); +void glibtop_init_proclist_s (glibtop *server); unsigned * -glibtop_get_proclist_s (glibtop_server *server, glibtop_closure *closure, glibtop_array *array, +glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf, int64_t which, int64_t arg); #endif @@ -87,6 +99,6 @@ extern const char *glibtop_descriptions_proclist []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/procmap.h b/include/glibtop/procmap.h index 5d4a7d82..0846bc28 100644 --- a/include/glibtop/procmap.h +++ b/include/glibtop/procmap.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,10 +27,13 @@ #include <glibtop.h> #include <glibtop/global.h> -#include <glibtop/compat_10.h> -#include <glibtop/array.h> +BEGIN_LIBGTOP_DECLS + +#define GLIBTOP_PROC_MAP_NUMBER 0 +#define GLIBTOP_PROC_MAP_TOTAL 1 +#define GLIBTOP_PROC_MAP_SIZE 2 -G_BEGIN_DECLS +#define GLIBTOP_MAX_PROC_MAP 3 #define GLIBTOP_MAP_ENTRY_START 1 #define GLIBTOP_MAP_ENTRY_END 2 @@ -54,12 +55,24 @@ G_BEGIN_DECLS typedef struct _glibtop_map_entry glibtop_map_entry; +typedef struct _glibtop_proc_map glibtop_proc_map; + struct _glibtop_map_entry { - u_int64_t flags, start, end, offset, perm, inode, device; - char filename [GLIBTOP_MAP_FILENAME_LEN+1]; + u_int64_t flags, start, end, offset, perm, inode, device; + char filename [GLIBTOP_MAP_FILENAME_LEN+1]; }; +struct _glibtop_proc_map +{ + u_int64_t flags, + number, /* GLIBTOP_PROC_MAP_NUMBER */ + total, /* GLIBTOP_PROC_MAP_TOTAL */ + size; /* GLIBTOP_PROC_MAP_SIZE */ +}; + +#define glibtop_get_proc_map(proc_map,pid) glibtop_get_proc_map_l(glibtop_global_server, proc_map, pid) + #if GLIBTOP_SUID_PROC_MAP #define glibtop_get_proc_map_r glibtop_get_proc_map_p #else @@ -67,18 +80,18 @@ struct _glibtop_map_entry #endif glibtop_map_entry * -glibtop_get_proc_map_l (glibtop_client *client, glibtop_array *array, pid_t pid); +glibtop_get_proc_map_l (glibtop *server, glibtop_proc_map *buf, pid_t pid); #if GLIBTOP_SUID_PROC_MAP -int glibtop_init_proc_map_p (glibtop_server *server, glibtop_closure *closure); +void glibtop_init_proc_map_p (glibtop *server); glibtop_map_entry * -glibtop_get_proc_map_p (glibtop_server *server, glibtop_closure *closure, glibtop_array *array, pid_t pid); +glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf, pid_t pid); #else -int glibtop_init_proc_map_s (glibtop_server *server, glibtop_closure *closure); +void glibtop_init_proc_map_s (glibtop *server); glibtop_map_entry * -glibtop_get_proc_map_s (glibtop_server *server, glibtop_closure *closure, glibtop_array *array, pid_t pid); +glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid); #endif #ifdef GLIBTOP_NAMES @@ -92,6 +105,6 @@ extern const char *glibtop_descriptions_proc_map []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/procmem.h b/include/glibtop/procmem.h index 9ed20d7b..7738c711 100644 --- a/include/glibtop/procmem.h +++ b/include/glibtop/procmem.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,7 +27,7 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_PROC_MEM_SIZE 0 #define GLIBTOP_PROC_MEM_VSIZE 1 @@ -46,31 +44,33 @@ typedef struct _glibtop_proc_mem glibtop_proc_mem; struct _glibtop_proc_mem { - u_int64_t flags, - size, /* total # of pages of memory */ - vsize, /* number of pages of virtual memory ... */ - resident, /* number of resident set - * (non-swapped) pages (4k) */ - share, /* number of pages of shared (mmap'd) memory */ - rss, /* resident set size */ - rss_rlim; /* current limit (in bytes) of the rss - * of the process; usually 2,147,483,647 */ + u_int64_t flags, + size, /* total # of pages of memory */ + vsize, /* number of pages of virtual memory ... */ + resident, /* number of resident set + * (non-swapped) pages (4k) */ + share, /* number of pages of shared (mmap'd) memory */ + rss, /* resident set size */ + rss_rlim; /* current limit (in bytes) of the rss + * of the process; usually 2,147,483,647 */ }; +#define glibtop_get_proc_mem(p1, p2) glibtop_get_proc_mem_l(glibtop_global_server, p1, p2) + #if GLIBTOP_SUID_PROC_MEM #define glibtop_get_proc_mem_r glibtop_get_proc_mem_p #else #define glibtop_get_proc_mem_r glibtop_get_proc_mem_s #endif -int glibtop_get_proc_mem_l (glibtop_client *client, glibtop_proc_mem *buf, pid_t pid); +void glibtop_get_proc_mem_l (glibtop *server, glibtop_proc_mem *buf, pid_t pid); #if GLIBTOP_SUID_PROC_MEM -int glibtop_init_proc_mem_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_mem_p (glibtop_server *server, glibtop_closure *closure, glibtop_proc_mem *buf, pid_t pid); +void glibtop_init_proc_mem_p (glibtop *server); +void glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf, pid_t pid); #else -int glibtop_init_proc_mem_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_mem_s (glibtop_server *server, glibtop_closure *closure, glibtop_proc_mem *buf, pid_t pid); +void glibtop_init_proc_mem_s (glibtop *server); +void glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid); #endif #ifdef GLIBTOP_NAMES @@ -84,6 +84,6 @@ extern const char *glibtop_descriptions_proc_mem []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/procsegment.h b/include/glibtop/procsegment.h index 8b3892ee..e00444be 100644 --- a/include/glibtop/procsegment.h +++ b/include/glibtop/procsegment.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,7 +27,7 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_PROC_SEGMENT_TEXT_RSS 0 #define GLIBTOP_PROC_SEGMENT_SHLIB_RSS 1 @@ -38,18 +36,9 @@ G_BEGIN_DECLS #define GLIBTOP_PROC_SEGMENT_DIRTY_SIZE 4 #define GLIBTOP_PROC_SEGMENT_START_CODE 5 #define GLIBTOP_PROC_SEGMENT_END_CODE 6 -#define GLIBTOP_PROC_SEGMENT_START_DATA 7 -#define GLIBTOP_PROC_SEGMENT_END_DATA 8 -#define GLIBTOP_PROC_SEGMENT_START_BRK 9 -#define GLIBTOP_PROC_SEGMENT_END_BRK 10 -#define GLIBTOP_PROC_SEGMENT_START_STACK 11 -#define GLIBTOP_PROC_SEGMENT_START_MMAP 12 -#define GLIBTOP_PROC_SEGMENT_ARG_START 13 -#define GLIBTOP_PROC_SEGMENT_ARG_END 14 -#define GLIBTOP_PROC_SEGMENT_ENV_START 15 -#define GLIBTOP_PROC_SEGMENT_ENV_END 16 - -#define GLIBTOP_MAX_PROC_SEGMENT 17 +#define GLIBTOP_PROC_SEGMENT_START_STACK 7 + +#define GLIBTOP_MAX_PROC_SEGMENT 8 typedef struct _glibtop_proc_segment glibtop_proc_segment; @@ -57,40 +46,34 @@ typedef struct _glibtop_proc_segment glibtop_proc_segment; struct _glibtop_proc_segment { - u_int64_t flags, - text_rss, /* text resident set size */ - shlib_rss, /* shared-lib resident set size */ - data_rss, /* data resident set size */ - stack_rss, /* stack resident set size */ - dirty_size, /* size of dirty pages */ - start_code, /* address of beginning of code segment */ - end_code, /* address of end of code segment */ - start_data, /* address of beginning of data segment */ - end_data, /* address of end of data segment */ - start_brk, - end_brk, - start_stack, /* address of the bottom of stack segment */ - start_mmap, - arg_start, - arg_end, - env_start, - env_end; + u_int64_t flags, + text_rss, /* text resident set size */ + shlib_rss, /* shared-lib resident set size */ + data_rss, /* data resident set size */ + stack_rss, /* stack resident set size */ + dirty_size, /* size of dirty pages */ + start_code, + /* address of beginning of code segment */ + end_code, /* address of end of code segment */ + start_stack; /* address of the bottom of stack segment */ }; +#define glibtop_get_proc_segment(p1, p2) glibtop_get_proc_segment_l(glibtop_global_server, p1, p2) + #if GLIBTOP_SUID_PROC_SEGMENT #define glibtop_get_proc_segment_r glibtop_get_proc_segment_p #else #define glibtop_get_proc_segment_r glibtop_get_proc_segment_s #endif -int glibtop_get_proc_segment_l (glibtop_client *client, glibtop_proc_segment *buf, pid_t pid); +void glibtop_get_proc_segment_l (glibtop *server, glibtop_proc_segment *buf, pid_t pid); #if GLIBTOP_SUID_PROC_SEGMENT -int glibtop_init_proc_segment_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_segment_p (glibtop_server *server, glibtop_closure *closure, glibtop_proc_segment *buf, pid_t pid); +void glibtop_init_proc_segment_p (glibtop *server); +void glibtop_get_proc_segment_p (glibtop *server, glibtop_proc_segment *buf, pid_t pid); #else -int glibtop_init_proc_segment_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_segment_s (glibtop_server *server, glibtop_closure *closure, glibtop_proc_segment *buf, pid_t pid); +void glibtop_init_proc_segment_s (glibtop *server); +void glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf, pid_t pid); #endif #ifdef GLIBTOP_NAMES @@ -104,6 +87,6 @@ extern const char *glibtop_descriptions_proc_segment []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/procsignal.h b/include/glibtop/procsignal.h index d6ed293e..4a9bd162 100644 --- a/include/glibtop/procsignal.h +++ b/include/glibtop/procsignal.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,7 +27,7 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_PROC_SIGNAL_SIGNAL 0 #define GLIBTOP_PROC_SIGNAL_BLOCKED 1 @@ -44,27 +42,29 @@ typedef struct _glibtop_proc_signal glibtop_proc_signal; struct _glibtop_proc_signal { - u_int64_t flags, - signal [2], /* mask of pending signals */ - blocked [2], /* mask of blocked signals */ - sigignore [2], /* mask of ignored signals */ - sigcatch [2]; /* mask of caught signals */ + u_int64_t flags, + signal [2], /* mask of pending signals */ + blocked [2], /* mask of blocked signals */ + sigignore [2], /* mask of ignored signals */ + sigcatch [2]; /* mask of caught signals */ }; +#define glibtop_get_proc_signal(p1, p2) glibtop_get_proc_signal_l(glibtop_global_server, p1, p2) + #if GLIBTOP_SUID_PROC_SIGNAL #define glibtop_get_proc_signal_r glibtop_get_proc_signal_p #else #define glibtop_get_proc_signal_r glibtop_get_proc_signal_s #endif -int glibtop_get_proc_signal_l (glibtop_client *client, glibtop_proc_signal *buf, pid_t pid); +void glibtop_get_proc_signal_l (glibtop *server, glibtop_proc_signal *buf, pid_t pid); #if GLIBTOP_SUID_PROC_SIGNAL -int glibtop_init_proc_signal_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_signal_p (glibtop_server *server, glibtop_closure *closure, glibtop_proc_signal *buf, pid_t pid); +void glibtop_init_proc_signal_p (glibtop *server); +void glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf, pid_t pid); #else -int glibtop_init_proc_signal_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_signal_s (glibtop_server *server, glibtop_closure *closure, glibtop_proc_signal *buf, pid_t pid); +void glibtop_init_proc_signal_s (glibtop *server); +void glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf, pid_t pid); #endif #ifdef GLIBTOP_NAMES @@ -78,6 +78,6 @@ extern const char *glibtop_descriptions_proc_signal []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/procstate.h b/include/glibtop/procstate.h index f4264a32..ae3fec18 100644 --- a/include/glibtop/procstate.h +++ b/include/glibtop/procstate.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,27 +27,14 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS - -#define GLIBTOP_PROC_STATE_CMD 0 -#define GLIBTOP_PROC_STATE_STATE 1 -#define GLIBTOP_PROC_STATE_UID 2 -#define GLIBTOP_PROC_STATE_GID 3 -#define GLIBTOP_PROC_STATE_RUID 4 -#define GLIBTOP_PROC_STATE_RGID 5 -#define GLIBTOP_PROC_STATE_HAS_CPU 6 -#define GLIBTOP_PROC_STATE_PROCESSOR 7 -#define GLIBTOP_PROC_STATE_LAST_PROCESSOR 8 +BEGIN_LIBGTOP_DECLS -#define GLIBTOP_MAX_PROC_STATE 9 +#define GLIBTOP_PROC_STATE_CMD 0 +#define GLIBTOP_PROC_STATE_STATE 1 +#define GLIBTOP_PROC_STATE_UID 2 +#define GLIBTOP_PROC_STATE_GID 3 -/* Constants for the `state' field. */ -#define GLIBTOP_PROCESS_RUNNING 1 -#define GLIBTOP_PROCESS_INTERRUPTIBLE 2 -#define GLIBTOP_PROCESS_UNINTERRUPTIBLE 4 -#define GLIBTOP_PROCESS_ZOMBIE 8 -#define GLIBTOP_PROCESS_STOPPED 16 -#define GLIBTOP_PROCESS_SWAPPING 32 +#define GLIBTOP_MAX_PROC_STATE 4 typedef struct _glibtop_proc_state glibtop_proc_state; @@ -57,40 +42,36 @@ typedef struct _glibtop_proc_state glibtop_proc_state; struct _glibtop_proc_state { - u_int64_t flags; - char cmd[40]; /* basename of executable file in + u_int64_t flags; + char cmd[40], /* basename of executable file in * call to exec(2) */ - unsigned state; /* process state */ - /* NOTE: when porting the library, TRY HARD to implement the - * following two fields. */ - /* IMPORTANT NOTICE: For security reasons, it is extremely important - * only to set the flags value for those two - * fields if their values are corrent ! */ - int uid, /* effective UID of process */ - gid, /* effective GID of process */ - ruid, /* real UID of process */ - rgid; /* real GID of process */ - /* SMP values. */ - int has_cpu, - processor, - last_processor; - + state; /* single-char code for process state + * (S=sleeping) */ + /* NOTE: when porting the library, TRY HARD to implement the + * following two fields. */ + /* IMPORTANT NOTICE: For security reasons, it is extremely important + * only to set the flags value for those two + * fields if their values are corrent ! */ + int uid, /* UID of process */ + gid; /* GID of process */ }; +#define glibtop_get_proc_state(p1, p2) glibtop_get_proc_state_l(glibtop_global_server, p1, p2) + #if GLIBTOP_SUID_PROC_STATE #define glibtop_get_proc_state_r glibtop_get_proc_state_p #else #define glibtop_get_proc_state_r glibtop_get_proc_state_s #endif -int glibtop_get_proc_state_l (glibtop_client *client, glibtop_proc_state *buf, pid_t pid); +void glibtop_get_proc_state_l (glibtop *server, glibtop_proc_state *buf, pid_t pid); #if GLIBTOP_SUID_PROC_STATE -int glibtop_init_proc_state_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_state_p (glibtop_server *server, glibtop_closure *closure, glibtop_proc_state *buf, pid_t pid); +void glibtop_init_proc_state_p (glibtop *server); +void glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, pid_t pid); #else -int glibtop_init_proc_state_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_state_s (glibtop_server *server, glibtop_closure *closure, glibtop_proc_state *buf, pid_t pid); +void glibtop_init_proc_state_s (glibtop *server); +void glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid); #endif #ifdef GLIBTOP_NAMES @@ -104,6 +85,6 @@ extern const char *glibtop_descriptions_proc_state []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/proctime.h b/include/glibtop/proctime.h index afd07abc..236af2e4 100644 --- a/include/glibtop/proctime.h +++ b/include/glibtop/proctime.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -30,7 +28,7 @@ #include <glibtop/cpu.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_PROC_TIME_START_TIME 0 #define GLIBTOP_PROC_TIME_RTIME 1 @@ -43,9 +41,8 @@ G_BEGIN_DECLS #define GLIBTOP_PROC_TIME_FREQUENCY 8 #define GLIBTOP_PROC_TIME_XCPU_UTIME 9 #define GLIBTOP_PROC_TIME_XCPU_STIME 10 -#define GLIBTOP_PROC_TIME_XCPU_FLAGS 11 -#define GLIBTOP_MAX_PROC_TIME 12 +#define GLIBTOP_MAX_PROC_TIME 11 typedef struct _glibtop_proc_time glibtop_proc_time; @@ -53,41 +50,42 @@ typedef struct _glibtop_proc_time glibtop_proc_time; struct _glibtop_proc_time { - u_int64_t flags, - start_time, /* start time of process -- - * seconds since 1-1-70 */ - rtime, /* real time accumulated by process */ - utime, /* user-mode CPU time accumulated by process */ - stime, /* kernel-mode CPU time accumulated by process */ - cutime, /* cumulative utime of process and - * reaped children */ - cstime, /* cumulative stime of process and - * reaped children */ - timeout, /* The time (in jiffies) of the process's - * next timeout */ - it_real_value, /* The time (in jiffies) before the - * next SIGALRM is sent to the process - * due to an interval timer. */ - frequency, /* Tick frequency. */ - xcpu_utime [GLIBTOP_NCPU], /* utime and stime for all CPUs on */ - xcpu_stime [GLIBTOP_NCPU], /* SMP machines. */ - xcpu_flags; + u_int64_t flags, + start_time, /* start time of process -- + * seconds since 1-1-70 */ + rtime, /* real time accumulated by process */ + utime, /* user-mode CPU time accumulated by process */ + stime, /* kernel-mode CPU time accumulated by process */ + cutime, /* cumulative utime of process and + * reaped children */ + cstime, /* cumulative stime of process and + * reaped children */ + timeout, /* The time (in jiffies) of the process's + * next timeout */ + it_real_value, /* The time (in jiffies) before the + * next SIGALRM is sent to the process + * due to an interval timer. */ + frequency, /* Tick frequency. */ + xcpu_utime [GLIBTOP_NCPU], /* utime and stime for all CPUs on */ + xcpu_stime [GLIBTOP_NCPU]; /* SMP machines. */ }; +#define glibtop_get_proc_time(p1, p2) glibtop_get_proc_time_l(glibtop_global_server, p1, p2) + #if GLIBTOP_SUID_PROC_TIME #define glibtop_get_proc_time_r glibtop_get_proc_time_p #else #define glibtop_get_proc_time_r glibtop_get_proc_time_s #endif -int glibtop_get_proc_time_l (glibtop_client *client, glibtop_proc_time *buf, pid_t pid); +void glibtop_get_proc_time_l (glibtop *server, glibtop_proc_time *buf, pid_t pid); #if GLIBTOP_SUID_PROC_TIME -int glibtop_init_proc_time_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_time_p (glibtop_server *server, glibtop_closure *closure, glibtop_proc_time *buf, pid_t pid); +void glibtop_init_proc_time_p (glibtop *server); +void glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf, pid_t pid); #else -int glibtop_init_proc_time_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_time_s (glibtop_server *server, glibtop_closure *closure, glibtop_proc_time *buf, pid_t pid); +void glibtop_init_proc_time_s (glibtop *server); +void glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid); #endif #ifdef GLIBTOP_NAMES @@ -101,6 +99,6 @@ extern const char *glibtop_descriptions_proc_time []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/procuid.h b/include/glibtop/procuid.h index 38cf1cc3..3be378db 100644 --- a/include/glibtop/procuid.h +++ b/include/glibtop/procuid.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,28 +27,22 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_PROC_UID_UID 0 #define GLIBTOP_PROC_UID_EUID 1 #define GLIBTOP_PROC_UID_GID 2 #define GLIBTOP_PROC_UID_EGID 3 -#define GLIBTOP_PROC_UID_SUID 4 -#define GLIBTOP_PROC_UID_SGID 5 -#define GLIBTOP_PROC_UID_FSUID 6 -#define GLIBTOP_PROC_UID_FSGID 7 -#define GLIBTOP_PROC_UID_PID 8 -#define GLIBTOP_PROC_UID_PPID 9 -#define GLIBTOP_PROC_UID_PGRP 10 -#define GLIBTOP_PROC_UID_SESSION 11 -#define GLIBTOP_PROC_UID_TTY 12 -#define GLIBTOP_PROC_UID_TPGID 13 -#define GLIBTOP_PROC_UID_PRIORITY 14 -#define GLIBTOP_PROC_UID_NICE 15 -#define GLIBTOP_PROC_UID_NGROUPS 16 -#define GLIBTOP_PROC_UID_GROUPS 17 - -#define GLIBTOP_MAX_PROC_UID 18 +#define GLIBTOP_PROC_UID_PID 4 +#define GLIBTOP_PROC_UID_PPID 5 +#define GLIBTOP_PROC_UID_PGRP 6 +#define GLIBTOP_PROC_UID_SESSION 7 +#define GLIBTOP_PROC_UID_TTY 8 +#define GLIBTOP_PROC_UID_TPGID 9 +#define GLIBTOP_PROC_UID_PRIORITY 10 +#define GLIBTOP_PROC_UID_NICE 11 + +#define GLIBTOP_MAX_PROC_UID 12 typedef struct _glibtop_proc_uid glibtop_proc_uid; @@ -58,41 +50,37 @@ typedef struct _glibtop_proc_uid glibtop_proc_uid; struct _glibtop_proc_uid { - u_int64_t flags; - int uid, /* user id */ - euid, /* effective user id */ - gid, /* group id */ - egid, /* effective group id */ - suid, /* saved user id */ - sgid, /* saved group id */ - fsuid, /* file system user id */ - fsgid, /* file system group id */ - pid, /* process id */ - ppid, /* pid of parent process */ - pgrp, /* process group id */ - session, /* session id */ - tty, /* full device number of controlling terminal */ - tpgid, /* terminal process group id */ - priority, /* kernel scheduling priority */ - nice, /* standard unix nice level of process */ - ngroups, /* number of additional process groups */ - groups [GLIBTOP_MAX_GROUPS]; /* additional prcess groups */ + u_int64_t flags; + int uid, /* user id */ + euid, /* effective user id */ + gid, /* group id */ + egid, /* effective group id */ + pid, /* process id */ + ppid, /* pid of parent process */ + pgrp, /* process group id */ + session, /* session id */ + tty, /* full device number of controlling terminal */ + tpgid, /* terminal process group id */ + priority, /* kernel scheduling priority */ + nice; /* standard unix nice level of process */ }; +#define glibtop_get_proc_uid(p1, p2) glibtop_get_proc_uid_l(glibtop_global_server, p1, p2) + #if GLIBTOP_SUID_PROC_UID #define glibtop_get_proc_uid_r glibtop_get_proc_uid_p #else #define glibtop_get_proc_uid_r glibtop_get_proc_uid_s #endif -int glibtop_get_proc_uid_l (glibtop_client *client, glibtop_proc_uid *buf, pid_t pid); +void glibtop_get_proc_uid_l (glibtop *server, glibtop_proc_uid *buf, pid_t pid); #if GLIBTOP_SUID_PROC_UID -int glibtop_init_proc_uid_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_uid_p (glibtop_server *server, glibtop_closure *closure, glibtop_proc_uid *buf, pid_t pid); +void glibtop_init_proc_uid_p (glibtop *server); +void glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf, pid_t pid); #else -int glibtop_init_proc_uid_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_proc_uid_s (glibtop_server *server, glibtop_closure *closure, glibtop_proc_uid *buf, pid_t pid); +void glibtop_init_proc_uid_s (glibtop *server); +void glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf, pid_t pid); #endif #ifdef GLIBTOP_NAMES @@ -106,6 +94,6 @@ extern const char *glibtop_descriptions_proc_uid []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/sem_limits.h b/include/glibtop/sem_limits.h index f3364e03..e9576ff7 100644 --- a/include/glibtop/sem_limits.h +++ b/include/glibtop/sem_limits.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,52 +27,54 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS -#define GLIBTOP_SEM_LIMITS_SEMMAP 0 -#define GLIBTOP_SEM_LIMITS_SEMMNI 1 -#define GLIBTOP_SEM_LIMITS_SEMMNS 2 -#define GLIBTOP_SEM_LIMITS_SEMMNU 3 -#define GLIBTOP_SEM_LIMITS_SEMMSL 4 -#define GLIBTOP_SEM_LIMITS_SEMOPM 5 -#define GLIBTOP_SEM_LIMITS_SEMUME 6 -#define GLIBTOP_SEM_LIMITS_SEMUSZ 7 -#define GLIBTOP_SEM_LIMITS_SEMVMX 8 -#define GLIBTOP_SEM_LIMITS_SEMAEM 9 +#define GLIBTOP_IPC_SEMMAP 0 +#define GLIBTOP_IPC_SEMMNI 1 +#define GLIBTOP_IPC_SEMMNS 2 +#define GLIBTOP_IPC_SEMMNU 3 +#define GLIBTOP_IPC_SEMMSL 4 +#define GLIBTOP_IPC_SEMOPM 5 +#define GLIBTOP_IPC_SEMUME 6 +#define GLIBTOP_IPC_SEMUSZ 7 +#define GLIBTOP_IPC_SEMVMX 8 +#define GLIBTOP_IPC_SEMAEM 9 -#define GLIBTOP_MAX_SEM_LIMITS 10 +#define GLIBTOP_MAX_SEM_LIMITS 10 typedef struct _glibtop_sem_limits glibtop_sem_limits; struct _glibtop_sem_limits { - u_int64_t flags, - semmap, /* GLIBTOP_SEM_LIMITS_SEMMAP */ - semmni, /* GLIBTOP_SEM_LIMITS_SEMMNI */ - semmns, /* GLIBTOP_SEM_LIMITS_SEMMNS */ - semmnu, /* GLIBTOP_SEM_LIMITS_SEMMNU */ - semmsl, /* GLIBTOP_SEM_LIMITS_SEMMSL */ - semopm, /* GLIBTOP_SEM_LIMITS_SEMOPM */ - semume, /* GLIBTOP_SEM_LIMITS_SEMUME */ - semusz, /* GLIBTOP_SEM_LIMITS_SEMUSZ */ - semvmx, /* GLIBTOP_SEM_LIMITS_SEMVMX */ - semaem; /* GLIBTOP_SEM_LIMITS_SEMAEM */ + u_int64_t flags, + semmap, /* GLIBTOP_IPC_SEMMAP */ + semmni, /* GLIBTOP_IPC_SEMMNI */ + semmns, /* GLIBTOP_IPC_SEMMNS */ + semmnu, /* GLIBTOP_IPC_SEMMNU */ + semmsl, /* GLIBTOP_IPC_SEMMSL */ + semopm, /* GLIBTOP_IPC_SEMOPM */ + semume, /* GLIBTOP_IPC_SEMUME */ + semusz, /* GLIBTOP_IPC_SEMUSZ */ + semvmx, /* GLIBTOP_IPC_SEMVMX */ + semaem; /* GLIBTOP_IPC_SEMAEM */ }; +#define glibtop_get_sem_limits(sem) glibtop_get_sem_limits_l(glibtop_global_server, sem) + #if GLIBTOP_SUID_SEM_LIMITS #define glibtop_get_sem_limits_r glibtop_get_sem_limits_p #else #define glibtop_get_sem_limits_r glibtop_get_sem_limits_s #endif -int glibtop_get_sem_limits_l (glibtop_client *client, glibtop_sem_limits *buf); +void glibtop_get_sem_limits_l (glibtop *server, glibtop_sem_limits *buf); #if GLIBTOP_SUID_SEM_LIMITS -int glibtop_init_sem_limits_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_sem_limits_p (glibtop_server *server, glibtop_closure *closure, glibtop_sem_limits *buf); +void glibtop_init_sem_limits_p (glibtop *server); +void glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf); #else -int glibtop_init_sem_limits_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_sem_limits_s (glibtop_server *server, glibtop_closure *closure, glibtop_sem_limits *buf); +void glibtop_init_sem_limits_s (glibtop *server); +void glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf); #endif #ifdef GLIBTOP_NAMES @@ -88,6 +88,6 @@ extern const char *glibtop_descriptions_sem_limits []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/shm_limits.h b/include/glibtop/shm_limits.h index 11e26929..db7db793 100644 --- a/include/glibtop/shm_limits.h +++ b/include/glibtop/shm_limits.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,42 +27,44 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS -#define GLIBTOP_SHM_LIMITS_SHMMAX 0 -#define GLIBTOP_SHM_LIMITS_SHMMIN 1 -#define GLIBTOP_SHM_LIMITS_SHMMNI 2 -#define GLIBTOP_SHM_LIMITS_SHMSEG 3 -#define GLIBTOP_SHM_LIMITS_SHMALL 4 +#define GLIBTOP_IPC_SHMMAX 0 +#define GLIBTOP_IPC_SHMMIN 1 +#define GLIBTOP_IPC_SHMMNI 2 +#define GLIBTOP_IPC_SHMSEG 3 +#define GLIBTOP_IPC_SHMALL 4 -#define GLIBTOP_MAX_SHM_LIMITS 5 +#define GLIBTOP_MAX_SHM_LIMITS 5 typedef struct _glibtop_shm_limits glibtop_shm_limits; struct _glibtop_shm_limits { - u_int64_t flags, - shmmax, /* GLIBTOP_SHM_LIMITS_SHMMAX */ - shmmin, /* GLIBTOP_SHM_LIMITS_SHMMIN */ - shmmni, /* GLIBTOP_SHM_LIMITS_SHMMNI */ - shmseg, /* GLIBTOP_SHM_LIMITS_SHMSEG */ - shmall; /* GLIBTOP_SHM_LIMITS_SHMALL */ + u_int64_t flags, + shmmax, /* GLIBTOP_IPC_SHMMAX */ + shmmin, /* GLIBTOP_IPC_SHMMIN */ + shmmni, /* GLIBTOP_IPC_SHMMNI */ + shmseg, /* GLIBTOP_IPC_SHMSEG */ + shmall; /* GLIBTOP_IPC_SHMALL */ }; +#define glibtop_get_shm_limits(shm) glibtop_get_shm_limits_l(glibtop_global_server, shm) + #if GLIBTOP_SUID_SHM_LIMITS #define glibtop_get_shm_limits_r glibtop_get_shm_limits_p #else #define glibtop_get_shm_limits_r glibtop_get_shm_limits_s #endif -int glibtop_get_shm_limits_l (glibtop_client *client, glibtop_shm_limits *buf); +void glibtop_get_shm_limits_l (glibtop *server, glibtop_shm_limits *buf); #if GLIBTOP_SUID_SHM_LIMITS -int glibtop_init_shm_limits_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_shm_limits_p (glibtop_server *, glibtop_shm_limits *buf); +void glibtop_init_shm_limits_p (glibtop *server); +void glibtop_get_shm_limits_p (glibtop *, glibtop_shm_limits *buf); #else -int glibtop_init_shm_limits_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_shm_limits_s (glibtop_server *server, glibtop_closure *closure, glibtop_shm_limits *buf); +void glibtop_init_shm_limits_s (glibtop *server); +void glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf); #endif #ifdef GLIBTOP_NAMES @@ -78,6 +78,6 @@ extern const char *glibtop_descriptions_shm_limits []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/signal.h b/include/glibtop/signal.h index e4d90173..f8235b40 100644 --- a/include/glibtop/signal.h +++ b/include/glibtop/signal.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -32,18 +30,18 @@ #include <sys/signal.h> #endif -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS typedef struct _glibtop_signame glibtop_signame; struct _glibtop_signame { - const int number; - const char *name, *label; + const int number; + const char *name, *label; }; extern const glibtop_signame glibtop_sys_siglist []; -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/swap.h b/include/glibtop/swap.h index 7476cb63..049c2c2f 100644 --- a/include/glibtop/swap.h +++ b/include/glibtop/swap.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,7 +27,7 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_SWAP_TOTAL 0 #define GLIBTOP_SWAP_USED 1 @@ -43,28 +41,30 @@ typedef struct _glibtop_swap glibtop_swap; struct _glibtop_swap { - u_int64_t flags, - total, /* GLIBTOP_SWAP_TOTAL */ - used, /* GLIBTOP_SWAP_USED */ - free, /* GLIBTOP_SWAP_FREE */ - pagein, /* GLIBTOP_SWAP_PAGEIN */ - pageout; /* GLIBTOP_SWAP_PAGEOUT */ + u_int64_t flags, + total, /* GLIBTOP_SWAP_TOTAL */ + used, /* GLIBTOP_SWAP_USED */ + free, /* GLIBTOP_SWAP_FREE */ + pagein, /* GLIBTOP_SWAP_PAGEIN */ + pageout; /* GLIBTOP_SWAP_PAGEOUT */ }; +#define glibtop_get_swap(swap) glibtop_get_swap_l(glibtop_global_server, swap) + #if GLIBTOP_SUID_SWAP #define glibtop_get_swap_r glibtop_get_swap_p #else #define glibtop_get_swap_r glibtop_get_swap_s #endif -int glibtop_get_swap_l (glibtop_client *client, glibtop_swap *buf); +void glibtop_get_swap_l (glibtop *server, glibtop_swap *buf); #if GLIBTOP_SUID_SWAP -int glibtop_init_swap_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_swap_p (glibtop_server *server, glibtop_closure *closure, glibtop_swap *buf); +void glibtop_init_swap_p (glibtop *server); +void glibtop_get_swap_p (glibtop *server, glibtop_swap *buf); #else -int glibtop_init_swap_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_swap_s (glibtop_server *server, glibtop_closure *closure, glibtop_swap *buf); +void glibtop_init_swap_s (glibtop *server); +void glibtop_get_swap_s (glibtop *server, glibtop_swap *buf); #endif #ifdef GLIBTOP_NAMES @@ -78,6 +78,6 @@ extern const char *glibtop_descriptions_swap []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/sysdeps.h b/include/glibtop/sysdeps.h index d559f1f9..125cdf01 100644 --- a/include/glibtop/sysdeps.h +++ b/include/glibtop/sysdeps.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -28,72 +26,74 @@ #include <glibtop.h> -G_BEGIN_DECLS - -#define GLIBTOP_SYSDEPS_CPU 0 -#define GLIBTOP_SYSDEPS_MEM 1 -#define GLIBTOP_SYSDEPS_SWAP 2 -#define GLIBTOP_SYSDEPS_UPTIME 3 -#define GLIBTOP_SYSDEPS_LOADAVG 4 -#define GLIBTOP_SYSDEPS_SHM_LIMITS 5 -#define GLIBTOP_SYSDEPS_MSG_LIMITS 6 -#define GLIBTOP_SYSDEPS_SEM_LIMITS 7 -#define GLIBTOP_SYSDEPS_PROCLIST 8 -#define GLIBTOP_SYSDEPS_PROC_STATE 9 -#define GLIBTOP_SYSDEPS_PROC_UID 10 -#define GLIBTOP_SYSDEPS_PROC_MEM 11 -#define GLIBTOP_SYSDEPS_PROC_TIME 12 -#define GLIBTOP_SYSDEPS_PROC_SIGNAL 13 -#define GLIBTOP_SYSDEPS_PROC_KERNEL 14 -#define GLIBTOP_SYSDEPS_PROC_SEGMENT 15 -#define GLIBTOP_SYSDEPS_PROC_CWD 16 +BEGIN_LIBGTOP_DECLS + +#define GLIBTOP_SYSDEPS_FEATURES 0 +#define GLIBTOP_SYSDEPS_CPU 1 +#define GLIBTOP_SYSDEPS_MEM 2 +#define GLIBTOP_SYSDEPS_SWAP 3 +#define GLIBTOP_SYSDEPS_UPTIME 4 +#define GLIBTOP_SYSDEPS_LOADAVG 5 +#define GLIBTOP_SYSDEPS_SHM_LIMITS 6 +#define GLIBTOP_SYSDEPS_MSG_LIMITS 7 +#define GLIBTOP_SYSDEPS_SEM_LIMITS 8 +#define GLIBTOP_SYSDEPS_PROCLIST 9 +#define GLIBTOP_SYSDEPS_PROC_STATE 10 +#define GLIBTOP_SYSDEPS_PROC_UID 11 +#define GLIBTOP_SYSDEPS_PROC_MEM 12 +#define GLIBTOP_SYSDEPS_PROC_TIME 13 +#define GLIBTOP_SYSDEPS_PROC_SIGNAL 14 +#define GLIBTOP_SYSDEPS_PROC_KERNEL 15 +#define GLIBTOP_SYSDEPS_PROC_SEGMENT 16 #define GLIBTOP_SYSDEPS_PROC_ARGS 17 #define GLIBTOP_SYSDEPS_PROC_MAP 18 #define GLIBTOP_SYSDEPS_MOUNTLIST 19 #define GLIBTOP_SYSDEPS_FSUSAGE 20 -#define GLIBTOP_SYSDEPS_INTERFACE_NAMES 21 -#define GLIBTOP_SYSDEPS_NETINFO 22 -#define GLIBTOP_SYSDEPS_NETLOAD 23 -#define GLIBTOP_SYSDEPS_PPP 24 +#define GLIBTOP_SYSDEPS_NETLOAD 21 +#define GLIBTOP_SYSDEPS_PPP 22 -#define GLIBTOP_MAX_SYSDEPS 27 +#define GLIBTOP_MAX_SYSDEPS 23 #define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1) +typedef void (*glibtop_init_func_t) (glibtop *); +extern glibtop_init_func_t _glibtop_init_hook_s []; +extern glibtop_init_func_t _glibtop_init_hook_p []; + typedef struct _glibtop_sysdeps glibtop_sysdeps; struct _glibtop_sysdeps { - u_int64_t flags, - features, /* server features */ - pointer_size, /* sizeof(void*)*8 */ - cpu, /* glibtop_cpu */ - mem, /* glibtop_mem */ - swap, /* glibtop_swap */ - uptime, /* glibtop_uptime */ - loadavg, /* glibtop_loadavg */ - shm_limits, /* glibtop_shm_limits */ - msg_limits, /* glibtop_msg_limits */ - sem_limits, /* glibtop_sem_limits */ - proclist, /* glibtop_proclist */ - proc_state, /* glibtop_proc_state */ - proc_uid, /* glibtop_proc_uid */ - proc_mem, /* glibtop_proc_mem */ - proc_time, /* glibtop_proc_time */ - proc_signal, /* glibtop_proc_signal */ - proc_kernel, /* glibtop_proc_kernel */ - proc_segment, /* glibtop_proc_segment */ - proc_cwd, /* glibtop_proc_cwd */ - proc_args, /* glibtop_proc_args */ - proc_map, /* glibtop_proc_map */ - mountlist, /* glibtop_mountlist */ - fsusage, /* glibtop_fsusage */ - interface_names, /* glibtop_interface_names */ - netinfo, /* glibtop_netinfo */ - netload, /* glibtop_netload */ - ppp; /* glibtop_ppp */ + u_int64_t flags, + features, /* server features */ + cpu, /* glibtop_cpu */ + mem, /* glibtop_mem */ + swap, /* glibtop_swap */ + uptime, /* glibtop_uptime */ + loadavg, /* glibtop_loadavg */ + shm_limits, /* glibtop_shm_limits */ + msg_limits, /* glibtop_msg_limits */ + sem_limits, /* glibtop_sem_limits */ + proclist, /* glibtop_proclist */ + proc_state, /* glibtop_proc_state */ + proc_uid, /* glibtop_proc_uid */ + proc_mem, /* glibtop_proc_mem */ + proc_time, /* glibtop_proc_time */ + proc_signal, /* glibtop_proc_signal */ + proc_kernel, /* glibtop_proc_kernel */ + proc_segment, /* glibtop_proc_segment */ + proc_args, /* glibtop_proc_args */ + proc_map, /* glibtop_proc_map */ + mountlist, /* glibtop_mountlist */ + fsusage, /* glibtop_fsusage */ + netload, /* glibtop_netload */ + ppp; /* glibtop_ppp */ }; +#define glibtop_get_sysdeps(sysdeps) glibtop_get_sysdeps_r(glibtop_global_server,sysdeps) + +void glibtop_get_sysdeps_r (glibtop *server, glibtop_sysdeps *buf); + #ifdef GLIBTOP_NAMES /* You need to link with -lgtop_names to get this stuff here. */ @@ -105,6 +105,6 @@ extern const char *glibtop_descriptions_sysdeps []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/sysinfo.h b/include/glibtop/sysinfo.h index 3329ba0e..4dc53605 100644 --- a/include/glibtop/sysinfo.h +++ b/include/glibtop/sysinfo.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -32,7 +30,7 @@ #include <glib.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_SYSINFO_CPUINFO 0 @@ -44,21 +42,23 @@ typedef struct _glibtop_entry glibtop_entry; struct _glibtop_entry { - GPtrArray *labels; - GHashTable *values; - GHashTable *descriptions; + GPtrArray *labels; + GHashTable *values; + GHashTable *descriptions; }; struct _glibtop_sysinfo { - u_int64_t flags, ncpu; - glibtop_entry cpuinfo [GLIBTOP_NCPU]; + u_int64_t flags, ncpu; + glibtop_entry cpuinfo [GLIBTOP_NCPU]; }; +#define glibtop_get_sysinfo() glibtop_get_sysinfo_s(glibtop_global_server) + #define glibtop_get_sysinfo_r glibtop_get_sysinfo_s -glibtop_sysinfo *glibtop_get_sysinfo_s (glibtop_server *server); +glibtop_sysinfo *glibtop_get_sysinfo_s (glibtop *server); -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/types.h b/include/glibtop/types.h index 21753ae7..ab052b08 100644 --- a/include/glibtop/types.h +++ b/include/glibtop/types.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -26,16 +24,15 @@ #ifndef __GLIBTOP_TYPES_H__ #define __GLIBTOP_TYPES_H__ -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_TYPE_LONG 1 #define GLIBTOP_TYPE_ULONG 2 #define GLIBTOP_TYPE_DOUBLE 3 #define GLIBTOP_TYPE_INT 4 -#define GLIBTOP_TYPE_UNSIGNED 5 -#define GLIBTOP_TYPE_CHAR 6 -#define GLIBTOP_TYPE_STRING 7 +#define GLIBTOP_TYPE_CHAR 5 +#define GLIBTOP_TYPE_STRING 6 -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/union.h b/include/glibtop/union.h index c18bfc51..22dfe67d 100644 --- a/include/glibtop/union.h +++ b/include/glibtop/union.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -46,49 +44,42 @@ #include <glibtop/procargs.h> #include <glibtop/procmap.h> -#include <glibtop/proccwd.h> - #include <glibtop/mountlist.h> #include <glibtop/fsusage.h> #include <glibtop/netload.h> -#include <glibtop/netinfo.h> -#include <glibtop/interfaces.h> #include <glibtop/ppp.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS typedef union _glibtop_union glibtop_union; union _glibtop_union { - glibtop_cpu cpu; - glibtop_mem mem; - glibtop_swap swap; - glibtop_uptime uptime; - glibtop_loadavg loadavg; - glibtop_shm_limits shm_limits; - glibtop_msg_limits msg_limits; - glibtop_sem_limits sem_limits; - glibtop_array proclist; - glibtop_proc_state proc_state; - glibtop_proc_uid proc_uid; - glibtop_proc_mem proc_mem; - glibtop_proc_time proc_time; - glibtop_proc_signal proc_signal; - glibtop_proc_kernel proc_kernel; - glibtop_proc_segment proc_segment; - glibtop_proc_cwd proc_cwd; - glibtop_array proc_args; - glibtop_array proc_map; - glibtop_array mountlist; - glibtop_fsusage fsusage; - glibtop_array interface_names; - glibtop_netinfo netinfo; - glibtop_netload netload; - glibtop_ppp ppp; + glibtop_cpu cpu; + glibtop_mem mem; + glibtop_swap swap; + glibtop_uptime uptime; + glibtop_loadavg loadavg; + glibtop_shm_limits shm_limits; + glibtop_msg_limits msg_limits; + glibtop_sem_limits sem_limits; + glibtop_proclist proclist; + glibtop_proc_state proc_state; + glibtop_proc_uid proc_uid; + glibtop_proc_mem proc_mem; + glibtop_proc_time proc_time; + glibtop_proc_signal proc_signal; + glibtop_proc_kernel proc_kernel; + glibtop_proc_segment proc_segment; + glibtop_proc_args proc_args; + glibtop_proc_map proc_map; + glibtop_mountlist mountlist; + glibtop_fsusage fsusage; + glibtop_netload netload; + glibtop_ppp ppp; }; -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/uptime.h b/include/glibtop/uptime.h index 46048e1b..a487eb47 100644 --- a/include/glibtop/uptime.h +++ b/include/glibtop/uptime.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,38 +27,38 @@ #include <glibtop.h> #include <glibtop/global.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS #define GLIBTOP_UPTIME_UPTIME 0 #define GLIBTOP_UPTIME_IDLETIME 1 -#define GLIBTOP_UPTIME_BOOT_TIME 2 -#define GLIBTOP_MAX_UPTIME 3 +#define GLIBTOP_MAX_UPTIME 2 typedef struct _glibtop_uptime glibtop_uptime; struct _glibtop_uptime { - u_int64_t flags; - double uptime, /* GLIBTOP_UPTIME_UPTIME */ - idletime; /* GLIBTOP_UPTIME_IDLETIME */ - u_int64_t boot_time; /* GLIBTOP_UPTIME_BOOT_TIME */ + u_int64_t flags; + double uptime, /* GLIBTOP_UPTIME_UPTIME */ + idletime; /* GLIBTOP_UPTIME_IDLETIME */ }; +#define glibtop_get_uptime(uptime) glibtop_get_uptime_l(glibtop_global_server, uptime) + #if GLIBTOP_SUID_UPTIME #define glibtop_get_uptime_r glibtop_get_uptime_p #else #define glibtop_get_uptime_r glibtop_get_uptime_s #endif -int glibtop_get_uptime_l (glibtop_client *client, glibtop_uptime *buf); +void glibtop_get_uptime_l (glibtop *server, glibtop_uptime *buf); #if GLIBTOP_SUID_UPTIME -int glibtop_init_uptime_p (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_uptime_p (glibtop_server *server, glibtop_closure *closure, glibtop_uptime *buf); +void glibtop_init_uptime_p (glibtop *server); +void glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf); #else -int glibtop_init_uptime_s (glibtop_server *server, glibtop_closure *closure); -int glibtop_get_uptime_s (glibtop_server *server, glibtop_closure *closure, glibtop_uptime *buf); +void glibtop_init_uptime_s (glibtop *server); +void glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf); #endif #ifdef GLIBTOP_NAMES @@ -74,6 +72,6 @@ extern const char *glibtop_descriptions_uptime []; #endif -G_END_DECLS +END_LIBGTOP_DECLS #endif diff --git a/include/glibtop/xmalloc.h b/include/glibtop/xmalloc.h index e4cbf31c..9f5eac06 100644 --- a/include/glibtop/xmalloc.h +++ b/include/glibtop/xmalloc.h @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - /* $Id$ */ /* Copyright (C) 1998-99 Martin Baulig @@ -29,14 +27,20 @@ #include <glibtop.h> #include <glibtop/error.h> -G_BEGIN_DECLS +BEGIN_LIBGTOP_DECLS + +#define glibtop_malloc(p1) glibtop_malloc_r(glibtop_global_server, p1) +#define glibtop_calloc(p1, p2) glibtop_calloc_r(glibtop_global_server, p1, p2) +#define glibtop_realloc(p1, p2) glibtop_realloc_r(glibtop_global_server, p1, p2) +#define glibtop_strdup(p1) glibtop_strdup_r(glibtop_global_server, p1) +#define glibtop_free(p1) glibtop_free_r(glibtop_global_server, p1) -void *glibtop_malloc_r (glibtop_server *server, size_t size); -void *glibtop_calloc_r (glibtop_server *server, size_t nmemb, size_t size); -void *glibtop_realloc_r (glibtop_server *server, void *ptr, size_t size); -char *glibtop_strdup_r (glibtop_server *server, const char *string); -void glibtop_free_r (glibtop_server *server, void *ptr); +void *glibtop_malloc_r (glibtop *server, size_t size); +void *glibtop_calloc_r (glibtop *server, size_t nmemb, size_t size); +void *glibtop_realloc_r (glibtop *server, void *ptr, size_t size); +char *glibtop_strdup_r (glibtop *server, const char *string); +void glibtop_free_r (glibtop *server, const void *ptr); -G_END_DECLS +END_LIBGTOP_DECLS #endif |