Started with the big rewrite for GNOME 2.0:
2000-11-20 Martin Baulig <baulig@suse.de> Started with the big rewrite for GNOME 2.0: - split the `glibtop' structure into `glibtop_server' and `glibtop_client' and make `glibtop_client' a GObject. - cleanly separate the library and the backends. This stuff currently does not compile. * glibtop.h (glibtop_server_private, glibtop_server_info): Removed typedefs. (struct _glibtop, struct _glibtop_server_info): Removed. (glibtop_global_server, glibtop_server_features): Removed. (glibtop_server_ref, glibtop_server_unref): Removed. * glibtop.h (glibtop_init_s): First argument is now a `glibtop_server *'. * include/glibtop/*.h: Removed all #defines with the glibtop_global_server. (glibtop_get_*_l): First argument is now a `glibtop_client *'. (glibtop_get_*_s, glibtop_init_*_s): First argument is now a `glibtop_server *'. * lib/glibtop-client.c: New file. * sysdeps/common/xmalloc.c: Moved to lib/. * sysdeps/common/error.c: Moved to lib/. * lib/xmalloc.c: Moved here from sysdeps/common/. * lib/error.c: Moved here from sysdeps/common/. * include/glibtop/backend.h (glibtop_backend_open_func_t, glibtop_backend_close_func_t): First argument is now a `glibtop_server *'. (glibtop_backend_info): Added `glibtop_server *server'. (glibtop_open_backend_l): Returns `glibtop_backend *', first argument is `glibtop_client *' and added `GError **'. * include/glibtop/close.h (glibtop_close_s, glibtop_close_p): First argument is now a `glibtop_server *'. * include/glibtop/error.h (*): First argument is now a `glibtop_server *'. * include/glibtop/errors.h: Switched this to use GError.
This commit is contained in:
committed by
Martin Baulig
parent
c15ff3f342
commit
752d5b47d2
@@ -16,8 +16,7 @@ CFLAGS = @CFLAGS@ $(inodedb_DEFS)
|
||||
|
||||
lib_LTLIBRARIES = libgtop_common.la libgtop_suid_common.la
|
||||
|
||||
libgtop_common_la_SOURCES = xmalloc.c error.c \
|
||||
fsusage.c fsusage.h mountlist.c mountlist.h \
|
||||
libgtop_common_la_SOURCES = fsusage.c fsusage.h mountlist.c mountlist.h \
|
||||
$(inodedb_SRCLIST)
|
||||
|
||||
libgtop_common_la_LDFLAGS = $(LT_VERSION_INFO) $(dynamic_ldflags)
|
||||
|
@@ -1,170 +0,0 @@
|
||||
/* -*- 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 <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/error.h>
|
||||
|
||||
#define DEFAULT_NAME "LibGTop-Server"
|
||||
|
||||
/* Prints error message and exits. */
|
||||
|
||||
static void
|
||||
print_server_name (glibtop *server)
|
||||
{
|
||||
fprintf (stderr, "%s: ", server ?
|
||||
(server->name ? server->name : DEFAULT_NAME)
|
||||
: DEFAULT_NAME);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_error_vr (glibtop *server, char *format, va_list args)
|
||||
{
|
||||
print_server_name (server);
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, "\n");
|
||||
|
||||
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||
abort ();
|
||||
#else
|
||||
exit (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_error_io_vr (glibtop *server, char *format, int error, va_list args)
|
||||
{
|
||||
print_server_name (server);
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, ": %s\n", strerror (error));
|
||||
|
||||
#ifdef LIBGTOP_ENABLE_DEBUG
|
||||
abort ();
|
||||
#else
|
||||
exit (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_warn_vr (glibtop *server, char *format, va_list args)
|
||||
{
|
||||
print_server_name (server);
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, "\n");
|
||||
|
||||
#ifdef LIBGTOP_FATAL_WARNINGS
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_warn_io_vr (glibtop *server, char *format, int error, va_list args)
|
||||
{
|
||||
print_server_name (server);
|
||||
vfprintf (stderr, format, args);
|
||||
fprintf (stderr, ": %s\n", strerror (error));
|
||||
|
||||
#ifdef LIBGTOP_FATAL_WARNINGS
|
||||
abort ();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_error_r (glibtop *server, char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
glibtop_error_vr (server, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_warn_r (glibtop *server, char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
glibtop_warn_vr (server, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_error_io_r (glibtop *server, char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
glibtop_error_io_vr (server, format, errno, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_warn_io_r (glibtop *server, char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
glibtop_warn_io_vr (server, format, errno, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
#ifndef __GNUC__
|
||||
|
||||
static void
|
||||
glibtop_error (char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
glibtop_error_vr (glibtop_global_server, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
static void
|
||||
glibtop_warn (char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
glibtop_warn_vr (glibtop_global_server, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
static void
|
||||
glibtop_error_io (char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
glibtop_error_io_vr (glibtop_global_server, format, errno, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
static void
|
||||
glibtop_warn_io (char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
glibtop_warn_io_vr (glibtop_global_server, format, errno, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
#endif /* no __GNUC__ */
|
@@ -291,12 +291,12 @@ statfs (path, fsb)
|
||||
#endif /* _AIX && _I386 */
|
||||
|
||||
int
|
||||
glibtop_get_fsusage_s (glibtop *server, glibtop_fsusage *buf,
|
||||
glibtop_get_fsusage_s (glibtop_server *server, glibtop_fsusage *buf,
|
||||
const char *disk)
|
||||
{
|
||||
struct fs_usage fsp;
|
||||
|
||||
glibtop_init_r (&server, 0, 0);
|
||||
glibtop_init_s (server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_fsusage));
|
||||
memset (&fsp, 0, sizeof (struct fs_usage));
|
||||
|
@@ -588,13 +588,14 @@ read_filesystem_list (need_fs_type, all_fs)
|
||||
}
|
||||
|
||||
glibtop_mountentry *
|
||||
glibtop_get_mountlist_s (glibtop *server, glibtop_mountlist *buf, int all_fs)
|
||||
glibtop_get_mountlist_s (glibtop_server *server, glibtop_mountlist *buf,
|
||||
int all_fs)
|
||||
{
|
||||
struct mount_entry *me, *tmp, *next;
|
||||
glibtop_mountentry *mount_list;
|
||||
int count;
|
||||
|
||||
glibtop_init_r (&server, 0, 0);
|
||||
glibtop_init_s (server, 0, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_mountlist));
|
||||
|
||||
|
@@ -1,98 +0,0 @@
|
||||
/* -*- 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 <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/xmalloc.h>
|
||||
|
||||
#ifdef LIBGTOP_USE_GLIB_MALLOC
|
||||
#include <glib.h>
|
||||
#endif
|
||||
|
||||
/* Wrappers to malloc, calloc, realloc ... */
|
||||
|
||||
void *
|
||||
glibtop_malloc_r (glibtop *server, size_t size)
|
||||
{
|
||||
#ifdef LIBGTOP_USE_GLIB_MALLOC
|
||||
return g_malloc0 (size);
|
||||
#else
|
||||
void *buf = malloc (size);
|
||||
|
||||
if (!buf)
|
||||
glibtop_error_io_r (server, "malloc %d bytes", size);
|
||||
|
||||
return buf;
|
||||
#endif
|
||||
}
|
||||
|
||||
void *
|
||||
glibtop_calloc_r (glibtop *server, size_t nmemb, size_t size)
|
||||
{
|
||||
#ifdef LIBGTOP_USE_GLIB_MALLOC
|
||||
return g_malloc0 (size * nmemb);
|
||||
#else
|
||||
void *buf = calloc (nmemb, size);
|
||||
|
||||
if (!buf)
|
||||
glibtop_error_io_r (server, "calloc %d blocks (%d bytes each)",
|
||||
nmemb, size);
|
||||
|
||||
return buf;
|
||||
#endif
|
||||
}
|
||||
|
||||
void *
|
||||
glibtop_realloc_r (glibtop *server, void *ptr, size_t size)
|
||||
{
|
||||
#ifdef LIBGTOP_USE_GLIB_MALLOC
|
||||
return g_realloc (ptr, size);
|
||||
#else
|
||||
void *buf = realloc (ptr, size);
|
||||
|
||||
if (!buf)
|
||||
glibtop_error_io_r (server, "realloc %d bytes", size);
|
||||
|
||||
return buf;
|
||||
#endif
|
||||
}
|
||||
|
||||
char *
|
||||
glibtop_strdup_r (glibtop *server, const char *string)
|
||||
{
|
||||
#ifdef LIBGTOP_USE_GLIB_MALLOC
|
||||
return g_strdup (string);
|
||||
#else
|
||||
return strcpy (glibtop_malloc_r (server, strlen (string) + 1), string);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_free_r (glibtop *server, const void *ptr)
|
||||
{
|
||||
#ifdef LIBGTOP_USE_GLIB_MALLOC
|
||||
g_free (ptr);
|
||||
#else
|
||||
if (ptr) free ((void *) ptr);
|
||||
#endif
|
||||
}
|
@@ -28,7 +28,7 @@
|
||||
/* Wrappers to malloc, calloc, realloc ... */
|
||||
|
||||
void *
|
||||
glibtop_malloc_r (glibtop *server, size_t size)
|
||||
glibtop_malloc_r (glibtop_server *server, size_t size)
|
||||
{
|
||||
void *buf = malloc (size);
|
||||
|
||||
@@ -39,7 +39,7 @@ glibtop_malloc_r (glibtop *server, size_t size)
|
||||
}
|
||||
|
||||
void *
|
||||
glibtop_calloc_r (glibtop *server, size_t nmemb, size_t size)
|
||||
glibtop_calloc_r (glibtop_server *server, size_t nmemb, size_t size)
|
||||
{
|
||||
void *buf = calloc (nmemb, size);
|
||||
|
||||
@@ -51,7 +51,7 @@ glibtop_calloc_r (glibtop *server, size_t nmemb, size_t size)
|
||||
}
|
||||
|
||||
void *
|
||||
glibtop_realloc_r (glibtop *server, void *ptr, size_t size)
|
||||
glibtop_realloc_r (glibtop_server *server, void *ptr, size_t size)
|
||||
{
|
||||
void *buf = realloc (ptr, size);
|
||||
|
||||
@@ -62,13 +62,13 @@ glibtop_realloc_r (glibtop *server, void *ptr, size_t size)
|
||||
}
|
||||
|
||||
char *
|
||||
glibtop_strdup_r (glibtop *server, const char *string)
|
||||
glibtop_strdup_r (glibtop_server *server, const char *string)
|
||||
{
|
||||
return strcpy (glibtop_malloc_r (server, strlen (string) + 1), string);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_free_r (glibtop *server, const void *ptr)
|
||||
glibtop_free_r (glibtop_server *server, const void *ptr)
|
||||
{
|
||||
if (ptr) free ((void *) ptr);
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
INCLUDES = @INCLUDES@
|
||||
INCLUDES = @INCLUDES@ -D_IN_LIBGTOP_SERVER
|
||||
|
||||
lib_LTLIBRARIES = libgtop_sysdeps.la
|
||||
|
||||
@@ -13,5 +13,5 @@ libgtop_sysdeps_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
|
||||
|
||||
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
include_HEADERS = glibtop_server.h
|
||||
noinst_HEADERS = glibtop_server_private.h
|
||||
|
||||
|
@@ -28,5 +28,5 @@
|
||||
/* Closes pipe to gtop server. */
|
||||
|
||||
void
|
||||
glibtop_close_s (glibtop *server)
|
||||
glibtop_close_s (glibtop_server *server)
|
||||
{ }
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_cpu = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_cpu_s (glibtop *server)
|
||||
glibtop_init_cpu_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.cpu = _glibtop_sysdeps_cpu;
|
||||
|
||||
@@ -41,8 +41,10 @@ glibtop_init_cpu_s (glibtop *server)
|
||||
/* Provides information about cpu usage. */
|
||||
|
||||
int
|
||||
glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
glibtop_get_cpu_s (glibtop_server *server, glibtop_cpu *buf)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_CPU, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_cpu));
|
||||
|
||||
return 0;
|
||||
|
@@ -23,8 +23,8 @@
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GLIBTOP_SERVER_H__
|
||||
#define __GLIBTOP_SERVER_H__
|
||||
#ifndef __GLIBTOP_SERVER_PRIVATE_H__
|
||||
#define __GLIBTOP_SERVER_PRIVATE_H__
|
||||
|
||||
BEGIN_LIBGTOP_DECLS
|
||||
|
@@ -34,7 +34,7 @@ static const unsigned long _glibtop_sysdeps_interface_names =
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_interface_names_s (glibtop *server)
|
||||
glibtop_init_interface_names_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.interface_names = _glibtop_sysdeps_interface_names;
|
||||
|
||||
@@ -45,11 +45,11 @@ glibtop_init_interface_names_s (glibtop *server)
|
||||
|
||||
|
||||
glibtop_interface *
|
||||
glibtop_get_interface_names_s (glibtop *server, glibtop_array *array,
|
||||
glibtop_get_interface_names_s (glibtop_server *server, glibtop_array *array,
|
||||
u_int64_t interface, u_int64_t number,
|
||||
u_int64_t instance, u_int64_t strategy)
|
||||
{
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_INTERFACE_NAMES, 0);
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_INTERFACE_NAMES, 0);
|
||||
|
||||
memset (array, 0, sizeof (glibtop_array));
|
||||
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_loadavg = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_loadavg_s (glibtop *server)
|
||||
glibtop_init_loadavg_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
|
||||
|
||||
@@ -41,8 +41,10 @@ glibtop_init_loadavg_s (glibtop *server)
|
||||
/* Provides load averange. */
|
||||
|
||||
int
|
||||
glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf)
|
||||
glibtop_get_loadavg_s (glibtop_server *server, glibtop_loadavg *buf)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_LOADAVG, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_loadavg));
|
||||
|
||||
return 0;
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_mem = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_mem_s (glibtop *server)
|
||||
glibtop_init_mem_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.mem = _glibtop_sysdeps_mem;
|
||||
|
||||
@@ -41,8 +41,10 @@ glibtop_init_mem_s (glibtop *server)
|
||||
/* Provides information about memory usage. */
|
||||
|
||||
int
|
||||
glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
|
||||
glibtop_get_mem_s (glibtop_server *server, glibtop_mem *buf)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_MEM, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_mem));
|
||||
|
||||
return 0;
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_msg_limits = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_msg_limits_s (glibtop *server)
|
||||
glibtop_init_msg_limits_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits;
|
||||
|
||||
@@ -41,8 +41,10 @@ glibtop_init_msg_limits_s (glibtop *server)
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
int
|
||||
glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf)
|
||||
glibtop_get_msg_limits_s (glibtop_server *server, glibtop_msg_limits *buf)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_MSG_LIMITS, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_msg_limits));
|
||||
|
||||
return 0;
|
||||
|
@@ -32,7 +32,7 @@ static const unsigned long _glibtop_sysdeps_netload = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_netload_s (glibtop *server)
|
||||
glibtop_init_netload_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.netload = _glibtop_sysdeps_netload;
|
||||
|
||||
@@ -42,10 +42,12 @@ glibtop_init_netload_s (glibtop *server)
|
||||
/* Provides network statistics. */
|
||||
|
||||
int
|
||||
glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
|
||||
glibtop_get_netload_s (glibtop_server *server, glibtop_netload *buf,
|
||||
const char *interface, unsigned transport,
|
||||
unsigned protocol)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_NETLOAD, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_netload));
|
||||
|
||||
return 0;
|
||||
|
@@ -29,7 +29,7 @@
|
||||
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
|
||||
|
||||
void
|
||||
glibtop_open_s (glibtop *server, const char *program_name,
|
||||
glibtop_open_s (glibtop_server *server, const char *program_name,
|
||||
const unsigned long features, const unsigned flags)
|
||||
{
|
||||
server->name = program_name;
|
||||
|
@@ -32,7 +32,7 @@ static const unsigned long _glibtop_sysdeps_ppp = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_ppp_s (glibtop *server)
|
||||
glibtop_init_ppp_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.ppp = _glibtop_sysdeps_ppp;
|
||||
|
||||
@@ -42,9 +42,11 @@ glibtop_init_ppp_s (glibtop *server)
|
||||
/* Provides PPP/ISDN information. */
|
||||
|
||||
int
|
||||
glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device,
|
||||
unsigned short isdn)
|
||||
glibtop_get_ppp_s (glibtop_server *server, glibtop_ppp *buf,
|
||||
unsigned short device, unsigned short isdn)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_PPP, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_ppp));
|
||||
|
||||
return 0;
|
||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_args = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_proc_args_s (glibtop *server)
|
||||
glibtop_init_proc_args_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
|
||||
|
||||
@@ -43,8 +43,11 @@ glibtop_init_proc_args_s (glibtop *server)
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
char **
|
||||
glibtop_get_proc_args_s (glibtop *server, glibtop_array *array, pid_t pid)
|
||||
glibtop_get_proc_args_s (glibtop_server *server, glibtop_array *array, pid_t pid)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_PROC_ARGS, 0);
|
||||
|
||||
memset (array, 0, sizeof (glibtop_array));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proc_cwd = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_proc_cwd_s (glibtop *server)
|
||||
glibtop_init_proc_cwd_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.proc_cwd = _glibtop_sysdeps_proc_cwd;
|
||||
|
||||
@@ -43,8 +43,10 @@ glibtop_init_proc_cwd_s (glibtop *server)
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
char *
|
||||
glibtop_get_proc_cwd_s (glibtop *server, glibtop_proc_cwd *buf, pid_t pid)
|
||||
glibtop_get_proc_cwd_s (glibtop_server *server, glibtop_proc_cwd *buf, pid_t pid)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_PROC_CWD, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_cwd));
|
||||
|
||||
return NULL;
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_proc_kernel = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_proc_kernel_s (glibtop *server)
|
||||
glibtop_init_proc_kernel_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel;
|
||||
|
||||
@@ -41,9 +41,11 @@ glibtop_init_proc_kernel_s (glibtop *server)
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
int
|
||||
glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf,
|
||||
glibtop_get_proc_kernel_s (glibtop_server *server, glibtop_proc_kernel *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_PROC_KERNEL, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_kernel));
|
||||
|
||||
return 0;
|
||||
|
@@ -33,7 +33,7 @@ static const unsigned long _glibtop_sysdeps_proclist = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_proclist_s (glibtop *server)
|
||||
glibtop_init_proclist_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.proclist = _glibtop_sysdeps_proclist;
|
||||
|
||||
@@ -48,9 +48,12 @@ glibtop_init_proclist_s (glibtop *server)
|
||||
* each buf->size big. The total size is stored in buf->total. */
|
||||
|
||||
unsigned *
|
||||
glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
|
||||
glibtop_get_proclist_s (glibtop_server *server, glibtop_proclist *buf,
|
||||
int64_t which, int64_t arg)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_PROCLIST, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proclist));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ static const unsigned long _glibtop_sysdeps_proc_map = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_proc_map_s (glibtop *server)
|
||||
glibtop_init_proc_map_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
|
||||
|
||||
@@ -44,9 +44,10 @@ glibtop_init_proc_map_s (glibtop *server)
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
glibtop_map_entry *
|
||||
glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
|
||||
glibtop_get_proc_map_s (glibtop_server *server, glibtop_proc_map *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0);
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_PROC_MAP, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_map));
|
||||
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_proc_mem = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_proc_mem_s (glibtop *server)
|
||||
glibtop_init_proc_mem_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
|
||||
|
||||
@@ -41,9 +41,11 @@ glibtop_init_proc_mem_s (glibtop *server)
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
int
|
||||
glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf,
|
||||
glibtop_get_proc_mem_s (glibtop_server *server, glibtop_proc_mem *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_PROC_MEM, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_mem));
|
||||
|
||||
return 0;
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_proc_segment = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_proc_segment_s (glibtop *server)
|
||||
glibtop_init_proc_segment_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment;
|
||||
|
||||
@@ -41,9 +41,11 @@ glibtop_init_proc_segment_s (glibtop *server)
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
int
|
||||
glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
||||
glibtop_get_proc_segment_s (glibtop_server *server, glibtop_proc_segment *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_segment));
|
||||
|
||||
return 0;
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_proc_signal = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_proc_signal_s (glibtop *server)
|
||||
glibtop_init_proc_signal_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.proc_signal = _glibtop_sysdeps_proc_signal;
|
||||
|
||||
@@ -41,9 +41,11 @@ glibtop_init_proc_signal_s (glibtop *server)
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
int
|
||||
glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf,
|
||||
glibtop_get_proc_signal_s (glibtop_server *server, glibtop_proc_signal *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_PROC_SIGNAL, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_signal));
|
||||
|
||||
return 0;
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_proc_state = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_proc_state_s (glibtop *server)
|
||||
glibtop_init_proc_state_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.proc_state = _glibtop_sysdeps_proc_state;
|
||||
|
||||
@@ -41,9 +41,11 @@ glibtop_init_proc_state_s (glibtop *server)
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
int
|
||||
glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf,
|
||||
glibtop_get_proc_state_s (glibtop_server *server, glibtop_proc_state *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_PROC_STATE, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_state));
|
||||
|
||||
return 0;
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_proc_time = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_proc_time_s (glibtop *server)
|
||||
glibtop_init_proc_time_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.proc_time = _glibtop_sysdeps_proc_time;
|
||||
|
||||
@@ -41,9 +41,11 @@ glibtop_init_proc_time_s (glibtop *server)
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
int
|
||||
glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf,
|
||||
glibtop_get_proc_time_s (glibtop_server *server, glibtop_proc_time *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_PROC_TIME, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_time));
|
||||
|
||||
return 0;
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_proc_uid = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_proc_uid_s (glibtop *server)
|
||||
glibtop_init_proc_uid_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid;
|
||||
|
||||
@@ -41,9 +41,11 @@ glibtop_init_proc_uid_s (glibtop *server)
|
||||
/* Provides detailed information about a process. */
|
||||
|
||||
int
|
||||
glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf,
|
||||
glibtop_get_proc_uid_s (glibtop_server *server, glibtop_proc_uid *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_PROC_UID, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_uid));
|
||||
|
||||
return 0;
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_sem_limits = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_sem_limits_s (glibtop *server)
|
||||
glibtop_init_sem_limits_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.sem_limits = _glibtop_sysdeps_sem_limits;
|
||||
|
||||
@@ -41,7 +41,7 @@ glibtop_init_sem_limits_s (glibtop *server)
|
||||
/* Provides information about sysv sem limits. */
|
||||
|
||||
int
|
||||
glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf)
|
||||
glibtop_get_sem_limits_s (glibtop_server *server, glibtop_sem_limits *buf)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_sem_limits));
|
||||
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_shm_limits = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_shm_limits_s (glibtop *server)
|
||||
glibtop_init_shm_limits_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits;
|
||||
|
||||
@@ -41,7 +41,7 @@ glibtop_init_shm_limits_s (glibtop *server)
|
||||
/* Provides information about sysv ipc limits. */
|
||||
|
||||
int
|
||||
glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf)
|
||||
glibtop_get_shm_limits_s (glibtop_server *server, glibtop_shm_limits *buf)
|
||||
{
|
||||
memset (buf, 0, sizeof (glibtop_shm_limits));
|
||||
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_swap = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_swap_s (glibtop *server)
|
||||
glibtop_init_swap_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.swap = _glibtop_sysdeps_swap;
|
||||
|
||||
@@ -41,8 +41,10 @@ glibtop_init_swap_s (glibtop *server)
|
||||
/* Provides information about swap usage. */
|
||||
|
||||
int
|
||||
glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
|
||||
glibtop_get_swap_s (glibtop_server *server, glibtop_swap *buf)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_SWAP, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_swap));
|
||||
|
||||
return 0;
|
||||
|
@@ -31,7 +31,7 @@ static const unsigned long _glibtop_sysdeps_uptime = 0;
|
||||
/* Init function. */
|
||||
|
||||
int
|
||||
glibtop_init_uptime_s (glibtop *server)
|
||||
glibtop_init_uptime_s (glibtop_server *server)
|
||||
{
|
||||
server->info->sysdeps.uptime = _glibtop_sysdeps_uptime;
|
||||
|
||||
@@ -41,8 +41,10 @@ glibtop_init_uptime_s (glibtop *server)
|
||||
/* Provides uptime and idle time. */
|
||||
|
||||
int
|
||||
glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf)
|
||||
glibtop_get_uptime_s (glibtop_server *server, glibtop_uptime *buf)
|
||||
{
|
||||
glibtop_init_s (server, GLIBTOP_SYSDEPS_UPTIME, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_uptime));
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user