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.
This commit is contained in:
Martin Baulig
1999-12-12 14:20:17 +00:00
committed by Martin Baulig
parent a33f4df47e
commit 881c2a2086
15 changed files with 186 additions and 173 deletions

View File

@@ -1,3 +1,37 @@
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.
1999-12-12 Martin Baulig <martin@home-of-linux.org> 1999-12-12 Martin Baulig <martin@home-of-linux.org>
* include/glibtop/array.h: New file. * include/glibtop/array.h: New file.

View File

@@ -6,7 +6,7 @@ retval|loadavg|double(loadavg[3]):ulong(nr_running,nr_tasks,last_pid)
retval|shm_limits|ulong(shmmax,shmmin,shmmni,shmseg,shmall) retval|shm_limits|ulong(shmmax,shmmin,shmmni,shmseg,shmall)
retval|msg_limits|ulong(msgpool,msgmap,msgmax,msgmnb,msgmni,msgssz,msgtql) retval|msg_limits|ulong(msgpool,msgmap,msgmax,msgmnb,msgmni,msgssz,msgtql)
retval|sem_limits|ulong(semmap,semmni,semmns,semmnu,semmsl,semopm,semume,semusz,semvmx,semaem) retval|sem_limits|ulong(semmap,semmni,semmns,semmnu,semmsl,semopm,semume,semusz,semvmx,semaem)
pointer(unsigned)|proclist|ulong(number,size,total)|long(which,arg) pointer(unsigned)|proclist|array|long(which,arg)
retval|proc_state|string(cmd):unsigned(state):ulong(uid,gid,ruid,rgid,has_cpu,processor,last_processor)|pid_t(pid) retval|proc_state|string(cmd):unsigned(state):ulong(uid,gid,ruid,rgid,has_cpu,processor,last_processor)|pid_t(pid)
retval|proc_uid|long(uid,euid,gid,egid,suid,sgid,fsuid,fsgid,pid,ppid,pgrp,session,tty,tpgid,priority,nice,ngroups,groups[GLIBTOP_MAX_GROUPS])|pid_t(pid) retval|proc_uid|long(uid,euid,gid,egid,suid,sgid,fsuid,fsgid,pid,ppid,pgrp,session,tty,tpgid,priority,nice,ngroups,groups[GLIBTOP_MAX_GROUPS])|pid_t(pid)
retval|proc_mem|long(size,vsize,resident,share,rss,rss_rlim)|pid_t(pid) retval|proc_mem|long(size,vsize,resident,share,rss,rss_rlim)|pid_t(pid)
@@ -15,10 +15,10 @@ retval|proc_signal|ulong(signal[2],blocked[2],sigignore[2],sigcatch[2])|pid_t(pi
retval|proc_kernel|ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,nwchan):string(wchan)|pid_t(pid) retval|proc_kernel|ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,nwchan):string(wchan)|pid_t(pid)
retval|proc_segment|ulong(text_rss,shlib_rss,data_rss,stack_rss,dirty_size,start_code,end_code,start_data,end_data,start_brk,end_brk,start_stack,start_mmap,arg_start,arg_end,env_start,env_end)|pid_t(pid) retval|proc_segment|ulong(text_rss,shlib_rss,data_rss,stack_rss,dirty_size,start_code,end_code,start_data,end_data,start_brk,end_brk,start_stack,start_mmap,arg_start,arg_end,env_start,env_end)|pid_t(pid)
char *|proc_args|ulong(size)|pid_t(pid):unsigned(max_len) char *|proc_args|ulong(size)|pid_t(pid):unsigned(max_len)
array(glibtop_map_entry)|proc_map|ulong(number,size,total)|pid_t(pid) array(glibtop_map_entry)|proc_map|array|pid_t(pid)
array(glibtop_mountentry)|@mountlist|ulong(number,size,total)|int(all_fs) array(glibtop_mountentry)|@mountlist|array|int(all_fs)
retval|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string(mount_dir) retval|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string(mount_dir)
array(glibtop_interface)|interface_names|ulong(number,size,total)|ulong(interface,number,instance,strategy) array(glibtop_interface)|interface_names|array|ulong(interface,number,instance,strategy)
retval|netinfo|ulong(if_flags,transport,mtu,subnet,address)|string(interface):unsigned(transport) retval|netinfo|ulong(if_flags,transport,mtu,subnet,address)|string(interface):unsigned(transport)
retval|netload|ulong(packets_in,packets_out,packets_total,bytes_in,bytes_out,bytes_total,errors_in,errors_out,errors_total,collisions)|string(interface):unsigned(transport,protocol) retval|netload|ulong(packets_in,packets_out,packets_total,bytes_in,bytes_out,bytes_total,errors_in,errors_out,errors_total,collisions)|string(interface):unsigned(transport,protocol)
retval|ppp|ulong(state,bytes_in,bytes_out)|ushort(device) retval|ppp|ulong(state,bytes_in,bytes_out)|ushort(device)

