diff options
author | Benoît Dejean <bdejean@src.gnome.org> | 2004-11-22 11:13:24 +0000 |
---|---|---|
committer | Benoît Dejean <bdejean@src.gnome.org> | 2004-11-22 11:13:24 +0000 |
commit | 7ff23722494b84d1d38d7d11c985fd901e9951d1 (patch) | |
tree | 8bc9da0d019db89c1698c2b46e0793ab48d72e30 /sysdeps | |
parent | f378a263b014b95d18215a08bcd3ebeefc5d34fc (diff) | |
download | libgtop-7ff23722494b84d1d38d7d11c985fd901e9951d1.tar.gz |
UTF-8-ified.
* AUTHORS:
* MAINTAINERS: UTF-8-ified.
* acconfig.h:
* acinclude.m4:
* configure.in:
* kernel/ChangeLog:
* kernel/sysctl/.cvsignore:
* kernel/sysctl/Makefile:
* kernel/sysctl/libgtop.c:
* kernel/sysctl/libgtop.h:
* kernel/sysctl/libgtop_syms.c:
* kernel/sysctl/main.c:
* kernel/sysctl/patch-2.2.1:
* kernel/sysctl/patch-2.2.x:
* kernel/table.h:
* kernel/table20/Makefile:
* kernel/table20/README:
* kernel/table20/entry-i386.S:
* kernel/table20/kernel.patch:
* kernel/table20/main.c:
* kernel/table20/unistd-i386.h:
* kernel/table20/version.h:
* kernel/table21/.cvsignore:
* kernel/table21/Makefile:
* kernel/table21/README:
* kernel/table21/entry-i386.S:
* kernel/table21/main.c:
* kernel/table21/module.c:
* kernel/table21/unistd-i386.h:
* kernel/table21/version.h:
* kernel/version.h:
* libgtop-sysdeps.m4:
* sysdeps/Makefile.am:
* sysdeps/kernel/.cvsignore:
* sysdeps/kernel/ChangeLog:
* sysdeps/kernel/Makefile.am:
* sysdeps/kernel/close.c:
* sysdeps/kernel/cpu.c:
* sysdeps/kernel/glibtop_private.h:
* sysdeps/kernel/glibtop_server.h:
* sysdeps/kernel/kernel.h:
* sysdeps/kernel/kernel.s:
* sysdeps/kernel/loadavg.c:
* sysdeps/kernel/mem.c:
* sysdeps/kernel/msg_limits.c:
* sysdeps/kernel/netload.c:
* sysdeps/kernel/open.c:
* sysdeps/kernel/ppp.c:
* sysdeps/kernel/procargs.c:
* sysdeps/kernel/procdata.c:
* sysdeps/kernel/prockernel.c:
* sysdeps/kernel/proclist.c:
* sysdeps/kernel/procmap.c:
* sysdeps/kernel/procmem.c:
* sysdeps/kernel/procsegment.c:
* sysdeps/kernel/procsignal.c:
* sysdeps/kernel/procstate.c:
* sysdeps/kernel/proctime.c:
* sysdeps/kernel/procuid.c:
* sysdeps/kernel/sem_limits.c:
* sysdeps/kernel/shm_limits.c:
* sysdeps/kernel/siglist.c:
* sysdeps/kernel/swap.c:
* sysdeps/kernel/sysinfo.c:
* sysdeps/kernel/uptime.c: Removed kernel patch and implementation.
Diffstat (limited to 'sysdeps')
33 files changed, 1 insertions, 2114 deletions
diff --git a/sysdeps/Makefile.am b/sysdeps/Makefile.am index b4f4ac1d..5930c5f0 100644 --- a/sysdeps/Makefile.am +++ b/sysdeps/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS = common @sysdeps_dir@ names -DIST_SUBDIRS = common linux kernel names osf1 \ +DIST_SUBDIRS = common linux names osf1 \ stub stub_suid sun4 freebsd solaris aix diff --git a/sysdeps/kernel/.cvsignore b/sysdeps/kernel/.cvsignore deleted file mode 100644 index b851d091..00000000 --- a/sysdeps/kernel/.cvsignore +++ /dev/null @@ -1,28 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -close.lo -cpu.lo -init.lo -ipc_limits.lo -libgtop_sysdeps.la -loadavg.lo -mem.lo -msg_limits.lo -open.lo -procdata.lo -prockernel.lo -proclist.lo -procmem.lo -procsegment.lo -procsignal.lo -procstate.lo -proctime.lo -procuid.lo -sem_limits.lo -shm_limits.lo -swap.lo -sysdeps.lo -sysinfo.lo -uptime.lo diff --git a/sysdeps/kernel/ChangeLog b/sysdeps/kernel/ChangeLog deleted file mode 100644 index 4ead129c..00000000 --- a/sysdeps/kernel/ChangeLog +++ /dev/null @@ -1,71 +0,0 @@ -2004-06-13 Benoît Dejean <tazforever@dlfp.org> - - * sysinfo.c: Added missing const qualifier. - -2004-06-06 Benoît Dejean <tazforever@dlfp.org> - - * proclist.c: (glibtop_get_proclist_s): Used g_memdup. - -2004-05-25 Benoît Dejean <tazforever@dlfp.org> - - * sem_limits.c: - * shm_limits.c: - * swap.c: Added missing const qualifiers. - - * uptime.c: (glibtop_get_uptime_s): Cleaned up. Added boot_time. - -2004-03-09 Bastien Nocera <hadess@hadess.net> - - * proclist.c: (glibtop_get_proclist_s): fix g_malloc usage on non-Linux - platforms (patch by Benoît Dejean <bnet@ifrance.com>) - -2003-10-21 Bastien Nocera <hadess@hadess.net> - - * Makefile.am: install only one library, libgtop-2.0 - Fix build-time warnings due to the redefinition of guint64 - -2003-10-20 Bastien Nocera <hadess@hadess.net> - - * glibtop_private.h: s/u_int64_t/guint64/ - -2003-10-20 Bastien Nocera <hadess@hadess.net> - - * glibtop_private.h: - * glibtop_server.h: - * kernel.h: - * procargs.c: - * proclist.c: - * procmap.c: fixed compilation - -2003-10-20 Bastien Nocera <hadess@hadess.net> - - * proclist.c: (glibtop_get_proclist_s): replace all the xmalloc crap - by glib memory management functions - -2001-10-17 Abel Cheung <maddog@linux.org.hk> - - * Makefile.am: move header to $(includedir)/libgtop-1.0/glibtop. - -1998-10-26 Martin Baulig <martin@home-of-linux.org> - - * netload.c: New file. Currently empty. - -1998-10-26 Martin Baulig <martin@home-of-linux.org> - - * procargs.c: New file. Currently empty. - -1998-10-25 Martin Baulig <martin@home-of-linux.org> - - * ppp.c: New file. Currently empty. - -1998-06-14 Martin Baulig <martin@home-of-linux.org> - - * kernel.s: New file - declaration of the table () function - via _syscall3 (); due to a bug in egcs, we cannot put this - into a C file. - -1998-06-13 Martin Baulig <martin@home-of-linux.org> - - The code in this directory fetches all information - directly from the kernel. It uses the new table () - system call from the `kernel' directory. diff --git a/sysdeps/kernel/Makefile.am b/sysdeps/kernel/Makefile.am deleted file mode 100644 index e3e68267..00000000 --- a/sysdeps/kernel/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ - -INCLUDES = @INCLUDES@ - -noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la - -libgtop_sysdeps_2_0_la_SOURCES = open.c close.c kernel.s cpu.c mem.c swap.c \ - uptime.c loadavg.c shm_limits.c msg_limits.c \ - sem_limits.c proclist.c procstate.c procuid.c \ - proctime.c procmem.c procsignal.c prockernel.c \ - procsegment.c siglist.c procargs.c procmap.c \ - netload.c ppp.c - -libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO) - -libgtopinclude_HEADERS = glibtop_server.h -libgtopincludedir = $(includedir)/libgtop-2.0 - -noinst_HEADERS = kernel.h - -kernel.o kernel.lo: $(srcdir)/kernel.s - rm -f kernel.o kernel.lo - $(AS) -o kernel.o $(srcdir)/kernel.s - cp kernel.o kernel.lo - diff --git a/sysdeps/kernel/close.c b/sysdeps/kernel/close.c deleted file mode 100644 index 4262d2f0..00000000 --- a/sysdeps/kernel/close.c +++ /dev/null @@ -1,30 +0,0 @@ -/* $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) -{ } diff --git a/sysdeps/kernel/cpu.c b/sysdeps/kernel/cpu.c deleted file mode 100644 index 1a7127ba..00000000 --- a/sysdeps/kernel/cpu.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $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 <config.h> -#include <glibtop/error.h> -#include <glibtop/cpu.h> - -#include "kernel.h" - -static const unsigned long _glibtop_sysdeps_cpu = -(1 << GLIBTOP_CPU_TOTAL) + (1 << GLIBTOP_CPU_USER) + -(1 << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_SYS) + -(1 << GLIBTOP_CPU_IDLE) + (1 << GLIBTOP_CPU_FREQUENCY); - -/* Init function. */ - -void -glibtop_init_cpu_s (glibtop *server) -{ - server->sysdeps.cpu = _glibtop_sysdeps_cpu; -} - -/* Provides information about cpu usage. */ - -void -glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf) -{ - union table tbl; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0); - - memset (buf, 0, sizeof (glibtop_cpu)); - - if (table (TABLE_CPU, &tbl, NULL)) - glibtop_error_io_r (server, "table(TABLE_CPU)"); - - buf->flags = _glibtop_sysdeps_cpu; - - buf->total = tbl.cpu.total; - buf->user = tbl.cpu.user; - buf->nice = tbl.cpu.nice; - buf->sys = tbl.cpu.sys; - buf->idle = tbl.cpu.idle; - buf->frequency = tbl.cpu.frequency; -} diff --git a/sysdeps/kernel/glibtop_private.h b/sysdeps/kernel/glibtop_private.h deleted file mode 100644 index ccbf7615..00000000 --- a/sysdeps/kernel/glibtop_private.h +++ /dev/null @@ -1,89 +0,0 @@ -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - 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_PRIVATE_H__ -#define __GLIBTOP_PRIVATE_H__ - -#include <glibtop.h> -#include <glibtop/error.h> - -#include <sys/param.h> -#include <sys/sysctl.h> -#include <sys/user.h> - -#undef LIBGTOP_VERSION -#include <linux/libgtop.h> - -G_BEGIN_DECLS - -int -glibtop_get_proc_data_stat_s (glibtop *server, libgtop_stat_t *stat); - -int -glibtop_get_proc_data_mem_s (glibtop *server, libgtop_mem_t *mem); - -int -glibtop_get_proc_data_swap_s (glibtop *server, libgtop_swap_t *swap); - -int -glibtop_get_proc_data_proclist_s (glibtop *server, - libgtop_proclist_t *proclist, - guint64 which, guint64 arg); - -int -glibtop_get_proc_data_proc_state_s (glibtop *server, - libgtop_proc_state_t *proc_state, - pid_t pid); - -int -glibtop_get_proc_data_proc_mem_s (glibtop *server, - libgtop_proc_mem_t *proc_mem, - pid_t pid); - -int -glibtop_get_proc_data_proc_signal_s (glibtop *server, - libgtop_proc_signal_t *proc_signal, - pid_t pid); - -int -glibtop_get_proc_data_proc_kernel_s (glibtop *server, - libgtop_proc_kernel_t *proc_kernel, - pid_t pid); - -int -glibtop_get_proc_data_proc_args_s (glibtop *server, pid_t pid, - char *result, size_t max_len); - -int -glibtop_get_proc_data_proc_maps_s (glibtop *server, pid_t pid, - libgtop_proc_maps_t *result, - size_t max_len); - -int -glibtop_get_proc_data_netload_s (glibtop *server, - libgtop_netload_t *netload, - const char *device); - -G_END_DECLS - -#endif /* __GLIBTOP_PRIVATE_H__ */ diff --git a/sysdeps/kernel/glibtop_server.h b/sysdeps/kernel/glibtop_server.h deleted file mode 100644 index 5a8c68e9..00000000 --- a/sysdeps/kernel/glibtop_server.h +++ /dev/null @@ -1,52 +0,0 @@ -/* $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__ - -G_BEGIN_DECLS - -#define GLIBTOP_SUID_CPU 0 -#define GLIBTOP_SUID_MEM 0 -#define GLIBTOP_SUID_SWAP 0 -#define GLIBTOP_SUID_UPTIME 0 -#define GLIBTOP_SUID_LOADAVG 0 -#define GLIBTOP_SUID_SHM_LIMITS 0 -#define GLIBTOP_SUID_MSG_LIMITS 0 -#define GLIBTOP_SUID_SEM_LIMITS 0 -#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 0 -#define GLIBTOP_SUID_PPP 0 - -G_END_DECLS - -#endif diff --git a/sysdeps/kernel/kernel.h b/sysdeps/kernel/kernel.h deleted file mode 100644 index 824fbedb..00000000 --- a/sysdeps/kernel/kernel.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $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_KERNEL_KERNEL_H__ -#define __GLIBTOP_KERNEL_KERNEL_H__ - -#include <linux/unistd.h> -#include <linux/table.h> - -#include <sys/param.h> - -#include <syscall.h> - -G_BEGIN_DECLS - -extern int table (int, union table *, const void *); - -G_END_DECLS - -#endif diff --git a/sysdeps/kernel/kernel.s b/sysdeps/kernel/kernel.s deleted file mode 100644 index d6b368c1..00000000 --- a/sysdeps/kernel/kernel.s +++ /dev/null @@ -1,42 +0,0 @@ - .file "test.c" - .version "01.01" -/ GNU C version egcs-2.90.29 980515 (egcs-1.0.3 release) (i686-pc-linux-gnu) compiled by GNU C version egcs-2.90.29 980515 (egcs-1.0.3 release). -/ options passed: -O2 -Wall -W -/ options enabled: -fdefer-pop -fcse-follow-jumps -fcse-skip-blocks -/ -fexpensive-optimizations -fthread-jumps -fstrength-reduce -fpeephole -/ -fforce-mem -ffunction-cse -finline -fkeep-static-consts -fcaller-saves -/ -fpcc-struct-return -frerun-cse-after-loop -frerun-loop-opt -/ -fschedule-insns2 -fcommon -fverbose-asm -fgnu-linker -fregmove -/ -falias-check -fargument-alias -m80387 -mhard-float -mno-soft-float -/ -mieee-fp -mfp-ret-in-387 -mschedule-prologue -mcpu=pentiumpro -/ -march=pentium - -gcc2_compiled.: -.text - .align 4 -.globl table - .type table,@function -table: - pushl %ebp - movl %esp,%ebp - movl $190,%eax - pushl %ebx - movl 8(%ebp),%ebx - movl 12(%ebp),%ecx - movl 16(%ebp),%edx -#APP - int $0x80 -#NO_APP - testl %eax,%eax - jge .L3 - negl %eax - movl %eax,errno - movl $-1,%eax -.L3: - movl -4(%ebp),%ebx - movl %ebp,%esp - popl %ebp - ret -.Lfe1: - .size table,.Lfe1-table - .ident "GCC: (GNU) egcs-2.90.29 980515 (egcs-1.0.3 release)" diff --git a/sysdeps/kernel/loadavg.c b/sysdeps/kernel/loadavg.c deleted file mode 100644 index 3c81d84a..00000000 --- a/sysdeps/kernel/loadavg.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $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 <config.h> -#include <glibtop/error.h> -#include <glibtop/loadavg.h> - -#include "kernel.h" - -static const unsigned long _glibtop_sysdeps_loadavg = -(1 << GLIBTOP_LOADAVG_LOADAVG) + (1 << GLIBTOP_LOADAVG_NR_RUNNING) + -(1 << GLIBTOP_LOADAVG_NR_TASKS) + (1 << GLIBTOP_LOADAVG_LAST_PID); - -/* Init function. */ - -void -glibtop_init_loadavg_s (glibtop *server) -{ - server->sysdeps.loadavg = _glibtop_sysdeps_loadavg; -} - -/* Provides load load averange. */ - -void -glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf) -{ - union table tbl; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_LOADAVG, 0); - - memset (buf, 0, sizeof (glibtop_loadavg)); - - if (table (TABLE_LOADAVG, &tbl, NULL)) - glibtop_error_io_r (server, "table(TABLE_LOADAVG)"); - - buf->flags = _glibtop_sysdeps_loadavg; - - buf->loadavg [0] = tbl.loadavg.loadavg [0]; - buf->loadavg [1] = tbl.loadavg.loadavg [1]; - buf->loadavg [2] = tbl.loadavg.loadavg [2]; - - buf->nr_running = tbl.loadavg.nr_running; - buf->nr_tasks = tbl.loadavg.nr_tasks; - buf->last_pid = tbl.loadavg.last_pid; -} diff --git a/sysdeps/kernel/mem.c b/sysdeps/kernel/mem.c deleted file mode 100644 index dd85de0a..00000000 --- a/sysdeps/kernel/mem.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $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 <config.h> -#include <glibtop/error.h> -#include <glibtop/mem.h> - -#include "kernel.h" - -static const unsigned long _glibtop_sysdeps_mem = -(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) + -(1 << GLIBTOP_MEM_FREE) + (1 << GLIBTOP_MEM_SHARED) + -(1 << GLIBTOP_MEM_BUFFER) + (1 << GLIBTOP_MEM_CACHED) + -(1 << GLIBTOP_MEM_USER); - -/* Init function. */ - -void -glibtop_init_mem_s (glibtop *server) -{ - server->sysdeps.mem = _glibtop_sysdeps_mem; -} - -/* Provides information about memory usage. */ - -void -glibtop_get_mem_s (glibtop *server, glibtop_mem *buf) -{ - union table tbl; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_MEM, 0); - - memset (buf, 0, sizeof (glibtop_mem)); - - if (table (TABLE_MEM, &tbl, NULL)) - glibtop_error_io_r (server, "table(TABLE_MEM)"); - - buf->flags = _glibtop_sysdeps_mem; - - buf->total = tbl.mem.total; - buf->used = tbl.mem.used; - buf->free = tbl.mem.free; - buf->shared = tbl.mem.shared; - buf->buffer = tbl.mem.buffer; - buf->cached = tbl.mem.cached; - - buf->user = buf->total - buf->free - buf->shared - buf->buffer; -} diff --git a/sysdeps/kernel/msg_limits.c b/sysdeps/kernel/msg_limits.c deleted file mode 100644 index bd182db3..00000000 --- a/sysdeps/kernel/msg_limits.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $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/msg_limits.h> - -#include <sys/ipc.h> -#include <sys/msg.h> - -static const unsigned long _glibtop_sysdeps_msg_limits = -(1 << GLIBTOP_IPC_MSGPOOL) + (1 << GLIBTOP_IPC_MSGMAP) + -(1 << GLIBTOP_IPC_MSGMAX) + (1 << GLIBTOP_IPC_MSGMNB) + -(1 << GLIBTOP_IPC_MSGMNI) + (1 << GLIBTOP_IPC_MSGSSZ) + -(1 << GLIBTOP_IPC_MSGTQL); - -/* Init function. */ - -void -glibtop_init_msg_limits_s (glibtop *server) -{ - server->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits; -} - -/* Provides information about sysv ipc limits. */ - -void -glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf) -{ - struct msginfo msginfo; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_MSG_LIMITS, 0); - - memset (buf, 0, sizeof (glibtop_msg_limits)); - - buf->flags = _glibtop_sysdeps_msg_limits; - - msgctl (0, IPC_INFO, (struct msqid_ds *) &msginfo); - - buf->msgpool = msginfo.msgpool; - buf->msgmap = msginfo.msgmap; - buf->msgmax = msginfo.msgmax; - buf->msgmnb = msginfo.msgmnb; - buf->msgmni = msginfo.msgmni; - buf->msgssz = msginfo.msgssz; - buf->msgtql = msginfo.msgtql; -} diff --git a/sysdeps/kernel/netload.c b/sysdeps/kernel/netload.c deleted file mode 100644 index beebedba..00000000 --- a/sysdeps/kernel/netload.c +++ /dev/null @@ -1,45 +0,0 @@ -/* $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/netload.h> - -static const unsigned long _glibtop_sysdeps_netload = 0; - -/* Init function. */ - -void -glibtop_init_netload_s (glibtop *server) -{ - server->sysdeps.netload = _glibtop_sysdeps_netload; -} - -/* Provides network statistics. */ - -void -glibtop_get_netload_s (glibtop *server, glibtop_netload *buf, - const char *interface) -{ - memset (buf, 0, sizeof (glibtop_netload)); -} diff --git a/sysdeps/kernel/open.c b/sysdeps/kernel/open.c deleted file mode 100644 index 260b899b..00000000 --- a/sysdeps/kernel/open.c +++ /dev/null @@ -1,63 +0,0 @@ -/* $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/open.h> - -/* ===================================================== - * Linux kernel version information for procps utilities - * Copyright (c) 1996 Charles Blake <cblake@bbn.com> - */ -#include <sys/utsname.h> - -#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z) - -static int linux_version_code = 0; - -static void set_linux_version(void) { - static struct utsname uts; - int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */ - - if (linux_version_code) return; - if (uname(&uts) == -1) /* failure most likely implies impending death */ - exit(1); - if (sscanf(uts.release, "%d.%d.%d", &x, &y, &z) < 3) - fprintf(stderr, /* *very* unlikely to happen by accident */ - "Non-standard uts for running kernel:\n" - "release %s=%d.%d.%d gives version code %d\n", - uts.release, x, y, z, LINUX_VERSION(x,y,z)); - linux_version_code = LINUX_VERSION(x, y, z); -} - -/* ======================================================= */ - -/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */ - -void -glibtop_open_s (glibtop *server, const char *program_name, - const unsigned long features, const unsigned flags) -{ - server->name = program_name; - - set_linux_version (); - server->os_version_code = (unsigned long) linux_version_code; -} diff --git a/sysdeps/kernel/ppp.c b/sysdeps/kernel/ppp.c deleted file mode 100644 index 6d0905d5..00000000 --- a/sysdeps/kernel/ppp.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $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)); -} diff --git a/sysdeps/kernel/procargs.c b/sysdeps/kernel/procargs.c deleted file mode 100644 index 72a45f3b..00000000 --- a/sysdeps/kernel/procargs.c +++ /dev/null @@ -1,46 +0,0 @@ -/* $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/procargs.h> - -static const unsigned long _glibtop_sysdeps_proc_args = 0; - -/* Init function. */ - -void -glibtop_init_proc_args_s (glibtop *server) -{ - server->sysdeps.proc_args = _glibtop_sysdeps_proc_args; -} - -/* Provides detailed information about a process. */ - -const char * -glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf, - pid_t pid, unsigned max_len) -{ - memset (buf, 0, sizeof (glibtop_proc_args)); - return NULL; -} diff --git a/sysdeps/kernel/procdata.c b/sysdeps/kernel/procdata.c deleted file mode 100644 index aabebca9..00000000 --- a/sysdeps/kernel/procdata.c +++ /dev/null @@ -1,180 +0,0 @@ -/* $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 <config.h> -#include <glibtop/procdata.h> - -#include <sys/stat.h> - -#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z) - -#define BIT_SHIFT(x) (1 << (x % 32)) - -static const unsigned long _glibtop_sysdeps_procdata_0 = -BIT_SHIFT(GLIBTOP_PROCDATA_CMD) + -BIT_SHIFT(GLIBTOP_PROCDATA_STATE) + -BIT_SHIFT(GLIBTOP_PROCDATA_UID) + -BIT_SHIFT(GLIBTOP_PROCDATA_PID) + -BIT_SHIFT(GLIBTOP_PROCDATA_PPID) + -BIT_SHIFT(GLIBTOP_PROCDATA_PGRP) + -BIT_SHIFT(GLIBTOP_PROCDATA_SESSION) + -BIT_SHIFT(GLIBTOP_PROCDATA_TTY) + -BIT_SHIFT(GLIBTOP_PROCDATA_TPGID) + -BIT_SHIFT(GLIBTOP_PROCDATA_PRIORITY) + -BIT_SHIFT(GLIBTOP_PROCDATA_NICE) + -BIT_SHIFT(GLIBTOP_PROCDATA_SIGNAL) + -BIT_SHIFT(GLIBTOP_PROCDATA_BLOCKED) + -BIT_SHIFT(GLIBTOP_PROCDATA_SIGIGNORE) + -BIT_SHIFT(GLIBTOP_PROCDATA_SIGCATCH) + -BIT_SHIFT(GLIBTOP_PROCDATA_START_TIME) + -BIT_SHIFT(GLIBTOP_PROCDATA_UTIME) + -BIT_SHIFT(GLIBTOP_PROCDATA_STIME) + -BIT_SHIFT(GLIBTOP_PROCDATA_CUTIME) + -BIT_SHIFT(GLIBTOP_PROCDATA_CSTIME) + -BIT_SHIFT(GLIBTOP_PROCDATA_SIZE) + -BIT_SHIFT(GLIBTOP_PROCDATA_RESIDENT) + -BIT_SHIFT(GLIBTOP_PROCDATA_SHARE) + -BIT_SHIFT(GLIBTOP_PROCDATA_TRS) + -BIT_SHIFT(GLIBTOP_PROCDATA_LRS) + -BIT_SHIFT(GLIBTOP_PROCDATA_DRS) + -BIT_SHIFT(GLIBTOP_PROCDATA_DT) + -BIT_SHIFT(GLIBTOP_PROCDATA_VSIZE) + -BIT_SHIFT(GLIBTOP_PROCDATA_RSS) + -BIT_SHIFT(GLIBTOP_PROCDATA_RSS_RLIM) + -BIT_SHIFT(GLIBTOP_PROCDATA_TIMEOUT) + -BIT_SHIFT(GLIBTOP_PROCDATA_IT_REAL_VALUE); - -static const unsigned long _glibtop_sysdeps_procdata_1 = -BIT_SHIFT(GLIBTOP_PROCDATA_K_FLAGS) + -BIT_SHIFT(GLIBTOP_PROCDATA_MIN_FLT) + -BIT_SHIFT(GLIBTOP_PROCDATA_MAJ_FLT) + -BIT_SHIFT(GLIBTOP_PROCDATA_CMIN_FLT) + -BIT_SHIFT(GLIBTOP_PROCDATA_CMAJ_FLT) + -BIT_SHIFT(GLIBTOP_PROCDATA_START_CODE) + -BIT_SHIFT(GLIBTOP_PROCDATA_END_CODE) + -BIT_SHIFT(GLIBTOP_PROCDATA_START_STACK) + -BIT_SHIFT(GLIBTOP_PROCDATA_KSTK_ESP) + -BIT_SHIFT(GLIBTOP_PROCDATA_KSTK_EIP) + -BIT_SHIFT(GLIBTOP_PROCDATA_WCHAN); - -/* Provides detailed information about a process. */ - -void -glibtop_get_procdata_s (glibtop *server, glibtop_procdata *buf, pid_t pid) -{ - char input [BUFSIZ], *tmp; - struct stat statb; - int nread; - FILE *f; - - glibtop_init_s (&server, 0, 0); - - memset (buf, 0, sizeof (glibtop_procdata)); - - if (pid == 0) { - /* Client is only interested in the flags. */ - buf->flags [0] = _glibtop_sysdeps_procdata_0; - buf->flags [1] = _glibtop_sysdeps_procdata_1; - return; - } - - - sprintf (input, "/proc/%d/stat", pid); - - if (stat (input, &statb)) return; - - buf->uid = statb.st_uid; - - f = fopen (input, "r"); - if (!f) return; - - nread = fread (input, 1, BUFSIZ, f); - - if (nread < 0) { - fclose (f); - return; - } - - input [nread] = 0; - - /* This is from guile-utils/gtop/proc/readproc.c */ - - /* split into "PID (cmd" and "<rest>" */ - tmp = strrchr (input, ')'); - *tmp = '\0'; /* replace trailing ')' with NUL */ - /* parse these two strings separately, skipping the leading "(". */ - memset (buf->cmd, 0, sizeof (buf->cmd)); - sscanf (input, "%d (%39c", &buf->pid, buf->cmd); - sscanf(tmp + 2, /* skip space after ')' too */ - "%c %d %d %d %d %d %lu %lu %lu %lu %lu " - "%ld %ld %ld %ld %d %d %lu %lu %ld %lu " - "%lu %lu %lu %lu %lu %lu %lu %d %d %d %d %lu", - &buf->state, &buf->ppid, &buf->pgrp, &buf->session, - &buf->tty, &buf->tpgid, &buf->k_flags, &buf->min_flt, - &buf->cmin_flt, &buf->maj_flt, &buf->cmaj_flt, - &buf->utime, &buf->stime, &buf->cutime, &buf->cstime, - &buf->priority, &buf->nice, &buf->timeout, - &buf->it_real_value, &buf->start_time, &buf->vsize, - &buf->rss, &buf->rss_rlim, &buf->start_code, - &buf->end_code, &buf->start_stack, &buf->kstk_esp, - &buf->kstk_eip, &buf->signal, &buf->blocked, - &buf->sigignore, &buf->sigcatch, &buf->wchan); - - if (buf->tty == 0) - /* the old notty val, update elsewhere bef. moving to 0 */ - buf->tty = -1; - - if (server->os_version_code < LINUX_VERSION(1,3,39)) { - /* map old meanings to new */ - buf->priority = 2*15 - buf->priority; - buf->nice = 15 - buf->nice; - } - if (server->os_version_code < LINUX_VERSION(1,1,30) && buf->tty != -1) - /* when tty wasn't full devno */ - buf->tty = 4*0x100 + buf->tty; - - fclose (f); - - sprintf (input, "/proc/%d/statm", pid); - - f = fopen (input, "r"); - if (!f) return; - - nread = fread (input, 1, BUFSIZ, f); - - if (nread < 0) { - fclose (f); - return; - } - - input [nread] = 0; - - sscanf (input, "%ld %ld %ld %ld %ld %ld %ld", - &buf->size, &buf->resident, &buf->share, - &buf->trs, &buf->lrs, &buf->drs, &buf->dt); - - fclose (f); - - buf->flags [0] = _glibtop_sysdeps_procdata_0; - buf->flags [1] = _glibtop_sysdeps_procdata_1; -} diff --git a/sysdeps/kernel/prockernel.c b/sysdeps/kernel/prockernel.c deleted file mode 100644 index 1c13dfbf..00000000 --- a/sysdeps/kernel/prockernel.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $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/prockernel.h> - -#include "kernel.h" - -static const unsigned long _glibtop_sysdeps_proc_kernel = -(1 << GLIBTOP_PROC_KERNEL_K_FLAGS) + (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) -{ - union table tbl; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_KERNEL, 0); - - memset (buf, 0, sizeof (glibtop_proc_kernel)); - - if (table (TABLE_PROC_KERNEL, &tbl, &pid)) - glibtop_error_io_r (server, "table(TABLE_PROC_KERNEL)"); - - buf->flags = _glibtop_sysdeps_proc_kernel; - - buf->min_flt = tbl.proc_kernel.min_flt; - buf->cmin_flt = tbl.proc_kernel.cmin_flt; - buf->maj_flt = tbl.proc_kernel.maj_flt; - buf->cmaj_flt = tbl.proc_kernel.cmaj_flt; - buf->kstk_esp = tbl.proc_kernel.kesp; - buf->kstk_eip = tbl.proc_kernel.keip; - buf->nwchan = tbl.proc_kernel.wchan; -} diff --git a/sysdeps/kernel/proclist.c b/sysdeps/kernel/proclist.c deleted file mode 100644 index 7a243061..00000000 --- a/sysdeps/kernel/proclist.c +++ /dev/null @@ -1,83 +0,0 @@ -/* $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/proclist.h> - -#include "kernel.h" - -static const unsigned long _glibtop_sysdeps_proclist = -(1 << GLIBTOP_PROCLIST_TOTAL) + (1 << GLIBTOP_PROCLIST_NUMBER) + -(1 << GLIBTOP_PROCLIST_SIZE); - -/* Init function. */ - -void -glibtop_init_proclist_s (glibtop *server) -{ - server->sysdeps.proclist = _glibtop_sysdeps_proclist; -} - -#define BLOCK_COUNT 256 -#define BLOCK_SIZE (BLOCK_COUNT * sizeof (unsigned)) - -/* Fetch list of currently running processes. - * - * The interface of this function is a little bit different from the others: - * buf->flags is only set if the call succeeded, in this case pids_chain, - * a list of the pids of all currently running processes is returned, - * buf->number is the number of elements of this list and buf->size is - * the size of one single element (sizeof (unsigned)). The total size is - * stored in buf->total. - * - * The calling function has to free the memory to which a pointer is returned. - * - * On error, NULL is returned and buf->flags is zero. */ - -unsigned * -glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf, - gint64 which, gint64 arg) -{ - union table tbl; - unsigned *pids_chain; - struct proclist_args args; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROCLIST, 0); - - memset (buf, 0, sizeof (glibtop_proclist)); - - args.which = which; - args.arg = arg; - - if (table (TABLE_PROCLIST, &tbl, &args)) - glibtop_error_io_r (server, "table(TABLE_PROCLIST)"); - - buf->size = sizeof (unsigned); - buf->number = tbl.proclist.nr_tasks; - - buf->total = buf->number * sizeof (unsigned); - - pids_chain = g_memdup(tbl.proclist.pids, buf->total); - - return pids_chain; -} diff --git a/sysdeps/kernel/procmap.c b/sysdeps/kernel/procmap.c deleted file mode 100644 index f5cfd940..00000000 --- a/sysdeps/kernel/procmap.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $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/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_s (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0); - - memset (buf, 0, sizeof (glibtop_proc_map)); - - return NULL; -} diff --git a/sysdeps/kernel/procmem.c b/sysdeps/kernel/procmem.c deleted file mode 100644 index 972af542..00000000 --- a/sysdeps/kernel/procmem.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $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/procmem.h> - -#include "kernel.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_SHARE) + -(1 << GLIBTOP_PROC_MEM_RSS) + (1 << GLIBTOP_PROC_MEM_RSS_RLIM); - -/* Init function. */ - -void -glibtop_init_proc_mem_s (glibtop *server) -{ - server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem; -} - -/* Provides detailed information about a process. */ - -void -glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, - pid_t pid) -{ - union table tbl; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_MEM, 0); - - memset (buf, 0, sizeof (glibtop_proc_mem)); - - if (table (TABLE_PROC_MEM, &tbl, &pid)) - glibtop_error_io_r (server, "table(TABLE_PROC_MEM)"); - - buf->rss = tbl.proc_mem.rss; - buf->rss_rlim = tbl.proc_mem.rlim; - - if (table (TABLE_PROC_SEGMENT, &tbl, &pid)) - glibtop_error_io_r (server, "table(TABLE_PROC_SEGMENT)"); - - buf->flags = _glibtop_sysdeps_proc_mem; - - buf->vsize = tbl.proc_segment.vsize; - buf->size = tbl.proc_segment.size; - buf->resident = tbl.proc_segment.resident; - buf->share = tbl.proc_segment.shared; -} diff --git a/sysdeps/kernel/procsegment.c b/sysdeps/kernel/procsegment.c deleted file mode 100644 index 20fdc29f..00000000 --- a/sysdeps/kernel/procsegment.c +++ /dev/null @@ -1,77 +0,0 @@ -/* $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 <config.h> -#include <glibtop/error.h> -#include <glibtop/procsegment.h> - -#include "kernel.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) + -(1 << GLIBTOP_PROC_SEGMENT_DIRTY_SIZE) + -(1 << GLIBTOP_PROC_SEGMENT_START_CODE) + -(1 << GLIBTOP_PROC_SEGMENT_END_CODE) + -(1 << GLIBTOP_PROC_SEGMENT_START_STACK); - -/* Init function. */ - -void -glibtop_init_proc_segment_s (glibtop *server) -{ - server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment; -} - -/* Provides detailed information about a process. */ - -void -glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf, - pid_t pid) -{ - union table tbl; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0); - - memset (buf, 0, sizeof (glibtop_proc_segment)); - - if (table (TABLE_PROC_MEM, &tbl, &pid)) - glibtop_error_io_r (server, "table(TABLE_PROC_MEM)"); - - buf->start_code = tbl.proc_mem.start_code; - buf->end_code = tbl.proc_mem.end_code; - buf->start_stack = tbl.proc_mem.start_stack; - - if (table (TABLE_PROC_SEGMENT, &tbl, &pid)) - glibtop_error_io_r (server, "table(TABLE_PROC_SEGMENT)"); - - buf->flags = _glibtop_sysdeps_proc_segment; - - buf->text_rss = tbl.proc_segment.trs; - buf->shlib_rss = tbl.proc_segment.lrs; - buf->data_rss = tbl.proc_segment.drs; - buf->stack_rss = tbl.proc_segment.srs; - buf->dirty_size = tbl.proc_segment.dt; -} diff --git a/sysdeps/kernel/procsignal.c b/sysdeps/kernel/procsignal.c deleted file mode 100644 index 3e3829c2..00000000 --- a/sysdeps/kernel/procsignal.c +++ /dev/null @@ -1,63 +0,0 @@ -/* $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/procsignal.h> - -#include "kernel.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) -{ - union table tbl; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_SIGNAL, 0); - - memset (buf, 0, sizeof (glibtop_proc_signal)); - - if (table (TABLE_PROC_SIGNAL, &tbl, &pid)) - glibtop_error_io_r (server, "table(TABLE_PROC_SIGNAL)"); - - buf->flags = _glibtop_sysdeps_proc_signal; - - buf->signal [0] = tbl.proc_signal.signal; - buf->blocked [0] = tbl.proc_signal.blocked; - buf->sigignore [0] = tbl.proc_signal.ignored; - buf->sigcatch [0] = tbl.proc_signal.caught; -} diff --git a/sysdeps/kernel/procstate.c b/sysdeps/kernel/procstate.c deleted file mode 100644 index 59217a5e..00000000 --- a/sysdeps/kernel/procstate.c +++ /dev/null @@ -1,75 +0,0 @@ -/* $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/procstate.h> - -#include "kernel.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. */ - -#define NR_STATES 7 - -void -glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, - pid_t pid) -{ - union table tbl; - static const char states [NR_STATES] = - { 'R', 'S', 'D', 'Z', 'T', 'W', '.' }; - unsigned state; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_STATE, 0); - - memset (buf, 0, sizeof (glibtop_proc_state)); - - if (table (TABLE_PROC_STATE, &tbl, &pid)) - glibtop_error_io_r (server, "table(TABLE_PROC_STATE)"); - - buf->flags = _glibtop_sysdeps_proc_state; - - memcpy (buf->cmd, tbl.proc_state.comm, sizeof (tbl.proc_state.comm)); - - buf->uid = tbl.proc_state.uid; - buf->gid = tbl.proc_state.state; - - state = (unsigned) tbl.proc_state.state; - - if (state >= NR_STATES) - state = NR_STATES; - - buf->state = states [state]; -} diff --git a/sysdeps/kernel/proctime.c b/sysdeps/kernel/proctime.c deleted file mode 100644 index 5e5f455a..00000000 --- a/sysdeps/kernel/proctime.c +++ /dev/null @@ -1,73 +0,0 @@ -/* $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/proctime.h> - -#include "kernel.h" - -static const unsigned long _glibtop_sysdeps_proc_time = -(1 << GLIBTOP_PROC_TIME_UTIME) + (1 << GLIBTOP_PROC_TIME_CUTIME) + -(1 << GLIBTOP_PROC_TIME_STIME) + (1 << GLIBTOP_PROC_TIME_CSTIME) + -(1 << GLIBTOP_PROC_TIME_RTIME) + (1 << GLIBTOP_PROC_TIME_FREQUENCY) + -(1 << GLIBTOP_PROC_TIME_TIMEOUT) + (1 << GLIBTOP_PROC_TIME_IT_REAL_VALUE) + -(1 << GLIBTOP_PROC_TIME_START_TIME); - -/* Init function. */ - -void -glibtop_init_proc_time_s (glibtop *server) -{ - server->sysdeps.proc_time = _glibtop_sysdeps_proc_time; -} - -/* Provides detailed information about a process. */ - -void -glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, - pid_t pid) -{ - union table tbl; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_TIME, 0); - - memset (buf, 0, sizeof (glibtop_proc_time)); - - if (table (TABLE_PROC_TIME, &tbl, &pid)) - glibtop_error_io_r (server, "table(TABLE_PROC_TIME)"); - - buf->utime = tbl.proc_time.utime; - buf->stime = tbl.proc_time.stime; - - buf->rtime = buf->utime + buf->stime; - - buf->cutime = tbl.proc_time.cutime; - buf->cstime = tbl.proc_time.cstime; - - buf->frequency = 100; - - buf->timeout = tbl.proc_time.timeout; - buf->it_real_value = tbl.proc_time.it_real_value; - buf->start_time = tbl.proc_time.start_time; -} diff --git a/sysdeps/kernel/procuid.c b/sysdeps/kernel/procuid.c deleted file mode 100644 index d934b9c7..00000000 --- a/sysdeps/kernel/procuid.c +++ /dev/null @@ -1,105 +0,0 @@ -/* $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/procuid.h> - -#include "kernel.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_TPGID) + -(1 << GLIBTOP_PROC_UID_PRIORITY) + (1 << GLIBTOP_PROC_UID_NICE); - -/* Init function. */ - -void -glibtop_init_proc_uid_s (glibtop *server) -{ - server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid; -} - -#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z) - -/* Provides detailed information about a process. */ - -void -glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf, - pid_t pid) -{ - union table tbl; - long def_priority, priority, nice; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_UID, 0); - - memset (buf, 0, sizeof (glibtop_proc_uid)); - - if (table (TABLE_PROC_UID, &tbl, &pid)) - glibtop_error_io_r (server, "table(TABLE_PROC_UID)"); - - buf->flags = _glibtop_sysdeps_proc_uid; - - buf->uid = tbl.proc_uid.uid; - buf->euid = tbl.proc_uid.euid; - buf->gid = tbl.proc_uid.gid; - buf->egid = tbl.proc_uid.egid; - - buf->pid = tbl.proc_uid.pid; - buf->ppid = tbl.proc_uid.ppid; - buf->pgrp = tbl.proc_uid.pgrp; - buf->session = tbl.proc_uid.session; - buf->tty = tbl.proc_uid.tty; - buf->tpgid = tbl.proc_uid.tpgid; - - /* scale priority and nice values from timeslices to -20..20 */ - /* to make it look like a "normal" unix priority/nice value */ - - def_priority = tbl.proc_uid.def_priority; - - priority = tbl.proc_uid.counter; - priority = 20 - (priority * 10 + def_priority / 2) / def_priority; - nice = tbl.proc_uid.priority; - nice = 20 - (nice * 20 + def_priority / 2) / def_priority; - - buf->priority = (int) priority; - buf->nice = (int) nice; - - if (buf->tty == 0) - /* the old notty val, update elsewhere bef. moving to 0 */ - buf->tty = -1; - - if (server->os_version_code < LINUX_VERSION(1,3,39)) { - /* map old meanings to new */ - buf->priority = 2*15 - buf->priority; - buf->nice = 15 - buf->nice; - } - if (server->os_version_code < LINUX_VERSION(1,1,30) && buf->tty != -1) - /* when tty wasn't full devno */ - buf->tty = 4*0x100 + buf->tty; - - buf->flags = _glibtop_sysdeps_proc_uid; -} diff --git a/sysdeps/kernel/sem_limits.c b/sysdeps/kernel/sem_limits.c deleted file mode 100644 index 4d227553..00000000 --- a/sysdeps/kernel/sem_limits.c +++ /dev/null @@ -1,86 +0,0 @@ -/* $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/sem_limits.h> - -#include <sys/ipc.h> -#include <sys/sem.h> - -#ifdef _SEM_SEMUN_UNDEFINED - -/* glibc 2.1 will no longer defines semun, instead it defines - * _SEM_SEMUN_UNDEFINED so users can define semun on their own. - * Thanks to Albert K T Hui <avatar@deva.net>. */ - -union semun -{ - int val; - struct semid_ds *buf; - unsigned short int *array; - struct seminfo *__buf; -}; -#endif - -static const unsigned long _glibtop_sysdeps_sem_limits = -(1 << GLIBTOP_IPC_SEMMAP) + (1 << GLIBTOP_IPC_SEMMNI) + -(1 << GLIBTOP_IPC_SEMMNS) + (1 << GLIBTOP_IPC_SEMMNU) + -(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_s (glibtop *server) -{ - server->sysdeps.sem_limits = _glibtop_sysdeps_sem_limits; -} - -/* Provides information about sysv ipc limits. */ - -void -glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf) -{ - struct seminfo seminfo; - union semun arg; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_SEM_LIMITS, 0); - - memset (buf, 0, sizeof (glibtop_sem_limits)); - - buf->flags = _glibtop_sysdeps_sem_limits; - - arg.array = (ushort *) &seminfo; - semctl (0, 0, IPC_INFO, arg); - - buf->semmap = seminfo.semmap; - buf->semmni = seminfo.semmni; - buf->semmns = seminfo.semmns; - buf->semmnu = seminfo.semmnu; - buf->semmsl = seminfo.semmsl; - buf->semopm = seminfo.semopm; - buf->semume = seminfo.semume; - buf->semusz = seminfo.semusz; - buf->semvmx = seminfo.semvmx; - buf->semaem = seminfo.semaem; -} diff --git a/sysdeps/kernel/shm_limits.c b/sysdeps/kernel/shm_limits.c deleted file mode 100644 index 85a15618..00000000 --- a/sysdeps/kernel/shm_limits.c +++ /dev/null @@ -1,62 +0,0 @@ -/* $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/shm_limits.h> - -#include <sys/ipc.h> -#include <sys/shm.h> - -static const unsigned long _glibtop_sysdeps_shm_limits = -(1 << GLIBTOP_IPC_SHMMAX) + (1 << GLIBTOP_IPC_SHMMIN) + -(1 << GLIBTOP_IPC_SHMMNI) + (1 << GLIBTOP_IPC_SHMSEG) + -(1 << GLIBTOP_IPC_SHMALL); - -/* Init function. */ - -void -glibtop_init_shm_limits_s (glibtop *server) -{ - server->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits; -} - -/* Provides information about sysv ipc limits. */ - -void -glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf) -{ - struct shminfo shminfo; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_SHM_LIMITS, 0); - - memset (buf, 0, sizeof (glibtop_shm_limits)); - - buf->flags = _glibtop_sysdeps_shm_limits; - - shmctl (0, IPC_INFO, (struct shmid_ds *) &shminfo); - - buf->shmmax = shminfo.shmmax; - buf->shmmin = shminfo.shmmin; - buf->shmmni = shminfo.shmmni; - buf->shmseg = shminfo.shmseg; - buf->shmall = shminfo.shmall; -} diff --git a/sysdeps/kernel/siglist.c b/sysdeps/kernel/siglist.c deleted file mode 100644 index d00223c0..00000000 --- a/sysdeps/kernel/siglist.c +++ /dev/null @@ -1,60 +0,0 @@ -/* $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", NULL }, /* Hangup (POSIX). */ - { 2, "SIGINT", NULL }, /* Interrupt (ANSI). */ - { 3, "SIGQUIT", NULL }, /* Quit (POSIX). */ - { 4, "SIGILL", NULL }, /* Illegal instruction (ANSI). */ - { 5, "SIGTRAP", NULL }, /* Trace trap (POSIX). */ - { 6, "SIGABRT", NULL }, /* Abort (ANSI). */ - { 7, "SIGBUS", NULL }, /* BUS error (4.2 BSD). */ - { 8, "SIGFPE", NULL }, /* Floating-point exception (ANSI). */ - { 9, "SIGKILL", NULL }, /* Kill, unblockable (POSIX). */ - { 10, "SIGUSR1", NULL }, /* User-defined signal 1 (POSIX). */ - { 11, "SIGSEGV", NULL }, /* Segmentation violation (ANSI). */ - { 12, "SIGUSR2", NULL }, /* User-defined signal 2 (POSIX). */ - { 13, "SIGPIPE", NULL }, /* Broken pipe (POSIX). */ - { 14, "SIGALRM", NULL }, /* Alarm clock (POSIX). */ - { 15, "SIGTERM", NULL }, /* Termination (ANSI). */ - { 16, "SIGSTKFLT", NULL }, /* ??? */ - { 17, "SIGCHLD", NULL }, /* Child status has changed (POSIX). */ - { 18, "SIGCONT", NULL }, /* Continue (POSIX). */ - { 19, "SIGSTOP", NULL }, /* Stop, unblockable (POSIX). */ - { 20, "SIGTSTP", NULL }, /* Keyboard stop (POSIX). */ - { 21, "SIGTTIN", NULL }, /* Background read from tty (POSIX). */ - { 22, "SIGTTOU", NULL }, /* Background write to tty (POSIX). */ - { 23, "SIGURG", NULL }, /* Urgent condition on socket (4.2 BSD). */ - { 24, "SIGXCPU", NULL }, /* CPU limit exceeded (4.2 BSD). */ - { 25, "SIGXFSZ", NULL }, /* File size limit exceeded (4.2 BSD). */ - { 26, "SIGVTALRM", NULL }, /* Virtual alarm clock (4.2 BSD). */ - { 27, "SIGPROF", NULL }, /* Profiling alarm clock (4.2 BSD). */ - { 28, "SIGWINCH", NULL }, /* Window size change (4.3 BSD, Sun). */ - { 29, "SIGIO", NULL }, /* I/O now possible (4.2 BSD). */ - { 30, "SIGPWR", NULL }, /* Power failure restart (System V). */ - { 31, "SIGUNUSED", NULL }, - { 0, NULL, NULL }, -}; diff --git a/sysdeps/kernel/swap.c b/sysdeps/kernel/swap.c deleted file mode 100644 index f80a03dc..00000000 --- a/sysdeps/kernel/swap.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $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 <config.h> -#include <glibtop/error.h> -#include <glibtop/swap.h> - -#include "kernel.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); - -/* 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) -{ - union table tbl; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_SWAP, 0); - - memset (buf, 0, sizeof (glibtop_swap)); - - if (table (TABLE_SWAP, &tbl, NULL)) - glibtop_error_io_r (server, "table(TABLE_SWAP)"); - - buf->flags = _glibtop_sysdeps_swap; - - buf->total = tbl.swap.total; - buf->used = tbl.swap.used; - buf->free = tbl.swap.free; - - buf->pagein = tbl.swap.pagein; - buf->pageout = tbl.swap.pageout; -} diff --git a/sysdeps/kernel/sysinfo.c b/sysdeps/kernel/sysinfo.c deleted file mode 100644 index c3486edf..00000000 --- a/sysdeps/kernel/sysinfo.c +++ /dev/null @@ -1,94 +0,0 @@ -/* $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 <config.h> -#include <glibtop/cpu.h> -#include <glibtop/sysinfo.h> - -static const unsigned long _glibtop_sysdeps_sysinfo = -(1 << GLIBTOP_SYSINFO_CPUINFO); - -static glibtop_sysinfo sysinfo; - -static void -init_sysinfo (glibtop *server) -{ - char buffer [BUFSIZ]; - static int init = 0; - glibtop_entry *cpuinfo = NULL; - FILE *f; - - if (init) return; - - init = TRUE; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0); - - memset (&sysinfo, 0, sizeof (glibtop_sysinfo)); - - g_return_if_fail (f = fopen ("/proc/cpuinfo", "r")); - - while (fgets (buffer, BUFSIZ, f)) { - char *p, *start, *key, *value; - - if (cpuinfo == NULL) { - cpuinfo = &sysinfo.cpuinfo [sysinfo.ncpu++]; - - cpuinfo->labels = g_ptr_array_new (); - - cpuinfo->values = g_hash_table_new (NULL, NULL); - - if (sysinfo.ncpu > GLIBTOP_NCPU) - sysinfo.ncpu = GLIBTOP_NCPU; - } - - p = strchr (buffer, ':'); - if (!p) continue; - - /* Remove leading spaces from `p'. */ - *p = '\0'; start = p; p++; - while (isspace (*p)) p++; - - /* Remove trailing spaces from `buffer'. */ - while ((start > buffer) && (*start) && isspace (*start)) - *start-- = '\0'; - - key = g_strdup (buffer); - value = g_strdup (p); - - g_ptr_array_add (cpuinfo->labels, key); - - g_hash_table_insert (cpuinfo->values, key, value); - } - - fclose (f); - - sysinfo.flags = _glibtop_sysdeps_sysinfo; -} - -const glibtop_sysinfo * -glibtop_get_sysinfo_s (glibtop *server) -{ - init_sysinfo (server); - return &sysinfo; -} diff --git a/sysdeps/kernel/uptime.c b/sysdeps/kernel/uptime.c deleted file mode 100644 index 4f07b570..00000000 --- a/sysdeps/kernel/uptime.c +++ /dev/null @@ -1,67 +0,0 @@ -/* $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 <config.h> -#include <glibtop/error.h> -#include <glibtop/uptime.h> - -#include <time.h> - -#include "kernel.h" - -static const unsigned long _glibtop_sysdeps_uptime = -(1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME); - -/* Init function. */ - -void -glibtop_init_uptime_s (glibtop *server) -{ - server->sysdeps.uptime = _glibtop_sysdeps_uptime; -} - -/* Provides uptime and idle time. */ - -void -glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf) -{ - union table tbl; - - glibtop_init_s (&server, GLIBTOP_SYSDEPS_UPTIME, 0); - - memset (buf, 0, sizeof (glibtop_uptime)); - - if (table (TABLE_UPTIME, &tbl, NULL)) - glibtop_error_io_r (server, "table(TABLE_UPTIME)"); - - buf->flags = _glibtop_sysdeps_uptime; - -#if 0 - fprintf (stderr, "Table (%u) = %lu, %lu\n", - TABLE_UPTIME, tbl.uptime.uptime, tbl.uptime.idle); -#endif - - buf->uptime = (double) tbl.uptime.uptime / HZ; - buf->idletime = (double) tbl.uptime.idle / HZ; - buf->boot_time = (guint64) time(NULL) - (tbl.uptime.uptime / HZ); -} |