Added new glibtop_get_proc_argv*() functions. These are more easier to use

* include/glibtop/procargs.h: Added new glibtop_get_proc_argv*() functions.
	These are more easier to use than glibtop_get_proc_args*(). They return
	a NULL-terminated array of string (like main's char* argv[]).
This commit is contained in:
Benoît Dejean
2004-07-07 20:22:58 +00:00
parent de7fd9e85b
commit a8593d5b84
2 changed files with 62 additions and 16 deletions

View File

@@ -1,3 +1,9 @@
2004-07-07 Benoît Dejean <tazforever@dlfp.org>
* include/glibtop/procargs.h: Added new glibtop_get_proc_argv*() functions.
These are more easier to use than glibtop_get_proc_args*(). They return
a NULL-terminated array of string (like main's char* argv[]).
2004-07-07 Benoît Dejean <tazforever@dlfp.org> 2004-07-07 Benoît Dejean <tazforever@dlfp.org>
* include/glibtop/netinfo.h: * include/glibtop/netinfo.h:

View File

@@ -41,31 +41,71 @@ struct _glibtop_proc_args
size; /* GLIBTOP_PROC_ARGS_SIZE */ 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
char * char *
glibtop_get_proc_args_l (glibtop *server, glibtop_proc_args *buf, glibtop_get_proc_args_l (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len); pid_t pid, unsigned max_len);
#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 #if GLIBTOP_SUID_PROC_ARGS
void glibtop_init_proc_args_p (glibtop *server);
char * # define glibtop_get_proc_args_r glibtop_get_proc_args_p
glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len);
#else
void glibtop_init_proc_args_s (glibtop *server);
char * void glibtop_init_proc_args_p (glibtop *server);
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
char *
glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len);
#else /* !GLIBTOP_SUID_PROC_ARGS */
# define glibtop_get_proc_args_r glibtop_get_proc_args_s
void glibtop_init_proc_args_s (glibtop *server);
char *
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len);
#endif /* GLIBTOP_SUID_PROC_ARGS */
/*
* NEW functions
*/
char **
glibtop_get_proc_argv_l (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len); pid_t pid, unsigned max_len);
#endif
#define glibtop_get_proc_argv(proc_args,pid,max_len) glibtop_get_proc_argv_l(glibtop_global_server, proc_args, pid, max_len)
#if GLIBTOP_SUID_PROC_ARGS
# define glibtop_get_proc_argv_r glibtop_get_proc_args_p
# define glibtop_init_proc_argv_p glibtop_init_proc_args_p
char **
glibtop_get_proc_argv_p (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len);
#else /* !GLIBTOP_SUID_PROC_ARGS */
# define glibtop_get_proc_argv_r glibtop_get_proc_args_s
# define glibtop_init_proc_argv_s glibtop_init_proc_args_s
char **
glibtop_get_proc_argv_s (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len);
#endif /* GLIBTOP_SUID_PROC_ARGS */
#ifdef GLIBTOP_NAMES #ifdef GLIBTOP_NAMES