View File

@@ -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 \ procsignal.h read_data.h union.h types.h gnuserv.h \
parameter.h mountlist.h fsusage.h procmap.h signal.h \ parameter.h mountlist.h fsusage.h procmap.h signal.h \
inodedb.h sysinfo.h ppp.h procargs.h netload.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

View File

@@ -31,16 +31,20 @@
BEGIN_LIBGTOP_DECLS 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; typedef struct _glibtop_array glibtop_array;
struct _glibtop_array struct _glibtop_array
{ {
u_int64_t number, /* Number of elements */ u_int64_t flags,
size, /* Size of a single element */ number, /* GLIBTOP_ARRAY_NUMBER */
size; /* Total size of the array */ size, /* GLIBTOP_ARRAY_SIZE */
total; /* GLIBTOP_ARRAY_TOTAL */
}; };
GPtrArray * /* internal use only */
_glibtop_list_to_array (glibtop *array, gpointer data);
#endif #endif

View File

@@ -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

View File

@@ -29,6 +29,9 @@
#include <glibtop.h> #include <glibtop.h>
#include <glibtop/global.h> #include <glibtop/global.h>
#include <glibtop/compat_10.h>
#include <glibtop/array.h>
BEGIN_LIBGTOP_DECLS BEGIN_LIBGTOP_DECLS
#define GLIBTOP_INTERFACE_IF_FLAGS 0 #define GLIBTOP_INTERFACE_IF_FLAGS 0
@@ -43,14 +46,6 @@ BEGIN_LIBGTOP_DECLS
typedef struct _glibtop_interface glibtop_interface; 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_interface_type glibtop_interface_type;
typedef enum _glibtop_transport glibtop_transport; typedef enum _glibtop_transport glibtop_transport;
typedef enum _glibtop_protocol glibtop_protocol; typedef enum _glibtop_protocol glibtop_protocol;
@@ -144,15 +139,7 @@ struct _glibtop_interface
char name [GLIBTOP_INTERFACE_LEN]; char name [GLIBTOP_INTERFACE_LEN];
}; };
struct _glibtop_interface_names #define glibtop_get_interface_names(array,interface,number,instance,strategy) glibtop_get_interface_names_l (glibtop_global_server, array, interface, number, instance, strategy)
{
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)
#if GLIBTOP_SUID_INTERFACE_NAMES #if GLIBTOP_SUID_INTERFACE_NAMES
#define glibtop_get_interface_names_r glibtop_get_interface_names_p #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 #define glibtop_get_interface_names_r glibtop_get_interface_names_s
#endif #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 #if GLIBTOP_SUID_INTERFACE_NAMES
int glibtop_init_interface_names_p (glibtop *server); 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 #else
int glibtop_init_interface_names_s (glibtop *server); 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 #endif
#ifdef GLIBTOP_NAMES #ifdef GLIBTOP_NAMES

