diff --git a/backends/sysdeps/.cvsignore b/backends/sysdeps/.cvsignore new file mode 100644 index 00000000..09980ae6 --- /dev/null +++ b/backends/sysdeps/.cvsignore @@ -0,0 +1,6 @@ +.deps +.libs +Makefile +Makefile.in +*.lo +*.la diff --git a/backends/sysdeps/ChangeLog b/backends/sysdeps/ChangeLog new file mode 100644 index 00000000..ebc7d1ee --- /dev/null +++ b/backends/sysdeps/ChangeLog @@ -0,0 +1,7 @@ +2000-01-01 Martin Baulig + + Initial version of the "glibtop-backend-sysdeps" backend. + + * backend-sysdeps.c: New file. + * glibtop-backend-private.h: New file. + diff --git a/backends/sysdeps/Makefile.am b/backends/sysdeps/Makefile.am new file mode 100644 index 00000000..293e6eba --- /dev/null +++ b/backends/sysdeps/Makefile.am @@ -0,0 +1,17 @@ +LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ + +INCLUDES = @INCLUDES@ + +noinst_HEADERS = \ + glibtop-backend-private.h + +lib_LTLIBRARIES = \ + libgtop_backend_sysdeps.la + +libgtop_backend_sysdeps_la_SOURCES = \ + backend-sysdeps.c \ + call-vector.c + +libgtop_backend_sysdeps_la_LDFLAGS = \ + $(LT_VERSION_INFO) + diff --git a/backends/sysdeps/backend-sysdeps.c b/backends/sysdeps/backend-sysdeps.c new file mode 100644 index 00000000..2fef81dc --- /dev/null +++ b/backends/sysdeps/backend-sysdeps.c @@ -0,0 +1,77 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ + +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , 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 +#include +#include + +#include +#include +#include + +static int +_open_sysdeps (glibtop *, glibtop_backend *, u_int64_t, const char **); + +static int +_close_sysdeps (glibtop *, glibtop_backend *); + +extern glibtop_call_vector glibtop_backend_sysdeps_call_vector; + +glibtop_backend_info glibtop_backend_sysdeps = { + "glibtop-backend-sysdeps", _open_sysdeps, _close_sysdeps, + &glibtop_backend_sysdeps_call_vector +}; + +static int +_open_sysdeps (glibtop *server, glibtop_backend *backend, + u_int64_t features, const char **backend_args) +{ + glibtop_init_func_t *init_fkt; + + backend->_priv = glibtop_calloc_r + (server, 1, sizeof (glibtop_backend_private)); + + /* Do the initialization, but only if not already initialized. */ + + if ((server->flags & _GLIBTOP_INIT_STATE_SYSDEPS) == 0) { + glibtop_open_s (server, "glibtop", features, 0); + + for (init_fkt = _glibtop_init_hook_s; *init_fkt; init_fkt++) + (*init_fkt) (server); + + server->sysdeps.pointer_size = sizeof (void*)*8; + + server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS; + } + + return 0; +} + +static int +_close_sysdeps (glibtop *server, glibtop_backend *backend) +{ + return -1; +} + diff --git a/backends/sysdeps/call-vector.c b/backends/sysdeps/call-vector.c new file mode 100644 index 00000000..2eeac114 --- /dev/null +++ b/backends/sysdeps/call-vector.c @@ -0,0 +1,147 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ + +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , 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 +#include +#include + +#include +#include +#include + +glibtop_call_vector glibtop_backend_sysdeps_call_vector = { +#if GLIBTOP_SUID_CPU + NULL, +#else + glibtop_get_cpu_s, +#endif +#if GLIBTOP_SUID_MEM + NULL, +#else + glibtop_get_mem_s, +#endif +#if GLIBTOP_SUID_SWAP + NULL, +#else + glibtop_get_swap_s, +#endif +#if GLIBTOP_SUID_UPTIME + NULL, +#else + glibtop_get_uptime_s, +#endif +#if GLIBTOP_SUID_LOADAVG + NULL, +#else + glibtop_get_loadavg_s, +#endif +#if GLIBTOP_SUID_SHM_LIMITS + NULL, +#else + glibtop_get_shm_limits_s, +#endif +#if GLIBTOP_SUID_MSG_LIMITS + NULL, +#else + glibtop_get_msg_limits_s, +#endif +#if GLIBTOP_SUID_SEM_LIMITS + NULL, +#else + glibtop_get_sem_limits_s, +#endif +#if GLIBTOP_SUID_PROCLIST + NULL, +#else + glibtop_get_proclist_s, +#endif +#if GLIBTOP_SUID_PROC_STATE + NULL, +#else + glibtop_get_proc_state_s, +#endif +#if GLIBTOP_SUID_PROC_UID + NULL, +#else + glibtop_get_proc_uid_s, +#endif +#if GLIBTOP_SUID_PROC_MEM + NULL, +#else + glibtop_get_proc_mem_s, +#endif +#if GLIBTOP_SUID_PROC_TIME + NULL, +#else + glibtop_get_proc_time_s, +#endif +#if GLIBTOP_SUID_PROC_SIGNAL + NULL, +#else + glibtop_get_proc_signal_s, +#endif +#if GLIBTOP_SUID_PROC_KERNEL + NULL, +#else + glibtop_get_proc_kernel_s, +#endif +#if GLIBTOP_SUID_PROC_SEGMENT + NULL, +#else + glibtop_get_proc_segment_s, +#endif +#if GLIBTOP_SUID_PROC_ARGS + NULL, +#else + glibtop_get_proc_args_s, +#endif +#if GLIBTOP_SUID_PROC_MAP + NULL, +#else + glibtop_get_proc_map_s, +#endif + glibtop_get_mountlist_s, + glibtop_get_fsusage_s, +#if GLIBTOP_SUID_INTERFACE_NAMES + NULL, +#else + glibtop_get_interface_names_s, +#endif +#if GLIBTOP_SUID_NETINFO + NULL, +#else + glibtop_get_netinfo_s, +#endif +#if GLIBTOP_SUID_NETLOAD + NULL, +#else + glibtop_get_netload_s, +#endif +#if GLIBTOP_SUID_PPP + NULL +#else + glibtop_get_ppp_s +#endif +}; diff --git a/backends/sysdeps/glibtop-backend-private.h b/backends/sysdeps/glibtop-backend-private.h new file mode 100644 index 00000000..81d485b6 --- /dev/null +++ b/backends/sysdeps/glibtop-backend-private.h @@ -0,0 +1,34 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ + +/* $Id$ */ + +/* Copyright (C) 1998-99 Martin Baulig + This file is part of LibGTop 1.0. + + Contributed by Martin Baulig , 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_BACKEND_PRIVATE_H__ +#define __GLIBTOP_BACKEND_PRIVATE_H__ + +struct _glibtop_backend_private +{ + u_int64_t flags; +}; + +#endif