New fields error_method',
sysdeps' and `required'. I added an improved
1998-08-07 Martin Baulig <martin@home-of-linux.org> * glibtop.h (_glibtop): New fields `error_method', `sysdeps' and `required'. I added an improved error handling: the client can tell the libraries which fields are absolutely required for each features and if it fails to set one of them, this will create an error which is handled depending upon the `error_method'. * include/glibtop/open.h: Define some constants for `error_method'. * lib/sysdeps.c (glibtop_get_sysdeps_r): No longer actually call any sysdeps function, it now simply copies `server->sysdeps'. (_glibtop_init_hook_s): Added. List of functions to be called during `glibtop_init_s' set to `glibtop_init_<no-suid-feature>_s'. * include/glibtop/sysdeps.h (<glibtop/union.h>): Removed. (glibtop_init_func_t): New typedef. (_glibtop_init_hook_s): Added. * sysdeps/linux/*.c (glibtop_init_<feature>_s): New functions. (glibtop_get_proc_*): Zero is now a valid pid. * sysdeps/kernel/*.c (glibtop_init_<feature>_s): New functions. (glibtop_get_proc_*): Zero is now a valid pid. 1998-08-06 Martin Baulig <martin@home-of-linux.org>
This commit is contained in:
committed by
Martin Baulig
parent
09e1353d0d
commit
4b3fcf149a
25
ChangeLog
25
ChangeLog
@@ -1,3 +1,28 @@
|
||||
1998-08-07 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* glibtop.h (_glibtop): New fields `error_method', `sysdeps' and
|
||||
`required'. I added an improved error handling: the client can tell
|
||||
the libraries which fields are absolutely required for each features
|
||||
and if it fails to set one of them, this will create an error which
|
||||
is handled depending upon the `error_method'.
|
||||
|
||||
* include/glibtop/open.h: Define some constants for `error_method'.
|
||||
|
||||
* lib/sysdeps.c (glibtop_get_sysdeps_r): No longer actually call any
|
||||
sysdeps function, it now simply copies `server->sysdeps'.
|
||||
(_glibtop_init_hook_s): Added. List of functions to be called during
|
||||
`glibtop_init_s' set to `glibtop_init_<no-suid-feature>_s'.
|
||||
|
||||
* include/glibtop/sysdeps.h (<glibtop/union.h>): Removed.
|
||||
(glibtop_init_func_t): New typedef.
|
||||
(_glibtop_init_hook_s): Added.
|
||||
|
||||
* sysdeps/linux/*.c (glibtop_init_<feature>_s): New functions.
|
||||
(glibtop_get_proc_*): Zero is now a valid pid.
|
||||
|
||||
* sysdeps/kernel/*.c (glibtop_init_<feature>_s): New functions.
|
||||
(glibtop_get_proc_*): Zero is now a valid pid.
|
||||
|
||||
1998-08-06 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* configure.in (HAVE_SOCKETS, HAVE_SOCKADDR_SUN_LEN): New checks.
|
||||
|
@@ -33,10 +33,13 @@
|
||||
|
||||
typedef struct _glibtop glibtop;
|
||||
|
||||
#include <glibtop/sysdeps.h>
|
||||
|
||||
struct _glibtop
|
||||
{
|
||||
unsigned flags;
|
||||
unsigned method; /* Server Method */
|
||||
unsigned error_method; /* Error Method */
|
||||
#ifdef HAVE_GLIBTOP_MACHINE_H
|
||||
glibtop_machine machine; /* Machine dependent data */
|
||||
#endif
|
||||
@@ -51,6 +54,8 @@ struct _glibtop
|
||||
const char *server_rsh; /* Command used to connect to the target host */
|
||||
unsigned long features; /* Server is required for this features */
|
||||
unsigned long server_port; /* Port on which daemon is listening */
|
||||
glibtop_sysdeps sysdeps; /* Detailed feature list */
|
||||
glibtop_sysdeps required; /* Required feature list */
|
||||
pid_t pid; /* PID of the server */
|
||||
};
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/sysdeps.h>
|
||||
#include <glibtop/union.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@@ -60,8 +60,10 @@ struct _glibtop_cpu
|
||||
extern void glibtop_get_cpu_l __P((glibtop *, glibtop_cpu *));
|
||||
|
||||
#if GLIBTOP_SUID_CPU
|
||||
extern void glibtop_init_cpu_p __P((glibtop *));
|
||||
extern void glibtop_get_cpu_p __P((glibtop *, glibtop_cpu *));
|
||||
#else
|
||||
extern void glibtop_init_cpu_s __P((glibtop *));
|
||||
extern void glibtop_get_cpu_s __P((glibtop *, glibtop_cpu *));
|
||||
#endif
|
||||
|
||||
|
@@ -50,8 +50,10 @@ struct _glibtop_loadavg
|
||||
extern void glibtop_get_loadavg_l __P((glibtop *, glibtop_loadavg *));
|
||||
|
||||
#if GLIBTOP_SUID_LOADAVG
|
||||
extern void glibtop_init_loadavg_p __P((glibtop *));
|
||||
extern void glibtop_get_loadavg_p __P((glibtop *, glibtop_loadavg *));
|
||||
#else
|
||||
extern void glibtop_init_loadavg_s __P((glibtop *));
|
||||
extern void glibtop_get_loadavg_s __P((glibtop *, glibtop_loadavg *));
|
||||
#endif
|
||||
|
||||
|
@@ -64,8 +64,10 @@ struct _glibtop_mem
|
||||
extern void glibtop_get_mem_l __P((glibtop *, glibtop_mem *));
|
||||
|
||||
#if GLIBTOP_SUID_MEM
|
||||
extern void glibtop_init_mem_p __P((glibtop *));
|
||||
extern void glibtop_get_mem_p __P((glibtop *, glibtop_mem *));
|
||||
#else
|
||||
extern void glibtop_init_mem_s __P((glibtop *));
|
||||
extern void glibtop_get_mem_s __P((glibtop *, glibtop_mem *));
|
||||
#endif
|
||||
|
||||
|
@@ -62,8 +62,10 @@ struct _glibtop_msg_limits
|
||||
extern void glibtop_get_msg_limits_l __P((glibtop *, glibtop_msg_limits *));
|
||||
|
||||
#if GLIBTOP_SUID_MSG_LIMITS
|
||||
extern void glibtop_init_msg_limits_p __P((glibtop *));
|
||||
extern void glibtop_get_msg_limits_p __P((glibtop *, glibtop_msg_limits *));
|
||||
#else
|
||||
extern void glibtop_init_msg_limits_s __P((glibtop *));
|
||||
extern void glibtop_get_msg_limits_s __P((glibtop *, glibtop_msg_limits *));
|
||||
#endif
|
||||
|
||||
|
@@ -41,6 +41,13 @@ __BEGIN_DECLS
|
||||
#define GLIBTOP_METHOD_INET 3
|
||||
#define GLIBTOP_METHOD_UNIX 4
|
||||
|
||||
#define GLIBTOP_ERROR_METHOD_IGNORE 0
|
||||
#define GLIBTOP_ERROR_METHOD_WARN_ONCE 1
|
||||
#define GLIBTOP_ERROR_METHOD_WARN 2
|
||||
#define GLIBTOP_ERROR_METHOD_ABORT 3
|
||||
|
||||
#define GLIBTOP_ERROR_METHOD_DEFAULT GLIBTOP_ERROR_METHOD_WARN_ONCE
|
||||
|
||||
extern void glibtop_open_l __P((glibtop *, const char *, const unsigned long, const unsigned));
|
||||
|
||||
extern void glibtop_open_p __P((glibtop *, const char *, const unsigned long, const unsigned));
|
||||
|
@@ -25,11 +25,12 @@
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define GLIBTOP_PARAM_METHOD 1
|
||||
#define GLIBTOP_PARAM_FEATURES 2
|
||||
#define GLIBTOP_PARAM_COMMAND 3
|
||||
#define GLIBTOP_PARAM_HOST 4
|
||||
#define GLIBTOP_PARAM_PORT 5
|
||||
#define GLIBTOP_PARAM_METHOD 1
|
||||
#define GLIBTOP_PARAM_FEATURES 2
|
||||
#define GLIBTOP_PARAM_COMMAND 3
|
||||
#define GLIBTOP_PARAM_HOST 4
|
||||
#define GLIBTOP_PARAM_PORT 5
|
||||
#define GLIBTOP_PARAM_ERROR_METHOD 6
|
||||
|
||||
#define glibtop_get_parameter(p1,p2,p3) glibtop_get_parameter_l(glibtop_global_server,p1,p2,p3)
|
||||
#define glibtop_set_parameter(p1,p2,p3) glibtop_set_parameter_l(glibtop_global_server,p1,p2,p3)
|
||||
|
@@ -71,8 +71,10 @@ struct _glibtop_proc_kernel
|
||||
extern void glibtop_get_proc_kernel_l __P((glibtop *, glibtop_proc_kernel *, pid_t));
|
||||
|
||||
#if GLIBTOP_SUID_PROC_KERNEL
|
||||
extern void glibtop_init_proc_kernel_p __P((glibtop *));
|
||||
extern void glibtop_get_proc_kernel_p __P((glibtop *, glibtop_proc_kernel *, pid_t));
|
||||
#else
|
||||
extern void glibtop_init_proc_kernel_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_kernel_s __P((glibtop *, glibtop_proc_kernel *, pid_t));
|
||||
#endif
|
||||
|
||||
|
@@ -54,8 +54,10 @@ struct _glibtop_proclist
|
||||
extern unsigned *glibtop_get_proclist_l __P((glibtop *, glibtop_proclist *));
|
||||
|
||||
#if GLIBTOP_SUID_PROCLIST
|
||||
extern void glibtop_init_proclist_p __P((glibtop *));
|
||||
extern unsigned *glibtop_get_proclist_p __P((glibtop *, glibtop_proclist *));
|
||||
#else
|
||||
extern void glibtop_init_proclist_s __P((glibtop *));
|
||||
extern unsigned *glibtop_get_proclist_s __P((glibtop *, glibtop_proclist *));
|
||||
#endif
|
||||
|
||||
|
@@ -64,8 +64,10 @@ struct _glibtop_proc_mem
|
||||
extern void glibtop_get_proc_mem_l __P((glibtop *, glibtop_proc_mem *, pid_t));
|
||||
|
||||
#if GLIBTOP_SUID_PROC_MEM
|
||||
extern void glibtop_init_proc_mem_p __P((glibtop *));
|
||||
extern void glibtop_get_proc_mem_p __P((glibtop *, glibtop_proc_mem *, pid_t));
|
||||
#else
|
||||
extern void glibtop_init_proc_mem_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_mem_s __P((glibtop *, glibtop_proc_mem *, pid_t));
|
||||
#endif
|
||||
|
||||
|
@@ -65,8 +65,10 @@ struct _glibtop_proc_segment
|
||||
extern void glibtop_get_proc_segment_l __P((glibtop *, glibtop_proc_segment *, pid_t));
|
||||
|
||||
#if GLIBTOP_SUID_PROC_SEGMENT
|
||||
extern void glibtop_init_proc_segment_p __P((glibtop *));
|
||||
extern void glibtop_get_proc_segment_p __P((glibtop *, glibtop_proc_segment *, pid_t));
|
||||
#else
|
||||
extern void glibtop_init_proc_segment_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_segment_s __P((glibtop *, glibtop_proc_segment *, pid_t));
|
||||
#endif
|
||||
|
||||
|
@@ -58,8 +58,10 @@ struct _glibtop_proc_signal
|
||||
extern void glibtop_get_proc_signal_l __P((glibtop *, glibtop_proc_signal *, pid_t));
|
||||
|
||||
#if GLIBTOP_SUID_PROC_SIGNAL
|
||||
extern void glibtop_init_proc_signal_p __P((glibtop *));
|
||||
extern void glibtop_get_proc_signal_p __P((glibtop *, glibtop_proc_signal *, pid_t));
|
||||
#else
|
||||
extern void glibtop_init_proc_signal_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_signal_s __P((glibtop *, glibtop_proc_signal *, pid_t));
|
||||
#endif
|
||||
|
||||
|
@@ -65,8 +65,10 @@ struct _glibtop_proc_state
|
||||
extern void glibtop_get_proc_state_l __P((glibtop *, glibtop_proc_state *, pid_t));
|
||||
|
||||
#if GLIBTOP_SUID_PROC_STATE
|
||||
extern void glibtop_init_proc_state_p __P((glibtop *));
|
||||
extern void glibtop_get_proc_state_p __P((glibtop *, glibtop_proc_state *, pid_t));
|
||||
#else
|
||||
extern void glibtop_init_proc_state_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_state_s __P((glibtop *, glibtop_proc_state *, pid_t));
|
||||
#endif
|
||||
|
||||
|
@@ -70,8 +70,10 @@ struct _glibtop_proc_time
|
||||
extern void glibtop_get_proc_time_l __P((glibtop *, glibtop_proc_time *, pid_t));
|
||||
|
||||
#if GLIBTOP_SUID_PROC_TIME
|
||||
extern void glibtop_init_proc_time_p __P((glibtop *));
|
||||
extern void glibtop_get_proc_time_p __P((glibtop *, glibtop_proc_time *, pid_t));
|
||||
#else
|
||||
extern void glibtop_init_proc_time_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_time_s __P((glibtop *, glibtop_proc_time *, pid_t));
|
||||
#endif
|
||||
|
||||
|
@@ -74,8 +74,10 @@ struct _glibtop_proc_uid
|
||||
extern void glibtop_get_proc_uid_l __P((glibtop *, glibtop_proc_uid *, pid_t));
|
||||
|
||||
#if GLIBTOP_SUID_PROC_UID
|
||||
extern void glibtop_init_proc_uid_p __P((glibtop *));
|
||||
extern void glibtop_get_proc_uid_p __P((glibtop *, glibtop_proc_uid *, pid_t));
|
||||
#else
|
||||
extern void glibtop_init_proc_uid_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_uid_s __P((glibtop *, glibtop_proc_uid *, pid_t));
|
||||
#endif
|
||||
|
||||
|
@@ -68,8 +68,10 @@ struct _glibtop_sem_limits
|
||||
extern void glibtop_get_sem_limits_l __P((glibtop *, glibtop_sem_limits *));
|
||||
|
||||
#if GLIBTOP_SUID_SEM_LIMITS
|
||||
extern void glibtop_init_sem_limits_p __P((glibtop *));
|
||||
extern void glibtop_get_sem_limits_p __P((glibtop *, glibtop_sem_limits *));
|
||||
#else
|
||||
extern void glibtop_init_sem_limits_s __P((glibtop *));
|
||||
extern void glibtop_get_sem_limits_s __P((glibtop *, glibtop_sem_limits *));
|
||||
#endif
|
||||
|
||||
|
@@ -58,8 +58,10 @@ struct _glibtop_shm_limits
|
||||
extern void glibtop_get_shm_limits_l __P((glibtop *, glibtop_shm_limits *));
|
||||
|
||||
#if GLIBTOP_SUID_SHM_LIMITS
|
||||
extern void glibtop_init_shm_limits_p __P((glibtop *));
|
||||
extern void glibtop_get_shm_limits_p __P((glibtop *, glibtop_shm_limits *));
|
||||
#else
|
||||
extern void glibtop_init_shm_limits_s __P((glibtop *));
|
||||
extern void glibtop_get_shm_limits_s __P((glibtop *, glibtop_shm_limits *));
|
||||
#endif
|
||||
|
||||
|
@@ -58,8 +58,10 @@ struct _glibtop_swap
|
||||
extern void glibtop_get_swap_l __P((glibtop *, glibtop_swap *));
|
||||
|
||||
#if GLIBTOP_SUID_SWAP
|
||||
extern void glibtop_init_swap_p __P((glibtop *));
|
||||
extern void glibtop_get_swap_p __P((glibtop *, glibtop_swap *));
|
||||
#else
|
||||
extern void glibtop_init_swap_s __P((glibtop *));
|
||||
extern void glibtop_get_swap_s __P((glibtop *, glibtop_swap *));
|
||||
#endif
|
||||
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#define __GLIBTOP_SYSDEPS_H__
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/union.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@@ -51,6 +50,9 @@ __BEGIN_DECLS
|
||||
|
||||
#define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1)
|
||||
|
||||
typedef void (*glibtop_init_func_t) (glibtop *);
|
||||
extern glibtop_init_func_t _glibtop_init_hook_s [];
|
||||
|
||||
typedef struct _glibtop_sysdeps glibtop_sysdeps;
|
||||
|
||||
struct _glibtop_sysdeps
|
||||
|
@@ -52,8 +52,10 @@ struct _glibtop_uptime
|
||||
extern void glibtop_get_uptime_l __P((glibtop *, glibtop_uptime *));
|
||||
|
||||
#if GLIBTOP_SUID_UPTIME
|
||||
extern void glibtop_init_uptime_p __P((glibtop *));
|
||||
extern void glibtop_get_uptime_p __P((glibtop *, glibtop_uptime *));
|
||||
#else
|
||||
extern void glibtop_init_uptime_s __P((glibtop *));
|
||||
extern void glibtop_get_uptime_s __P((glibtop *, glibtop_uptime *));
|
||||
#endif
|
||||
|
||||
|
38
lib/init.c
38
lib/init.c
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
#include <glibtop/sysdeps.h>
|
||||
#include <glibtop/parameter.h>
|
||||
|
||||
#ifndef DEFAULT_PORT
|
||||
@@ -30,7 +31,6 @@
|
||||
static glibtop _glibtop_global_server;
|
||||
glibtop *glibtop_global_server = &_glibtop_global_server;
|
||||
|
||||
|
||||
void
|
||||
_init_server (glibtop *server, const unsigned features)
|
||||
{
|
||||
@@ -109,7 +109,7 @@ _init_server (glibtop *server, const unsigned features)
|
||||
|
||||
/* Override default. */
|
||||
if (server->server_host)
|
||||
glibtop_free_r (server, (char *) server->server_host);
|
||||
glibtop_free_r (server, server->server_host);
|
||||
|
||||
server->server_host = glibtop_strdup_r
|
||||
(server, temp+1);
|
||||
@@ -193,19 +193,35 @@ glibtop_init_r (glibtop **server_ptr, const unsigned long features,
|
||||
}
|
||||
|
||||
glibtop *
|
||||
glibtop_init_s (glibtop **server, const unsigned long features,
|
||||
glibtop_init_s (glibtop **server_ptr, const unsigned long features,
|
||||
const unsigned flags)
|
||||
{
|
||||
if (*server != NULL)
|
||||
return *server;
|
||||
glibtop *server;
|
||||
glibtop_init_func_t *init_fkt;
|
||||
|
||||
fprintf (stderr, "DEBUG: %s (%d)\n", __FILE__, __LINE__);
|
||||
if (server_ptr == NULL)
|
||||
return NULL;
|
||||
|
||||
if (glibtop_global_server == NULL) {
|
||||
glibtop_global_server = &_glibtop_global_server;
|
||||
glibtop_open_s (glibtop_global_server, "glibtop",
|
||||
features, flags);
|
||||
if (*server_ptr == NULL)
|
||||
*server_ptr = glibtop_global_server;
|
||||
|
||||
server = *server_ptr;
|
||||
|
||||
/* Should we do the initialization? */
|
||||
|
||||
if (flags & GLIBTOP_INIT_NO_INIT)
|
||||
return server;
|
||||
|
||||
/* Do the initialization, but only if not already initialized. */
|
||||
|
||||
if ((server->flags & _GLIBTOP_INIT_STATE_INIT) == 0) {
|
||||
glibtop_open_s (server, "glibtop", features, flags);
|
||||
|
||||
for (init_fkt = _glibtop_init_hook_s; *init_fkt; init_fkt++)
|
||||
(*init_fkt) (server);
|
||||
|
||||
server->flags |= _GLIBTOP_INIT_STATE_INIT;
|
||||
}
|
||||
|
||||
return *server = glibtop_global_server;
|
||||
return server;
|
||||
}
|
||||
|
60
lib/lib.awk
60
lib/lib.awk
@@ -5,10 +5,41 @@ BEGIN {
|
||||
|
||||
print "#include <glibtop.h>";
|
||||
print "#include <glibtop/open.h>";
|
||||
print "";
|
||||
print "#include <glibtop/sysdeps.h>";
|
||||
print "#include <glibtop/union.h>";
|
||||
print "";
|
||||
print "#include <glibtop/command.h>";
|
||||
|
||||
print "";
|
||||
print "/* Some required fields are missing. */";
|
||||
print "";
|
||||
|
||||
print "static void";
|
||||
print "_glibtop_missing_feature (glibtop *server, const char *feature,";
|
||||
print "\t\t\t const u_int64_t present, u_int64_t *required)";
|
||||
print "{";
|
||||
print "\tswitch (server->error_method) {";
|
||||
print "\tcase GLIBTOP_ERROR_METHOD_WARN_ONCE:";
|
||||
print "\t\t*required &= present;";
|
||||
print "\tcase GLIBTOP_ERROR_METHOD_WARN:";
|
||||
print "\t\tglibtop_warn_r (server,";
|
||||
print "\t\t\t\t_(\"glibtop_get_%s (): Client requested \"";
|
||||
print "\t\t\t\t \"field mask %05Lx, but only have %05Lx.\"),";
|
||||
print "\t\t\t\t feature, required, present);";
|
||||
print "\t\tbreak;";
|
||||
print "\tcase GLIBTOP_ERROR_METHOD_ABORT:";
|
||||
print "\t\tglibtop_error_r (server,";
|
||||
print "\t\t\t\t _(\"glibtop_get_%s (): Client requested \"";
|
||||
print "\t\t\t\t \"field mask %05x, but only have %05x.\"),";
|
||||
print "\t\t\t\t feature, required, present);";
|
||||
print "\t\tbreak;";
|
||||
print "\t}";
|
||||
print "}";
|
||||
|
||||
print "";
|
||||
print "/* Library functions. */";
|
||||
print "";
|
||||
}
|
||||
|
||||
function output(line) {
|
||||
@@ -37,8 +68,8 @@ function output(line) {
|
||||
|
||||
print retval;
|
||||
if (retval !~ /^void$/) {
|
||||
prefix = "return ";
|
||||
prefix_space = " ";
|
||||
prefix = "retval = ";
|
||||
prefix_space = " ";
|
||||
} else {
|
||||
prefix = "";
|
||||
prefix_space = "";
|
||||
@@ -52,8 +83,15 @@ function output(line) {
|
||||
}
|
||||
|
||||
print "{";
|
||||
if (retval !~ /^void$/)
|
||||
print "\t"retval" retval;\n";
|
||||
print "\tglibtop_init_r (&server, (1 << GLIBTOP_SYSDEPS_"toupper(feature)"), 0);";
|
||||
|
||||
print "";
|
||||
print "\t/* If neccessary, we ask the server for the requested";
|
||||
print "\t * feature. If not, we call the sysdeps function. */";
|
||||
print "";
|
||||
|
||||
print "\tif ((server->flags & _GLIBTOP_INIT_STATE_SERVER) &&";
|
||||
print "\t (server->features & (1 << GLIBTOP_SYSDEPS_"toupper(feature)")))";
|
||||
print "\t{";
|
||||
@@ -77,9 +115,9 @@ function output(line) {
|
||||
print "#if (!GLIBTOP_SUID_"toupper(feature)")";
|
||||
|
||||
if (param == "")
|
||||
print "\t\t"prefix"glibtop_get_"feature"_r (server, buf);";
|
||||
print "\t\t"prefix"glibtop_get_"feature"_s (server, buf);";
|
||||
else
|
||||
print "\t\t"prefix"glibtop_get_"feature"_r (server, buf, "param");";
|
||||
print "\t\t"prefix"glibtop_get_"feature"_s (server, buf, "param");";
|
||||
|
||||
if (orig !~ /^@/) {
|
||||
print "#else";
|
||||
@@ -89,6 +127,20 @@ function output(line) {
|
||||
}
|
||||
|
||||
print "\t}";
|
||||
|
||||
print "";
|
||||
print "\t/* Make sure that all required fields are present. */";
|
||||
print "";
|
||||
|
||||
print "\tif (buf->flags & server->required."feature")";
|
||||
print "\t\t_glibtop_missing_feature (server, \""feature"\", buf->flags,";
|
||||
print "\t\t\t\t\t &server->required."feature");";
|
||||
|
||||
if (retval !~ /^void$/) {
|
||||
print "\n\t/* Now we can return. */";
|
||||
print "\n\treturn retval;";
|
||||
}
|
||||
|
||||
print "}";
|
||||
print "";
|
||||
}
|
||||
|
@@ -57,6 +57,8 @@ glibtop_open_l (glibtop *server, const char *program_name,
|
||||
|
||||
server->features = features;
|
||||
|
||||
server->error_method = GLIBTOP_ERROR_METHOD_DEFAULT;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "SIZEOF: %u - %u - %u - %u - %u - %u\n",
|
||||
sizeof (glibtop_command), sizeof (glibtop_response),
|
||||
|
@@ -58,6 +58,9 @@ glibtop_get_parameter_l (glibtop *server, const unsigned parameter,
|
||||
case GLIBTOP_PARAM_PORT:
|
||||
_write_data (&server->server_port,
|
||||
sizeof (server->server_port));
|
||||
case GLIBTOP_PARAM_ERROR_METHOD:
|
||||
_write_data (&server->error_method,
|
||||
sizeof (server->error_method));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -76,5 +79,9 @@ glibtop_set_parameter_l (glibtop *server, const unsigned parameter,
|
||||
_check_data (sizeof (server->features));
|
||||
memcpy (&server->features, data_ptr, data_size);
|
||||
break;
|
||||
case GLIBTOP_PARAM_ERROR_METHOD:
|
||||
_check_data (sizeof (server->error_method));
|
||||
memcpy (&server->error_method, data_ptr, data_size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
106
lib/sysdeps.c
106
lib/sysdeps.c
@@ -39,62 +39,62 @@ GLIBTOP_SUID_PROC_SIGNAL +
|
||||
GLIBTOP_SUID_PROC_KERNEL +
|
||||
GLIBTOP_SUID_PROC_SEGMENT;
|
||||
|
||||
glibtop_init_func_t _glibtop_init_hook_s [] = {
|
||||
#if !GLIBTOP_SUID_CPU
|
||||
glibtop_init_cpu_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_MEM
|
||||
glibtop_init_mem_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_SWAP
|
||||
glibtop_init_swap_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_UPTIME
|
||||
glibtop_init_uptime_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_LOADAVG
|
||||
glibtop_init_loadavg_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_SHM_LIMITS
|
||||
glibtop_init_shm_limits_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_MSG_LIMITS
|
||||
glibtop_init_msg_limits_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_SEM_LIMITS
|
||||
glibtop_init_sem_limits_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_PROCLIST
|
||||
glibtop_init_proclist_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_PROC_STATE
|
||||
glibtop_init_proc_state_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_PROC_UID
|
||||
glibtop_init_proc_uid_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_PROC_MEM
|
||||
glibtop_init_proc_mem_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_PROC_TIME
|
||||
glibtop_init_proc_time_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_PROC_SIGNAL
|
||||
glibtop_init_proc_signal_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_PROC_KERNEL
|
||||
glibtop_init_proc_kernel_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_PROC_SEGMENT
|
||||
glibtop_init_proc_segment_s,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Checks which features are implemented. */
|
||||
|
||||
void
|
||||
glibtop_get_sysdeps_r (glibtop *server, glibtop_sysdeps *buf)
|
||||
{
|
||||
glibtop_union data;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_sysdeps));
|
||||
|
||||
buf->features = glibtop_server_features;
|
||||
|
||||
/* Call all system dependent functions to check which values
|
||||
* they return. */
|
||||
|
||||
glibtop_get_cpu_l (server, &data.cpu);
|
||||
buf->cpu = data.cpu.flags;
|
||||
|
||||
glibtop_get_mem_l (server, &data.mem);
|
||||
buf->mem = data.mem.flags;
|
||||
|
||||
glibtop_get_swap_l (server, &data.swap);
|
||||
buf->swap = data.swap.flags;
|
||||
|
||||
glibtop_get_uptime_l (server, &data.uptime);
|
||||
buf->uptime = data.uptime.flags;
|
||||
|
||||
glibtop_get_loadavg_l (server, &data.loadavg);
|
||||
buf->loadavg = data.loadavg.flags;
|
||||
|
||||
glibtop_get_shm_limits_l (server, &data.shm_limits);
|
||||
buf->shm_limits = data.shm_limits.flags;
|
||||
|
||||
glibtop_get_msg_limits_l (server, &data.msg_limits);
|
||||
buf->msg_limits = data.msg_limits.flags;
|
||||
|
||||
glibtop_get_sem_limits_l (server, &data.sem_limits);
|
||||
buf->sem_limits = data.sem_limits.flags;
|
||||
|
||||
glibtop_get_proclist_l (server, &data.proclist);
|
||||
buf->proclist = data.proclist.flags;
|
||||
|
||||
glibtop_get_proc_state_l (server, &data.proc_state, 0);
|
||||
buf->proc_state = data.proc_state.flags;
|
||||
|
||||
glibtop_get_proc_uid_l (server, &data.proc_uid, 0);
|
||||
buf->proc_uid = data.proc_uid.flags;
|
||||
|
||||
glibtop_get_proc_mem_l (server, &data.proc_mem, 0);
|
||||
buf->proc_mem = data.proc_mem.flags;
|
||||
|
||||
glibtop_get_proc_time_l (server, &data.proc_time, 0);
|
||||
buf->proc_time = data.proc_time.flags;
|
||||
|
||||
glibtop_get_proc_kernel_l (server, &data.proc_kernel, 0);
|
||||
buf->proc_kernel = data.proc_kernel.flags;
|
||||
|
||||
glibtop_get_proc_segment_l (server, &data.proc_segment, 0);
|
||||
buf->proc_segment = data.proc_segment.flags;
|
||||
memcpy (buf, &server->sysdeps, sizeof (glibtop_sysdeps));
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ BEGIN {
|
||||
print "#include <glibtop.h>";
|
||||
print "#include <glibtop/xmalloc.h>";
|
||||
print "#include <glibtop/sysdeps.h>";
|
||||
print "#include <glibtop/union.h>";
|
||||
print "";
|
||||
print "#include <guile/gh.h>";
|
||||
|
||||
|
@@ -5,6 +5,7 @@ BEGIN {
|
||||
|
||||
print "#include <glibtop.h>";
|
||||
print "#include <glibtop/sysdeps.h>";
|
||||
print "#include <glibtop/union.h>";
|
||||
print "";
|
||||
print "#include <guile/gh.h>";
|
||||
|
||||
|
@@ -30,6 +30,14 @@ static const unsigned long _glibtop_sysdeps_cpu =
|
||||
(1 << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_SYS) +
|
||||
(1 << GLIBTOP_CPU_IDLE) + (1 << GLIBTOP_CPU_FREQUENCY);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_cpu_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
|
||||
}
|
||||
|
||||
/* Provides information about cpu usage. */
|
||||
|
||||
void
|
||||
|
@@ -28,6 +28,14 @@
|
||||
static const unsigned long _glibtop_sysdeps_loadavg =
|
||||
(1 << GLIBTOP_LOADAVG_LOADAVG);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_loadavg_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
|
||||
}
|
||||
|
||||
/* Provides load load averange. */
|
||||
|
||||
void
|
||||
|
@@ -31,6 +31,14 @@ static const unsigned long _glibtop_sysdeps_mem =
|
||||
(1 << GLIBTOP_MEM_BUFFER) + (1 << GLIBTOP_MEM_CACHED) +
|
||||
(1 << GLIBTOP_MEM_USER);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_mem_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.mem = _glibtop_sysdeps_mem;
|
||||
}
|
||||
|
||||
/* Provides information about memory usage. */
|
||||
|
||||
void
|
||||
|
@@ -30,6 +30,14 @@ static const unsigned long _glibtop_sysdeps_msg_limits =
|
||||
(1 << GLIBTOP_IPC_MSGMNI) + (1 << GLIBTOP_IPC_MSGSSZ) +
|
||||
(1 << GLIBTOP_IPC_MSGTQL);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_msg_limits_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
|
@@ -31,6 +31,14 @@ static const unsigned long _glibtop_sysdeps_proc_kernel =
|
||||
(1 << GLIBTOP_PROC_KERNEL_CMAJ_FLT) + (1 << GLIBTOP_PROC_KERNEL_KSTK_ESP) +
|
||||
(1 << GLIBTOP_PROC_KERNEL_KSTK_EIP) + (1 << GLIBTOP_PROC_KERNEL_WCHAN);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_kernel_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
@@ -43,12 +51,6 @@ glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf,
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_kernel));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_kernel;
|
||||
return;
|
||||
}
|
||||
|
||||
if (table (TABLE_PROC_KERNEL, &tbl, &pid))
|
||||
glibtop_error_io_r (server, "table(TABLE_PROC_KERNEL)");
|
||||
|
||||
|
@@ -29,6 +29,14 @@ static const unsigned long _glibtop_sysdeps_proclist =
|
||||
(1 << GLIBTOP_PROCLIST_TOTAL) + (1 << GLIBTOP_PROCLIST_NUMBER) +
|
||||
(1 << GLIBTOP_PROCLIST_SIZE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proclist_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proclist = _glibtop_sysdeps_proclist;
|
||||
}
|
||||
|
||||
#define BLOCK_COUNT 256
|
||||
#define BLOCK_SIZE (BLOCK_COUNT * sizeof (unsigned))
|
||||
|
||||
|
@@ -30,6 +30,14 @@ static const unsigned long _glibtop_sysdeps_proc_mem =
|
||||
(1 << GLIBTOP_PROC_MEM_RESIDENT) + (1 << GLIBTOP_PROC_MEM_SHARE) +
|
||||
(1 << GLIBTOP_PROC_MEM_RSS) + (1 << GLIBTOP_PROC_MEM_RSS_RLIM);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_mem_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
@@ -42,12 +50,6 @@ glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf,
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_mem));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_mem;
|
||||
return;
|
||||
}
|
||||
|
||||
if (table (TABLE_PROC_MEM, &tbl, &pid))
|
||||
glibtop_error_io_r (server, "table(TABLE_PROC_MEM)");
|
||||
|
||||
|
@@ -31,6 +31,14 @@ static const unsigned long _glibtop_sysdeps_proc_segment =
|
||||
(1 << GLIBTOP_PROC_SEGMENT_START_CODE) + (1 << GLIBTOP_PROC_SEGMENT_END_CODE) +
|
||||
(1 << GLIBTOP_PROC_SEGMENT_START_STACK);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_segment_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
@@ -43,12 +51,6 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_segment));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_segment;
|
||||
return;
|
||||
}
|
||||
|
||||
if (table (TABLE_PROC_MEM, &tbl, &pid))
|
||||
glibtop_error_io_r (server, "table(TABLE_PROC_MEM)");
|
||||
|
||||
|
@@ -29,6 +29,14 @@ static const unsigned long _glibtop_sysdeps_proc_signal =
|
||||
(1 << GLIBTOP_PROC_SIGNAL_SIGNAL) + (1 << GLIBTOP_PROC_SIGNAL_BLOCKED) +
|
||||
(1 << GLIBTOP_PROC_SIGNAL_SIGIGNORE) + (1 << GLIBTOP_PROC_SIGNAL_SIGCATCH);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_signal_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_signal = _glibtop_sysdeps_proc_signal;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
@@ -41,12 +49,6 @@ glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf,
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_signal));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_signal;
|
||||
return;
|
||||
}
|
||||
|
||||
if (table (TABLE_PROC_SIGNAL, &tbl, &pid))
|
||||
glibtop_error_io_r (server, "table(TABLE_PROC_SIGNAL)");
|
||||
|
||||
|
@@ -28,6 +28,14 @@
|
||||
static const unsigned long _glibtop_sysdeps_proc_state =
|
||||
(1 << GLIBTOP_PROC_STATE_CMD) + (1 << GLIBTOP_PROC_STATE_STATE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_state_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_state = _glibtop_sysdeps_proc_state;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
#define NR_STATES 7
|
||||
@@ -45,12 +53,6 @@ glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf,
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_state));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_state;
|
||||
return;
|
||||
}
|
||||
|
||||
if (table (TABLE_PROC_STATE, &tbl, &pid))
|
||||
glibtop_error_io_r (server, "table(TABLE_PROC_STATE)");
|
||||
|
||||
|
@@ -31,6 +31,14 @@ static const unsigned long _glibtop_sysdeps_proc_time =
|
||||
(1 << GLIBTOP_PROC_TIME_TIMEOUT) + (1 << GLIBTOP_PROC_TIME_IT_REAL_VALUE) +
|
||||
(1 << GLIBTOP_PROC_TIME_START_TIME);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_time_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
@@ -43,12 +51,6 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf,
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_time));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_time;
|
||||
return;
|
||||
}
|
||||
|
||||
if (table (TABLE_PROC_TIME, &tbl, &pid))
|
||||
glibtop_error_io_r (server, "table(TABLE_PROC_TIME)");
|
||||
|
||||
|
@@ -33,6 +33,14 @@ static const unsigned long _glibtop_sysdeps_proc_uid =
|
||||
(1 << GLIBTOP_PROC_UID_TTY) + (1 << GLIBTOP_PROC_UID_TPGID) +
|
||||
(1 << GLIBTOP_PROC_UID_PRIORITY) + (1 << GLIBTOP_PROC_UID_NICE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_uid_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid;
|
||||
}
|
||||
|
||||
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
@@ -48,12 +56,6 @@ glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf,
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_uid));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_uid;
|
||||
return;
|
||||
}
|
||||
|
||||
if (table (TABLE_PROC_UID, &tbl, &pid))
|
||||
glibtop_error_io_r (server, "table(TABLE_PROC_UID)");
|
||||
|
||||
|
@@ -24,6 +24,21 @@
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/sem.h>
|
||||
|
||||
#ifdef _SEM_SEMUN_UNDEFINED
|
||||
|
||||
/* glibc 2.1 will no longer defines semun, instead it defines
|
||||
* _SEM_SEMUN_UNDEFINED so users can define semun on their own.
|
||||
* Thanks to Albert K T Hui <avatar@deva.net>. */
|
||||
|
||||
union semun
|
||||
{
|
||||
int val;
|
||||
struct semid_ds *buf;
|
||||
unsigned short int *array;
|
||||
struct seminfo *__buf;
|
||||
};
|
||||
#endif
|
||||
|
||||
static unsigned long _glibtop_sysdeps_sem_limits =
|
||||
(1 << GLIBTOP_IPC_SEMMAP) + (1 << GLIBTOP_IPC_SEMMNI) +
|
||||
(1 << GLIBTOP_IPC_SEMMNS) + (1 << GLIBTOP_IPC_SEMMNU) +
|
||||
@@ -31,6 +46,14 @@ static unsigned long _glibtop_sysdeps_sem_limits =
|
||||
(1 << GLIBTOP_IPC_SEMUME) + (1 << GLIBTOP_IPC_SEMUSZ) +
|
||||
(1 << GLIBTOP_IPC_SEMVMX) + (1 << GLIBTOP_IPC_SEMAEM);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_sem_limits_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.sem_limits = _glibtop_sysdeps_sem_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
|
@@ -29,6 +29,14 @@ static unsigned long _glibtop_sysdeps_shm_limits =
|
||||
(1 << GLIBTOP_IPC_SHMMNI) + (1 << GLIBTOP_IPC_SHMSEG) +
|
||||
(1 << GLIBTOP_IPC_SHMALL);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_shm_limits_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
|
@@ -30,6 +30,14 @@ static unsigned long _glibtop_sysdeps_swap =
|
||||
(1 << GLIBTOP_SWAP_FREE) + (1 << GLIBTOP_SWAP_PAGEIN) +
|
||||
(1 << GLIBTOP_SWAP_PAGEOUT);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_swap_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.swap = _glibtop_sysdeps_swap;
|
||||
}
|
||||
|
||||
/* Provides information about swap usage. */
|
||||
|
||||
void
|
||||
|
@@ -28,6 +28,14 @@
|
||||
static unsigned long _glibtop_sysdeps_uptime =
|
||||
(1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_uptime_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.uptime = _glibtop_sysdeps_uptime;
|
||||
}
|
||||
|
||||
/* Provides uptime and idle time. */
|
||||
|
||||
void
|
||||
|
@@ -28,6 +28,14 @@ static const unsigned long _glibtop_sysdeps_cpu =
|
||||
(1 << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_SYS) +
|
||||
(1 << GLIBTOP_CPU_IDLE) + (1 << GLIBTOP_CPU_FREQUENCY);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_cpu_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
|
||||
}
|
||||
|
||||
/* Provides information about cpu usage. */
|
||||
|
||||
#define FILENAME "/proc/stat"
|
||||
@@ -37,7 +45,7 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_cpu));
|
||||
|
||||
|
@@ -26,16 +26,24 @@
|
||||
static const unsigned long _glibtop_sysdeps_loadavg =
|
||||
(1 << GLIBTOP_LOADAVG_LOADAVG);
|
||||
|
||||
#define FILENAME "/proc/loadavg"
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_loadavg_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
|
||||
}
|
||||
|
||||
/* Provides load load averange. */
|
||||
|
||||
#define FILENAME "/proc/loadavg"
|
||||
|
||||
void
|
||||
glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_LOADAVG, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_loadavg));
|
||||
|
||||
|
@@ -29,16 +29,24 @@ static const unsigned long _glibtop_sysdeps_mem =
|
||||
(1 << GLIBTOP_MEM_BUFFER) + (1 << GLIBTOP_MEM_CACHED) +
|
||||
(1 << GLIBTOP_MEM_USER);
|
||||
|
||||
#define FILENAME "/proc/meminfo"
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_mem_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.mem = _glibtop_sysdeps_mem;
|
||||
}
|
||||
|
||||
/* Provides information about memory usage. */
|
||||
|
||||
#define FILENAME "/proc/meminfo"
|
||||
|
||||
void
|
||||
glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_MEM, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_mem));
|
||||
|
||||
|
@@ -30,6 +30,14 @@ static const unsigned long _glibtop_sysdeps_msg_limits =
|
||||
(1 << GLIBTOP_IPC_MSGMNI) + (1 << GLIBTOP_IPC_MSGSSZ) +
|
||||
(1 << GLIBTOP_IPC_MSGTQL);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_msg_limits_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
@@ -37,7 +45,7 @@ glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf)
|
||||
{
|
||||
struct msginfo msginfo;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_MSG_LIMITS, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_msg_limits));
|
||||
|
||||
|
@@ -29,6 +29,14 @@ static const unsigned long _glibtop_sysdeps_proc_kernel =
|
||||
(1 << GLIBTOP_PROC_KERNEL_CMAJ_FLT) + (1 << GLIBTOP_PROC_KERNEL_KSTK_ESP) +
|
||||
(1 << GLIBTOP_PROC_KERNEL_KSTK_EIP) + (1 << GLIBTOP_PROC_KERNEL_WCHAN);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_kernel_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
@@ -38,16 +46,10 @@ glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf, pid_t pid)
|
||||
int nread;
|
||||
FILE *f;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_KERNEL, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_kernel));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_kernel;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
f = fopen (input, "r");
|
||||
|
@@ -32,6 +32,14 @@ static const unsigned long _glibtop_sysdeps_proclist =
|
||||
(1 << GLIBTOP_PROCLIST_TOTAL) + (1 << GLIBTOP_PROCLIST_NUMBER) +
|
||||
(1 << GLIBTOP_PROCLIST_SIZE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proclist_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proclist = _glibtop_sysdeps_proclist;
|
||||
}
|
||||
|
||||
#define BLOCK_COUNT 256
|
||||
#define BLOCK_SIZE (BLOCK_COUNT * sizeof (unsigned))
|
||||
|
||||
@@ -60,7 +68,7 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf)
|
||||
struct stat statb;
|
||||
int len, i, ok;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROCLIST, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proclist));
|
||||
|
||||
@@ -69,7 +77,8 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf)
|
||||
|
||||
/* read every every entry in /proc */
|
||||
|
||||
for (count = total = 0, entry = readdir (proc); entry; entry = readdir (proc)) {
|
||||
for (count = total = 0, entry = readdir (proc);
|
||||
entry; entry = readdir (proc)) {
|
||||
ok = 1; len = strlen (entry->d_name);
|
||||
|
||||
/* does it consist entirely of digits? */
|
||||
@@ -94,14 +103,15 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf)
|
||||
* full, we copy it to the pids_chain. */
|
||||
|
||||
if (count >= BLOCK_COUNT) {
|
||||
/* The following call to glibtop_realloc will be equivalent to
|
||||
* glibtop_malloc if pids_chain is NULL. We just calculate the
|
||||
* new size and copy pids to the beginning of the newly allocated
|
||||
* block. */
|
||||
/* The following call to glibtop_realloc will be
|
||||
* equivalent to glibtop_malloc () if `pids_chain' is
|
||||
* NULL. We just calculate the new size and copy `pids'
|
||||
* to the beginning of the newly allocated block. */
|
||||
|
||||
new_size = pids_size + BLOCK_SIZE;
|
||||
|
||||
pids_chain = glibtop_realloc_r (server, pids_chain, new_size);
|
||||
pids_chain = glibtop_realloc_r
|
||||
(server, pids_chain, new_size);
|
||||
|
||||
memcpy (pids_chain + pids_offset, pids, BLOCK_SIZE);
|
||||
|
||||
@@ -121,8 +131,8 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf)
|
||||
|
||||
closedir (proc);
|
||||
|
||||
/* count is only zero if an error occured (one a running Linux system, we
|
||||
* only have at least one single process). */
|
||||
/* count is only zero if an error occured (one a running Linux system,
|
||||
* we have at least one single process). */
|
||||
|
||||
if (!count) return NULL;
|
||||
|
||||
@@ -141,8 +151,8 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf)
|
||||
|
||||
pids_offset += BLOCK_COUNT;
|
||||
|
||||
/* Since everything is ok now, we can set buf->flags, fill in the remaining fields
|
||||
and return pids_chain. */
|
||||
/* Since everything is ok now, we can set buf->flags, fill in the
|
||||
* remaining fields and return the `pids_chain'. */
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proclist;
|
||||
|
||||
|
@@ -28,6 +28,14 @@ static const unsigned long _glibtop_sysdeps_proc_mem =
|
||||
(1 << GLIBTOP_PROC_MEM_RESIDENT) + (1 << GLIBTOP_PROC_MEM_SHARE) +
|
||||
(1 << GLIBTOP_PROC_MEM_RSS) + (1 << GLIBTOP_PROC_MEM_RSS_RLIM);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_mem_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
@@ -37,16 +45,10 @@ glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
|
||||
int nread;
|
||||
FILE *f;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_MEM, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_mem));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_mem;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
f = fopen (input, "r");
|
||||
|
@@ -29,6 +29,14 @@ static const unsigned long _glibtop_sysdeps_proc_segment =
|
||||
(1 << GLIBTOP_PROC_SEGMENT_START_CODE) + (1 << GLIBTOP_PROC_SEGMENT_END_CODE) +
|
||||
(1 << GLIBTOP_PROC_SEGMENT_START_STACK);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_segment_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
@@ -39,16 +47,10 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
||||
int nread;
|
||||
FILE *f;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_segment));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_segment;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
f = fopen (input, "r");
|
||||
|
@@ -27,6 +27,14 @@ static const unsigned long _glibtop_sysdeps_proc_signal =
|
||||
(1 << GLIBTOP_PROC_SIGNAL_SIGNAL) + (1 << GLIBTOP_PROC_SIGNAL_BLOCKED) +
|
||||
(1 << GLIBTOP_PROC_SIGNAL_SIGIGNORE) + (1 << GLIBTOP_PROC_SIGNAL_SIGCATCH);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_signal_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_signal = _glibtop_sysdeps_proc_signal;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
@@ -36,16 +44,10 @@ glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf, pid_t pid)
|
||||
int nread;
|
||||
FILE *f;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_SIGNAL, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_signal));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_signal;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
f = fopen (input, "r");
|
||||
|
@@ -29,6 +29,14 @@ static const unsigned long _glibtop_sysdeps_proc_state =
|
||||
(1 << GLIBTOP_PROC_STATE_CMD) + (1 << GLIBTOP_PROC_STATE_STATE) +
|
||||
(1 << GLIBTOP_PROC_STATE_UID) + (1 << GLIBTOP_PROC_STATE_GID);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_state_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_state = _glibtop_sysdeps_proc_state;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
@@ -39,16 +47,10 @@ glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid)
|
||||
int nread;
|
||||
FILE *f;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_STATE, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_state));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_state;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
/* IMPORTANT NOTICE: For security reasons it is extremely important
|
||||
|
@@ -29,6 +29,14 @@ static const unsigned long _glibtop_sysdeps_proc_time =
|
||||
(1 << GLIBTOP_PROC_TIME_CSTIME) + (1 << GLIBTOP_PROC_TIME_TIMEOUT) +
|
||||
(1 << GLIBTOP_PROC_TIME_IT_REAL_VALUE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_time_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
@@ -38,16 +46,10 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
|
||||
int nread;
|
||||
FILE *f;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_TIME, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_time));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_time;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
f = fopen (input, "r");
|
||||
|
@@ -33,6 +33,14 @@ static const unsigned long _glibtop_sysdeps_proc_uid =
|
||||
|
||||
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_uid_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
@@ -42,16 +50,10 @@ glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf, pid_t pid)
|
||||
int nread;
|
||||
FILE *f;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_UID, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_uid));
|
||||
|
||||
if (pid == 0) {
|
||||
/* Client is only interested in the flags. */
|
||||
buf->flags = _glibtop_sysdeps_proc_uid;
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf (input, "/proc/%d/status", pid);
|
||||
|
||||
f = fopen (input, "r");
|
||||
|
@@ -25,6 +25,11 @@
|
||||
#include <sys/sem.h>
|
||||
|
||||
#ifdef _SEM_SEMUN_UNDEFINED
|
||||
|
||||
/* glibc 2.1 will no longer defines semun, instead it defines
|
||||
* _SEM_SEMUN_UNDEFINED so users can define semun on their own.
|
||||
* Thanks to Albert K T Hui <avatar@deva.net>. */
|
||||
|
||||
union semun
|
||||
{
|
||||
int val;
|
||||
@@ -41,6 +46,14 @@ static unsigned long _glibtop_sysdeps_sem_limits =
|
||||
(1 << GLIBTOP_IPC_SEMUME) + (1 << GLIBTOP_IPC_SEMUSZ) +
|
||||
(1 << GLIBTOP_IPC_SEMVMX) + (1 << GLIBTOP_IPC_SEMAEM);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_sem_limits_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.sem_limits = _glibtop_sysdeps_sem_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
@@ -49,7 +62,7 @@ glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf)
|
||||
struct seminfo seminfo;
|
||||
union semun arg;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_SEM_LIMITS, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_sem_limits));
|
||||
|
||||
|
@@ -29,6 +29,14 @@ static unsigned long _glibtop_sysdeps_shm_limits =
|
||||
(1 << GLIBTOP_IPC_SHMMNI) + (1 << GLIBTOP_IPC_SHMSEG) +
|
||||
(1 << GLIBTOP_IPC_SHMALL);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_shm_limits_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
@@ -36,7 +44,7 @@ glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf)
|
||||
{
|
||||
struct shminfo shminfo;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_SHM_LIMITS, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_shm_limits));
|
||||
|
||||
|
@@ -30,10 +30,18 @@ static unsigned long _glibtop_sysdeps_swap =
|
||||
(1 << GLIBTOP_SWAP_FREE) + (1 << GLIBTOP_SWAP_PAGEIN) +
|
||||
(1 << GLIBTOP_SWAP_PAGEOUT);
|
||||
|
||||
#define FILENAME "/proc/meminfo"
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_swap_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.swap = _glibtop_sysdeps_swap;
|
||||
}
|
||||
|
||||
/* Provides information about swap usage. */
|
||||
|
||||
#define FILENAME "/proc/meminfo"
|
||||
|
||||
void
|
||||
glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
|
||||
{
|
||||
@@ -41,7 +49,7 @@ glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
|
||||
int fd, len;
|
||||
FILE *f;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_SWAP, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_swap));
|
||||
|
||||
|
@@ -26,16 +26,24 @@
|
||||
static unsigned long _glibtop_sysdeps_uptime =
|
||||
(1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME);
|
||||
|
||||
#define FILENAME "/proc/uptime"
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_uptime_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.uptime = _glibtop_sysdeps_uptime;
|
||||
}
|
||||
|
||||
/* Provides uptime and idle time. */
|
||||
|
||||
#define FILENAME "/proc/uptime"
|
||||
|
||||
void
|
||||
glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
glibtop_init_s (&server, 0, 0);
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_UPTIME, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_uptime));
|
||||
|
||||
|
Reference in New Issue
Block a user