View File

@@ -29,18 +29,13 @@
#include <glibtop.h> #include <glibtop.h>
#include <glibtop/global.h> #include <glibtop/global.h>
#include <glibtop/compat_10.h>
#include <glibtop/array.h>
BEGIN_LIBGTOP_DECLS BEGIN_LIBGTOP_DECLS
#define GLIBTOP_MOUNTLIST_NUMBER 0
#define GLIBTOP_MOUNTLIST_TOTAL 1
#define GLIBTOP_MOUNTLIST_SIZE 2
#define GLIBTOP_MAX_MOUNTLIST 3
typedef struct _glibtop_mountentry glibtop_mountentry; typedef struct _glibtop_mountentry glibtop_mountentry;
typedef struct _glibtop_mountlist glibtop_mountlist;
struct _glibtop_mountentry struct _glibtop_mountentry
{ {
u_int64_t dev; u_int64_t dev;
@@ -49,23 +44,15 @@ struct _glibtop_mountentry
char type [GLIBTOP_MOUNTENTRY_LEN+1]; char type [GLIBTOP_MOUNTENTRY_LEN+1];
}; };
struct _glibtop_mountlist #define glibtop_get_mountlist(array,all_fs) glibtop_get_mountlist_l(glibtop_global_server, array, all_fs)
{
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 #define glibtop_get_mountlist_r glibtop_get_mountlist_s
glibtop_mountentry * 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_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 #ifdef GLIBTOP_NAMES

View File

@@ -29,14 +29,11 @@
#include <glibtop.h> #include <glibtop.h>
#include <glibtop/global.h> #include <glibtop/global.h>
#include <glibtop/compat_10.h>
#include <glibtop/array.h>
BEGIN_LIBGTOP_DECLS BEGIN_LIBGTOP_DECLS
#define GLIBTOP_PROCLIST_NUMBER 0
#define GLIBTOP_PROCLIST_TOTAL 1
#define GLIBTOP_PROCLIST_SIZE 2
#define GLIBTOP_MAX_PROCLIST 3
/* You can use the folowing constants as the `which' member of /* You can use the folowing constants as the `which' member of
* glibtop_get_proclist () to specify which processes to fetch. */ * glibtop_get_proclist () to specify which processes to fetch. */
@@ -55,17 +52,7 @@ BEGIN_LIBGTOP_DECLS
#define GLIBTOP_EXCLUDE_SYSTEM 0x2000 #define GLIBTOP_EXCLUDE_SYSTEM 0x2000
#define GLIBTOP_EXCLUDE_NOTTY 0x4000 #define GLIBTOP_EXCLUDE_NOTTY 0x4000
typedef struct _glibtop_proclist glibtop_proclist; #define glibtop_get_proclist(array,which,arg) glibtop_get_proclist_l(glibtop_global_server, array, which, arg)
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 #if GLIBTOP_SUID_PROCLIST
#define glibtop_get_proclist_r glibtop_get_proclist_p #define glibtop_get_proclist_r glibtop_get_proclist_p
@@ -74,20 +61,20 @@ struct _glibtop_proclist
#endif #endif
unsigned * 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); int64_t which, int64_t arg);
#if GLIBTOP_SUID_PROCLIST #if GLIBTOP_SUID_PROCLIST
int glibtop_init_proclist_p (glibtop *server); int glibtop_init_proclist_p (glibtop *server);
unsigned * 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); int64_t which, int64_t arg);
#else #else
int glibtop_init_proclist_s (glibtop *server); int glibtop_init_proclist_s (glibtop *server);
unsigned * 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); int64_t which, int64_t arg);
#endif #endif

View File

