Added new feature (proc_args) to get command line arguments:
typedef struct _glibtop_proc_args glibtop_proc_args; struct _glibtop_proc_args { u_int64_t flags, size; /* GLIBTOP_PROC_ARGS_SIZE */ }; Returns a string containing all command line arguments of the process, the `unsigned' parameter is the maximum length of this string; if it is zero then no limit will be set. extern const char *glibtop_get_proc_args_l __P((glibtop *, glibtop_proc_args *, pid_t, unsigned));
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
||||
1998-10-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
Added `Command Line Parameters' feature (proc_args).
|
||||
|
||||
* include/glibtop/proc_args.h: New file.
|
||||
* features.def: Added new feature `proc_args'.
|
||||
|
||||
* lib/lib.awk: New type `unsigned' for the features.def which
|
||||
is `unsigned'.
|
||||
|
||||
1998-10-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
Added PPP/ISDN support.
|
||||
|
@@ -1,3 +1,8 @@
|
||||
1998-10-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* first.c (glibtop_get_proc_args): Get command line arguments.
|
||||
* second.c: Likewise.
|
||||
|
||||
1998-10-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* first.c (glibtop_get_ppp): Get PPP/ISDN statistics.
|
||||
|
@@ -43,7 +43,7 @@ main (int argc, char *argv [])
|
||||
glibtop_union data;
|
||||
glibtop_sysdeps sysdeps;
|
||||
unsigned c, method, count, port, i, *ptr;
|
||||
char buffer [BUFSIZ];
|
||||
char buffer [BUFSIZ], *args;
|
||||
pid_t pid, ppid;
|
||||
|
||||
count = PROFILE_COUNT;
|
||||
@@ -324,6 +324,17 @@ main (int argc, char *argv [])
|
||||
|
||||
printf ("\n");
|
||||
|
||||
args = glibtop_get_proc_args (&data.proc_args, pid, 0);
|
||||
|
||||
printf ("Proc_Args PID %5d (0x%08lx): %lu - '%s'\n", (int) pid,
|
||||
(unsigned long) data.proc_args.flags,
|
||||
(unsigned long) data.proc_args.size,
|
||||
args);
|
||||
|
||||
glibtop_free (args);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
for (c = 0; c < PROFILE_COUNT; c++)
|
||||
glibtop_get_proc_state (&data.proc_state, ppid);
|
||||
|
||||
@@ -418,6 +429,17 @@ main (int argc, char *argv [])
|
||||
|
||||
printf ("\n");
|
||||
|
||||
args = glibtop_get_proc_args (&data.proc_args, ppid, 0);
|
||||
|
||||
printf ("Proc_Args PID %5d (0x%08lx): %lu - '%s'\n", (int) ppid,
|
||||
(unsigned long) data.proc_args.flags,
|
||||
(unsigned long) data.proc_args.size,
|
||||
args);
|
||||
|
||||
glibtop_free (args);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
for (c = 0; c < PROFILE_COUNT; c++)
|
||||
glibtop_get_proc_state (&data.proc_state, 1);
|
||||
|
||||
@@ -511,6 +533,17 @@ main (int argc, char *argv [])
|
||||
(unsigned long) data.proc_kernel.nwchan,
|
||||
data.proc_kernel.wchan);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
args = glibtop_get_proc_args (&data.proc_args, 1, 0);
|
||||
|
||||
printf ("Proc_Args PID %5d (0x%08lx): %lu - '%s'\n", 1,
|
||||
(unsigned long) data.proc_args.flags,
|
||||
(unsigned long) data.proc_args.size,
|
||||
args);
|
||||
|
||||
glibtop_free (args);
|
||||
|
||||
glibtop_close ();
|
||||
|
||||
exit (0);
|
||||
|
@@ -35,6 +35,7 @@ static void
|
||||
output (pid_t pid)
|
||||
{
|
||||
glibtop_union data;
|
||||
char *args;
|
||||
#if HAVE_LIBGTOP_SMP
|
||||
unsigned long total;
|
||||
double p_total, p_utime, p_stime;
|
||||
@@ -135,6 +136,17 @@ output (pid_t pid)
|
||||
|
||||
printf ("\n");
|
||||
|
||||
args = glibtop_get_proc_args (&data.proc_args, pid, 0);
|
||||
|
||||
printf ("Proc_Args PID %5d (0x%08lx): %lu - '%s'\n", (int) pid,
|
||||
(unsigned long) data.proc_args.flags,
|
||||
(unsigned long) data.proc_args.size,
|
||||
args);
|
||||
|
||||
glibtop_free (args);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
#if HAVE_LIBGTOP_SMP
|
||||
ncpu = glibtop_global_server->ncpu;
|
||||
|
||||
|
@@ -14,6 +14,7 @@ void|proc_time|long(start_time,rtime,utime,stime,cutime,cstime,timeout,it_real_v
|
||||
void|proc_signal|ulong(signal[2],blocked[2],sigignore[2],sigcatch[2])|pid_t(pid)
|
||||
void|proc_kernel|ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,nwchan):str(wchan)|pid_t(pid)
|
||||
void|proc_segment|ulong(text_rss,shlib_rss,data_rss,stack_rss,dirty_size,start_code,end_code,start_stack)|pid_t(pid)
|
||||
const char *|proc_args|ulong(size)|pid_t(pid):unsigned(max_len)
|
||||
glibtop_map_entry *|proc_map|ulong(number,size,total)|pid_t(pid)
|
||||
glibtop_mountentry *|@mountlist|ulong(number,size,total)|int(all_fs)
|
||||
void|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string|mount_dir
|
||||
|
@@ -7,4 +7,4 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.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
|
||||
inodedb.h sysinfo.h ppp.h procargs.h
|
||||
|
@@ -48,13 +48,14 @@ __BEGIN_DECLS
|
||||
#define GLIBTOP_CMND_PROC_SIGNAL 15
|
||||
#define GLIBTOP_CMND_PROC_KERNEL 16
|
||||
#define GLIBTOP_CMND_PROC_SEGMENT 17
|
||||
#define GLIBTOP_CMND_PROC_MAP 18
|
||||
#define GLIBTOP_CMND_PROC_ARGS 18
|
||||
#define GLIBTOP_CMND_PROC_MAP 19
|
||||
|
||||
#define GLIBTOP_CMND_MOUNTLIST 19
|
||||
#define GLIBTOP_CMND_FSUSAGE 20
|
||||
#define GLIBTOP_CMND_PPP 21
|
||||
#define GLIBTOP_CMND_MOUNTLIST 20
|
||||
#define GLIBTOP_CMND_FSUSAGE 21
|
||||
#define GLIBTOP_CMND_PPP 22
|
||||
|
||||
#define GLIBTOP_MAX_CMND 22
|
||||
#define GLIBTOP_MAX_CMND 23
|
||||
|
||||
#define _GLIBTOP_PARAM_SIZE 16
|
||||
|
||||
|
73
include/glibtop/procargs.h
Normal file
73
include/glibtop/procargs.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef __GLIBTOP_PROC_ARGS_H__
|
||||
#define __GLIBTOP_PROC_ARGS_H__
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/global.h>
|
||||
|
||||
__BEGIN_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 */
|
||||
};
|
||||
|
||||
#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
|
||||
#else
|
||||
#define glibtop_get_proc_args_r glibtop_get_proc_args_s
|
||||
#endif
|
||||
|
||||
extern const char *glibtop_get_proc_args_l __P((glibtop *, glibtop_proc_args *, pid_t, unsigned));
|
||||
|
||||
#if GLIBTOP_SUID_PROC_ARGS
|
||||
extern void glibtop_init_proc_args_p __P((glibtop *));
|
||||
extern const char *glibtop_get_proc_args_p __P((glibtop *, glibtop_proc_args *, pid_t, unsigned));
|
||||
#else
|
||||
extern void glibtop_init_proc_args_s __P((glibtop *));
|
||||
extern const char *glibtop_get_proc_args_s __P((glibtop *, glibtop_proc_args *, pid_t, unsigned));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
||||
extern const char *glibtop_names_proc_args [];
|
||||
extern const unsigned glibtop_types_proc_args [];
|
||||
extern const char *glibtop_labels_proc_args [];
|
||||
extern const char *glibtop_descriptions_proc_args [];
|
||||
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
@@ -43,12 +43,13 @@ __BEGIN_DECLS
|
||||
#define GLIBTOP_SYSDEPS_PROC_SIGNAL 14
|
||||
#define GLIBTOP_SYSDEPS_PROC_KERNEL 15
|
||||
#define GLIBTOP_SYSDEPS_PROC_SEGMENT 16
|
||||
#define GLIBTOP_SYSDEPS_PROC_MAP 17
|
||||
#define GLIBTOP_SYSDEPS_MOUNTLIST 18
|
||||
#define GLIBTOP_SYSDEPS_FSUSAGE 19
|
||||
#define GLIBTOP_SYSDEPS_PPP 20
|
||||
#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_PPP 21
|
||||
|
||||
#define GLIBTOP_MAX_SYSDEPS 21
|
||||
#define GLIBTOP_MAX_SYSDEPS 22
|
||||
|
||||
#define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1)
|
||||
|
||||
@@ -78,6 +79,7 @@ struct _glibtop_sysdeps
|
||||
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 */
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include <glibtop/procsignal.h>
|
||||
#include <glibtop/prockernel.h>
|
||||
#include <glibtop/procsegment.h>
|
||||
#include <glibtop/procargs.h>
|
||||
#include <glibtop/procmap.h>
|
||||
|
||||
#include <glibtop/mountlist.h>
|
||||
@@ -68,6 +69,7 @@ union _glibtop_union
|
||||
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;
|
||||
|
11
lib/lib.awk
11
lib/lib.awk
@@ -41,11 +41,12 @@ BEGIN {
|
||||
print "/* Library functions. */";
|
||||
print "";
|
||||
|
||||
convert["long"] = "int64_t";
|
||||
convert["ulong"] = "u_int64_t";
|
||||
convert["pid_t"] = "pid_t";
|
||||
convert["int"] = "int";
|
||||
convert["ushort"] = "unsigned short";
|
||||
convert["long"] = "int64_t";
|
||||
convert["ulong"] = "u_int64_t";
|
||||
convert["pid_t"] = "pid_t";
|
||||
convert["int"] = "int";
|
||||
convert["ushort"] = "unsigned short";
|
||||
convert["unsigned"] = "unsigned";
|
||||
}
|
||||
|
||||
function output(line) {
|
||||
|
@@ -90,6 +90,9 @@ glibtop_init_func_t _glibtop_init_hook_s [] = {
|
||||
#if !GLIBTOP_SUID_PROC_SEGMENT
|
||||
glibtop_init_proc_segment_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_PROC_ARGS
|
||||
glibtop_init_proc_args_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_PROC_MAP
|
||||
glibtop_init_proc_map_s,
|
||||
#endif
|
||||
|
@@ -29,6 +29,7 @@ handle_parent_connection (int s)
|
||||
glibtop_command _cmnd, *cmnd = &_cmnd;
|
||||
glibtop_mountentry *mount_list;
|
||||
char parameter [BUFSIZ];
|
||||
unsigned short device;
|
||||
int64_t *param_ptr;
|
||||
int all_fs;
|
||||
pid_t pid;
|
||||
@@ -193,7 +194,7 @@ handle_parent_connection (int s)
|
||||
do_output (s, resp, _offset_data (proc_segment), 0, NULL);
|
||||
break;
|
||||
case GLIBTOP_CMND_MOUNTLIST:
|
||||
memcpy (&all_fs, parameter, sizeof (all_fs));
|
||||
memcpy (&all_fs, parameter, sizeof (all_fs));
|
||||
mount_list = glibtop_get_mountlist_l
|
||||
(server, &resp->u.data.mountlist, all_fs);
|
||||
do_output (s, resp, _offset_data (mountlist),
|
||||
@@ -206,6 +207,12 @@ handle_parent_connection (int s)
|
||||
do_output (s, resp, _offset_data (fsusage),
|
||||
0, NULL);
|
||||
break;
|
||||
case GLIBTOP_CMND_PPP:
|
||||
memcpy (&device, parameter, sizeof (device));
|
||||
glibtop_get_ppp_l
|
||||
(server, &resp->u.data.ppp, device);
|
||||
do_output (s, resp, _offset_data (ppp), 0, NULL);
|
||||
break;
|
||||
default:
|
||||
glibtop_warn ("Parent received unknown command %u",
|
||||
cmnd->command);
|
||||
|
@@ -45,6 +45,7 @@ GLIBTOP_SUID_PROC_TIME +
|
||||
GLIBTOP_SUID_PROC_SIGNAL +
|
||||
GLIBTOP_SUID_PROC_KERNEL +
|
||||
GLIBTOP_SUID_PROC_SEGMENT +
|
||||
GLIBTOP_SUID_PROC_ARGS +
|
||||
GLIBTOP_SUID_PROC_MAP +
|
||||
GLIBTOP_SUID_PPP;
|
||||
|
||||
|
@@ -27,6 +27,8 @@ handle_slave_connection (int input, int output)
|
||||
glibtop *server = glibtop_global_server;
|
||||
int64_t *param_ptr;
|
||||
void *ptr;
|
||||
|
||||
unsigned short max_len;
|
||||
pid_t pid;
|
||||
|
||||
glibtop_response _resp, *resp = &_resp;
|
||||
@@ -77,6 +79,19 @@ handle_slave_connection (int input, int output)
|
||||
glibtop_free_r (server, ptr);
|
||||
break;
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_ARGS
|
||||
case GLIBTOP_CMND_PROC_ARGS:
|
||||
memcpy (&pid, parameter, sizeof (pid_t));
|
||||
memcpy (&max_len, parameter + sizeof (pid_t),
|
||||
sizeof (max_len));
|
||||
ptr = glibtop_get_proc_args_p (server,
|
||||
&resp->u.data.proc_args,
|
||||
pid, max_len);
|
||||
do_output (output, resp, _offset_data (proc_args),
|
||||
resp->u.data.proc_args.size, ptr);
|
||||
glibtop_free_r (server, ptr);
|
||||
break;
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_MAP
|
||||
case GLIBTOP_CMND_PROC_MAP:
|
||||
memcpy (&pid, parameter, sizeof (pid_t));
|
||||
@@ -101,7 +116,7 @@ handle_slave_command (glibtop_command *cmnd, glibtop_response *resp,
|
||||
const void *parameter)
|
||||
{
|
||||
glibtop *server = glibtop_global_server;
|
||||
unsigned short device;
|
||||
unsigned device;
|
||||
pid_t pid;
|
||||
|
||||
switch (cmnd->command) {
|
||||
|
@@ -71,6 +71,9 @@ glibtop_init_func_t _glibtop_init_hook_p [] = {
|
||||
#if GLIBTOP_SUID_PROC_SEGMENT
|
||||
glibtop_init_proc_segment_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_ARGS
|
||||
glibtop_init_proc_args_p,
|
||||
#endif
|
||||
#if GLIBTOP_SUID_PROC_MAP
|
||||
glibtop_init_proc_map_p,
|
||||
#endif
|
||||
|
@@ -1,3 +1,7 @@
|
||||
1998-10-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* procargs.c: New file to get command line arguments.
|
||||
|
||||
1998-10-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* ppp.c: New file to get PPP/ISDN statistics. Currently this only
|
||||
|
@@ -10,7 +10,7 @@ libgtop_sysdeps_suid_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c procmap.c ppp.c
|
||||
procsegment.c procargs.c procmap.c ppp.c
|
||||
|
||||
libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
|
@@ -40,6 +40,7 @@ __BEGIN_DECLS
|
||||
#define GLIBTOP_SUID_PROC_SIGNAL (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL)
|
||||
#define GLIBTOP_SUID_PROC_KERNEL (1 << GLIBTOP_SYSDEPS_PROC_KERNEL)
|
||||
#define GLIBTOP_SUID_PROC_SEGMENT (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT)
|
||||
#define GLIBTOP_SUID_PROC_ARGS (1 << GLIBTOP_SYSDEPS_PROC_ARGS)
|
||||
#define GLIBTOP_SUID_PROC_MAP (1 << GLIBTOP_SYSDEPS_PROC_MAP)
|
||||
#define GLIBTOP_SUID_PPP (1 << GLIBTOP_SYSDEPS_PPP)
|
||||
|
||||
|
91
sysdeps/freebsd/procargs.c
Normal file
91
sysdeps/freebsd/procargs.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
#include <glibtop/procargs.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
#include <kvm.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_args =
|
||||
(1 << GLIBTOP_PROC_ARGS_SIZE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_args_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
const char *
|
||||
glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf,
|
||||
pid_t pid, unsigned max_len)
|
||||
{
|
||||
struct kinfo_proc *pinfo;
|
||||
char *retval, **args, **ptr;
|
||||
unsigned size = 0;
|
||||
int count;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_ARGS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_args));
|
||||
|
||||
glibtop_suid_enter (server);
|
||||
|
||||
/* Get the process data */
|
||||
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
|
||||
if ((pinfo == NULL) || (count < 1))
|
||||
glibtop_error_io_r (server, "kvm_getprocs (proc_args)");
|
||||
|
||||
args = kvm_getargv (server->machine.kd, pinfo, max_len);
|
||||
if (args == NULL) {
|
||||
glibtop_warn_io_r (server, "kvm_getargv");
|
||||
glibtop_suid_leave (server);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
glibtop_suid_leave (server);
|
||||
|
||||
for (ptr = args; *ptr; ptr++)
|
||||
size += strlen (*ptr)+1;
|
||||
|
||||
buf->size = size+2;
|
||||
|
||||
retval = glibtop_malloc_r (server, buf->size);
|
||||
memset (retval, 0, buf->size);
|
||||
|
||||
for (ptr = args; *ptr; ptr++) {
|
||||
if (*retval) strcat (retval, " ");
|
||||
strcat (retval, *ptr);
|
||||
}
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_args;
|
||||
|
||||
return retval;
|
||||
}
|
@@ -1,3 +1,7 @@
|
||||
1998-10-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* procargs.c: New file. Currently empty.
|
||||
|
||||
1998-10-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* ppp.c: New file. Currently empty.
|
||||
|
@@ -8,7 +8,8 @@ libgtop_sysdeps_la_SOURCES = open.c close.c kernel.s cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c siglist.c procmap.c ppp.c
|
||||
procsegment.c siglist.c procargs.c procmap.c \
|
||||
ppp.c
|
||||
|
||||
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
|
45
sysdeps/kernel/procargs.c
Normal file
45
sysdeps/kernel/procargs.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
#include <glibtop/procargs.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_args = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_args_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
const char *
|
||||
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
|
||||
pid_t pid, unsigned max_len)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_proc_args));
|
||||
return NULL;
|
||||
}
|
@@ -1,3 +1,7 @@
|
||||
1998-10-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* procargs.c: New file. Currently empty.
|
||||
|
||||
1998-10-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* ppp.c: New file. Currently empty.
|
||||
|
@@ -8,8 +8,8 @@ libgtop_sysdeps_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c procmap.c siglist.c sysinfo.c \
|
||||
ppp.c
|
||||
procsegment.c procargs.c procmap.c siglist.c \
|
||||
sysinfo.c ppp.c
|
||||
libgtop_sysdeps_la_LIBADD = @GLIB_LIBS@
|
||||
|
||||
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
45
sysdeps/linux/procargs.c
Normal file
45
sysdeps/linux/procargs.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
#include <glibtop/procargs.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_args = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_args_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
const char *
|
||||
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
|
||||
pid_t pid, unsigned max_len)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_proc_args));
|
||||
return NULL;
|
||||
}
|
@@ -9,7 +9,7 @@ libgtop_names_la_SOURCES = cpu.c mem.c swap.c uptime.c loadavg.c \
|
||||
proclist.c sysdeps.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c \
|
||||
prockernel.c procsegment.c fsusage.c \
|
||||
mountlist.c procmap.c ppp.c
|
||||
mountlist.c procargs.c procmap.c ppp.c
|
||||
|
||||
libgtop_names_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
|
42
sysdeps/names/procargs.c
Normal file
42
sysdeps/names/procargs.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <glibtop/procargs.h>
|
||||
|
||||
const char *glibtop_names_proc_args [GLIBTOP_MAX_PROC_ARGS] =
|
||||
{
|
||||
"size"
|
||||
};
|
||||
|
||||
const unsigned glibtop_types_proc_args [GLIBTOP_MAX_PROC_ARGS] =
|
||||
{
|
||||
GLIBTOP_TYPE_ULONG
|
||||
};
|
||||
|
||||
const char *glibtop_labels_proc_args [GLIBTOP_MAX_PROC_ARGS] =
|
||||
{
|
||||
N_("Size")
|
||||
};
|
||||
|
||||
const char *glibtop_descriptions_proc_args [GLIBTOP_MAX_PROC_ARGS] =
|
||||
{
|
||||
N_("Length in bytes of the returned string.")
|
||||
};
|
@@ -1,3 +1,7 @@
|
||||
1998-10-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* procargs.c: New file.
|
||||
|
||||
1998-10-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* ppp.c: New file.
|
||||
|
@@ -8,7 +8,7 @@ libgtop_sysdeps_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c procmap.c ppp.c
|
||||
procsegment.c procargs.c procmap.c ppp.c
|
||||
|
||||
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
|
45
sysdeps/stub/procargs.c
Normal file
45
sysdeps/stub/procargs.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
#include <glibtop/procargs.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_args = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_args_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
const char *
|
||||
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
|
||||
pid_t pid, unsigned max_len)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_proc_args));
|
||||
return NULL;
|
||||
}
|
@@ -1,3 +1,8 @@
|
||||
1998-10-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* procargs.c: New file.
|
||||
* procmap.c: New file.
|
||||
|
||||
1998-10-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* ChangeLog: New file.
|
||||
|
@@ -12,7 +12,7 @@ libgtop_sysdeps_suid_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \
|
||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c proclist.c procstate.c procuid.c \
|
||||
proctime.c procmem.c procsignal.c prockernel.c \
|
||||
procsegment.c ppp.c
|
||||
procsegment.c procargs.c procmap.c ppp.c
|
||||
|
||||
libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
|
45
sysdeps/stub_suid/procargs.c
Normal file
45
sysdeps/stub_suid/procargs.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
#include <glibtop/procargs.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_args = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_args_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
const char *
|
||||
glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf,
|
||||
pid_t pid, unsigned max_len)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_proc_args));
|
||||
return NULL;
|
||||
}
|
44
sysdeps/stub_suid/procmap.c
Normal file
44
sysdeps/stub_suid/procmap.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
#include <glibtop/procmap.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_map = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_map_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
glibtop_map_entry *
|
||||
glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf, pid_t pid)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_proc_map));
|
||||
return NULL;
|
||||
}
|
Reference in New Issue
Block a user