Implemented what Solaris has to offer cheaply. It sucks, but digging in
* procargs.c: Implemented what Solaris has to offer cheaply. It sucks, but digging in process address space would be too slow.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
1999-05-17 Drazen Kacar <dave@srce.hr>
|
||||||
|
|
||||||
|
* procargs.c: Implemented what Solaris has to offer cheaply.
|
||||||
|
It sucks, but digging in process address space would be
|
||||||
|
too slow.
|
||||||
|
|
||||||
1999-05-11 Drazen Kacar <dave@srce.hr>
|
1999-05-11 Drazen Kacar <dave@srce.hr>
|
||||||
|
|
||||||
* proctime.c: Return 0 usage times for scheaduler (PID 0).
|
* proctime.c: Return 0 usage times for scheaduler (PID 0).
|
||||||
|
@@ -26,7 +26,8 @@
|
|||||||
#include <glibtop/xmalloc.h>
|
#include <glibtop/xmalloc.h>
|
||||||
#include <glibtop/procargs.h>
|
#include <glibtop/procargs.h>
|
||||||
|
|
||||||
static const unsigned long _glibtop_sysdeps_proc_args = 0;
|
static const unsigned long _glibtop_sysdeps_proc_args =
|
||||||
|
(1L << GLIBTOP_PROC_ARGS_SIZE);
|
||||||
|
|
||||||
/* Init function. */
|
/* Init function. */
|
||||||
|
|
||||||
@@ -42,6 +43,30 @@ char *
|
|||||||
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
|
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
|
||||||
pid_t pid, unsigned max_len)
|
pid_t pid, unsigned max_len)
|
||||||
{
|
{
|
||||||
|
struct psinfo pinfo;
|
||||||
|
int len;
|
||||||
|
char *ret;
|
||||||
|
|
||||||
memset (buf, 0, sizeof (glibtop_proc_args));
|
memset (buf, 0, sizeof (glibtop_proc_args));
|
||||||
return NULL;
|
|
||||||
|
if(glibtop_get_proc_data_psinfo_s(server, &pinfo, pid))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
len = strlen(pinfo.pr_psargs);
|
||||||
|
if(max_len)
|
||||||
|
{
|
||||||
|
ret = glibtop_malloc_r(server, max_len + 1);
|
||||||
|
if(max_len < len)
|
||||||
|
len = max_len;
|
||||||
|
memcpy(ret, pinfo.pr_psargs, len);
|
||||||
|
ret[len] = 0;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
ret = glibtop_malloc_r(server, len + 1);
|
||||||
|
memcpy(ret, pinfo.pr_psargs, len);
|
||||||
|
ret[len] = 0;
|
||||||
|
|
||||||
|
buf->size = len;
|
||||||
|
buf->flags = _glibtop_sysdeps_proc_args;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user