@@ -29,14 +29,11 @@
#include <glibtop.h> #include <glibtop.h>
#include <glibtop/global.h> #include <glibtop/global.h>
#include <glibtop/compat_10.h>
#include <glibtop/array.h>
BEGIN_LIBGTOP_DECLS BEGIN_LIBGTOP_DECLS
#define GLIBTOP_PROC_MAP_NUMBER 0
#define GLIBTOP_PROC_MAP_TOTAL 1
#define GLIBTOP_PROC_MAP_SIZE 2
#define GLIBTOP_MAX_PROC_MAP 3
#define GLIBTOP_MAP_ENTRY_START 1 #define GLIBTOP_MAP_ENTRY_START 1
#define GLIBTOP_MAP_ENTRY_END 2 #define GLIBTOP_MAP_ENTRY_END 2
#define GLIBTOP_MAP_ENTRY_OFFSET 3 #define GLIBTOP_MAP_ENTRY_OFFSET 3
@@ -57,23 +54,13 @@ BEGIN_LIBGTOP_DECLS
typedef struct _glibtop_map_entry glibtop_map_entry; typedef struct _glibtop_map_entry glibtop_map_entry;
typedef struct _glibtop_proc_map glibtop_proc_map;
struct _glibtop_map_entry struct _glibtop_map_entry
{ {
u_int64_t flags, start, end, offset, perm, inode, device; u_int64_t flags, start, end, offset, perm, inode, device;
char filename [GLIBTOP_MAP_FILENAME_LEN+1]; char filename [GLIBTOP_MAP_FILENAME_LEN+1];
}; };
struct _glibtop_proc_map #define glibtop_get_proc_map(array,pid) glibtop_get_proc_map_l(glibtop_global_server, array, pid)
{
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 #if GLIBTOP_SUID_PROC_MAP
#define glibtop_get_proc_map_r glibtop_get_proc_map_p #define glibtop_get_proc_map_r glibtop_get_proc_map_p
@@ -82,18 +69,18 @@ struct _glibtop_proc_map
#endif #endif
glibtop_map_entry * 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 #if GLIBTOP_SUID_PROC_MAP
int glibtop_init_proc_map_p (glibtop *server); int glibtop_init_proc_map_p (glibtop *server);
glibtop_map_entry * 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 #else
int glibtop_init_proc_map_s (glibtop *server); int glibtop_init_proc_map_s (glibtop *server);
glibtop_map_entry * 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 #endif
#ifdef GLIBTOP_NAMES #ifdef GLIBTOP_NAMES

View File

@@ -68,7 +68,7 @@ union _glibtop_union
glibtop_shm_limits shm_limits; glibtop_shm_limits shm_limits;
glibtop_msg_limits msg_limits; glibtop_msg_limits msg_limits;
glibtop_sem_limits sem_limits; glibtop_sem_limits sem_limits;
glibtop_proclist proclist; glibtop_array proclist;
glibtop_proc_state proc_state; glibtop_proc_state proc_state;
glibtop_proc_uid proc_uid; glibtop_proc_uid proc_uid;
glibtop_proc_mem proc_mem; glibtop_proc_mem proc_mem;
@@ -77,10 +77,10 @@ union _glibtop_union
glibtop_proc_kernel proc_kernel; glibtop_proc_kernel proc_kernel;
glibtop_proc_segment proc_segment; glibtop_proc_segment proc_segment;
glibtop_proc_args proc_args; glibtop_proc_args proc_args;
glibtop_proc_map proc_map; glibtop_array proc_map;
glibtop_mountlist mountlist; glibtop_array mountlist;
glibtop_fsusage fsusage; glibtop_fsusage fsusage;
glibtop_interface_names interface_names; glibtop_array interface_names;
glibtop_netinfo netinfo; glibtop_netinfo netinfo;
glibtop_netload netload; glibtop_netload netload;
glibtop_ppp ppp; glibtop_ppp ppp;

View File

@@ -211,6 +211,12 @@ sub output {
if ($line_fields[3] eq '') { if ($line_fields[3] eq '') {
$sysdeps_code .= sprintf ("\t%sglibtop_get_%s_s (server%s);\n", $sysdeps_code .= sprintf ("\t%sglibtop_get_%s_s (server%s);\n",
$prefix, $feature, $call_param); $prefix, $feature, $call_param);
} elsif ($line_fields[3] eq 'array') {
$sysdeps_code .= sprintf ("\t%sglibtop_get_%s_s (server, array%s);\n",
$prefix, $feature, $call_param);
} elsif ($line_fields[3] =~ /^array/) {
$sysdeps_code .= sprintf ("\t%sglibtop_get_%s_s (server, array, buf%s);\n",
$prefix, $feature, $call_param);
} else { } else {
$sysdeps_code .= sprintf ("\t%sglibtop_get_%s_s (server, buf%s);\n", $sysdeps_code .= sprintf ("\t%sglibtop_get_%s_s (server, buf%s);\n",
$prefix, $feature, $call_param); $prefix, $feature, $call_param);
@@ -243,6 +249,9 @@ sub output {
"_LIBGTOP_SEND_len", "_LIBGTOP_SEND_ptr"); "_LIBGTOP_SEND_len", "_LIBGTOP_SEND_ptr");
if ($line_fields[3] eq '') { if ($line_fields[3] eq '') {
$call_code .= sprintf ("\t\t\t%s0, NULL,\n", $call_prefix_space); $call_code .= sprintf ("\t\t\t%s0, NULL,\n", $call_prefix_space);
} elsif ($line_fields[3] eq 'array') {
$call_code .= sprintf ("\t\t\t%ssizeof (glibtop_array), array,\n",
$call_prefix_space);
} else { } else {
$call_code .= sprintf ("\t\t\t%ssizeof (glibtop_%s), buf,\n", $call_code .= sprintf ("\t\t\t%ssizeof (glibtop_%s), buf,\n",
$call_prefix_space, $feature); $call_prefix_space, $feature);
@@ -263,7 +272,7 @@ sub output {
$check_code = "check_missing:\n"; $check_code = "check_missing:\n";
$check_code .= "\t/* Make sure that all required fields are present. */\n"; $check_code .= "\t/* Make sure that all required fields are present. */\n";
if (!($line_fields[3] eq '')) { if (!(($line_fields[3] eq '') or ($line_fields[3] eq 'array'))) {
$check_code .= "\tif (buf->flags & server->required." . $feature . ")\n"; $check_code .= "\tif (buf->flags & server->required." . $feature . ")\n";
$check_code .= "\t\t_glibtop_missing_feature (server, \"" . $feature . $check_code .= "\t\t_glibtop_missing_feature (server, \"" . $feature .
"\", buf->flags,\n\t\t\t\t\t &server->required." . $feature . ");\n"; "\", buf->flags,\n\t\t\t\t\t &server->required." . $feature . ");\n";
@@ -284,6 +293,12 @@ sub output {
if ($line_fields[3] eq '') { if ($line_fields[3] eq '') {
$func_decl .= sprintf ("glibtop_get_%s_l (glibtop *server%s)\n", $func_decl .= sprintf ("glibtop_get_%s_l (glibtop *server%s)\n",
$feature, $param_decl); $feature, $param_decl);
} elsif ($line_fields[3] eq 'array') {
$func_decl .= sprintf ("glibtop_get_%s_l (glibtop *server, glibtop_array *array%s)\n",
$feature, $param_decl);
} elsif ($line_fields[3] =~ /^array/) {
$func_decl .= sprintf ("glibtop_get_%s_l (glibtop *server, glibtop_array *array, %s *buf%s)\n",
$feature, 'glibtop_'.$feature, $param_decl);
} else { } else {
$func_decl .= sprintf ("glibtop_get_%s_l (glibtop *server, %s *buf%s)\n", $func_decl .= sprintf ("glibtop_get_%s_l (glibtop *server, %s *buf%s)\n",
$feature, 'glibtop_'.$feature, $param_decl); $feature, 'glibtop_'.$feature, $param_decl);

View File

@@ -25,24 +25,10 @@
#include <glibtop/interfaces.h> #include <glibtop/interfaces.h>
const char *glibtop_names_interface_names[GLIBTOP_MAX_INTERFACE_NAMES] = const char *glibtop_names_interface_names[] = { };
{
"number", "size"
};
const unsigned glibtop_types_interface_names[GLIBTOP_MAX_INTERFACE_NAMES] = const unsigned glibtop_types_interface_names[] = { };
{
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
};
const char *glibtop_labels_interface_names[GLIBTOP_MAX_INTERFACE_NAMES] = const char *glibtop_labels_interface_names[] = { };
{
N_ ("Number"),
N_ ("Size")
};
const char *glibtop_descriptions_interface_names[GLIBTOP_MAX_INTERFACE_NAMES] = const char *glibtop_descriptions_interface_names[] = { };
{
N_ ("Number"),
N_ ("Size")
};

View File

@@ -25,26 +25,10 @@
#include <glibtop/mountlist.h> #include <glibtop/mountlist.h>
const char *glibtop_names_mountlist[GLIBTOP_MAX_MOUNTLIST] = const char *glibtop_names_mountlist[] = { };
{
"number", "total", "size"
};
const unsigned glibtop_types_mountlist[GLIBTOP_MAX_MOUNTLIST] = const unsigned glibtop_types_mountlist[] = { };
{
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
};
const char *glibtop_labels_mountlist[GLIBTOP_MAX_MOUNTLIST] = const char *glibtop_labels_mountlist[] = { };
{
N_ ("Number of list elements"),
N_ ("Total size of list"),
N_ ("Size of a single list element")
};
const char *glibtop_descriptions_mountlist[GLIBTOP_MAX_MOUNTLIST] = const char *glibtop_descriptions_mountlist[] = { };
{
N_ ("Number of list elements"),
N_ ("Total size of list"),
N_ ("Size of a single list element")
};

View File

@@ -25,26 +25,10 @@
#include <glibtop/proclist.h> #include <glibtop/proclist.h>
const char *glibtop_names_proclist[GLIBTOP_MAX_PROCLIST] = const char *glibtop_names_proclist[] = { };
{
"number", "total", "size"
};
const unsigned glibtop_types_proclist[GLIBTOP_MAX_PROCLIST] = const unsigned glibtop_types_proclist[] = { };
{
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
};
const char *glibtop_labels_proclist[GLIBTOP_MAX_PROCLIST] = const char *glibtop_labels_proclist[] = { };
{
N_ ("Number of list elements"),
N_ ("Total size of list"),
N_ ("Size of a single list element")
};
const char *glibtop_descriptions_proclist[GLIBTOP_MAX_PROCLIST] = const char *glibtop_descriptions_proclist[] = { };
{
N_ ("Number of list elements"),
N_ ("Total size of list"),
N_ ("Size of a single list element")
};

View File

@@ -25,26 +25,10 @@
#include <glibtop/procmap.h> #include <glibtop/procmap.h>
const char *glibtop_names_proc_map[GLIBTOP_MAX_PROC_MAP] = const char *glibtop_names_proc_map[] = { };
{
"number", "total", "size"
};
const unsigned glibtop_types_proc_map[GLIBTOP_MAX_PROC_MAP] = const unsigned glibtop_types_proc_map[] = { };
{
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
};
const char *glibtop_labels_proc_map[GLIBTOP_MAX_PROC_MAP] = const char *glibtop_labels_proc_map[] = { };
{
N_ ("Number of list elements"),
N_ ("Total size of list"),
N_ ("Size of a single list element")
};
const char *glibtop_descriptions_proc_map[GLIBTOP_MAX_PROC_MAP] = const char *glibtop_descriptions_proc_map[] = { };
{
N_ ("Number of list elements"),
N_ ("Total size of list"),
N_ ("Size of a single list element")
};