summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMartin Baulig <martin@home-of-linux.org>1999-12-12 14:20:17 +0000
committerMartin Baulig <martin@src.gnome.org>1999-12-12 14:20:17 +0000
commit881c2a208669f096339d755d21c1a8d2d267ca40 (patch)
treefdddae7b8b8f870bef30a771ad06614f8f3cd40b /include
parenta33f4df47e398aaf62043ed98229977e42ac2241 (diff)
downloadlibgtop-881c2a208669f096339d755d21c1a8d2d267ca40.tar.gz
All functions which return an array now take a `glibtop_array *array'
1999-12-12 Martin Baulig <martin@home-of-linux.org> All functions which return an array now take a `glibtop_array *array' parameter instead of a `glibtop_<feature> *buf' one. For compatibility, we typedef the corresponding `glibtop_<feature>'s to `glibtop_array' in <glibtop/compat_10.h>. This has the advantage that scripting languages like Guile with an array implementation which stores the length of an array in the array don't need the `glibtop_array' parameter at all any longer. We'll also add convenient functions which return GPtrArray's here. * include/glibtop/proclist.h (glibtop_proclist): Removed. (glibtop_get_proclist_*): This now takes a `glibtop_array' parameter instead of a `glibtop_proclist' one. * include/glibtop/procmap.h (glibtop_proc_map): Removed. (glibtop_get_proc_map_*): This now takes a `glibtop_array' parameter instead of a `glibtop_proc_map' one. * include/glibtop/mountlist.h (glibtop_mountlist): Removed. (glibtop_get_mountlist_*): This now takes a `glibtop_array' parameter instead of a `glibtop_mountlist' one. * include/glibtop/interfaces.h (glibtop_interface_names): Removed. (glibtop_get_interface_names_*): This now takes a `glibtop_array' parameter instead of a `glibtop_interface_name' one. * include/glibtop/compat_10.h: New file. Contains some typedefs and #defines to keep compatibility until the big restructurement is completely done.
Diffstat (limited to 'include')
-rw-r--r--include/glibtop/Makefile.am2
-rw-r--r--include/glibtop/array.h16
-rw-r--r--include/glibtop/compat_10.h74
-rw-r--r--include/glibtop/interfaces.h27
-rw-r--r--include/glibtop/mountlist.h25
-rw-r--r--include/glibtop/proclist.h27
-rw-r--r--include/glibtop/procmap.h27
-rw-r--r--include/glibtop/union.h8
8 files changed, 116 insertions, 90 deletions
diff --git a/include/glibtop/Makefile.am b/include/glibtop/Makefile.am
index 28a79174..66de9b1b 100644
--- a/include/glibtop/Makefile.am
+++ b/include/glibtop/Makefile.am
@@ -8,4 +8,4 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.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 \
- netinfo.h interfaces.h limits.h
+ netinfo.h interfaces.h limits.h array.h compat_10.h
diff --git a/include/glibtop/array.h b/include/glibtop/array.h
index b6825dc5..bb5b4c6d 100644
--- a/include/glibtop/array.h
+++ b/include/glibtop/array.h
@@ -31,16 +31,20 @@
BEGIN_LIBGTOP_DECLS
+#define GLIBTOP_ARRAY_NUMBER 0
+#define GLIBTOP_ARRAY_SIZE 1
+#define GLIBTOP_ARRAY_TOTAL 2
+
+#define GLIBTOP_MAX_ARRAY 3
+
typedef struct _glibtop_array glibtop_array;
struct _glibtop_array
{
- u_int64_t number, /* Number of elements */
- size, /* Size of a single element */
- size; /* Total size of the array */
+ u_int64_t flags,
+ number, /* GLIBTOP_ARRAY_NUMBER */
+ size, /* GLIBTOP_ARRAY_SIZE */
+ total; /* GLIBTOP_ARRAY_TOTAL */
};
-GPtrArray * /* internal use only */
-_glibtop_list_to_array (glibtop *array, gpointer data);
-
#endif
diff --git a/include/glibtop/compat_10.h b/include/glibtop/compat_10.h
new file mode 100644
index 00000000..4dfaf1c4
--- /dev/null
+++ b/include/glibtop/compat_10.h
@@ -0,0 +1,74 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+
+/* $Id$ */
+
+/* Copyright (C) 1998-99 Martin Baulig
+ This file is part of LibGTop 1.0.
+
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ LibGTop is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ LibGTop is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LibGTop; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __GLIBTOP_COMPAT10_H__
+#define __GLIBTOP_COMPAT10_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+BEGIN_LIBGTOP_DECLS
+
+/* glibtop_proclist */
+
+#define GLIBTOP_PROCLIST_NUMBER GLIBTOP_ARRAY_NUMBER
+#define GLIBTOP_PROCLIST_SIZE GLIBTOP_ARRAY_SIZE
+#define GLIBTOP_PROCLIST_TOTAL GLIBTOP_ARRAY_TOTAL
+
+#define GLIBTOP_MAX_PROCLIST GLIBTOP_MAX_ARRAY
+
+typedef struct _glibtop_array glibtop_proclist;
+
+/* glibtop_mountlist */
+
+#define GLIBTOP_MOUNTLIST_NUMBER GLIBTOP_ARRAY_NUMBER
+#define GLIBTOP_MOUNTLIST_SIZE GLIBTOP_ARRAY_SIZE
+#define GLIBTOP_MOUNTLIST_TOTAL GLIBTOP_ARRAY_TOTAL
+
+#define GLIBTOP_MAX_MOUNTLIST GLIBTOP_MAX_ARRAY
+
+typedef struct _glibtop_array glibtop_mountlist;
+
+/* glibtop_proc_map */
+
+#define GLIBTOP_PROC_MAP_NUMBER GLIBTOP_ARRAY_NUMBER
+#define GLIBTOP_PROC_MAP_SIZE GLIBTOP_ARRAY_SIZE
+#define GLIBTOP_PROC_MAP_TOTAL GLIBTOP_ARRAY_TOTAL
+
+#define GLIBTOP_MAX_PROC_MAP GLIBTOP_MAX_ARRAY
+
+typedef struct _glibtop_array glibtop_proc_map;
+
+/* glibtop_interface_names */
+
+#define GLIBTOP_INTERFACE_NAMES_NUMBER GLIBTOP_ARRAY_NUMBER
+#define GLIBTOP_INTERFACE_NAMES_SIZE GLIBTOP_ARRAY_SIZE
+#define GLIBTOP_INTERFACE_NAMES_TOTAL GLIBTOP_ARRAY_TOTAL
+
+#define GLIBTOP_MAX_INTERFACE_NAMES GLIBTOP_MAX_ARRAY
+
+typedef struct _glibtop_array glibtop_interface_names;
+
+#endif
diff --git a/include/glibtop/interfaces.h b/include/glibtop/interfaces.h
index bea7ced7..adf6b995 100644
--- a/include/glibtop/interfaces.h
+++ b/include/glibtop/interfaces.h
@@ -29,6 +29,9 @@
#include <glibtop.h>
#include <glibtop/global.h>
+#include <glibtop/compat_10.h>
+#include <glibtop/array.h>
+
BEGIN_LIBGTOP_DECLS
#define GLIBTOP_INTERFACE_IF_FLAGS 0
@@ -43,14 +46,6 @@ BEGIN_LIBGTOP_DECLS
typedef struct _glibtop_interface glibtop_interface;
-#define GLIBTOP_INTERFACE_NAMES_NUMBER 0
-#define GLIBTOP_INTERFACE_NAMES_SIZE 1
-#define GLIBTOP_INTERFACE_NAMES_TOTAL 2
-
-#define GLIBTOP_MAX_INTERFACE_NAMES 3
-
-typedef struct _glibtop_interface_names glibtop_interface_names;
-
typedef enum _glibtop_interface_type glibtop_interface_type;
typedef enum _glibtop_transport glibtop_transport;
typedef enum _glibtop_protocol glibtop_protocol;
@@ -144,15 +139,7 @@ struct _glibtop_interface
char name [GLIBTOP_INTERFACE_LEN];
};
-struct _glibtop_interface_names
-{
- u_int64_t flags,
- number, /* GLIBTOP_INTERFACES_NUMBER */
- size, /* GLIBTOP_INTERFACES_SIZE */
- total; /* GLIBTOP_INTERFACES_TOTAL */
-};
-
-#define glibtop_get_interface_names(buf,interface,number,instance,strategy) glibtop_get_interface_names_l (glibtop_global_server, buf, interface, number, instance, strategy)
+#define glibtop_get_interface_names(array,interface,number,instance,strategy) glibtop_get_interface_names_l (glibtop_global_server, array, interface, number, instance, strategy)
#if GLIBTOP_SUID_INTERFACE_NAMES
#define glibtop_get_interface_names_r glibtop_get_interface_names_p
@@ -160,14 +147,14 @@ struct _glibtop_interface_names
#define glibtop_get_interface_names_r glibtop_get_interface_names_s
#endif
-glibtop_interface *glibtop_get_interface_names_l (glibtop *server, glibtop_interface_names *buf, u_int64_t interface, u_int64_t number, u_int64_t instance, u_int64_t strategy);
+glibtop_interface *glibtop_get_interface_names_l (glibtop *server, glibtop_array *array, u_int64_t interface, u_int64_t number, u_int64_t instance, u_int64_t strategy);
#if GLIBTOP_SUID_INTERFACE_NAMES
int glibtop_init_interface_names_p (glibtop *server);
-glibtop_interface *glibtop_get_interface_names_p (glibtop *server, glibtop_interface_names *buf, u_int64_t interface, u_int64_t number, u_int64_t instance, u_int64_t strategy);
+glibtop_interface *glibtop_get_interface_names_p (glibtop *server, glibtop_array *array, u_int64_t interface, u_int64_t number, u_int64_t instance, u_int64_t strategy);
#else
int glibtop_init_interface_names_s (glibtop *server);
-glibtop_interface *glibtop_get_interface_names_s (glibtop *server, glibtop_interface_names *buf, u_int64_t interface, u_int64_t number, u_int64_t instance, u_int64_t strategy);
+glibtop_interface *glibtop_get_interface_names_s (glibtop *server, glibtop_array *array, u_int64_t interface, u_int64_t number, u_int64_t instance, u_int64_t strategy);
#endif
#ifdef GLIBTOP_NAMES
diff --git a/include/glibtop/mountlist.h b/include/glibtop/mountlist.h
index 89a1dc70..897a2424 100644
--- a/include/glibtop/mountlist.h
+++ b/include/glibtop/mountlist.h
@@ -29,18 +29,13 @@
#include <glibtop.h>
#include <glibtop/global.h>
-BEGIN_LIBGTOP_DECLS
-
-#define GLIBTOP_MOUNTLIST_NUMBER 0
-#define GLIBTOP_MOUNTLIST_TOTAL 1
-#define GLIBTOP_MOUNTLIST_SIZE 2
+#include <glibtop/compat_10.h>
+#include <glibtop/array.h>
-#define GLIBTOP_MAX_MOUNTLIST 3
+BEGIN_LIBGTOP_DECLS
typedef struct _glibtop_mountentry glibtop_mountentry;
-typedef struct _glibtop_mountlist glibtop_mountlist;
-
struct _glibtop_mountentry
{
u_int64_t dev;
@@ -49,23 +44,15 @@ struct _glibtop_mountentry
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(array,all_fs) glibtop_get_mountlist_l(glibtop_global_server, array, all_fs)
#define glibtop_get_mountlist_r glibtop_get_mountlist_s
glibtop_mountentry *
-glibtop_get_mountlist_l (glibtop *server, glibtop_mountlist *buf, int all_fs);
+glibtop_get_mountlist_l (glibtop *server, glibtop_array *array, int all_fs);
glibtop_mountentry *
-glibtop_get_mountlist_s (glibtop *server, glibtop_mountlist *buf, int all_fs);
+glibtop_get_mountlist_s (glibtop *server, glibtop_array *array, int all_fs);
#ifdef GLIBTOP_NAMES
diff --git a/include/glibtop/proclist.h b/include/glibtop/proclist.h
index e0ce0f41..a0fe9172 100644
--- a/include/glibtop/proclist.h
+++ b/include/glibtop/proclist.h
@@ -29,13 +29,10 @@
#include <glibtop.h>
#include <glibtop/global.h>
-BEGIN_LIBGTOP_DECLS
-
-#define GLIBTOP_PROCLIST_NUMBER 0
-#define GLIBTOP_PROCLIST_TOTAL 1
-#define GLIBTOP_PROCLIST_SIZE 2
+#include <glibtop/compat_10.h>
+#include <glibtop/array.h>
-#define GLIBTOP_MAX_PROCLIST 3
+BEGIN_LIBGTOP_DECLS
/* You can use the folowing constants as the `which' member of
* glibtop_get_proclist () to specify which processes to fetch. */
@@ -55,17 +52,7 @@ BEGIN_LIBGTOP_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)
+#define glibtop_get_proclist(array,which,arg) glibtop_get_proclist_l(glibtop_global_server, array, which, arg)
#if GLIBTOP_SUID_PROCLIST
#define glibtop_get_proclist_r glibtop_get_proclist_p
@@ -74,20 +61,20 @@ struct _glibtop_proclist
#endif
unsigned *
-glibtop_get_proclist_l (glibtop *server, glibtop_proclist *buf,
+glibtop_get_proclist_l (glibtop *server, glibtop_array *array,
int64_t which, int64_t arg);
#if GLIBTOP_SUID_PROCLIST
int glibtop_init_proclist_p (glibtop *server);
unsigned *
-glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
+glibtop_get_proclist_p (glibtop *server, glibtop_array *array,
int64_t which, int64_t arg);
#else
int glibtop_init_proclist_s (glibtop *server);
unsigned *
-glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
+glibtop_get_proclist_s (glibtop *server, glibtop_array *array,
int64_t which, int64_t arg);
#endif
diff --git a/include/glibtop/procmap.h b/include/glibtop/procmap.h
index eceafea5..fbcda9d4 100644
--- a/include/glibtop/procmap.h
+++ b/include/glibtop/procmap.h
@@ -29,13 +29,10 @@
#include <glibtop.h>
#include <glibtop/global.h>
-BEGIN_LIBGTOP_DECLS
-
-#define GLIBTOP_PROC_MAP_NUMBER 0
-#define GLIBTOP_PROC_MAP_TOTAL 1
-#define GLIBTOP_PROC_MAP_SIZE 2
+#include <glibtop/compat_10.h>
+#include <glibtop/array.h>
-#define GLIBTOP_MAX_PROC_MAP 3
+BEGIN_LIBGTOP_DECLS
#define GLIBTOP_MAP_ENTRY_START 1
#define GLIBTOP_MAP_ENTRY_END 2
@@ -57,23 +54,13 @@ BEGIN_LIBGTOP_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];
};
-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)
+#define glibtop_get_proc_map(array,pid) glibtop_get_proc_map_l(glibtop_global_server, array, pid)
#if GLIBTOP_SUID_PROC_MAP
#define glibtop_get_proc_map_r glibtop_get_proc_map_p
@@ -82,18 +69,18 @@ struct _glibtop_proc_map
#endif
glibtop_map_entry *
-glibtop_get_proc_map_l (glibtop *server, glibtop_proc_map *buf, pid_t pid);
+glibtop_get_proc_map_l (glibtop *server, glibtop_array *array, pid_t pid);
#if GLIBTOP_SUID_PROC_MAP
int glibtop_init_proc_map_p (glibtop *server);
glibtop_map_entry *
-glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf, pid_t pid);
+glibtop_get_proc_map_p (glibtop *server, glibtop_array *array, pid_t pid);
#else
int glibtop_init_proc_map_s (glibtop *server);
glibtop_map_entry *
-glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid);
+glibtop_get_proc_map_s (glibtop *server, glibtop_array *array, pid_t pid);
#endif
#ifdef GLIBTOP_NAMES
diff --git a/include/glibtop/union.h b/include/glibtop/union.h
index e072b213..68abdaf1 100644
--- a/include/glibtop/union.h
+++ b/include/glibtop/union.h
@@ -68,7 +68,7 @@ union _glibtop_union
glibtop_shm_limits shm_limits;
glibtop_msg_limits msg_limits;
glibtop_sem_limits sem_limits;
- glibtop_proclist proclist;
+ glibtop_array proclist;
glibtop_proc_state proc_state;
glibtop_proc_uid proc_uid;
glibtop_proc_mem proc_mem;
@@ -77,10 +77,10 @@ union _glibtop_union
glibtop_proc_kernel proc_kernel;
glibtop_proc_segment proc_segment;
glibtop_proc_args proc_args;
- glibtop_proc_map proc_map;
- glibtop_mountlist mountlist;
+ glibtop_array proc_map;
+ glibtop_array mountlist;
glibtop_fsusage fsusage;
- glibtop_interface_names interface_names;
+ glibtop_array interface_names;
glibtop_netinfo netinfo;
glibtop_netload netload;
glibtop_ppp ppp;