Added sysdeps/aix directory that was missing
2002-12-30 Bastien Nocera <hadess@hadess.net> * Added sysdeps/aix directory that was missing
This commit is contained in:
committed by
Bastien Nocera
parent
2661891d6a
commit
ab60fc3dd1
3
sysdeps/aix/ChangeLog
Normal file
3
sysdeps/aix/ChangeLog
Normal file
@@ -0,0 +1,3 @@
|
||||
2002-09-24 Laurent Vivier <Laurent.Vivier@bull.net>
|
||||
|
||||
* Create sysdeps/aix (from stub)
|
23
sysdeps/aix/Makefile.am
Normal file
23
sysdeps/aix/Makefile.am
Normal file
@@ -0,0 +1,23 @@
|
||||
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
INCLUDES = @INCLUDES@
|
||||
|
||||
lib_LTLIBRARIES = libgtop_sysdeps-2.0.la libgtop_sysdeps_suid-2.0.la
|
||||
|
||||
libgtop_sysdeps_2_0_la_SOURCES = siglist.c nosuid.c
|
||||
|
||||
libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
libgtop_sysdeps_suid_2_0_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 procargs.c procmap.c netload.c \
|
||||
ppp.c utils.c utils.h sysinfo.c
|
||||
|
||||
libgtop_sysdeps_suid_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
libgtop_sysdeps_suid_2_0_la_LIBADD = $(top_builddir)/sysdeps/common/libgtop_suid_common-2.0.la $(GLIB_LIBS)
|
||||
|
||||
libgtopinclude_HEADERS = glibtop_server.h glibtop_machine.h glibtop_suid.h
|
||||
|
||||
libgtopincludedir = $(includedir)/libgtop-2.0
|
30
sysdeps/aix/close.c
Normal file
30
sysdeps/aix/close.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <glibtop/close.h>
|
||||
|
||||
/* Closes pipe to gtop server. */
|
||||
|
||||
void
|
||||
glibtop_close_s (glibtop *server)
|
||||
{ }
|
125
sysdeps/aix/cpu.c
Normal file
125
sysdeps/aix/cpu.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/systemcfg.h>
|
||||
#include <sys/sysinfo.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/cpu.h>
|
||||
|
||||
#include <utils.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_cpu =
|
||||
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
|
||||
(1L << GLIBTOP_CPU_SYS) + (1L << GLIBTOP_CPU_IDLE) +
|
||||
(1L << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_FREQUENCY) +
|
||||
(1L << GLIBTOP_XCPU_TOTAL) + (1L << GLIBTOP_XCPU_USER) +
|
||||
(1L << GLIBTOP_XCPU_SYS) + (1L << GLIBTOP_XCPU_IDLE) +
|
||||
(1L << GLIBTOP_XCPU_NICE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_cpu_p (glibtop *server)
|
||||
{
|
||||
off_t result;
|
||||
|
||||
server->ncpu = _system_configuration.ncpus;
|
||||
if (server->ncpu == 1)
|
||||
{
|
||||
server->ncpu = 0; /* means single-processor, see glibtop.h */
|
||||
}
|
||||
|
||||
result = _glibtop_get_kmem_offset(server, "cpuinfo");
|
||||
if (result == -1)
|
||||
{
|
||||
server->sysdeps.cpu = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
server->machine.cpuinfo_offset = result;
|
||||
|
||||
server->machine.cpuinfo = (struct cpuinfo*)calloc(_system_configuration.ncpus, sizeof(struct cpuinfo));
|
||||
|
||||
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
|
||||
}
|
||||
|
||||
/* Provides information about cpu usage. */
|
||||
|
||||
void
|
||||
glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
|
||||
{
|
||||
int result;
|
||||
int cpu;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_CPU), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_cpu));
|
||||
|
||||
result = _glibtop_get_kmem_info(server, server->machine.cpuinfo_offset,
|
||||
server->machine.cpuinfo,
|
||||
_system_configuration.ncpus
|
||||
* sizeof(struct cpuinfo));
|
||||
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read cpuinfo");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->idle = 0;
|
||||
buf->user = 0;
|
||||
buf->sys = 0;
|
||||
buf->nice = 0;
|
||||
for (cpu = 0; cpu < _system_configuration.ncpus; cpu++)
|
||||
{
|
||||
if (cpu < GLIBTOP_NCPU)
|
||||
{
|
||||
buf->xcpu_idle[cpu] =
|
||||
server->machine.cpuinfo[cpu].cpu[CPU_IDLE];
|
||||
buf->xcpu_user[cpu] =
|
||||
server->machine.cpuinfo[cpu].cpu[CPU_USER];
|
||||
buf->xcpu_sys[cpu] =
|
||||
server->machine.cpuinfo[cpu].cpu[CPU_KERNEL];
|
||||
buf->xcpu_nice[cpu] =
|
||||
server->machine.cpuinfo[cpu].cpu[CPU_WAIT];
|
||||
|
||||
buf->xcpu_total[cpu] = buf->xcpu_idle[cpu] +
|
||||
buf->xcpu_user[cpu] +
|
||||
buf->xcpu_sys[cpu] +
|
||||
buf->xcpu_nice[cpu];
|
||||
}
|
||||
|
||||
buf->idle += server->machine.cpuinfo[cpu].cpu[CPU_IDLE];
|
||||
buf->user += server->machine.cpuinfo[cpu].cpu[CPU_USER];
|
||||
buf->sys += server->machine.cpuinfo[cpu].cpu[CPU_KERNEL];
|
||||
buf->nice += server->machine.cpuinfo[cpu].cpu[CPU_WAIT];
|
||||
|
||||
buf->total = buf->idle + buf->user + buf->sys + buf->nice ;
|
||||
}
|
||||
|
||||
buf->frequency = sysconf(_SC_CLK_TCK);
|
||||
buf->flags = _glibtop_sysdeps_cpu;
|
||||
}
|
53
sysdeps/aix/glibtop_machine.h
Normal file
53
sysdeps/aix/glibtop_machine.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, March 1999.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GLIBTOP_MACHINE_H__
|
||||
#define __GLIBTOP_MACHINE_H__
|
||||
|
||||
#include <procinfo.h>
|
||||
|
||||
BEGIN_LIBGTOP_DECLS
|
||||
|
||||
typedef struct _glibtop_machine glibtop_machine;
|
||||
|
||||
struct _glibtop_machine
|
||||
{
|
||||
uid_t uid, euid;
|
||||
gid_t gid, egid;
|
||||
|
||||
int kmem_fd;
|
||||
|
||||
off_t cpuinfo_offset;
|
||||
off_t ifnet_offset;
|
||||
off_t loadavg_offset;
|
||||
off_t shminfo_offset;
|
||||
off_t seminfo_offset;
|
||||
off_t msginfo_offset;
|
||||
|
||||
struct cpuinfo *cpuinfo;
|
||||
struct procsinfo last_pinfo;
|
||||
};
|
||||
|
||||
END_LIBGTOP_DECLS
|
||||
|
||||
#endif /* __GLIBTOP_MACHINE_H__ */
|
52
sysdeps/aix/glibtop_server.h
Normal file
52
sysdeps/aix/glibtop_server.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GLIBTOP_SERVER_H__
|
||||
#define __GLIBTOP_SERVER_H__
|
||||
|
||||
BEGIN_LIBGTOP_DECLS
|
||||
|
||||
#define GLIBTOP_SUID_CPU (1 << GLIBTOP_SYSDEPS_CPU)
|
||||
#define GLIBTOP_SUID_MEM 0
|
||||
#define GLIBTOP_SUID_SWAP 0
|
||||
#define GLIBTOP_SUID_UPTIME (1 << GLIBTOP_SYSDEPS_UPTIME)
|
||||
#define GLIBTOP_SUID_LOADAVG (1 << GLIBTOP_SYSDEPS_LOADAVG)
|
||||
#define GLIBTOP_SUID_SHM_LIMITS (1 << GLIBTOP_SYSDEPS_SHM_LIMITS)
|
||||
#define GLIBTOP_SUID_MSG_LIMITS (1 << GLIBTOP_SYSDEPS_MSG_LIMITS)
|
||||
#define GLIBTOP_SUID_SEM_LIMITS (1 << GLIBTOP_SYSDEPS_SEM_LIMITS)
|
||||
#define GLIBTOP_SUID_PROCLIST 0
|
||||
#define GLIBTOP_SUID_PROC_STATE 0
|
||||
#define GLIBTOP_SUID_PROC_UID 0
|
||||
#define GLIBTOP_SUID_PROC_MEM 0
|
||||
#define GLIBTOP_SUID_PROC_TIME 0
|
||||
#define GLIBTOP_SUID_PROC_SIGNAL 0
|
||||
#define GLIBTOP_SUID_PROC_KERNEL 0
|
||||
#define GLIBTOP_SUID_PROC_SEGMENT 0
|
||||
#define GLIBTOP_SUID_PROC_ARGS 0
|
||||
#define GLIBTOP_SUID_PROC_MAP 0
|
||||
#define GLIBTOP_SUID_NETLOAD (1 << GLIBTOP_SYSDEPS_NETLOAD)
|
||||
#define GLIBTOP_SUID_PPP 0
|
||||
|
||||
END_LIBGTOP_DECLS
|
||||
|
||||
#endif
|
52
sysdeps/aix/glibtop_suid.h
Normal file
52
sysdeps/aix/glibtop_suid.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GLIBTOP_SUID_H__
|
||||
#define __GLIBTOP_SUID_H__
|
||||
|
||||
BEGIN_LIBGTOP_DECLS
|
||||
|
||||
#if _IN_LIBGTOP
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
static inline void glibtop_suid_enter (glibtop *server) {
|
||||
setegid (server->machine.egid);
|
||||
}
|
||||
|
||||
static inline void glibtop_suid_leave (glibtop *server) {
|
||||
if (setegid (server->machine.gid))
|
||||
_exit (1);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_init_p (glibtop *server, const unsigned long features,
|
||||
const unsigned flags);
|
||||
void
|
||||
glibtop_open_p (glibtop *server, const char *program_name,
|
||||
const unsigned long features,
|
||||
const unsigned flags);
|
||||
|
||||
END_LIBGTOP_DECLS
|
||||
|
||||
#endif
|
78
sysdeps/aix/loadavg.c
Normal file
78
sysdeps/aix/loadavg.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <nlist.h>
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/loadavg.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_loadavg =
|
||||
(1 << GLIBTOP_LOADAVG_LOADAVG);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_loadavg_p (glibtop *server)
|
||||
{
|
||||
int result;
|
||||
|
||||
result = _glibtop_get_kmem_offset(server, "avenrun");
|
||||
if (result == -1)
|
||||
{
|
||||
server->sysdeps.loadavg = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
server->machine.loadavg_offset = result;
|
||||
|
||||
server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
|
||||
}
|
||||
|
||||
/* Provides load averange. */
|
||||
|
||||
void
|
||||
glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf)
|
||||
{
|
||||
int result;
|
||||
int loadavg[3];
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_LOADAVG), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_loadavg));
|
||||
|
||||
result = _glibtop_get_kmem_info(server, server->machine.loadavg_offset,
|
||||
loadavg, sizeof(loadavg));
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read loadavg");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->loadavg[0] = loadavg[0] / 65536.0;
|
||||
buf->loadavg[1] = loadavg[1] / 65536.0;
|
||||
buf->loadavg[2] = loadavg[2] / 65536.0;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_loadavg;
|
||||
}
|
76
sysdeps/aix/mem.c
Normal file
76
sysdeps/aix/mem.c
Normal file
@@ -0,0 +1,76 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/vminfo.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/mem.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_mem =
|
||||
(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) +
|
||||
(1 << GLIBTOP_MEM_FREE) + (1 << GLIBTOP_MEM_LOCKED);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_mem_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.mem = _glibtop_sysdeps_mem;
|
||||
}
|
||||
|
||||
/* Provides information about memory usage. */
|
||||
|
||||
void
|
||||
glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
|
||||
{
|
||||
struct vminfo vminfo;
|
||||
int pagesize;
|
||||
int result;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_mem));
|
||||
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
|
||||
#ifdef HAVE_VMGETINFO
|
||||
result = vmgetinfo((void*)&vminfo, VMINFO, sizeof(vminfo));
|
||||
#else
|
||||
result = _glibtop_vmgetinfo((void*)&vminfo, VMINFO, sizeof(vminfo));
|
||||
#endif
|
||||
if (result == -1)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read vminfo");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
buf->total = vminfo.memsizepgs * pagesize;
|
||||
buf->used = (vminfo.numwseguse + vminfo.numpseguse +
|
||||
vminfo.numclseguse) * pagesize;
|
||||
buf->free = vminfo.numfrb * pagesize;
|
||||
buf->locked = (vminfo.numwsegpin + vminfo.numpsegpin +
|
||||
vminfo.numclsegpin) * pagesize;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_mem;
|
||||
}
|
81
sysdeps/aix/msg_limits.c
Normal file
81
sysdeps/aix/msg_limits.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <sys/msg.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/msg_limits.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_msg_limits =
|
||||
(1 << GLIBTOP_IPC_MSGMAX) + (1 << GLIBTOP_IPC_MSGMNB) +
|
||||
(1 << GLIBTOP_IPC_MSGMNI) + (1 << GLIBTOP_IPC_MSGTQL);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_msg_limits_p (glibtop *server)
|
||||
{
|
||||
off_t result;
|
||||
|
||||
result = _glibtop_get_kmem_offset(server, "msginfo");
|
||||
if (result <= 0)
|
||||
{
|
||||
server->sysdeps.sem_limits = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
server->machine.msginfo_offset = result;
|
||||
|
||||
server->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
|
||||
{
|
||||
int result;
|
||||
struct msginfo msginfo;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_msg_limits));
|
||||
|
||||
result = _glibtop_get_kmem_info(server, server->machine.msginfo_offset,
|
||||
&msginfo, sizeof(msginfo));
|
||||
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read seminfo");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
buf->msgmax = msginfo.msgmax;
|
||||
buf->msgmnb = msginfo.msgmnb;
|
||||
buf->msgmni = msginfo.msgmni;
|
||||
buf->msgtql = msginfo.msgmnm;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_msg_limits;
|
||||
}
|
207
sysdeps/aix/netload.c
Normal file
207
sysdeps/aix/netload.c
Normal file
@@ -0,0 +1,207 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, October 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/netload.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_netload =
|
||||
(1 << GLIBTOP_NETLOAD_IF_FLAGS) + (1 << GLIBTOP_NETLOAD_MTU) +
|
||||
(1 << GLIBTOP_NETLOAD_SUBNET) + (1 << GLIBTOP_NETLOAD_ADDRESS) +
|
||||
(1 << GLIBTOP_NETLOAD_PACKETS_IN) + (1 << GLIBTOP_NETLOAD_PACKETS_OUT) +
|
||||
(1 << GLIBTOP_NETLOAD_PACKETS_TOTAL) + (1 << GLIBTOP_NETLOAD_BYTES_IN) +
|
||||
(1 << GLIBTOP_NETLOAD_BYTES_OUT) + (1 << GLIBTOP_NETLOAD_BYTES_TOTAL) +
|
||||
(1 << GLIBTOP_NETLOAD_ERRORS_IN) + (1 << GLIBTOP_NETLOAD_ERRORS_OUT) +
|
||||
(1 << GLIBTOP_NETLOAD_ERRORS_TOTAL) + (1 << GLIBTOP_NETLOAD_COLLISIONS);
|
||||
|
||||
static void get_ifaddr(glibtop* server, struct ifaddr* next, long* addr, long* mask)
|
||||
{
|
||||
struct ifaddr ifaddr;
|
||||
struct sockaddr_in sockaddr;
|
||||
|
||||
*addr = 0;
|
||||
*mask = 0;
|
||||
|
||||
while (next)
|
||||
{
|
||||
/* get interface ifaddr structure */
|
||||
|
||||
_glibtop_get_kmem_info(server, (off_t)next, &ifaddr, sizeof(ifaddr));
|
||||
|
||||
/* get socket addr information */
|
||||
|
||||
_glibtop_get_kmem_info( server, (off_t)ifaddr.ifa_addr
|
||||
, &sockaddr, sizeof(sockaddr));
|
||||
|
||||
/* if valid family : UDP, TCP, ...*/
|
||||
|
||||
if (sockaddr.sin_family == AF_INET)
|
||||
{
|
||||
*addr = sockaddr.sin_addr.s_addr;
|
||||
|
||||
_glibtop_get_kmem_info( server, (off_t)ifaddr.ifa_netmask
|
||||
, &sockaddr, sizeof(sockaddr));
|
||||
|
||||
*mask = sockaddr.sin_addr.s_addr;
|
||||
|
||||
/* address found */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
next = ifaddr.ifa_next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_netload_p (glibtop *server)
|
||||
{
|
||||
off_t result;
|
||||
off_t addr;
|
||||
|
||||
result = _glibtop_get_kmem_offset(server, "ifnet");
|
||||
if (result <= 0)
|
||||
{
|
||||
server->sysdeps.netload = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
result = _glibtop_get_kmem_info(server, result, &addr, sizeof(addr));
|
||||
if (result <= 0)
|
||||
{
|
||||
server->sysdeps.netload = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
server->machine.ifnet_offset = addr;
|
||||
|
||||
server->sysdeps.netload = _glibtop_sysdeps_netload;
|
||||
}
|
||||
|
||||
/* Provides network statistics. */
|
||||
|
||||
void
|
||||
glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
|
||||
const char *interface)
|
||||
{
|
||||
int result;
|
||||
off_t offset;
|
||||
struct ifnet ifnet;
|
||||
long addr;
|
||||
long mask;
|
||||
char name[16];
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_netload));
|
||||
|
||||
for ( offset = server->machine.ifnet_offset;
|
||||
offset != 0;
|
||||
offset = (off_t)ifnet.if_next
|
||||
)
|
||||
{
|
||||
result = _glibtop_get_kmem_info(server, offset,
|
||||
&ifnet, sizeof(ifnet));
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read ifnet");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
result = _glibtop_get_kmem_info(server, (off_t)ifnet.if_name,
|
||||
name, sizeof(name));
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read if_name");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(name+strlen(name), "%d", ifnet.if_unit);
|
||||
if (strcmp(name, interface) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ifnet.if_flags & IFF_UP)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_UP);
|
||||
if (ifnet.if_flags & IFF_BROADCAST)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_BROADCAST);
|
||||
if (ifnet.if_flags & IFF_LOOPBACK)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_LOOPBACK);
|
||||
if (ifnet.if_flags & IFF_POINTOPOINT)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_POINTOPOINT);
|
||||
if (ifnet.if_flags & IFF_RUNNING)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_RUNNING);
|
||||
if (ifnet.if_flags & IFF_NOARP)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_NOARP);
|
||||
if (ifnet.if_flags & IFF_PROMISC)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_PROMISC);
|
||||
if (ifnet.if_flags & IFF_ALLMULTI)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_ALLMULTI);
|
||||
if (ifnet.if_flags & IFF_OACTIVE)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_OACTIVE);
|
||||
if (ifnet.if_flags & IFF_SIMPLEX)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_SIMPLEX);
|
||||
if (ifnet.if_flags & IFF_LINK0)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_LINK0);
|
||||
if (ifnet.if_flags & IFF_LINK1)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_LINK1);
|
||||
if (ifnet.if_flags & IFF_LINK2)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_LINK2);
|
||||
if (ifnet.if_flags & IFF_LINK2)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_LINK2);
|
||||
if (ifnet.if_flags & 0x80000)
|
||||
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_MULTICAST);
|
||||
|
||||
buf->mtu = ifnet.if_mtu;
|
||||
|
||||
get_ifaddr(server, ifnet.if_addrlist, &addr, &mask);
|
||||
|
||||
buf->subnet = addr & mask;
|
||||
buf->address = addr;
|
||||
|
||||
buf->packets_in = ifnet.if_ipackets;
|
||||
buf->packets_out = ifnet.if_opackets;
|
||||
buf->packets_total = buf->packets_in + buf->packets_out;
|
||||
|
||||
buf->bytes_in = ifnet.if_ibytes;
|
||||
buf->bytes_out = ifnet.if_obytes;
|
||||
buf->bytes_total = buf->bytes_in + buf->bytes_out;
|
||||
|
||||
buf->errors_in = ifnet.if_ierrors;
|
||||
buf->errors_out = ifnet.if_oerrors;
|
||||
buf->errors_total = ifnet.if_ierrors + ifnet.if_oerrors;
|
||||
|
||||
buf->collisions = ifnet.if_collisions;
|
||||
}
|
||||
|
||||
buf->flags = _glibtop_sysdeps_netload;
|
||||
}
|
46
sysdeps/aix/nosuid.c
Normal file
46
sysdeps/aix/nosuid.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <sys/systemcfg.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/open.h>
|
||||
#include <glibtop/close.h>
|
||||
|
||||
void
|
||||
glibtop_open_s (glibtop *server,
|
||||
const char *program_name,
|
||||
const unsigned long features,
|
||||
const unsigned flags)
|
||||
{
|
||||
server->ncpu = _system_configuration.ncpus;
|
||||
|
||||
if (server->ncpu == 1)
|
||||
{
|
||||
server->ncpu = 0; /* means single-processor, see glibtop.h */
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_close_s (glibtop *server)
|
||||
{ }
|
82
sysdeps/aix/open.c
Normal file
82
sysdeps/aix/open.c
Normal file
@@ -0,0 +1,82 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/open.h>
|
||||
|
||||
#include "glibtop_suid.h"
|
||||
|
||||
/* !!! THIS FUNCTION RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
|
||||
|
||||
void
|
||||
glibtop_init_p (glibtop *server, const unsigned long features,
|
||||
const unsigned flags)
|
||||
{
|
||||
glibtop_init_func_t *init_fkt;
|
||||
|
||||
if (server == NULL)
|
||||
glibtop_error_r (NULL, "glibtop_init_p (server == NULL)");
|
||||
|
||||
if ((server->flags & _GLIBTOP_INIT_STATE_SYSDEPS) == 0) {
|
||||
glibtop_open_p (server, "glibtop", features, flags);
|
||||
|
||||
for (init_fkt = _glibtop_init_hook_p; *init_fkt; init_fkt++)
|
||||
(*init_fkt) (server);
|
||||
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
|
||||
}
|
||||
}
|
||||
|
||||
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
|
||||
|
||||
void
|
||||
glibtop_open_p (glibtop *server, const char *program_name,
|
||||
const unsigned long features, const unsigned flags)
|
||||
{
|
||||
/* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */
|
||||
|
||||
server->machine.uid = getuid ();
|
||||
server->machine.euid = geteuid ();
|
||||
server->machine.gid = getgid ();
|
||||
server->machine.egid = getegid ();
|
||||
|
||||
/* open kmem */
|
||||
|
||||
server->machine.kmem_fd = open("/dev/kmem", O_RDONLY);
|
||||
if (server->machine.kmem_fd == -1)
|
||||
glibtop_error_io_r (server, "Cannot open /dev/kmem");
|
||||
|
||||
/* Drop priviledges. */
|
||||
|
||||
if (seteuid (server->machine.uid))
|
||||
_exit (1);
|
||||
|
||||
if (setegid (server->machine.gid))
|
||||
_exit (1);
|
||||
|
||||
/* !!! END OF SUID ROOT PART !!! */
|
||||
|
||||
server->name = program_name;
|
||||
}
|
44
sysdeps/aix/ppp.c
Normal file
44
sysdeps/aix/ppp.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, October 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. 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/ppp.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_ppp = 0;
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_ppp_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.ppp = _glibtop_sysdeps_ppp;
|
||||
}
|
||||
|
||||
/* Provides PPP/ISDN information. */
|
||||
|
||||
void
|
||||
glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_ppp));
|
||||
}
|
132
sysdeps/aix/procargs.c
Normal file
132
sysdeps/aix/procargs.c
Normal file
@@ -0,0 +1,132 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <procinfo.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
#include <glibtop/procargs.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_args =
|
||||
(1 << GLIBTOP_PROC_ARGS_SIZE);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_args_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
static void _glibtop_remove_non_ascii(char* string)
|
||||
{
|
||||
for (;*string != 0;string++)
|
||||
{
|
||||
if (!isascii(*string))
|
||||
*string = '?';
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
|
||||
pid_t pid, unsigned max_len)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
char *args_buffer;
|
||||
char* args = NULL;
|
||||
int size;
|
||||
int result;
|
||||
int len;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_args));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read procsinfo");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size = max_len != 0 ? max_len : 4096;
|
||||
args_buffer = glibtop_malloc_r (server, size);
|
||||
if (args_buffer == NULL)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot malloc procsinfo");
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
result = getargs(pinfo, sizeof(struct procsinfo), args_buffer, size);
|
||||
if (result == -1)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot malloc getargs");
|
||||
|
||||
glibtop_free_r(server, args_buffer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* look if empty string */
|
||||
|
||||
if (args_buffer[0] == 0)
|
||||
{
|
||||
glibtop_free_r(server, args_buffer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* compute length of args and realloc */
|
||||
|
||||
len = 0;
|
||||
while ((args_buffer[len] != 0) && (len < size))
|
||||
{
|
||||
_glibtop_remove_non_ascii(args_buffer + len);
|
||||
|
||||
len += strlen(args_buffer + len) + 1;
|
||||
}
|
||||
|
||||
args = glibtop_malloc_r (server, len);
|
||||
if (args == NULL)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot malloc procsinfo");
|
||||
|
||||
glibtop_free_r(server, args_buffer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
memcpy(args, args_buffer, len);
|
||||
glibtop_free_r(server, args_buffer);
|
||||
|
||||
buf->size = len - 1;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_args;
|
||||
|
||||
return args;
|
||||
}
|
98
sysdeps/aix/prockernel.c
Normal file
98
sysdeps/aix/prockernel.c
Normal file
@@ -0,0 +1,98 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <procinfo.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/prockernel.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_kernel =
|
||||
(1 <<GLIBTOP_PROC_KERNEL_MIN_FLT) + (1 <<GLIBTOP_PROC_KERNEL_MAJ_FLT) +
|
||||
(1 <<GLIBTOP_PROC_KERNEL_CMIN_FLT) + (1 <<GLIBTOP_PROC_KERNEL_CMAJ_FLT) +
|
||||
(1 <<GLIBTOP_PROC_KERNEL_KSTK_ESP) + (1 <<GLIBTOP_PROC_KERNEL_KSTK_EIP) +
|
||||
(1 <<GLIBTOP_PROC_KERNEL_NWCHAN);
|
||||
|
||||
|
||||
|
||||
/* 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
|
||||
glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct thrdsinfo thinfo;
|
||||
struct procsinfo *pinfo;
|
||||
tid_t thid;
|
||||
int result;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_kernel));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL)
|
||||
{
|
||||
glibtop_error_io_r(server, "Cannot read procsinfo");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(pinfo->pi_flags | SKPROC))
|
||||
{
|
||||
/* not a kernel process */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
buf->min_flt = pinfo->pi_ru.ru_minflt;
|
||||
buf->maj_flt = pinfo->pi_ru.ru_majflt;
|
||||
|
||||
buf->cmin_flt = pinfo->pi_cru.ru_minflt;
|
||||
buf->cmaj_flt = pinfo->pi_cru.ru_majflt;
|
||||
|
||||
thid = 0;
|
||||
result = getthrds(pid, &thinfo, sizeof(thinfo), &thid, 1);
|
||||
if (result != 1)
|
||||
{
|
||||
glibtop_error_io_r(server, "Cannot read thrdsinfo");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
buf->kstk_esp = thinfo.ti_ustk;
|
||||
buf->kstk_eip = thinfo.ti_code;
|
||||
|
||||
buf->nwchan = thinfo.ti_wchan;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_kernel;
|
||||
}
|
247
sysdeps/aix/proclist.c
Normal file
247
sysdeps/aix/proclist.c
Normal file
@@ -0,0 +1,247 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <procinfo.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
#include <glibtop/proclist.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proclist =
|
||||
(1 << GLIBTOP_PROCLIST_NUMBER) + (1 << GLIBTOP_PROCLIST_TOTAL) +
|
||||
(1 << GLIBTOP_PROCLIST_SIZE);
|
||||
|
||||
#define BLOCK_COUNT 256
|
||||
#define BLOCK_SIZE (BLOCK_COUNT * sizeof (unsigned int))
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proclist_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proclist = _glibtop_sysdeps_proclist;
|
||||
}
|
||||
|
||||
/* Fetch list of currently running processes.
|
||||
*
|
||||
* IMPORTANT NOTE:
|
||||
* On error, this function MUST return NULL and set buf->flags to zero !
|
||||
* On success, it returnes a pointer to a list of buf->number elements
|
||||
* each buf->size big. The total size is stored in buf->total. */
|
||||
|
||||
unsigned *
|
||||
glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
|
||||
int64_t which, int64_t arg)
|
||||
{
|
||||
struct procsinfo pinfo;
|
||||
int count, total;
|
||||
unsigned pids [BLOCK_COUNT], *pids_chain = NULL;
|
||||
int pids_size = 0, pids_offset = 0, new_size;
|
||||
pid_t current;
|
||||
int result;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proclist));
|
||||
|
||||
for( count = total = 0, current = 0
|
||||
, result = getprocs(&pinfo, sizeof(pinfo), NULL, 0, ¤t, 1);
|
||||
result == 1;
|
||||
result = getprocs(&pinfo, sizeof(pinfo), NULL, 0, ¤t, 1))
|
||||
{
|
||||
if (which & GLIBTOP_EXCLUDE_IDLE)
|
||||
{
|
||||
if (pinfo.pi_state & SIDL)
|
||||
{
|
||||
/* exclude idle processes */
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (which & GLIBTOP_EXCLUDE_SYSTEM)
|
||||
{
|
||||
if (pinfo.pi_flags & SKPROC)
|
||||
{
|
||||
/* exclude Kernel processes */
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (which & GLIBTOP_EXCLUDE_NOTTY)
|
||||
{
|
||||
if (!pinfo.pi_ttyp)
|
||||
{
|
||||
/* exclude processes without tty */
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
switch(which & GLIBTOP_KERN_PROC_MASK)
|
||||
{
|
||||
case GLIBTOP_KERN_PROC_ALL:
|
||||
|
||||
/* return information about all processes
|
||||
* so, let's go ahead
|
||||
*/
|
||||
|
||||
break;
|
||||
|
||||
case GLIBTOP_KERN_PROC_PID:
|
||||
|
||||
/* return information about all processes with
|
||||
* pid passed in arg
|
||||
*/
|
||||
|
||||
if (pinfo.pi_pid != arg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GLIBTOP_KERN_PROC_PGRP:
|
||||
|
||||
/* return information about all processes in
|
||||
* process group passed in arg
|
||||
*/
|
||||
|
||||
if (pinfo.pi_pgrp != arg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GLIBTOP_KERN_PROC_SESSION:
|
||||
|
||||
/* return information about all processes in
|
||||
* session passed in arg
|
||||
*/
|
||||
|
||||
if (pinfo.pi_sid != arg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GLIBTOP_KERN_PROC_TTY:
|
||||
|
||||
/* return information about all processes with
|
||||
* tty device number passed in arg
|
||||
*/
|
||||
|
||||
if (pinfo.pi_ttyd != arg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GLIBTOP_KERN_PROC_UID:
|
||||
|
||||
/* return information about all processes with
|
||||
* effective uid passed in arg
|
||||
*/
|
||||
|
||||
if (pinfo.pi_cred.cr_uid != arg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GLIBTOP_KERN_PROC_RUID:
|
||||
|
||||
/* return information about all processes with
|
||||
* real uid passed in arg
|
||||
*/
|
||||
|
||||
if (pinfo.pi_cred.cr_ruid != arg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
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. */
|
||||
|
||||
new_size = pids_size + BLOCK_SIZE;
|
||||
|
||||
pids_chain = glibtop_realloc_r
|
||||
(server, pids_chain, new_size);
|
||||
memcpy (pids_chain + pids_offset, pids, BLOCK_SIZE);
|
||||
|
||||
pids_size = new_size;
|
||||
pids_offset += BLOCK_COUNT;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
/* pids is now big enough to hold at least one single pid. */
|
||||
|
||||
pids[count++] = pinfo.pi_pid;
|
||||
|
||||
total++;
|
||||
}
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
glibtop_error_io_r(server, "Cannot read procsinfo");
|
||||
}
|
||||
|
||||
/* count is only zero if an error occured (one a running Linux system,
|
||||
* we have at least one single process). */
|
||||
|
||||
if (!count) return NULL;
|
||||
|
||||
/* 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 + count * sizeof (unsigned);
|
||||
|
||||
pids_chain = glibtop_realloc_r (server, pids_chain, new_size);
|
||||
|
||||
memcpy (pids_chain + pids_offset, pids, count * sizeof (unsigned));
|
||||
|
||||
pids_size = new_size;
|
||||
|
||||
/* Since everything is ok now, we can set buf->flags, fill in the
|
||||
* remaining fields and return the `pids_chain'. */
|
||||
|
||||
buf->size = sizeof(unsigned int);
|
||||
buf->number = total;
|
||||
buf->total = total * buf->size;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proclist;
|
||||
|
||||
return pids_chain;
|
||||
}
|
50
sysdeps/aix/procmap.c
Normal file
50
sysdeps/aix/procmap.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. 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_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
glibtop_map_entry *
|
||||
glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
|
||||
{
|
||||
glibtop_init_p (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_map));
|
||||
|
||||
return NULL;
|
||||
}
|
73
sysdeps/aix/procmem.c
Normal file
73
sysdeps/aix/procmem.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/vminfo.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/procmem.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_mem =
|
||||
(1 << GLIBTOP_PROC_MEM_SIZE) + (1 << GLIBTOP_PROC_MEM_VSIZE) +
|
||||
(1 << GLIBTOP_PROC_MEM_RESIDENT) + (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
|
||||
glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
int pagesize;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_mem));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read procsinfo");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
|
||||
buf->vsize = buf->size = pinfo->pi_size * pagesize;
|
||||
buf->resident = buf->rss = (pinfo->pi_drss + pinfo->pi_trss) * pagesize;
|
||||
buf->rss_rlim = pinfo->pi_rlimit[RLIMIT_RSS].rlim_cur;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_mem;
|
||||
}
|
74
sysdeps/aix/procsegment.c
Normal file
74
sysdeps/aix/procsegment.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/vminfo.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/procsegment.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_segment =
|
||||
(1 << GLIBTOP_PROC_SEGMENT_TEXT_RSS) + (1 << GLIBTOP_PROC_SEGMENT_SHLIB_RSS) +
|
||||
(1 << GLIBTOP_PROC_SEGMENT_DATA_RSS) + (1 << GLIBTOP_PROC_SEGMENT_STACK_RSS);
|
||||
|
||||
|
||||
/* 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
|
||||
glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
int pagesize;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_segment));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read procsinfo");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
|
||||
buf->text_rss = pinfo->pi_trss * pagesize;
|
||||
buf->data_rss = pinfo->pi_drss * pagesize;
|
||||
buf->shlib_rss = pinfo->pi_ru.ru_ixrss * pagesize;
|
||||
buf->stack_rss = pinfo->pi_ru.ru_isrss * pagesize;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_segment;
|
||||
}
|
89
sysdeps/aix/procsignal.c
Normal file
89
sysdeps/aix/procsignal.c
Normal file
@@ -0,0 +1,89 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C)) +998-99 Martin Baulig
|
||||
This file is part of LibGTop) +.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April) +998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version) + of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite) +30,
|
||||
Boston, MA) +2111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/vminfo.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/signal.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/procsignal.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
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
|
||||
glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
int i;
|
||||
long bit;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_signal));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read procsinfo");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* pending signals */
|
||||
|
||||
#define NB_BITS (8 * sizeof(u_int64_t))
|
||||
|
||||
for (i = 0; (i < NSIG) && (i < 2 * NB_BITS); i++)
|
||||
{
|
||||
bit = 1 << (NB_BITS - 1 - (i % NB_BITS));
|
||||
|
||||
if (sigismember(&pinfo->pi_sig, i))
|
||||
buf->signal[i / NB_BITS] |= bit;
|
||||
|
||||
if (pinfo->pi_signal[i] == (long)SIG_HOLD)
|
||||
buf->blocked[i / NB_BITS] |= bit;
|
||||
|
||||
if (pinfo->pi_signal[i] == (long)SIG_IGN)
|
||||
buf->sigignore[i / NB_BITS] |= bit;
|
||||
|
||||
if (pinfo->pi_signal[i] == (long)SIG_CATCH)
|
||||
buf->sigcatch[i / NB_BITS] |= bit;
|
||||
}
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_signal;
|
||||
}
|
127
sysdeps/aix/procstate.c
Normal file
127
sysdeps/aix/procstate.c
Normal file
@@ -0,0 +1,127 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <procinfo.h>
|
||||
#include <sys/thread.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/procstate.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
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
|
||||
glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
struct thrdsinfo thinfo;
|
||||
tid_t thid;
|
||||
int result;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_state));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL)
|
||||
{
|
||||
glibtop_error_io_r(server, "Cannot read procsinfo");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (pinfo->pi_pid == 0)
|
||||
{
|
||||
strcpy(buf->cmd, "swapper");
|
||||
}
|
||||
|
||||
if (pinfo->pi_comm[0] == 0)
|
||||
{
|
||||
strcpy(buf->cmd, "<unknown>");
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(buf->cmd, pinfo->pi_comm, 39);
|
||||
}
|
||||
|
||||
buf->uid = pinfo->pi_uid;
|
||||
buf->gid = pinfo->pi_cred.cr_gid;
|
||||
|
||||
if (pinfo->pi_state == SZOMB)
|
||||
{
|
||||
buf->state = 'Z';
|
||||
strcpy(buf->cmd, "<defunct>");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* get state of first thread */
|
||||
|
||||
thid = 0;
|
||||
result = getthrds(pid, &thinfo, sizeof(thinfo), &thid, 1);
|
||||
if (result != 1)
|
||||
{
|
||||
glibtop_error_io_r(server, "Cannot read threadinfo");
|
||||
}
|
||||
|
||||
switch (thinfo.ti_state)
|
||||
{
|
||||
case TSIDL:
|
||||
buf->state = 'D';
|
||||
break;
|
||||
case TSRUN:
|
||||
buf->state = 'R';
|
||||
break;
|
||||
case TSSLEEP:
|
||||
buf->state = 'S';
|
||||
break;
|
||||
case TSZOMB:
|
||||
buf->state = 'Z';
|
||||
strcpy(buf->cmd, "<defunct>");
|
||||
break;
|
||||
case TSSTOP:
|
||||
buf->state = 'T';
|
||||
break;
|
||||
case TSSWAP:
|
||||
buf->state = 'W';
|
||||
break;
|
||||
default:
|
||||
buf->state = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_state;
|
||||
}
|
72
sysdeps/aix/proctime.c
Normal file
72
sysdeps/aix/proctime.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/proctime.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_time =
|
||||
(1 << GLIBTOP_PROC_TIME_START_TIME) + (1 << GLIBTOP_PROC_TIME_RTIME) +
|
||||
(1 << GLIBTOP_PROC_TIME_UTIME) + (1 << GLIBTOP_PROC_TIME_STIME) +
|
||||
(1 << GLIBTOP_PROC_TIME_CUTIME) + (1 << GLIBTOP_PROC_TIME_CSTIME) +
|
||||
(1 << GLIBTOP_PROC_TIME_FREQUENCY);
|
||||
|
||||
/* 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
|
||||
glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_time));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read procsinfo");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->start_time = pinfo->pi_start;
|
||||
buf->utime = pinfo->pi_ru.ru_utime.tv_sec + (double)pinfo->pi_ru.ru_utime.tv_usec/1000000.0;
|
||||
buf->stime = pinfo->pi_ru.ru_stime.tv_sec + (double)pinfo->pi_ru.ru_stime.tv_usec/1000000.0;
|
||||
buf->rtime = buf->utime + buf->stime;
|
||||
buf->cutime = pinfo->pi_cru.ru_utime.tv_sec + (double)pinfo->pi_cru.ru_utime.tv_usec/1000000.0;
|
||||
buf->cstime = pinfo->pi_cru.ru_stime.tv_sec + (double)pinfo->pi_cru.ru_stime.tv_usec/1000000.0;
|
||||
buf->frequency = sysconf(_SC_CLK_TCK);
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_time;
|
||||
}
|
101
sysdeps/aix/procuid.c
Normal file
101
sysdeps/aix/procuid.c
Normal file
@@ -0,0 +1,101 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/vminfo.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/procuid.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_uid =
|
||||
(1 << GLIBTOP_PROC_UID_UID) + (1 << GLIBTOP_PROC_UID_EUID) +
|
||||
(1 << GLIBTOP_PROC_UID_GID) + (1 << GLIBTOP_PROC_UID_EGID) +
|
||||
(1 << GLIBTOP_PROC_UID_PID) + (1 << GLIBTOP_PROC_UID_PPID) +
|
||||
(1 << GLIBTOP_PROC_UID_PGRP) + (1 << GLIBTOP_PROC_UID_SESSION) +
|
||||
(1 << GLIBTOP_PROC_UID_TTY) + (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;
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
void
|
||||
glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
struct procsinfo *pinfo;
|
||||
struct thrdsinfo thinfo;
|
||||
tid_t thid;
|
||||
int result;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_uid));
|
||||
|
||||
pinfo = _glibtop_get_procinfo(server, pid);
|
||||
if (pinfo == NULL)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read procsinfo");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
buf->uid = pinfo->pi_cred.cr_ruid;
|
||||
buf->euid = pinfo->pi_cred.cr_uid;
|
||||
buf->gid = pinfo->pi_cred.cr_rgid;
|
||||
buf->egid = pinfo->pi_cred.cr_gid;
|
||||
|
||||
buf->pid = pinfo->pi_pid;
|
||||
buf->ppid = pinfo->pi_ppid;
|
||||
|
||||
buf->pgrp = pinfo->pi_pgrp;
|
||||
buf->session = pinfo->pi_sid;
|
||||
|
||||
buf->tty = pinfo->pi_ttyd;
|
||||
|
||||
buf->nice = pinfo->pi_nice;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_proc_uid;
|
||||
|
||||
thid = 0;
|
||||
result = getthrds(pid, &thinfo, sizeof(thinfo), &thid, 1);
|
||||
if (result != 1)
|
||||
{
|
||||
buf->flags &= ~(1 << GLIBTOP_PROC_UID_PRIORITY);
|
||||
|
||||
glibtop_error_io_r(server, "Cannot read thrdsinfo");
|
||||
}
|
||||
|
||||
/* priority of first thread */
|
||||
|
||||
buf->priority = thinfo.ti_pri;
|
||||
}
|
86
sysdeps/aix/sem_limits.c
Normal file
86
sysdeps/aix/sem_limits.c
Normal file
@@ -0,0 +1,86 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/sem_limits.h>
|
||||
#include <glibtop/error.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_sem_limits =
|
||||
(1 << GLIBTOP_IPC_SEMMNI) + (1 << GLIBTOP_IPC_SEMMSL) +
|
||||
(1 << GLIBTOP_IPC_SEMOPM) + (1 << GLIBTOP_IPC_SEMUME) +
|
||||
(1 << GLIBTOP_IPC_SEMUSZ) + (1 << GLIBTOP_IPC_SEMVMX) +
|
||||
(1 << GLIBTOP_IPC_SEMAEM);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_sem_limits_p (glibtop *server)
|
||||
{
|
||||
off_t result;
|
||||
|
||||
result = _glibtop_get_kmem_offset(server, "seminfo");
|
||||
if (result <= 0)
|
||||
{
|
||||
server->sysdeps.sem_limits = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
server->machine.seminfo_offset = result;
|
||||
|
||||
server->sysdeps.sem_limits = _glibtop_sysdeps_sem_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv sem limits. */
|
||||
|
||||
void
|
||||
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
|
||||
{
|
||||
int result;
|
||||
struct seminfo seminfo;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_sem_limits));
|
||||
|
||||
result = _glibtop_get_kmem_info(server, server->machine.seminfo_offset,
|
||||
&seminfo, sizeof(seminfo));
|
||||
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read seminfo");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
buf->semmni = seminfo.semmni;
|
||||
buf->semmsl = seminfo.semmsl;
|
||||
buf->semopm = seminfo.semopm;
|
||||
buf->semume = seminfo.semume;
|
||||
buf->semusz = seminfo.semusz;
|
||||
buf->semvmx = seminfo.semvmx;
|
||||
buf->semaem = seminfo.semaem;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_sem_limits;
|
||||
}
|
79
sysdeps/aix/shm_limits.c
Normal file
79
sysdeps/aix/shm_limits.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <sys/shm.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/shm_limits.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_shm_limits =
|
||||
(1L << GLIBTOP_IPC_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN) +
|
||||
(1L << GLIBTOP_IPC_SHMMNI);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_shm_limits_p (glibtop *server)
|
||||
{
|
||||
int result;
|
||||
|
||||
result = _glibtop_get_kmem_offset(server, "shminfo");
|
||||
if (result == -1)
|
||||
{
|
||||
server->sysdeps.shm_limits = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
server->machine.shminfo_offset = result;
|
||||
|
||||
server->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits;
|
||||
}
|
||||
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
void
|
||||
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
|
||||
{
|
||||
int result;
|
||||
struct shminfo shminfo;
|
||||
int s;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_shm_limits));
|
||||
|
||||
result = _glibtop_get_kmem_info(server, server->machine.shminfo_offset,
|
||||
&shminfo, sizeof(struct shminfo));
|
||||
if (result <= 0)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read shminfo");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->shmmax = shminfo.shmmax;
|
||||
buf->shmmin = shminfo.shmmin;
|
||||
buf->shmmni = shminfo.shmmni;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_shm_limits;
|
||||
}
|
72
sysdeps/aix/siglist.c
Normal file
72
sysdeps/aix/siglist.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/signal.h>
|
||||
|
||||
const glibtop_signame glibtop_sys_siglist [] =
|
||||
{ { 1, "SIGHUP", "Hangup" },
|
||||
{ 2, "SIGINT", "Interrupt" },
|
||||
{ 3, "SIGQUIT", "Quit" },
|
||||
{ 4, "SIGILL", "Illegal Instruction" },
|
||||
{ 5, "SIGTRAP", "Trace/Breakpoint Trap" },
|
||||
{ 6, "SIGABRT", "Abort" },
|
||||
{ 7, "SIGEMT", "Emulation Trap" },
|
||||
{ 8, "SIGFPE", "Arithmetic Exception" },
|
||||
{ 9, "SIGKILL", "Killed" },
|
||||
{ 10, "SIGBUS", "Bus Error" },
|
||||
{ 11, "SIGSEGV", "Segmentation Fault" },
|
||||
{ 12, "SIGSYS", "Bad System Call" },
|
||||
{ 13, "SIGPIPE", "Broken Pipe" },
|
||||
{ 14, "SIGALRM", "Alarm Clock" },
|
||||
{ 15, "SIGTERM", "Terminated" },
|
||||
{ 16, "SIGURG", "Urgent Socket Condition" },
|
||||
{ 17, "SIGSTOP", "Stop (signal)" },
|
||||
{ 18, "SIGSTP", "Stop (user)" },
|
||||
{ 19, "SIGCONT", "Continue" },
|
||||
{ 20, "SIGCHLD", "Child Status Changed" },
|
||||
{ 21, "SIGTTIN", "Stopped (tty input)" },
|
||||
{ 22, "SIGTTOU", "Stopped (tty output)" },
|
||||
{ 23, "SIGIO", "I/O completed" },
|
||||
{ 24, "SIGXCPU", "Cpu Limit Exceeded" },
|
||||
{ 25, "SIGXFSZ", "File Size Limit Exceeded" },
|
||||
{ 27, "SIGMSG", "Message" },
|
||||
{ 28, "SIGWINCH","Window Size Change" },
|
||||
{ 29, "SIGPWR", "Power-Fail/Restart" },
|
||||
{ 30, "SIGUSR1", "User Signal 1" },
|
||||
{ 31, "SIGUSR2", "User Signal 2" },
|
||||
{ 32, "SIGPROF", "Profiling Timer Expired" },
|
||||
{ 33, "SIGDANGER","System Crash Imminent" },
|
||||
{ 34, "SIGVTALRM","Virtual Timer Expired" },
|
||||
{ 35, "SIGMIGRATE","Migrate Process" },
|
||||
{ 36, "SIGPRE", "Programming Exception" },
|
||||
{ 37, "SIGVIRT", "AIX Virtual Time Alarm" },
|
||||
{ 38, "SIGALRM1", "m:n Condition Variables" },
|
||||
{ 39, "SIGWAITING","Scheduling" },
|
||||
{ 59, "SIGCPUFAIL","Predictive De-configuration of Processors" },
|
||||
{ 60, "SIGKAP", "Keep Alive" },
|
||||
{ 61, "SIGRETRACT","Monitor Mode Relinguish" },
|
||||
{ 62, "SIGSOUND", "Sound Control Completed" },
|
||||
{ 63, "SIGSAK", "Secure Attention Key" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
128
sysdeps/aix/swap.c
Normal file
128
sysdeps/aix/swap.c
Normal file
@@ -0,0 +1,128 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <sys/vminfo.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/swap.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_swap =
|
||||
(1 << GLIBTOP_SWAP_TOTAL) + (1 << GLIBTOP_SWAP_USED) +
|
||||
(1 << GLIBTOP_SWAP_FREE) + (1 << GLIBTOP_SWAP_PAGEIN) +
|
||||
(1 << GLIBTOP_SWAP_PAGEOUT);
|
||||
|
||||
#define FILENAME "/etc/swapspaces"
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_swap_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.swap = _glibtop_sysdeps_swap;
|
||||
}
|
||||
|
||||
/* Provides information about swap usage. */
|
||||
|
||||
void
|
||||
glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
|
||||
{
|
||||
struct vminfo vminfo;
|
||||
struct pginfo pginfo;
|
||||
int pagesize;
|
||||
int result;
|
||||
FILE* fd;
|
||||
char device_name[128];
|
||||
int c;
|
||||
int comment = 0;
|
||||
int pos = 0;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_swap));
|
||||
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
|
||||
fd = fopen(FILENAME, "r");
|
||||
if (fd == NULL)
|
||||
{
|
||||
glibtop_error_io_r (server, "open (%s)", FILENAME);
|
||||
}
|
||||
|
||||
buf->total = 0;
|
||||
buf->free = 0;
|
||||
while((c = getc(fd)) != EOF)
|
||||
{
|
||||
if (comment)
|
||||
{
|
||||
/* skip comments */
|
||||
if (c == '\n') comment = 0;
|
||||
continue;
|
||||
}
|
||||
switch(c)
|
||||
{
|
||||
case '*':
|
||||
comment = 1;
|
||||
break;
|
||||
case '\n':
|
||||
device_name[pos] = 0;
|
||||
pos = 0;
|
||||
|
||||
if (strncmp("dev=", device_name, 4) == 0)
|
||||
{
|
||||
result = swapqry(device_name+4, &pginfo);
|
||||
if (result == -1)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read pginfo");
|
||||
break;
|
||||
}
|
||||
|
||||
buf->total += pginfo.size * pagesize;
|
||||
buf->free += pginfo.free * pagesize;;
|
||||
}
|
||||
break;
|
||||
case ' ':
|
||||
case '\t':
|
||||
break;
|
||||
default:
|
||||
device_name[pos++] = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
buf->used = buf->total - buf->free;
|
||||
fclose(fd);
|
||||
#ifdef HAVE_VMGETINFO
|
||||
result = vmgetinfo((void*)&vminfo, VMINFO, sizeof(vminfo));
|
||||
#else
|
||||
result = _glibtop_vmgetinfo((void*)&vminfo, VMINFO, sizeof(vminfo));
|
||||
#endif
|
||||
if (result == -1)
|
||||
{
|
||||
glibtop_error_io_r (server, "Cannot read vminfo");
|
||||
return;
|
||||
}
|
||||
|
||||
buf->pagein = vminfo.pageins;
|
||||
buf->pageout = vminfo.pageouts;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_swap;
|
||||
}
|
194
sysdeps/aix/sysinfo.c
Normal file
194
sysdeps/aix/sysinfo.c
Normal file
@@ -0,0 +1,194 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <sys/systemcfg.h>
|
||||
|
||||
#include <config.h>
|
||||
#include <glibtop/sysinfo.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_sysinfo =
|
||||
(1L << GLIBTOP_SYSINFO_CPUINFO);
|
||||
|
||||
static glibtop_sysinfo sysinfo;
|
||||
|
||||
static void add_info(glibtop_entry* entry, char* label, char* value)
|
||||
{
|
||||
g_ptr_array_add(entry->labels, g_strdup(label));
|
||||
g_hash_table_insert(entry->values, label, g_strdup(value));
|
||||
}
|
||||
|
||||
static void init_sysinfo(void)
|
||||
{
|
||||
int cpu;
|
||||
char buf[64];
|
||||
|
||||
memset (&sysinfo, 0, sizeof (glibtop_sysinfo));
|
||||
|
||||
sysinfo.ncpu = MIN(_system_configuration.ncpus, GLIBTOP_NCPU);
|
||||
|
||||
for (cpu = 0; cpu < sysinfo.ncpu ; cpu++)
|
||||
{
|
||||
/* init cpu data structure */
|
||||
|
||||
sysinfo.cpuinfo[cpu].labels = g_ptr_array_new();
|
||||
sysinfo.cpuinfo[cpu].values = g_hash_table_new (NULL, NULL);
|
||||
|
||||
/* add properties */
|
||||
|
||||
switch(_system_configuration.architecture)
|
||||
{
|
||||
case POWER_RS:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "architecture"
|
||||
, "Power Classic architecture");
|
||||
break;
|
||||
case POWER_PC:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "architecture"
|
||||
, "Power PC architecture");
|
||||
break;
|
||||
case IA64:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "architecture"
|
||||
, "Intel IA64 architecture");
|
||||
break;
|
||||
default:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "architecture"
|
||||
, "Unknown architecture");
|
||||
break;
|
||||
}
|
||||
|
||||
if ( (_system_configuration.architecture == POWER_RS) ||
|
||||
(_system_configuration.architecture == POWER_PC) )
|
||||
{
|
||||
switch(_system_configuration.implementation)
|
||||
{
|
||||
case POWER_RS1:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "RS1");
|
||||
break;
|
||||
case POWER_RSC:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "RSC");
|
||||
break;
|
||||
case POWER_RS2:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "RS2");
|
||||
break;
|
||||
case POWER_601:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "601");
|
||||
break;
|
||||
case POWER_603:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "603");
|
||||
break;
|
||||
case POWER_604:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "604");
|
||||
break;
|
||||
case POWER_620:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "620");
|
||||
break;
|
||||
case POWER_630:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "630");
|
||||
break;
|
||||
case POWER_A35:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "A35");
|
||||
break;
|
||||
case POWER_RS64II:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "RS64II");
|
||||
break;
|
||||
case POWER_RS64III:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "RS64III");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (_system_configuration.architecture == IA64)
|
||||
{
|
||||
switch(_system_configuration.implementation)
|
||||
{
|
||||
case IA64_M1:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "IA64 M1");
|
||||
break;
|
||||
case IA64_M2:
|
||||
add_info( &sysinfo.cpuinfo[cpu]
|
||||
, "implementation"
|
||||
, "IA64 M2");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(buf,"%d", _system_configuration.width);
|
||||
add_info( &sysinfo.cpuinfo[cpu], "width", buf);
|
||||
|
||||
if (_system_configuration.cache_attrib & (1 << 31))
|
||||
{
|
||||
/* L1 cache is present */
|
||||
|
||||
sprintf(buf,"%d", _system_configuration.icache_size);
|
||||
add_info( &sysinfo.cpuinfo[cpu], "L1 instruction cache size", buf);
|
||||
|
||||
sprintf(buf,"%d", _system_configuration.dcache_size);
|
||||
add_info( &sysinfo.cpuinfo[cpu], "L1 data cache size", buf);
|
||||
}
|
||||
|
||||
sprintf(buf,"%d", _system_configuration.L2_cache_size);
|
||||
add_info( &sysinfo.cpuinfo[cpu], "L2 cache size", buf);
|
||||
}
|
||||
|
||||
sysinfo.flags = _glibtop_sysdeps_sysinfo;
|
||||
}
|
||||
|
||||
glibtop_sysinfo *
|
||||
glibtop_get_sysinfo_s (glibtop *server)
|
||||
{
|
||||
static int first_time = 1;
|
||||
|
||||
if (first_time)
|
||||
{
|
||||
init_sysinfo();
|
||||
first_time = 0;
|
||||
}
|
||||
|
||||
return &sysinfo;
|
||||
}
|
73
sysdeps/aix/uptime.c
Normal file
73
sysdeps/aix/uptime.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. 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/uptime.h>
|
||||
|
||||
#include <glibtop/cpu.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_uptime =
|
||||
(1L << GLIBTOP_UPTIME_UPTIME) + (1L << GLIBTOP_UPTIME_IDLETIME);
|
||||
|
||||
static const unsigned long _required_cpu_flags =
|
||||
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_IDLE) +
|
||||
(1L << GLIBTOP_CPU_FREQUENCY);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_uptime_p (glibtop *server)
|
||||
{
|
||||
server->sysdeps.uptime = _glibtop_sysdeps_uptime;
|
||||
}
|
||||
|
||||
/* Provides uptime and idle time. */
|
||||
|
||||
void
|
||||
glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf)
|
||||
{
|
||||
glibtop_cpu cpu;
|
||||
|
||||
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_UPTIME), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_uptime));
|
||||
|
||||
/* We simply calculate it from the CPU usage. */
|
||||
|
||||
glibtop_get_cpu_p (server, &cpu);
|
||||
|
||||
/* Make sure all required fields are present. */
|
||||
|
||||
if ((cpu.flags & _required_cpu_flags) != _required_cpu_flags)
|
||||
return;
|
||||
|
||||
/* Calculate values. */
|
||||
|
||||
buf->uptime = (double) cpu.total / (double) cpu.frequency;
|
||||
buf->idletime = (double) cpu.idle / (double) cpu.frequency;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_uptime;
|
||||
}
|
141
sysdeps/aix/utils.c
Normal file
141
sysdeps/aix/utils.c
Normal file
@@ -0,0 +1,141 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <nlist.h>
|
||||
|
||||
#include <procinfo.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/vminfo.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
#include "glibtop_suid.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifndef HAVE_VMGETINFO
|
||||
#include <dlfcn.h>
|
||||
typedef int (*vmgetinfo_proto)(void *out, int command, int arg);
|
||||
#endif
|
||||
|
||||
off_t
|
||||
_glibtop_get_kmem_offset(glibtop* server, char* kname)
|
||||
{
|
||||
int result;
|
||||
struct nlist kernelnames[] =
|
||||
{ {NULL, 0, 0, 0, 0, 0},
|
||||
{NULL, 0, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
kernelnames[0]._n._n_name = kname;
|
||||
|
||||
glibtop_suid_enter(server);
|
||||
|
||||
result = knlist(kernelnames, 1, sizeof(struct nlist));
|
||||
|
||||
glibtop_suid_leave(server);
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return kernelnames[0].n_value;
|
||||
}
|
||||
|
||||
int
|
||||
_glibtop_get_kmem_info(glibtop* server, off_t offset, void* buf, size_t len)
|
||||
{
|
||||
int result;
|
||||
|
||||
glibtop_suid_enter(server);
|
||||
|
||||
lseek(server->machine.kmem_fd, offset, SEEK_SET);
|
||||
|
||||
result = read(server->machine.kmem_fd, buf, len);
|
||||
|
||||
glibtop_suid_leave(server);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
struct procsinfo*
|
||||
_glibtop_get_procinfo (glibtop *server, pid_t pid)
|
||||
{
|
||||
int result;
|
||||
pid_t current;
|
||||
static int first_time = 1;
|
||||
|
||||
/* test if procsinfo already found */
|
||||
|
||||
if ((server->machine.last_pinfo.pi_pid == pid) && (!first_time))
|
||||
{
|
||||
return &server->machine.last_pinfo;
|
||||
}
|
||||
|
||||
/* seek procsinfo if given pid */
|
||||
|
||||
first_time = 0;
|
||||
current = 0;
|
||||
while ((result = getprocs( &server->machine.last_pinfo
|
||||
, sizeof(struct procsinfo)
|
||||
, NULL, 0, ¤t, 1)) == 1)
|
||||
{
|
||||
|
||||
if (pid == server->machine.last_pinfo.pi_pid)
|
||||
{
|
||||
return &server->machine.last_pinfo;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef HAVE_VMGETINFO
|
||||
int
|
||||
_glibtop_vmgetinfo (void *out, int command, int arg)
|
||||
{
|
||||
void* handle;
|
||||
|
||||
static vmgetinfo_proto kern_vmgetinfo = NULL;
|
||||
|
||||
if (kern_vmgetinfo == NULL)
|
||||
{
|
||||
handle = dlopen("/unix", RTLD_NOW | RTLD_GLOBAL);
|
||||
if (handle == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
kern_vmgetinfo = dlsym( handle, "vmgetinfo");
|
||||
|
||||
dlclose(handle);
|
||||
|
||||
if (kern_vmgetinfo == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return kern_vmgetinfo(out, command, arg);
|
||||
}
|
||||
#endif
|
45
sysdeps/aix/utils.h
Normal file
45
sysdeps/aix/utils.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
This file is part of LibGTop 1.0.
|
||||
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, March 1999.
|
||||
|
||||
LibGTop is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
LibGTop 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 General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LibGTop; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __UTILS_H__
|
||||
#define __UTILS_H__
|
||||
|
||||
BEGIN_LIBGTOP_DECLS
|
||||
|
||||
extern off_t
|
||||
_glibtop_get_kmem_offset(glibtop* server, char* kname);
|
||||
|
||||
extern int
|
||||
_glibtop_get_kmem_info(glibtop* server, off_t offset, void* buf, size_t len);
|
||||
|
||||
extern struct procsinfo*
|
||||
_glibtop_get_procinfo (glibtop *server, pid_t pid);
|
||||
|
||||
#ifndef HAVE_VMGETINFO
|
||||
extern int
|
||||
_glibtop_vmgetinfo (void *out, int command, int arg);
|
||||
#endif
|
||||
|
||||
END_LIBGTOP_DECLS
|
||||
|
||||
#endif /* __UTILS_H__ */
|
Reference in New Issue
Block a user