Removed. (glibtop_get_proc_args_*): This now takes a `glibtop_array'
1999-12-12 Martin Baulig <martin@home-of-linux.org> * include/glibtop/procargs.h (glibtop_proc_args): Removed. (glibtop_get_proc_args_*): This now takes a `glibtop_array' parameter instead of a `glibtop_proc_args one and returns a `char **'.
This commit is contained in:
committed by
Martin Baulig
parent
da42214e86
commit
339e1f4557
@@ -1,3 +1,9 @@
|
|||||||
|
1999-12-12 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* include/glibtop/procargs.h (glibtop_proc_args): Removed.
|
||||||
|
(glibtop_get_proc_args_*): This now takes a `glibtop_array' parameter
|
||||||
|
instead of a `glibtop_proc_args one and returns a `char **'.
|
||||||
|
|
||||||
1999-12-13 Martin Baulig <martin@home-of-linux.org>
|
1999-12-13 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
* configure.in (LIBGTOP_LIBS): Put `-lgtop' after `-lgtop_common'.
|
* configure.in (LIBGTOP_LIBS): Put `-lgtop' after `-lgtop_common'.
|
||||||
|
@@ -14,7 +14,7 @@ retval|proc_time|long(start_time,rtime,utime,stime,cutime,cstime,timeout,it_real
|
|||||||
retval|proc_signal|ulong(signal[2],blocked[2],sigignore[2],sigcatch[2])|pid_t(pid)
|
retval|proc_signal|ulong(signal[2],blocked[2],sigignore[2],sigcatch[2])|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_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)
|
pointer(string)|proc_args|array|pid_t(pid)
|
||||||
array(glibtop_map_entry)|proc_map|array|pid_t(pid)
|
array(glibtop_map_entry)|proc_map|array|pid_t(pid)
|
||||||
array(glibtop_mountentry)|@mountlist|array|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)
|
||||||
|
@@ -51,6 +51,14 @@ typedef struct _glibtop_array glibtop_proclist;
|
|||||||
|
|
||||||
typedef struct _glibtop_array glibtop_mountlist;
|
typedef struct _glibtop_array glibtop_mountlist;
|
||||||
|
|
||||||
|
/* glibtop_proc_args */
|
||||||
|
|
||||||
|
#define GLIBTOP_PROC_ARGS_SIZE 0
|
||||||
|
|
||||||
|
#define GLIBTOP_MAX_PROC_ARGS 1
|
||||||
|
|
||||||
|
typedef struct _glibtop_array glibtop_proc_args;
|
||||||
|
|
||||||
/* glibtop_proc_map */
|
/* glibtop_proc_map */
|
||||||
|
|
||||||
#define GLIBTOP_PROC_MAP_NUMBER GLIBTOP_ARRAY_NUMBER
|
#define GLIBTOP_PROC_MAP_NUMBER GLIBTOP_ARRAY_NUMBER
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
BEGIN_LIBGTOP_DECLS
|
BEGIN_LIBGTOP_DECLS
|
||||||
|
|
||||||
#define glibtop_get_proc_args(proc_args) glibtop_get_proc_args_l(glibtop_global_server, pid)
|
#define glibtop_get_proc_args(array,pid) glibtop_get_proc_args_l(glibtop_global_server, array, pid)
|
||||||
|
|
||||||
#if GLIBTOP_SUID_PROC_ARGS
|
#if GLIBTOP_SUID_PROC_ARGS
|
||||||
#define glibtop_get_proc_args_r glibtop_get_proc_args_p
|
#define glibtop_get_proc_args_r glibtop_get_proc_args_p
|
||||||
|
@@ -76,7 +76,7 @@ union _glibtop_union
|
|||||||
glibtop_proc_signal proc_signal;
|
glibtop_proc_signal proc_signal;
|
||||||
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_array proc_args;
|
||||||
glibtop_array proc_map;
|
glibtop_array proc_map;
|
||||||
glibtop_array mountlist;
|
glibtop_array mountlist;
|
||||||
glibtop_fsusage fsusage;
|
glibtop_fsusage fsusage;
|
||||||
|
@@ -113,7 +113,7 @@ sub output {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($retval =~ /^(array|pointer)\((.*)\)$/) {
|
if ($retval =~ /^(array|pointer)\((.*)\)$/) {
|
||||||
$retval = "$2 *";
|
$retval = ($2 eq 'string') ? 'char **' : "$2 *";
|
||||||
}
|
}
|
||||||
|
|
||||||
$check_server_code = "\n";
|
$check_server_code = "\n";
|
||||||
|
@@ -164,7 +164,7 @@ handle_parent_connection (int s)
|
|||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
memcpy (&pid, parameter, sizeof (pid_t));
|
||||||
ptr = glibtop_get_proc_args_l (server,
|
ptr = glibtop_get_proc_args_l (server,
|
||||||
&resp->u.data.proc_args,
|
&resp->u.data.proc_args,
|
||||||
pid, 0);
|
pid);
|
||||||
do_output (s, resp, _offset_data (proc_args),
|
do_output (s, resp, _offset_data (proc_args),
|
||||||
ptr ? resp->u.data.proc_args.size+1 : 0, ptr,
|
ptr ? resp->u.data.proc_args.size+1 : 0, ptr,
|
||||||
(ptr != NULL) ? 0 : -1);
|
(ptr != NULL) ? 0 : -1);
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#include <glibtop_private.h>
|
#include <glibtop_private.h>
|
||||||
|
|
||||||
static const unsigned long _glibtop_sysdeps_proc_args =
|
static const unsigned long _glibtop_sysdeps_proc_args =
|
||||||
(1L << GLIBTOP_PROC_ARGS_SIZE);
|
(1L << GLIBTOP_ARRAY_NUMBER) + (1L << GLIBTOP_ARRAY_SIZE);
|
||||||
|
|
||||||
/* Init function. */
|
/* Init function. */
|
||||||
|
|
||||||
@@ -43,44 +43,46 @@ glibtop_init_proc_args_s (glibtop *server)
|
|||||||
|
|
||||||
/* Provides detailed information about a process. */
|
/* Provides detailed information about a process. */
|
||||||
|
|
||||||
char *
|
char **
|
||||||
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
|
glibtop_get_proc_args_s (glibtop *server, glibtop_array *array, pid_t pid)
|
||||||
pid_t pid, unsigned max_len)
|
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ];
|
char *ptr = NULL, *pos, **ptrlist;
|
||||||
char *retval = NULL, *ptr;
|
size_t count = 0, max_len, total;
|
||||||
size_t total;
|
int i, ret;
|
||||||
int ret;
|
|
||||||
|
|
||||||
memset (buf, 0, sizeof (glibtop_proc_args));
|
memset (array, 0, sizeof (glibtop_array));
|
||||||
|
|
||||||
if (max_len > BUFSIZ)
|
max_len = PAGE_SIZE;
|
||||||
retval = ptr = glibtop_malloc_r (server, max_len+1);
|
ptr = glibtop_malloc_r (server, max_len + 1);
|
||||||
else
|
|
||||||
ptr = buffer;
|
|
||||||
|
|
||||||
if (!max_len)
|
|
||||||
max_len = BUFSIZ;
|
|
||||||
|
|
||||||
ret = glibtop_get_proc_data_proc_args_s (server, pid, ptr, max_len);
|
ret = glibtop_get_proc_data_proc_args_s (server, pid, ptr, max_len);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (!retval) glibtop_free_r (server, retval);
|
glibtop_free_r (server, ptr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
total = ret;
|
total = ret;
|
||||||
|
ptr [total] = '\0';
|
||||||
|
|
||||||
if (retval) {
|
for (i = 0; i <= total; i++) {
|
||||||
retval = glibtop_realloc_r (server, retval, total+1);
|
if (ptr [i]) continue;
|
||||||
} else {
|
count++;
|
||||||
retval = glibtop_malloc_r (server, total+1);
|
|
||||||
memcpy (retval, buffer, total);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
retval [total] = 0;
|
ptrlist = glibtop_calloc_r (server, count+1, sizeof (char *));
|
||||||
|
|
||||||
buf->size = total;
|
for (i = 0, pos = ptr; i < count; i++) {
|
||||||
buf->flags = _glibtop_sysdeps_proc_args;
|
ptrlist [i] = glibtop_strdup_r (server, pos);
|
||||||
|
pos += strlen (pos) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
return retval;
|
ptrlist [count] = NULL;
|
||||||
|
|
||||||
|
glibtop_free_r (server, ptr);
|
||||||
|
|
||||||
|
array->number = count;
|
||||||
|
array->size = sizeof (char *);
|
||||||
|
array->flags = _glibtop_sysdeps_proc_args;
|
||||||
|
|
||||||
|
return ptrlist;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user