renamed all functions implementing features to '__p' (since they need to
* sysdeps/sun4/*.c: renamed all functions implementing features to '__p' (since they need to be SGID kmem on SunOS).
This commit is contained in:
@@ -30,11 +30,13 @@ static const unsigned long _glibtop_sysdeps_cpu =
|
||||
/* Provides information about cpu usage. */
|
||||
|
||||
void
|
||||
glibtop_get_cpu__r (glibtop *server, glibtop_cpu *buf)
|
||||
glibtop_get_cpu__p (glibtop *server, glibtop_cpu *buf)
|
||||
{
|
||||
long cp_time [CPUSTATES], mp_time [NCPU][CPUSTATES];
|
||||
int i;
|
||||
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_cpu));
|
||||
|
||||
/* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */
|
||||
@@ -43,15 +45,17 @@ glibtop_get_cpu__r (glibtop *server, glibtop_cpu *buf)
|
||||
|
||||
/* get the cp_time array */
|
||||
|
||||
(void) _glibtop_getkval (server, _glibtop_nlist [X_CP_TIME].n_value, (int *) cp_time,
|
||||
sizeof (cp_time), _glibtop_nlist [X_CP_TIME].n_name);
|
||||
(void) _glibtop_getkval (server, _glibtop_nlist [X_CP_TIME].n_value,
|
||||
(int *) cp_time, sizeof (cp_time),
|
||||
_glibtop_nlist [X_CP_TIME].n_name);
|
||||
|
||||
#ifdef MULTIPROCESSOR
|
||||
/* get the mp_time array as well */
|
||||
|
||||
if (server->machine.ncpu > 1) {
|
||||
(void) _glibtop_getkval (server, _glibtop_nlist [X_MP_TIME].n_value, (int *) mp_time,
|
||||
sizeof (mp_time), _glibtop_nlist [X_MP_TIME].n_name);
|
||||
(void) _glibtop_getkval (server, _glibtop_nlist [X_MP_TIME].n_value,
|
||||
(int *) mp_time, sizeof (mp_time),
|
||||
_glibtop_nlist [X_MP_TIME].n_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -26,14 +26,16 @@ static glibtop _glibtop_global_server;
|
||||
glibtop *glibtop_global_server = NULL;
|
||||
|
||||
glibtop *
|
||||
glibtop_init__r (glibtop **server)
|
||||
glibtop_init__r (glibtop **server, const unsigned long features,
|
||||
const unsigned flags)
|
||||
{
|
||||
if (*server != NULL)
|
||||
return *server;
|
||||
|
||||
if (glibtop_global_server == NULL) {
|
||||
glibtop_global_server = &_glibtop_global_server;
|
||||
glibtop_open (glibtop_global_server, "glibtop");
|
||||
glibtop_open__r (glibtop_global_server, "glibtop",
|
||||
features, flags);
|
||||
}
|
||||
|
||||
return *server = glibtop_global_server;
|
||||
|
@@ -25,7 +25,9 @@
|
||||
/* Provides load averange. */
|
||||
|
||||
void
|
||||
glibtop_get_loadavg__r (glibtop *server, glibtop_loadavg *buf)
|
||||
glibtop_get_loadavg__p (glibtop *server, glibtop_loadavg *buf)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_loadavg));
|
||||
}
|
||||
|
@@ -33,8 +33,10 @@ static const unsigned long _glibtop_sysdeps_mem =
|
||||
/* Provides information about memory usage. */
|
||||
|
||||
void
|
||||
glibtop_get_mem__r (glibtop *server, glibtop_mem *buf)
|
||||
glibtop_get_mem__p (glibtop *server, glibtop_mem *buf)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_mem));
|
||||
|
||||
/* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */
|
||||
|
@@ -24,7 +24,9 @@
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
glibtop_get_msg_limits__r (glibtop *server, glibtop_msg_limits *buf)
|
||||
glibtop_get_msg_limits__p (glibtop *server, glibtop_msg_limits *buf)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_msg_limits));
|
||||
}
|
||||
|
@@ -57,7 +57,8 @@ struct nlist _glibtop_nlist[] = {
|
||||
/* !!! THIS FUNCTION RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
|
||||
|
||||
void
|
||||
glibtop_open (glibtop *server, const char *program_name)
|
||||
glibtop_open__r (glibtop *server, const char *program_name,
|
||||
const unsigned long features, const unsigned flags)
|
||||
{
|
||||
register int pagesize;
|
||||
|
||||
|
@@ -25,7 +25,7 @@
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_procdata__r (glibtop *server, glibtop_procdata *buf, pid_t pid)
|
||||
glibtop_get_procdata__p (glibtop *server, glibtop_procdata *buf, pid_t pid)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_procdata));
|
||||
}
|
||||
|
@@ -25,8 +25,10 @@
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_kernel__r (glibtop *server, glibtop_proc_kernel *buf,
|
||||
glibtop_get_proc_kernel__p (glibtop *server, glibtop_proc_kernel *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_kernel));
|
||||
}
|
||||
|
@@ -32,8 +32,10 @@
|
||||
* each buf->size big. The total size is stored in buf->total. */
|
||||
|
||||
unsigned *
|
||||
glibtop_get_proclist__r (glibtop *server, glibtop_proclist *buf)
|
||||
glibtop_get_proclist__p (glibtop *server, glibtop_proclist *buf)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proclist));
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -25,8 +25,10 @@
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_mem__r (glibtop *server, glibtop_proc_mem *buf,
|
||||
glibtop_get_proc_mem__p (glibtop *server, glibtop_proc_mem *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_mem));
|
||||
}
|
||||
|
@@ -25,8 +25,10 @@
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_segment__r (glibtop *server, glibtop_proc_segment *buf,
|
||||
glibtop_get_proc_segment__p (glibtop *server, glibtop_proc_segment *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_segment));
|
||||
}
|
||||
|
@@ -25,8 +25,10 @@
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_signal__r (glibtop *server, glibtop_proc_signal *buf,
|
||||
pid_t pid)
|
||||
glibtop_get_proc_signal__p (glibtop *server, glibtop_proc_signal *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_signal));
|
||||
}
|
||||
|
@@ -25,8 +25,10 @@
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_state__r (glibtop *server, glibtop_proc_state *buf,
|
||||
glibtop_get_proc_state__p (glibtop *server, glibtop_proc_state *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_state));
|
||||
}
|
||||
|
@@ -25,8 +25,10 @@
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_time__r (glibtop *server, glibtop_proc_time *buf,
|
||||
pid_t pid)
|
||||
glibtop_get_proc_time__p (glibtop *server, glibtop_proc_time *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_time));
|
||||
}
|
||||
|
@@ -25,8 +25,10 @@
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_uid__r (glibtop *server, glibtop_proc_uid *buf,
|
||||
pid_t pid)
|
||||
glibtop_get_proc_uid__p (glibtop *server, glibtop_proc_uid *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_uid));
|
||||
}
|
||||
|
@@ -24,7 +24,9 @@
|
||||
/* Provides information about sysv sem limits. */
|
||||
|
||||
void
|
||||
glibtop_get_sem_limits__r (glibtop *server, glibtop_sem_limits *buf)
|
||||
glibtop_get_sem_limits__p (glibtop *server, glibtop_sem_limits *buf)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_sem_limits));
|
||||
}
|
||||
|
@@ -24,7 +24,9 @@
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
glibtop_get_shm_limits__r (glibtop *server, glibtop_shm_limits *buf)
|
||||
glibtop_get_shm_limits__p (glibtop *server, glibtop_shm_limits *buf)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_shm_limits));
|
||||
}
|
||||
|
@@ -25,7 +25,9 @@
|
||||
/* Provides information about swap usage. */
|
||||
|
||||
void
|
||||
glibtop_get_swap__r (glibtop *server, glibtop_swap *buf)
|
||||
glibtop_get_swap__p (glibtop *server, glibtop_swap *buf)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_swap));
|
||||
}
|
||||
|
@@ -25,7 +25,9 @@
|
||||
/* Provides uptime and idle time. */
|
||||
|
||||
void
|
||||
glibtop_get_uptime__r (glibtop *server, glibtop_uptime *buf)
|
||||
glibtop_get_uptime__p (glibtop *server, glibtop_uptime *buf)
|
||||
{
|
||||
glibtop_init__r (&server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_uptime));
|
||||
}
|
||||
|
Reference in New Issue
Block a user