Compare commits

...

31 Commits

Author SHA1 Message Date
Benoît Dejean
3d4491494f Released 2.23.90.
svn path=/trunk/; revision=2768
2008-08-18 16:11:59 +00:00
Benoît Dejean
10a04fc9c7 Improved freebsd port.
Patch by Joe Marcus Clarke <marcus@freebsd.org>.
Closes #548184.

svn path=/trunk/; revision=2767
2008-08-18 16:11:07 +00:00
Benoît Dejean
10e5124770 Bumped version number
svn path=/trunk/; revision=2766
2008-08-18 16:09:34 +00:00
Djihed Afifi
f269f738d7 Updated Arabic Translation by Khaled Hosny.
svn path=/trunk/; revision=2765
2008-08-06 08:32:20 +00:00
Djihed Afifi
bc86ee5421 Updated Arabic Translation by Khaled Hosny.
svn path=/trunk/; revision=2764
2008-07-29 01:34:38 +00:00
Leonardo Ferreira Fontenelle
7ea989c2b8 Terminology improvement by Vladimir Melo.
2008-07-25  Leonardo Ferreira Fontenelle  <leonardof@gnome.org>

	* pt_BR.po: Terminology improvement by Vladimir Melo.

svn path=/trunk/; revision=2763
2008-07-26 00:36:51 +00:00
Benoît Dejean
91b7ae4b11 Released 2.23.4.
svn path=/trunk/; revision=2759
2008-06-23 22:07:54 +00:00
Benoît Dejean
ce23ce407c Improved example.
svn path=/trunk/; revision=2758
2008-06-23 22:07:26 +00:00
Benoît Dejean
7f779e078d Fixed I/O stats so it works for unpartionned devices (e.g. cdrom).
svn path=/trunk/; revision=2757
2008-06-22 11:27:30 +00:00
Benoît Dejean
229eab1213 Updated example to display read/write counters.
svn path=/trunk/; revision=2756
2008-06-22 10:50:29 +00:00
Benoît Dejean
791e0dd859 Handle new /sys/block/.../stat format for linux >= 2.6.25.
Closes #539360.

svn path=/trunk/; revision=2755
2008-06-22 09:31:41 +00:00
Djihed Afifi
f63973eac5 Updated Arabic Translation by Khaled Hosny.
svn path=/trunk/; revision=2752
2008-06-11 21:40:37 +00:00
Benoît Dejean
806a2d2d7e Released 2.23.2.
svn path=/trunk/; revision=2750
2008-05-24 16:23:07 +00:00
Benoît Dejean
af81e9be75 Put back the old behaviour (no smart pss for now).
svn path=/trunk/; revision=2749
2008-05-24 16:20:01 +00:00
Benoît Dejean
90fc3ca780 New API to retrieve process CPU affinity.
Linux implementation.

svn path=/trunk/; revision=2748
2008-05-24 09:50:04 +00:00
Benoît Dejean
99e9437b37 Fixed libtool version.
Thanks to Bastien Nocera and Matteo Settenvini.
Set to 9:0:2.

svn path=/trunk/; revision=2746
2008-05-23 22:04:24 +00:00
Djihed Afifi
6c7f40ac64 Updated Arabic Translation by Khaled Hosny.
svn path=/trunk/; revision=2744
2008-05-22 22:59:38 +00:00
Djihed Afifi
e75261ada8 Updated Arabic Translation by Khaled Hosny.
svn path=/trunk/; revision=2743
2008-05-19 01:14:20 +00:00
Benoît Dejean
dc5da30913 Fixed parsing of big /proc/stat for uptime.
svn path=/trunk/; revision=2741
2008-04-28 16:20:56 +00:00
Benoît Dejean
4d78d26932 First try to implement proportional set size by recyling
glibtop_proc_mem's duplicate members.x
Currently implemented on linux in rss member, for now
size,share,resident,rss are the only filled members.

svn path=/trunk/; revision=2740
2008-04-21 18:59:25 +00:00
Benoît Dejean
cd950bbf73 Added comment about get_scaled usage.
svn path=/trunk/; revision=2739
2008-04-21 18:59:23 +00:00
Benoît Dejean
c1b95643a8 Updated glibtop_get_proc_open_files API so that it also list IPv6 TCP sockets.
Patch by Mark McClelland <mark@ovcam.org>.
Closes #528175.

WTH do we not care about udp ?

Updated libtool versioning: API addition does not change the ABI, so only
increased revision. gnome-2.22 is 8.1.1 so trunk is now 8.2.1.

svn path=/trunk/; revision=2738
2008-04-21 18:59:20 +00:00
Benoît Dejean
be8a371481 Fixed debug macro name.
svn path=/trunk/; revision=2736
2008-04-14 16:22:03 +00:00
Benoît Dejean
fedd75b2b1 Dropped dead files.
svn path=/trunk/; revision=2735
2008-04-14 16:22:00 +00:00
Benoît Dejean
a02e213373 Fixed ;;. Closes #521084.
Fixed ;;.
Closes #521084.

svn path=/trunk/; revision=2734
2008-04-05 17:13:28 +00:00
Benoît Dejean
e3697c9a9e Released 2.22.1.
svn path=/trunk/; revision=2732
2008-04-04 18:27:42 +00:00
Benoît Dejean
91e2e5a1b7 Bumped version number.
svn path=/trunk/; revision=2731
2008-04-04 17:31:42 +00:00
Eskild Hustvedt
158280e297 Updated the Norwegian Nynorsk translation
svn path=/trunk/; revision=2730
2008-04-04 11:45:43 +00:00
Benoît Dejean
62c741074c Fixed dist for !linux.
Patch by Petr Salinger <Petr.Salinger@seznam.cz>.
Closes #525953.

svn path=/trunk/; revision=2729
2008-04-03 16:39:43 +00:00
Benoît Dejean
87a80ba430 Fixed warnings about proclist returning pid_t.
svn path=/trunk/; revision=2728
2008-04-03 16:29:55 +00:00
Simos Xenitellis
7bb5abb9a8 Updated Greek translation
svn path=/trunk/; revision=2727
2008-03-16 17:04:28 +00:00
50 changed files with 1262 additions and 671 deletions

26
NEWS
View File

@@ -1,3 +1,29 @@
18 August 2008: Overview of changes in 2.23.90
==============================================
* freebsd:
- updated port by Joe Marcus Clarke.
23 June 2008: Overview of changes in 2.23.4
===========================================
* linux:
- Fixed and improved glibtop_get_fsusage with kernel >= 2.6.25.
Closes #539360.
24 May 2008: Overview of changes in 2.23.2
==========================================
* glibtop_get_proc_open_files API can also lists IPv6 TCP sockets.
* glibtop_get_proc_affinity : new API to retrieve process CPU affinity.
(Let's hope one day i'll find the gtk-doc documentation ...)
* linux:
- fixed parsing of big /proc/stat for uptime.
04 April 2008: Overview of changes in 2.22.1
============================================
* Fixed compilation/dist for !linux.
Closes #525953.
10 Mars 2008: Overview of changes in 2.22.0
===========================================
* linux:

View File

@@ -3,21 +3,21 @@ dnl Configure script for the Gnome library
dnl
m4_define([libgtop_major_version], [2])
m4_define([libgtop_minor_version], [22])
m4_define([libgtop_micro_version], [0])
m4_define([libgtop_minor_version], [23])
m4_define([libgtop_micro_version], [90])
m4_define([libgtop_version], [libgtop_major_version.libgtop_minor_version.libgtop_micro_version])
dnl increment if the interface has additions, changes, removals.
m4_define([libgtop_current], [8])
m4_define([libgtop_current], [9])
dnl increment any time the source changes; set to
dnl 0 if you increment CURRENT
m4_define([libgtop_revision], [1])
m4_define([libgtop_revision], [0])
dnl increment if any interfaces have been added; set to 0
dnl if any interfaces have been removed. removal has
dnl precedence over adding, so set to 0 if both happened.
m4_define([libgtop_age], [1])
m4_define([libgtop_age], [2])
# Increase each time you change the client/server protocol.
m4_define([libgtop_server_version], [5])

View File

@@ -8,7 +8,7 @@ DEFS = @DEFS@
noinst_PROGRAMS = first second pprint procargs df netlist \
mountlist procmap netload sysdeps timings \
openfiles smp proclist mem wd
openfiles smp proclist mem wd affinity
first_SOURCES = first.c
first_LDADD = $(top_builddir)/lib/libgtop-2.0.la
@@ -58,3 +58,5 @@ wd_LDADD = $(top_builddir)/lib/libgtop-2.0.la
mem_SOURCE = mem.c
mem_LDADD = $(top_builddir)/lib/libgtop-2.0.la
affinity_SOURCES = affinity.c
affinity_LDADD = $(top_builddir)/lib/libgtop-2.0.la

View File

@@ -0,0 +1,34 @@
#include <glibtop.h>
#include <glibtop/procaffinity.h>
#include <glib.h>
#include <unistd.h>
int main(int argc, char **argv)
{
pid_t pid;
glibtop_proc_affinity buf;
guint16 *cpus;
size_t i;
if (argc < 2 || !(pid = strtoul(argv[1], NULL, 0)))
pid = getpid();
glibtop_init();
cpus = glibtop_get_proc_affinity(&buf, pid);
g_print("Process %u:\n"
" - all: %d\n",
(unsigned)pid, buf.all);
for (i = 0; i != buf.number; ++i)
g_print(" - CPU#%u is set\n", cpus[i]);
g_free(cpus);
glibtop_close();
return 0;
}

View File

@@ -15,35 +15,43 @@ static void print_fsusage(const char *mountpoint)
glibtop_get_fsusage(&buf, mountpoint);
printf("%-20s %-10llu %-10llu %-10llu %.1f\n",
printf("%-30s %10llu %10llu %10llu %5.1f %10llu %10llu\n",
mountpoint,
buf.blocks * buf.block_size >> 20,
(buf.blocks - buf.bavail) * buf.block_size >> 20,
buf.bavail * buf.block_size >> 20,
(buf.blocks - buf.bavail) * 100.0 / buf.blocks
(buf.blocks - buf.bavail) * 100.0 / (buf.blocks ? buf.blocks : 1.0),
buf.read,
buf.write
);
}
int main()
int main(int argc, char **argv)
{
glibtop_mountlist buf;
glibtop_mountentry *entries;
size_t i;
glibtop_init();
printf("%-20s %-10s %-10s %-10s %-10s\n",
"Filesystem", "Size", "Used", "Avail", "Use%");
printf("%-30s %10s %10s %10s %5s %10s %10s\n",
"Filesystem", "Size", "Used", "Avail", "Use%", "Read", "Write");
entries = glibtop_get_mountlist(&buf, TRUE);
if (argc > 1) {
while (*++argv)
print_fsusage(*argv);
} else {
glibtop_mountentry *entries;
size_t i;
for(i = 0; i < buf.number; ++i)
{
print_fsusage(entries[i].mountdir);
}
entries = glibtop_get_mountlist(&buf, TRUE);
g_free(entries);
for(i = 0; i < buf.number; ++i)
{
print_fsusage(entries[i].mountdir);
}
g_free(entries);
}
glibtop_close();

View File

@@ -47,9 +47,9 @@ main (int argc, char *argv [])
{
glibtop_union data;
glibtop_sysdeps sysdeps;
unsigned c, method, count, port, i, *ptr;
unsigned c, method, count, port, i;
char buffer [BUFSIZ];
pid_t pid, ppid;
pid_t pid, ppid, *ptr;
char *args;
count = PROFILE_COUNT;

View File

@@ -37,9 +37,16 @@ static void show_open_files(pid_t pid)
printf("socket %s:%d\n", files[i].info.sock.dest_host, files[i].info.sock.dest_port);
break;
case GLIBTOP_FILE_TYPE_INET6SOCKET:
printf("socket [%s]:%d\n", files[i].info.sock.dest_host, files[i].info.sock.dest_port);
break;
case GLIBTOP_FILE_TYPE_LOCALSOCKET:
printf("localsocket %s\n", files[i].info.localsock.name);
break;
default:
printf("unknown type\n");
}
}

View File

@@ -11,7 +11,7 @@
static void print_pids(guint64 which, guint64 arg)
{
unsigned *pids;
pid_t *pids;
unsigned i;
glibtop_proclist buf;

View File

@@ -239,7 +239,8 @@ main (int argc, char *argv [])
{
glibtop_proclist proclist;
glibtop_sysdeps sysdeps;
unsigned *ptr, pid, i;
unsigned i;
pid_t *ptr, pid;
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, GTOPLOCALEDIR);

View File

@@ -73,11 +73,11 @@ int
main (int argc, char *argv [])
{
glibtop_union data;
unsigned c, count, *ptr;
unsigned c, count;
struct rusage total_start, total_end;
struct rusage rusage_start, rusage_end;
struct timeval elapsed_utime, elapsed_stime;
pid_t pid;
pid_t pid, *ptr;
count = PROFILE_COUNT;

View File

@@ -23,4 +23,5 @@ void|netload|ulong(if_flags,mtu,subnet,address,packets_in,packets_out,packets_to
void|ppp|ulong(state,bytes_in,bytes_out)|ushort(device)
char **|netlist|unsigned(number)
char **|proc_wd|ulong(number),str(root),str(exe)|pid_t(pid)
guint16*|proc_affinity|ulong(number),int(all)|pid_t(pid)

View File

@@ -8,7 +8,7 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.h \
procsignal.h union.h gnuserv.h \
parameter.h mountlist.h fsusage.h procmap.h signal.h \
sysinfo.h ppp.h procargs.h netload.h \
procwd.h \
procwd.h procaffinity.h \
netlist.h procopenfiles.h open.h
noinst_HEADERS = error.h write.h read_data.h read.h init_hooks.h

View File

@@ -58,8 +58,9 @@ G_BEGIN_DECLS
#define GLIBTOP_CMND_NETLIST 24
#define GLIBTOP_CMND_PROC_OPEN_FILES 25
#define GLIBTOP_CMND_PROC_WD 26
#define GLIBTOP_CMND_PROC_AFFINITY 27
#define GLIBTOP_MAX_CMND 27
#define GLIBTOP_MAX_CMND 28
#define _GLIBTOP_PARAM_SIZE 16

View File

@@ -1,68 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 2.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__
#include <glibtop/global.h>
#include <glibtop/sysdeps.h>
G_BEGIN_DECLS
typedef struct _glibtop_server glibtop_server;
typedef struct _glibtop_server_info glibtop_server_info;
typedef struct _glibtop_closure glibtop_closure;
struct _glibtop_server_info
{
int ncpu; /* Number of CPUs, zero if single-processor */
unsigned long features; /* Server is required for this features */
glibtop_sysdeps sysdeps; /* Detailed feature list */
glibtop_sysdeps required; /* Required feature list */
glibtop_sysdeps wanted; /* We only want this features */
};
struct _glibtop_server
{
glibtop_server_info *info;
int refcount;
unsigned flags;
const char *name;
void *_priv;
};
glibtop_server *
glibtop_server_new (void);
void
glibtop_server_ref (glibtop_server *server);
void
glibtop_server_unref (glibtop_server *server);
G_END_DECLS
#endif

View File

@@ -0,0 +1,61 @@
/* Copyright (C) 2007 Benoît Dejean
This file is part of LibGTop 2.
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_PROCAFFINITY_H__
#define __GLIBTOP_PROCAFFINITY_H__
#include <glibtop.h>
#include <glibtop/global.h>
G_BEGIN_DECLS
typedef struct _glibtop_proc_affinity glibtop_proc_affinity;
#define GLIBTOP_PROC_AFFINITY_NUMBER 0
#define GLIBTOP_PROC_AFFINITY_ALL 1
struct _glibtop_proc_affinity
{
guint64 flags;
guint32 number;
gboolean all;
};
guint16 * glibtop_get_proc_affinity(glibtop_proc_affinity *buf, pid_t pid);
guint16 * glibtop_get_proc_affinity_l(glibtop *server, glibtop_proc_affinity *buf, pid_t pid);
#if GLIBTOP_SUID_PROC_AFFINITY
#define glibtop_get_proc_affinity_r glibtop_get_proc_affinity_p
void _glibtop_init_proc_affinity_p(glibtop *server);
guint16 * glibtop_get_proc_affinity_p(glibtop *server, glibtop_proc_affinity *buf, pid_t pid);
#else
#define glibtop_get_proc_affinity_r glibtop_get_proc_affinity_s
void _glibtop_init_proc_affinity_s(glibtop *server);
guint16 * glibtop_get_proc_affinity_s(glibtop *server, glibtop_proc_affinity *buf, pid_t pid);
#endif
G_END_DECLS
#endif

View File

@@ -53,7 +53,8 @@ enum glibtop_file_type {
GLIBTOP_FILE_TYPE_FILE = 1,
GLIBTOP_FILE_TYPE_PIPE = 2,
GLIBTOP_FILE_TYPE_INETSOCKET = 4,
GLIBTOP_FILE_TYPE_LOCALSOCKET = 8
GLIBTOP_FILE_TYPE_LOCALSOCKET = 8,
GLIBTOP_FILE_TYPE_INET6SOCKET = 16
};
typedef struct _glibtop_open_files_entry glibtop_open_files_entry;
@@ -65,7 +66,8 @@ struct _glibtop_open_files_entry
int fd;
guint16 type; /* An "enum glibtop_file_type" value. */
union {
/* When type == GLIBTOP_FILE_TYPE_INETSOCKET */
/* When type == GLIBTOP_FILE_TYPE_INETSOCKET or
* when type == GLIBTOP_FILE_TYPE_INET6SOCKET */
struct {
char dest_host[GLIBTOP_OPEN_DEST_HOST_LEN+1];
int dest_port;

View File

@@ -52,8 +52,9 @@ G_BEGIN_DECLS
#define GLIBTOP_SYSDEPS_NETLIST 23
#define GLIBTOP_SYSDEPS_PROC_OPEN_FILES 24
#define GLIBTOP_SYSDEPS_PROC_WD 25
#define GLIBTOP_SYSDEPS_PROC_AFFINITY 26
#define GLIBTOP_MAX_SYSDEPS 26
#define GLIBTOP_MAX_SYSDEPS 27
#define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1)
@@ -88,6 +89,7 @@ struct _glibtop_sysdeps
guint64 netload; /* glibtop_netload */
guint64 ppp; /* glibtop_ppp */
guint64 proc_wd; /* glibtop_proc_wd */
guint64 proc_affinity; /* glibtop_proc_affinity */
};
void glibtop_get_sysdeps (glibtop_sysdeps *buf);

View File

@@ -43,6 +43,7 @@
#include <glibtop/procmap.h>
#include <glibtop/procopenfiles.h>
#include <glibtop/procwd.h>
#include <glibtop/procaffinity.h>
#include <glibtop/mountlist.h>
#include <glibtop/fsusage.h>
@@ -82,6 +83,7 @@ union _glibtop_union
glibtop_ppp ppp;
glibtop_proc_open_files proc_open_files;
glibtop_proc_wd proc_wd;
glibtop_proc_affinity proc_affinity;
};
G_END_DECLS

View File

@@ -1,173 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* 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 <glib/gstrfuncs.h>
#include <errno.h>
#define DEFAULT_NAME "LibGTop-Server"
/* Prints error message and exits. */
static void
print_server_name (glibtop_server *server)
{
fprintf (stderr, "%s: ", server ?
(server->name ? server->name : DEFAULT_NAME)
: DEFAULT_NAME);
}
void
glibtop_error_vr (glibtop_server *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 *server, char *format, int error, va_list args)
{
print_server_name (server);
vfprintf (stderr, format, args);
fprintf (stderr, ": %s\n", g_strerror (error));
#ifdef LIBGTOP_ENABLE_DEBUG
abort ();
#else
exit (1);
#endif
}
void
glibtop_warn_vr (glibtop_server *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 *server, char *format, int error, va_list args)
{
print_server_name (server);
vfprintf (stderr, format, args);
fprintf (stderr, ": %s\n", g_strerror (error));
#ifdef LIBGTOP_FATAL_WARNINGS
abort ();
#endif
}
void
glibtop_error_r (glibtop_server *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 *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 *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 *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__ */

View File

@@ -1,36 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* 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_PRIVATE_H__
#define __GLIBTOP_SERVER_PRIVATE_H__
#include <glib.h>
typedef struct _glibtop_server_private glibtop_server_private;
struct _glibtop_server_private
{
GSList *backend_list;
};
#endif

View File

@@ -1,57 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 2.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.h>
#include <glibtop-server-private.h>
glibtop_server *
glibtop_server_new (void)
{
glibtop_server *retval;
retval = g_new0 (glibtop_server, 1);
retval->info = g_new0 (glibtop_server_info, 1);
retval->_priv = g_new0 (glibtop_server_private, 1);
retval->refcount = 1;
return retval;
}
void
glibtop_server_ref (glibtop_server *server)
{
server->refcount++;
}
void
glibtop_server_unref (glibtop_server *server)
{
server->refcount--;
if (server->refcount <= 0) {
g_free (server->_priv);
g_free (server->info);
g_free (server);
}
}

View File

@@ -50,6 +50,8 @@ glibtop_get_sem_limits
glibtop_get_sem_limits_l
glibtop_get_shm_limits
glibtop_get_shm_limits_l
glibtop_get_proc_affinity
glibtop_get_proc_affinity_l
glibtop_get_swap
glibtop_get_swap_l
glibtop_get_sysdeps

View File

@@ -47,6 +47,7 @@ GLIBTOP_SUID_PROC_MAP +
GLIBTOP_SUID_NETLOAD +
GLIBTOP_SUID_NETLIST +
GLIBTOP_SUID_PROC_WD +
GLIBTOP_SUID_PROC_AFFINITY +
GLIBTOP_SUID_PPP;
const _glibtop_init_func_t _glibtop_init_hook_s [] = {
@@ -113,6 +114,9 @@ const _glibtop_init_func_t _glibtop_init_hook_s [] = {
#if !GLIBTOP_SUID_PROC_WD
_glibtop_init_proc_wd_s,
#endif
#if !GLIBTOP_SUID_PROC_AFFINITY
_glibtop_init_proc_affinity_s,
#endif
#if !GLIBTOP_SUID_PPP
_glibtop_init_ppp_s,
#endif
@@ -183,6 +187,9 @@ const _glibtop_init_func_t _glibtop_init_hook_p [] = {
#if GLIBTOP_SUID_PROC_WD
_glibtop_init_proc_wd_p,
#endif
#if GLIBTOP_SUID_PROC_AFFINITY
_glibtop_init_proc_affinity_p,
#endif
#if GLIBTOP_SUID_PPP
_glibtop_init_ppp_p,
#endif

View File

@@ -79,6 +79,8 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
libgtop_sysdeps_dir=freebsd
libgtop_use_machine_h=yes
libgtop_need_server=yes
libgtop_sysdeps_private_mountlist=yes
libgtop_sysdeps_private_fsusage=yes
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server2 && chmod 2755 $(bindir)/libgtop_server2'
;;
solaris*)

View File

@@ -1,3 +1,35 @@
2008-08-6 Djihed Afifi <djihed@gmail.com>
* ar.po: Updated Arabic Translation by Khaled Hosny.
2008-07-29 Djihed Afifi <djihed@gmail.com>
* ar.po: Updated Arabic Translation by Khaled Hosny.
2008-07-25 Leonardo Ferreira Fontenelle <leonardof@gnome.org>
* pt_BR.po: Terminology improvement by Vladimir Melo.
2008-06-11 Djihed Afifi <djihed@gmail.com>
* ar.po: Updated Arabic Translation by Khaled Hosny.
2008-05-22 Djihed Afifi <djihed@gmail.com>
* ar.po: Updated Arabic Translation by Khaled Hosny.
2008-05-19 Djihed Afifi <djihed@gmail.com>
* ar.po: Updated Arabic Translation by Khaled Hosny.
2008-04-04 Eskild Hustvedt <eskildh@gnome.org>
* nn.po: Updated Norwegian Nynorsk translation
2008-03-16 Simos Xenitellis <simos@gnome.org>
* el.po: Updated Greek translation.
2008-03-09 Gabor Kelemen <kelemeng@gnome.hu>
* hu.po: Translation updated

117
po/ar.po
View File

@@ -1,4 +1,4 @@
# translation of libgtop.HEAD.ar.po to Arabic
# translation of libgtop.HEAD.po to Arabic
# This file is distributed under the same license as the PACKAGE package.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER.
#
@@ -8,17 +8,17 @@
# Khaled Hosny <khaledhosny@eglug.org>, 2006, 2008.
msgid ""
msgstr ""
"Project-Id-Version: libgtop.HEAD.ar\n"
"Project-Id-Version: libgtop.HEAD\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-08-26 14:20-0700\n"
"PO-Revision-Date: 2008-01-11 23:29+0200\n"
"POT-Creation-Date: 2008-01-12 01:07+0000\n"
"PO-Revision-Date: 2008-07-28 19:26+0300\n"
"Last-Translator: Khaled Hosny <khaledhosny@eglug.org>\n"
"Language-Team: Arabic <doc@eglug.org>\n"
"Language-Team: Arabic <doc@arabeyes.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.11.4\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n>=3 && n<=10 ? 3 : n>=11 && n<=99 ? 4 : 5;\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
#: ../lib/read.c:51
#, c-format
@@ -27,9 +27,9 @@ msgid_plural "read %d bytes"
msgstr[0] "قرأ صفر بايت"
msgstr[1] "قرأ بايت واحدة"
msgstr[2] "قرأ بايتين"
msgstr[3] "قرأ %d بايتات"
msgstr[4] "قرأ %d بايت"
msgstr[5] "قرأ %d بايت"
msgstr[3] "قرأ %Id بايتات"
msgstr[4] "قرأ %Id بايت"
msgstr[5] "قرأ %Id بايت"
#: ../lib/read_data.c:51
msgid "read data size"
@@ -53,9 +53,9 @@ msgid_plural "wrote %d bytes"
msgstr[0] "كتب صفر بايت"
msgstr[1] "كتب بايت واحدة"
msgstr[2] "كتب بايتين"
msgstr[3] "كتب %d بايتات"
msgstr[4] "كتب %d بايت"
msgstr[5] "كتب %d بايت"
msgstr[3] "كتب %Id بايتات"
msgstr[4] "كتب %Id بايت"
msgstr[5] "كتب %Id بايت"
#: ../src/daemon/gnuserv.c:458
msgid "Enable debugging"
@@ -78,158 +78,127 @@ msgstr "استُحضرت من inetd "
msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr "شغّل '%s --help' لرؤية قائمة كاملة لخيارات سطر الأوامر.\n"
#: ../sysdeps/osf1/siglist.c:27
#: ../sysdeps/sun4/siglist.c:27
#: ../sysdeps/osf1/siglist.c:27 ../sysdeps/sun4/siglist.c:27
msgid "Hangup"
msgstr "علّق"
#: ../sysdeps/osf1/siglist.c:28
#: ../sysdeps/sun4/siglist.c:28
#: ../sysdeps/osf1/siglist.c:28 ../sysdeps/sun4/siglist.c:28
msgid "Interrupt"
msgstr "قاطِع"
#: ../sysdeps/osf1/siglist.c:29
#: ../sysdeps/sun4/siglist.c:29
#: ../sysdeps/osf1/siglist.c:29 ../sysdeps/sun4/siglist.c:29
msgid "Quit"
msgstr "اخرج"
#: ../sysdeps/osf1/siglist.c:30
#: ../sysdeps/sun4/siglist.c:30
#: ../sysdeps/osf1/siglist.c:30 ../sysdeps/sun4/siglist.c:30
msgid "Illegal instruction"
msgstr "توجيه ممنوع"
#: ../sysdeps/osf1/siglist.c:31
#: ../sysdeps/sun4/siglist.c:31
#: ../sysdeps/osf1/siglist.c:31 ../sysdeps/sun4/siglist.c:31
msgid "Trace trap"
msgstr "تتبع الأثر"
#: ../sysdeps/osf1/siglist.c:32
#: ../sysdeps/sun4/siglist.c:32
#: ../sysdeps/osf1/siglist.c:32 ../sysdeps/sun4/siglist.c:32
msgid "Abort"
msgstr "اجهض"
#: ../sysdeps/osf1/siglist.c:33
#: ../sysdeps/sun4/siglist.c:33
#: ../sysdeps/osf1/siglist.c:33 ../sysdeps/sun4/siglist.c:33
msgid "EMT error"
msgstr "خطأ EMT"
#: ../sysdeps/osf1/siglist.c:34
#: ../sysdeps/sun4/siglist.c:34
#: ../sysdeps/osf1/siglist.c:34 ../sysdeps/sun4/siglist.c:34
msgid "Floating-point exception"
msgstr "استثناء أرقام عشرية"
#: ../sysdeps/osf1/siglist.c:35
#: ../sysdeps/sun4/siglist.c:35
#: ../sysdeps/osf1/siglist.c:35 ../sysdeps/sun4/siglist.c:35
msgid "Kill"
msgstr "اقتل"
#: ../sysdeps/osf1/siglist.c:36
#: ../sysdeps/sun4/siglist.c:36
#: ../sysdeps/osf1/siglist.c:36 ../sysdeps/sun4/siglist.c:36
msgid "Bus error"
msgstr "خطأ في ناقل"
#: ../sysdeps/osf1/siglist.c:37
#: ../sysdeps/sun4/siglist.c:37
#: ../sysdeps/osf1/siglist.c:37 ../sysdeps/sun4/siglist.c:37
msgid "Segmentation violation"
msgstr "انتهاك اﻻنقسام"
#: ../sysdeps/osf1/siglist.c:38
#: ../sysdeps/sun4/siglist.c:38
#: ../sysdeps/osf1/siglist.c:38 ../sysdeps/sun4/siglist.c:38
msgid "Bad argument to system call"
msgstr "معطى سيء لنداء النظام"
#: ../sysdeps/osf1/siglist.c:39
#: ../sysdeps/sun4/siglist.c:39
#: ../sysdeps/osf1/siglist.c:39 ../sysdeps/sun4/siglist.c:39
msgid "Broken pipe"
msgstr "أنبوب مكسور"
#: ../sysdeps/osf1/siglist.c:40
#: ../sysdeps/sun4/siglist.c:40
#: ../sysdeps/osf1/siglist.c:40 ../sysdeps/sun4/siglist.c:40
msgid "Alarm clock"
msgstr "ساعة منبهة"
#: ../sysdeps/osf1/siglist.c:41
#: ../sysdeps/sun4/siglist.c:41
#: ../sysdeps/osf1/siglist.c:41 ../sysdeps/sun4/siglist.c:41
msgid "Termination"
msgstr "إنهاء"
#: ../sysdeps/osf1/siglist.c:42
#: ../sysdeps/sun4/siglist.c:42
#: ../sysdeps/osf1/siglist.c:42 ../sysdeps/sun4/siglist.c:42
msgid "Urgent condition on socket"
msgstr "حالة عاجلة عند المقبس"
#: ../sysdeps/osf1/siglist.c:43
#: ../sysdeps/sun4/siglist.c:43
#: ../sysdeps/osf1/siglist.c:43 ../sysdeps/sun4/siglist.c:43
msgid "Stop"
msgstr "قف"
#: ../sysdeps/osf1/siglist.c:44
#: ../sysdeps/sun4/siglist.c:44
#: ../sysdeps/osf1/siglist.c:44 ../sysdeps/sun4/siglist.c:44
msgid "Keyboard stop"
msgstr "إيقاف من لوحة المفاتيح"
#: ../sysdeps/osf1/siglist.c:45
#: ../sysdeps/sun4/siglist.c:45
#: ../sysdeps/osf1/siglist.c:45 ../sysdeps/sun4/siglist.c:45
msgid "Continue"
msgstr "تابع"
#: ../sysdeps/osf1/siglist.c:46
#: ../sysdeps/sun4/siglist.c:46
#: ../sysdeps/osf1/siglist.c:46 ../sysdeps/sun4/siglist.c:46
msgid "Child status has changed"
msgstr "تغيرت حالة الابن"
#: ../sysdeps/osf1/siglist.c:47
#: ../sysdeps/sun4/siglist.c:47
#: ../sysdeps/osf1/siglist.c:47 ../sysdeps/sun4/siglist.c:47
msgid "Background read from tty"
msgstr "قراءة من tty في الخلفية"
#: ../sysdeps/osf1/siglist.c:48
#: ../sysdeps/sun4/siglist.c:48
#: ../sysdeps/osf1/siglist.c:48 ../sysdeps/sun4/siglist.c:48
msgid "Background write to tty"
msgstr "كتابة لـ tty في الخلفية"
#: ../sysdeps/osf1/siglist.c:49
#: ../sysdeps/sun4/siglist.c:49
#: ../sysdeps/osf1/siglist.c:49 ../sysdeps/sun4/siglist.c:49
msgid "I/O now possible"
msgstr "الدخْل/الخرْج ممكن الآن"
#: ../sysdeps/osf1/siglist.c:50
#: ../sysdeps/sun4/siglist.c:50
#: ../sysdeps/osf1/siglist.c:50 ../sysdeps/sun4/siglist.c:50
msgid "CPU limit exceeded"
msgstr "تجاوز حد الـمعالج"
#: ../sysdeps/osf1/siglist.c:51
#: ../sysdeps/sun4/siglist.c:51
#: ../sysdeps/osf1/siglist.c:51 ../sysdeps/sun4/siglist.c:51
msgid "File size limit exceeded"
msgstr "تجاوز حد حجم الملف"
#: ../sysdeps/osf1/siglist.c:52
#: ../sysdeps/sun4/siglist.c:52
#: ../sysdeps/osf1/siglist.c:52 ../sysdeps/sun4/siglist.c:52
msgid "Virtual alarm clock"
msgstr "ساعة تنبيه تخيّلية"
#: ../sysdeps/osf1/siglist.c:53
#: ../sysdeps/sun4/siglist.c:53
#: ../sysdeps/osf1/siglist.c:53 ../sysdeps/sun4/siglist.c:53
msgid "Profiling alarm clock"
msgstr "تشخيص ساعة التنبيه"
#: ../sysdeps/osf1/siglist.c:54
#: ../sysdeps/sun4/siglist.c:54
#: ../sysdeps/osf1/siglist.c:54 ../sysdeps/sun4/siglist.c:54
msgid "Window size change"
msgstr "تغير حجم النافذة"
#: ../sysdeps/osf1/siglist.c:55
#: ../sysdeps/sun4/siglist.c:55
#: ../sysdeps/osf1/siglist.c:55 ../sysdeps/sun4/siglist.c:55
msgid "Information request"
msgstr "طلب معلومات"
#: ../sysdeps/osf1/siglist.c:56
#: ../sysdeps/sun4/siglist.c:56
#: ../sysdeps/osf1/siglist.c:56 ../sysdeps/sun4/siglist.c:56
msgid "User defined signal 1"
msgstr "إشارة 1 معرفة من طرف المستخدم"
#: ../sysdeps/osf1/siglist.c:57
#: ../sysdeps/sun4/siglist.c:57
#: ../sysdeps/osf1/siglist.c:57 ../sysdeps/sun4/siglist.c:57
msgid "User defined signal 2"
msgstr "إشارة 2 معرفة من طرف المستخدم"

115
po/el.po
View File

@@ -19,7 +19,7 @@ msgid ""
msgstr ""
"Project-Id-Version: el\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-09-25 18:15+0200\n"
"POT-Creation-Date: 2008-03-16 17:03+0000\n"
"PO-Revision-Date: 2005-02-18 13:40+0200\n"
"Last-Translator: Kostas Papadimas <pkst@gnome.org>\n"
"Language-Team: Greek <nls@tux.hellug.gr>\n"
@@ -29,195 +29,188 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: KBabel 1.3.1\n"
#: lib/read.c:65
#: ../lib/read.c:51
#, c-format
msgid "read %d byte"
msgid_plural "read %d bytes"
msgstr[0] "ανάγνωση %d byte"
msgstr[1] "ανάγνωση %d bytes"
#: lib/read_data.c:53
#: ../lib/read_data.c:51
msgid "read data size"
msgstr "ανάγνωση μεγέθους δεδομένων"
#: lib/read_data.c:72
#: ../lib/read_data.c:70
#, c-format
msgid "read %lu byte of data"
msgid_plural "read %lu bytes of data"
msgstr[0] "ανάγνωση %lu byte δεδομένων"
msgstr[1] "ανάγνωση %lu bytes δεδομένων"
#: lib/write.c:52
#: ../lib/write.c:51
#, c-format
msgid "wrote %d byte"
msgid_plural "wrote %d bytes"
msgstr[0] "εγγραφή %d byte"
msgstr[1] "εγγραφή %d bytes"
#: src/daemon/gnuserv.c:460
#: ../src/daemon/gnuserv.c:458
msgid "Enable debugging"
msgstr "Ενεργοποίηση εκσφαλμάτωσης"
#: src/daemon/gnuserv.c:460
msgid "DEBUG"
msgstr "ΕΚΣΦΑΛΜΑΤΩΣΗ"
#: src/daemon/gnuserv.c:462
#: ../src/daemon/gnuserv.c:460
msgid "Enable verbose output"
msgstr "Ενεργοποίηση περιφραστικής εξόδου"
#: src/daemon/gnuserv.c:462
msgid "VERBOSE"
msgstr "VERBOSE"
#: src/daemon/gnuserv.c:464
#: ../src/daemon/gnuserv.c:462
msgid "Don't fork into background"
msgstr "Να μη γίνει δικράνωση στο παρασκήνιο"
#: src/daemon/gnuserv.c:464
msgid "NO-DAEMON"
msgstr "ΧΩΡΊΣ-ΔΑΊΜΟΝΑ"
#: src/daemon/gnuserv.c:466
#: ../src/daemon/gnuserv.c:464
msgid "Invoked from inetd"
msgstr "Εκτελεσμένο από το inetd"
#: src/daemon/gnuserv.c:466
msgid "INETD"
msgstr "INETD"
#: src/daemon/gnuserv.c:500
#: ../src/daemon/gnuserv.c:498
#, c-format
msgid ""
"Error on option %s: %s.\n"
"Run '%s --help' to see a full list of available command line options.\n"
msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr ""
"Σφάλμα στην επιλογή %s: %s.\n"
"Εκτελέστε '%s --help' για να δείτε μια πλήρη λίστα των διαθέσιμων επιλογών "
"της γραμμής εντολών.\n"
#: sysdeps/osf1/siglist.c:28 sysdeps/sun4/siglist.c:28
#: ../sysdeps/osf1/siglist.c:27 ../sysdeps/sun4/siglist.c:27
msgid "Hangup"
msgstr "Αποτελμάτωση"
#: sysdeps/osf1/siglist.c:29 sysdeps/sun4/siglist.c:29
#: ../sysdeps/osf1/siglist.c:28 ../sysdeps/sun4/siglist.c:28
msgid "Interrupt"
msgstr "Διακοπή"
#: sysdeps/osf1/siglist.c:30 sysdeps/sun4/siglist.c:30
#: ../sysdeps/osf1/siglist.c:29 ../sysdeps/sun4/siglist.c:29
msgid "Quit"
msgstr "Έξοδος"
#: sysdeps/osf1/siglist.c:31 sysdeps/sun4/siglist.c:31
#: ../sysdeps/osf1/siglist.c:30 ../sysdeps/sun4/siglist.c:30
msgid "Illegal instruction"
msgstr "Ακατάλληλη εντολή"
#: sysdeps/osf1/siglist.c:32 sysdeps/sun4/siglist.c:32
#: ../sysdeps/osf1/siglist.c:31 ../sysdeps/sun4/siglist.c:31
msgid "Trace trap"
msgstr "Παγίδευση παρακολούθησης"
#: sysdeps/osf1/siglist.c:33 sysdeps/sun4/siglist.c:33
#: ../sysdeps/osf1/siglist.c:32 ../sysdeps/sun4/siglist.c:32
msgid "Abort"
msgstr "Αποβολή"
#: sysdeps/osf1/siglist.c:34 sysdeps/sun4/siglist.c:34
#: ../sysdeps/osf1/siglist.c:33 ../sysdeps/sun4/siglist.c:33
msgid "EMT error"
msgstr "Σφάλμα EMT"
#: sysdeps/osf1/siglist.c:35 sysdeps/sun4/siglist.c:35
#: ../sysdeps/osf1/siglist.c:34 ../sysdeps/sun4/siglist.c:34
msgid "Floating-point exception"
msgstr "Εξαίρεση κιν. υποδιαστολής"
#: sysdeps/osf1/siglist.c:36 sysdeps/sun4/siglist.c:36
#: ../sysdeps/osf1/siglist.c:35 ../sysdeps/sun4/siglist.c:35
msgid "Kill"
msgstr "Σκότωμα"
#: sysdeps/osf1/siglist.c:37 sysdeps/sun4/siglist.c:37
#: ../sysdeps/osf1/siglist.c:36 ../sysdeps/sun4/siglist.c:36
msgid "Bus error"
msgstr "Σφάλμα διαύλου"
#: sysdeps/osf1/siglist.c:38 sysdeps/sun4/siglist.c:38
#: ../sysdeps/osf1/siglist.c:37 ../sysdeps/sun4/siglist.c:37
msgid "Segmentation violation"
msgstr "Παραβίαση τμηματοποίησης"
#: sysdeps/osf1/siglist.c:39 sysdeps/sun4/siglist.c:39
#: ../sysdeps/osf1/siglist.c:38 ../sysdeps/sun4/siglist.c:38
msgid "Bad argument to system call"
msgstr "Ακατάλληλο όρισμα σε κλήση συστήματος"
#: sysdeps/osf1/siglist.c:40 sysdeps/sun4/siglist.c:40
#: ../sysdeps/osf1/siglist.c:39 ../sysdeps/sun4/siglist.c:39
msgid "Broken pipe"
msgstr "Διακοπείσα σωλήνωση"
#: sysdeps/osf1/siglist.c:41 sysdeps/sun4/siglist.c:41
#: ../sysdeps/osf1/siglist.c:40 ../sysdeps/sun4/siglist.c:40
msgid "Alarm clock"
msgstr "Ξυπνητήρι"
#: sysdeps/osf1/siglist.c:42 sysdeps/sun4/siglist.c:42
#: ../sysdeps/osf1/siglist.c:41 ../sysdeps/sun4/siglist.c:41
msgid "Termination"
msgstr "Τερματισμός"
#: sysdeps/osf1/siglist.c:43 sysdeps/sun4/siglist.c:43
#: ../sysdeps/osf1/siglist.c:42 ../sysdeps/sun4/siglist.c:42
msgid "Urgent condition on socket"
msgstr "Επείγουσα συνθήκη σε υποδοχέα"
#: sysdeps/osf1/siglist.c:44 sysdeps/sun4/siglist.c:44
#: ../sysdeps/osf1/siglist.c:43 ../sysdeps/sun4/siglist.c:43
msgid "Stop"
msgstr "Διακοπή"
#: sysdeps/osf1/siglist.c:45 sysdeps/sun4/siglist.c:45
#: ../sysdeps/osf1/siglist.c:44 ../sysdeps/sun4/siglist.c:44
msgid "Keyboard stop"
msgstr "Διακοπή πληκτρολογίου"
#: sysdeps/osf1/siglist.c:46 sysdeps/sun4/siglist.c:46
#: ../sysdeps/osf1/siglist.c:45 ../sysdeps/sun4/siglist.c:45
msgid "Continue"
msgstr "Συνέχεια"
#: sysdeps/osf1/siglist.c:47 sysdeps/sun4/siglist.c:47
#: ../sysdeps/osf1/siglist.c:46 ../sysdeps/sun4/siglist.c:46
msgid "Child status has changed"
msgstr "Η κατάσταση θυγατρικής διεργασίας έχει αλλάξει"
#: sysdeps/osf1/siglist.c:48 sysdeps/sun4/siglist.c:48
#: ../sysdeps/osf1/siglist.c:47 ../sysdeps/sun4/siglist.c:47
msgid "Background read from tty"
msgstr "Ανάγνωση παρασκηνίου από tty"
#: sysdeps/osf1/siglist.c:49 sysdeps/sun4/siglist.c:49
#: ../sysdeps/osf1/siglist.c:48 ../sysdeps/sun4/siglist.c:48
msgid "Background write to tty"
msgstr "Εγγραφή παρασκηνίου σε tty"
#: sysdeps/osf1/siglist.c:50 sysdeps/sun4/siglist.c:50
#: ../sysdeps/osf1/siglist.c:49 ../sysdeps/sun4/siglist.c:49
msgid "I/O now possible"
msgstr "Η Ε/Ε είναι τώρα δυνατή"
#: sysdeps/osf1/siglist.c:51 sysdeps/sun4/siglist.c:51
#: ../sysdeps/osf1/siglist.c:50 ../sysdeps/sun4/siglist.c:50
msgid "CPU limit exceeded"
msgstr "Το όριο ΚΜΕ έχει ξεπεραστεί"
#: sysdeps/osf1/siglist.c:52 sysdeps/sun4/siglist.c:52
#: ../sysdeps/osf1/siglist.c:51 ../sysdeps/sun4/siglist.c:51
msgid "File size limit exceeded"
msgstr "Το όριο μεγέθους αρχείου έχει ξεπεραστεί"
#: sysdeps/osf1/siglist.c:53 sysdeps/sun4/siglist.c:53
#: ../sysdeps/osf1/siglist.c:52 ../sysdeps/sun4/siglist.c:52
msgid "Virtual alarm clock"
msgstr "Ιδεατό ξυπνητήρι"
#: sysdeps/osf1/siglist.c:54 sysdeps/sun4/siglist.c:54
#: ../sysdeps/osf1/siglist.c:53 ../sysdeps/sun4/siglist.c:53
msgid "Profiling alarm clock"
msgstr "Έλεγχος απόδοσης ξυπνητηριού"
#: sysdeps/osf1/siglist.c:55 sysdeps/sun4/siglist.c:55
#: ../sysdeps/osf1/siglist.c:54 ../sysdeps/sun4/siglist.c:54
msgid "Window size change"
msgstr "Αλλαγή μεγέθους παραθύρου"
#: sysdeps/osf1/siglist.c:56 sysdeps/sun4/siglist.c:56
#: ../sysdeps/osf1/siglist.c:55 ../sysdeps/sun4/siglist.c:55
msgid "Information request"
msgstr "Αίτηση πληροφορίας"
# sysdeps/names/procsignal.c:49
#: sysdeps/osf1/siglist.c:57 sysdeps/sun4/siglist.c:57
#: ../sysdeps/osf1/siglist.c:56 ../sysdeps/sun4/siglist.c:56
msgid "User defined signal 1"
msgstr "Σήμα 1 οριζόμενο από το χρήστη"
# sysdeps/names/procsignal.c:49
#: sysdeps/osf1/siglist.c:58 sysdeps/sun4/siglist.c:58
#: ../sysdeps/osf1/siglist.c:57 ../sysdeps/sun4/siglist.c:57
msgid "User defined signal 2"
msgstr "Σήμα 2 οριζόμενο από το χρήστη"
#~ msgid "DEBUG"
#~ msgstr "ΕΚΣΦΑΛΜΑΤΩΣΗ"
#~ msgid "VERBOSE"
#~ msgstr "VERBOSE"
#~ msgid "NO-DAEMON"
#~ msgstr "ΧΩΡΊΣ-ΔΑΊΜΟΝΑ"
#~ msgid "INETD"
#~ msgstr "INETD"

131
po/nn.po
View File

@@ -9,202 +9,195 @@ msgid ""
msgstr ""
"Project-Id-Version: nn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-09-25 18:15+0200\n"
"PO-Revision-Date: 2004-03-23 12:02+0100\n"
"Last-Translator: Åsmund Skjæveland\n"
"Language-Team: Norwegian Nynorsk <i18n-nn@lister.ping.uio.no>\n"
"POT-Creation-Date: 2008-04-04 13:45+0200\n"
"PO-Revision-Date: 2008-04-04 13:45+0200\n"
"Last-Translator: Eskild Hustvedt <eskildh@gnome.org>\n"
"Language-Team: Norwegian Nynorsk <i18n-no@lister.ping.uio.no>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.3.1\n"
"X-Generator: VIM\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: lib/read.c:65
#: ../lib/read.c:51
#, c-format
msgid "read %d byte"
msgid_plural "read %d bytes"
msgstr[0] "las %d byte"
msgstr[1] "las %d byte"
#: lib/read_data.c:53
#: ../lib/read_data.c:51
msgid "read data size"
msgstr "lesestorleik på data"
#: lib/read_data.c:72
#, fuzzy, c-format
#: ../lib/read_data.c:70
#, c-format
msgid "read %lu byte of data"
msgid_plural "read %lu bytes of data"
msgstr[0] "las %d byte"
msgstr[1] "las %d byte"
msgstr[0] "las %d byte data"
msgstr[1] "las %d byte data"
#: lib/write.c:52
#, fuzzy, c-format
#: ../lib/write.c:51
#, c-format
msgid "wrote %d byte"
msgid_plural "wrote %d bytes"
msgstr[0] "skriv %d byte"
msgstr[1] "skriv %d byte"
#: src/daemon/gnuserv.c:460
#: ../src/daemon/gnuserv.c:458
msgid "Enable debugging"
msgstr "Skru på feilsøking"
#: src/daemon/gnuserv.c:460
msgid "DEBUG"
msgstr "FEILSØK"
#: src/daemon/gnuserv.c:462
#: ../src/daemon/gnuserv.c:460
msgid "Enable verbose output"
msgstr "Skru på ordrike utdata"
#: src/daemon/gnuserv.c:462
msgid "VERBOSE"
msgstr "ORDRIK"
#: src/daemon/gnuserv.c:464
#: ../src/daemon/gnuserv.c:462
msgid "Don't fork into background"
msgstr "Ikkje fork av inn i bakgrunnen"
#: src/daemon/gnuserv.c:464
msgid "NO-DAEMON"
msgstr "UTAN-NISSE"
#: src/daemon/gnuserv.c:466
#: ../src/daemon/gnuserv.c:464
msgid "Invoked from inetd"
msgstr "Starta frå inetd"
#: src/daemon/gnuserv.c:466
msgid "INETD"
msgstr "INETD"
#: src/daemon/gnuserv.c:500
#: ../src/daemon/gnuserv.c:498
#, c-format
msgid ""
"Error on option %s: %s.\n"
"Run '%s --help' to see a full list of available command line options.\n"
msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr ""
"Feil på valet «%s»: %s.\n"
"Køyr «%s --help» for å sjå full liste over tilgjengelege kommandlinjeval.\n"
#: sysdeps/osf1/siglist.c:28 sysdeps/sun4/siglist.c:28
#: ../sysdeps/osf1/siglist.c:27 ../sysdeps/sun4/siglist.c:27
msgid "Hangup"
msgstr "Legg på"
#: sysdeps/osf1/siglist.c:29 sysdeps/sun4/siglist.c:29
#: ../sysdeps/osf1/siglist.c:28 ../sysdeps/sun4/siglist.c:28
msgid "Interrupt"
msgstr "Avbrot"
#: sysdeps/osf1/siglist.c:30 sysdeps/sun4/siglist.c:30
#: ../sysdeps/osf1/siglist.c:29 ../sysdeps/sun4/siglist.c:29
msgid "Quit"
msgstr "Avslutt"
#: sysdeps/osf1/siglist.c:31 sysdeps/sun4/siglist.c:31
#: ../sysdeps/osf1/siglist.c:30 ../sysdeps/sun4/siglist.c:30
msgid "Illegal instruction"
msgstr "Ulovleg instruksjon."
#: sysdeps/osf1/siglist.c:32 sysdeps/sun4/siglist.c:32
#: ../sysdeps/osf1/siglist.c:31 ../sysdeps/sun4/siglist.c:31
msgid "Trace trap"
msgstr "Sporingsfelle"
#: sysdeps/osf1/siglist.c:33 sysdeps/sun4/siglist.c:33
#: ../sysdeps/osf1/siglist.c:32 ../sysdeps/sun4/siglist.c:32
msgid "Abort"
msgstr "Avbryt"
#: sysdeps/osf1/siglist.c:34 sysdeps/sun4/siglist.c:34
#: ../sysdeps/osf1/siglist.c:33 ../sysdeps/sun4/siglist.c:33
msgid "EMT error"
msgstr "EMT-feil"
#: sysdeps/osf1/siglist.c:35 sysdeps/sun4/siglist.c:35
#: ../sysdeps/osf1/siglist.c:34 ../sysdeps/sun4/siglist.c:34
msgid "Floating-point exception"
msgstr "Flyttaluttrykk"
#: sysdeps/osf1/siglist.c:36 sysdeps/sun4/siglist.c:36
#: ../sysdeps/osf1/siglist.c:35 ../sysdeps/sun4/siglist.c:35
msgid "Kill"
msgstr "Drep"
#: sysdeps/osf1/siglist.c:37 sysdeps/sun4/siglist.c:37
#: ../sysdeps/osf1/siglist.c:36 ../sysdeps/sun4/siglist.c:36
msgid "Bus error"
msgstr "Bussfeil"
#: sysdeps/osf1/siglist.c:38 sysdeps/sun4/siglist.c:38
#: ../sysdeps/osf1/siglist.c:37 ../sysdeps/sun4/siglist.c:37
msgid "Segmentation violation"
msgstr "Segmenteringsovertramp"
#: sysdeps/osf1/siglist.c:39 sysdeps/sun4/siglist.c:39
#: ../sysdeps/osf1/siglist.c:38 ../sysdeps/sun4/siglist.c:38
msgid "Bad argument to system call"
msgstr "Ugyldig argument til systemkall"
#: sysdeps/osf1/siglist.c:40 sysdeps/sun4/siglist.c:40
#: ../sysdeps/osf1/siglist.c:39 ../sysdeps/sun4/siglist.c:39
msgid "Broken pipe"
msgstr "Brote røyr"
#: sysdeps/osf1/siglist.c:41 sysdeps/sun4/siglist.c:41
#: ../sysdeps/osf1/siglist.c:40 ../sysdeps/sun4/siglist.c:40
msgid "Alarm clock"
msgstr "Alarmklokke"
#: sysdeps/osf1/siglist.c:42 sysdeps/sun4/siglist.c:42
#: ../sysdeps/osf1/siglist.c:41 ../sysdeps/sun4/siglist.c:41
msgid "Termination"
msgstr "Avlustting"
#: sysdeps/osf1/siglist.c:43 sysdeps/sun4/siglist.c:43
#: ../sysdeps/osf1/siglist.c:42 ../sysdeps/sun4/siglist.c:42
msgid "Urgent condition on socket"
msgstr "Hastesituasjon på sokkelen"
#: sysdeps/osf1/siglist.c:44 sysdeps/sun4/siglist.c:44
#: ../sysdeps/osf1/siglist.c:43 ../sysdeps/sun4/siglist.c:43
msgid "Stop"
msgstr "Stopp"
#: sysdeps/osf1/siglist.c:45 sysdeps/sun4/siglist.c:45
#: ../sysdeps/osf1/siglist.c:44 ../sysdeps/sun4/siglist.c:44
msgid "Keyboard stop"
msgstr "Tastaturstopp"
#: sysdeps/osf1/siglist.c:46 sysdeps/sun4/siglist.c:46
#: ../sysdeps/osf1/siglist.c:45 ../sysdeps/sun4/siglist.c:45
msgid "Continue"
msgstr "Fortset"
#: sysdeps/osf1/siglist.c:47 sysdeps/sun4/siglist.c:47
#: ../sysdeps/osf1/siglist.c:46 ../sysdeps/sun4/siglist.c:46
msgid "Child status has changed"
msgstr "Status på born er endra"
#: sysdeps/osf1/siglist.c:48 sysdeps/sun4/siglist.c:48
#: ../sysdeps/osf1/siglist.c:47 ../sysdeps/sun4/siglist.c:47
msgid "Background read from tty"
msgstr "Les frå tty i bakgrunnen"
#: sysdeps/osf1/siglist.c:49 sysdeps/sun4/siglist.c:49
#: ../sysdeps/osf1/siglist.c:48 ../sysdeps/sun4/siglist.c:48
msgid "Background write to tty"
msgstr "Skriv til tty i bakgrunnen"
#: sysdeps/osf1/siglist.c:50 sysdeps/sun4/siglist.c:50
#: ../sysdeps/osf1/siglist.c:49 ../sysdeps/sun4/siglist.c:49
msgid "I/O now possible"
msgstr "I/O no mogleg"
#: sysdeps/osf1/siglist.c:51 sysdeps/sun4/siglist.c:51
#: ../sysdeps/osf1/siglist.c:50 ../sysdeps/sun4/siglist.c:50
msgid "CPU limit exceeded"
msgstr "CPU-grense passert"
#: sysdeps/osf1/siglist.c:52 sysdeps/sun4/siglist.c:52
#: ../sysdeps/osf1/siglist.c:51 ../sysdeps/sun4/siglist.c:51
msgid "File size limit exceeded"
msgstr "Filstorleikgrense passert"
#: sysdeps/osf1/siglist.c:53 sysdeps/sun4/siglist.c:53
#: ../sysdeps/osf1/siglist.c:52 ../sysdeps/sun4/siglist.c:52
msgid "Virtual alarm clock"
msgstr "Virtuel alarmklokke"
#: sysdeps/osf1/siglist.c:54 sysdeps/sun4/siglist.c:54
#: ../sysdeps/osf1/siglist.c:53 ../sysdeps/sun4/siglist.c:53
msgid "Profiling alarm clock"
msgstr "Profilerer alarmklokke"
#: sysdeps/osf1/siglist.c:55 sysdeps/sun4/siglist.c:55
#: ../sysdeps/osf1/siglist.c:54 ../sysdeps/sun4/siglist.c:54
msgid "Window size change"
msgstr "Endring i vindaugsstorleik"
#: sysdeps/osf1/siglist.c:56 sysdeps/sun4/siglist.c:56
#: ../sysdeps/osf1/siglist.c:55 ../sysdeps/sun4/siglist.c:55
msgid "Information request"
msgstr "Informasjonsførespurnad"
#: sysdeps/osf1/siglist.c:57 sysdeps/sun4/siglist.c:57
#: ../sysdeps/osf1/siglist.c:56 ../sysdeps/sun4/siglist.c:56
msgid "User defined signal 1"
msgstr "Eigendefinert 1"
#: sysdeps/osf1/siglist.c:58 sysdeps/sun4/siglist.c:58
#: ../sysdeps/osf1/siglist.c:57 ../sysdeps/sun4/siglist.c:57
msgid "User defined signal 2"
msgstr "Eigendefinert 2"
#~ msgid "DEBUG"
#~ msgstr "FEILSØK"
#~ msgid "VERBOSE"
#~ msgstr "ORDRIK"
#~ msgid "NO-DAEMON"
#~ msgstr "UTAN-NISSE"
#~ msgid "INETD"
#~ msgstr "INETD"

View File

@@ -10,8 +10,8 @@ msgstr ""
"Project-Id-Version: libgtop\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-07-21 14:34-0300\n"
"PO-Revision-Date: 2007-07-21 14:37-0300\n"
"Last-Translator: Og Maciel <ogmaciel@gnome.org>\n"
"PO-Revision-Date: 2008-07-24 13:23-0300\n"
"Last-Translator: Vladimir Melo <vladimirmelo.psi@gmail.com>\n"
"Language-Team: Brazilian Portuguese <gnome-l10n-br@listas.cipsga.org.br>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -76,7 +76,7 @@ msgstr "Interromper"
#: ../sysdeps/osf1/siglist.c:29 ../sysdeps/sun4/siglist.c:29
msgid "Quit"
msgstr "Encerrar"
msgstr "Sair"
#: ../sysdeps/osf1/siglist.c:30 ../sysdeps/sun4/siglist.c:30
msgid "Illegal instruction"

View File

@@ -27,7 +27,7 @@ void
do_output (int s, glibtop_response *resp, off_t offset,
size_t data_size, const void *data)
{
#ifdef REAL_DEBUG
#ifdef DEBUG
fprintf (stderr, "Really writing %d bytes at offset %lu.\n",
sizeof (glibtop_response), offset);
#endif
@@ -44,7 +44,7 @@ do_output (int s, glibtop_response *resp, off_t offset,
}
if (resp->data_size) {
#ifdef REAL_DEBUG
#ifdef DEBUG
fprintf (stderr, "Writing %d bytes of data.\n", resp->data_size);
#endif
@@ -88,7 +88,7 @@ do_read (int s, void *ptr, size_t total_size)
tmp_ptr += nread;
ptr = tmp_ptr;
#ifdef REAL_DEBUG
#ifdef DEBUG
fprintf (stderr, "READ (%d): %d - %d - %d\n",
nread, already_read, remaining, total_size);
#endif

View File

@@ -53,6 +53,7 @@ GLIBTOP_SUID_PROC_MAP +
GLIBTOP_SUID_NETLOAD +
GLIBTOP_SUID_NETLIST +
GLIBTOP_SUID_PROC_WD +
GLIBTOP_SUID_PROC_AFFINITY +
GLIBTOP_SUID_PPP;
#include <fcntl.h>

View File

@@ -3,18 +3,18 @@ INCLUDES = @INCLUDES@
noinst_LTLIBRARIES = libgtop_common-2.0.la libgtop_suid_common-2.0.la
libgtop_common_2_0_la_SOURCES = error.c gnuslib.c \
procargs.c \
default.c
if !LIBGTOP_SYSDEPS_PRIVATE_MOUNTLIST
libgtop_common_2_0_la_SOURCES += mountlist.c
mountlist_src = mountlist.c
endif
if !LIBGTOP_SYSDEPS_PRIVATE_FSUSAGE
libgtop_common_2_0_la_SOURCES += fsusage.c
fsusage_src = fsusage.c
endif
libgtop_common_2_0_la_SOURCES = error.c gnuslib.c \
procargs.c \
default.c \
$(mountlist_src) $(fsusage_src)
# libgtop_common_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
libgtop_common_2_0_la_LIBADD = $(LIBGTOP_EXTRA_LIBS)

View File

@@ -368,3 +368,17 @@ glibtop_get_proc_wd(glibtop_proc_wd *buf, pid_t pid)
}
/**
* glibtop_get_proc_affinity:
* @buf:
* @pid: Process id to get the affinity
*
* Get the processor affinity list for a process
*
* Returns: A list of processor ID of 'buf.number' elements.
*/
guint16 *
glibtop_get_proc_affinity(glibtop_proc_affinity *buf, pid_t pid)
{
return glibtop_get_proc_affinity_l(glibtop_global_server, buf, pid);
}

View File

@@ -6,8 +6,8 @@ noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la libgtop_sysdeps_suid-2.0.la
libgtop_sysdeps_2_0_la_SOURCES = nosuid.c siglist.c sysinfo.c shm_limits.c \
cpu.c msg_limits.c sem_limits.c loadavg.c \
uptime.c netlist.c fsusage.c mem.c \
procopenfiles.c procwd.c \
glibtop_private.c
mountlist.c procopenfiles.c procwd.c \
procaffinity.c glibtop_private.c
libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO)

View File

@@ -10,6 +10,7 @@
#include <unistd.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/statvfs.h>
#if __FreeBSD_version >= 600000 || defined(__FreeBSD_kernel__)
#include <libgeom.h>
#include <sys/resource.h>
@@ -21,15 +22,13 @@
#include <string.h>
#include <stdlib.h>
void
_glibtop_freebsd_get_fsusage_read_write(glibtop *server,
glibtop_fsusage *buf,
const char *path);
static const unsigned long _glibtop_sysdeps_fsusage =
(1L << GLIBTOP_FSUSAGE_BLOCKS) + (1L << GLIBTOP_FSUSAGE_BFREE)
+ (1L << GLIBTOP_FSUSAGE_BAVAIL) + (1L << GLIBTOP_FSUSAGE_FILES)
+ (1L << GLIBTOP_FSUSAGE_FFREE) + (1L << GLIBTOP_FSUSAGE_BLOCK_SIZE);
void
_glibtop_freebsd_get_fsusage_read_write(glibtop *server,
glibtop_fsusage *buf,
const char *path)
static void
_glibtop_get_fsusage_read_write (glibtop *server, glibtop_fsusage *buf, const char *path)
{
int result;
struct statfs sfs;
@@ -135,3 +134,28 @@ _glibtop_freebsd_get_fsusage_read_write(glibtop *server,
#endif
buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
}
void
glibtop_get_fsusage_s(glibtop *server, glibtop_fsusage *buf, const char *path)
{
struct statvfs fsd;
glibtop_init_r (&server, 0, 0);
memset (buf, 0, sizeof (glibtop_fsusage));
if (statvfs (path, &fsd) < 0)
return;
buf->block_size = fsd.f_frsize;
buf->blocks = fsd.f_blocks;
buf->bfree = fsd.f_bfree;
buf->bavail = (fsd.f_bavail > fsd.f_bfree) ? 0 : fsd.f_bavail;
buf->files = fsd.f_files;
buf->ffree = fsd.f_ffree;
buf->flags = _glibtop_sysdeps_fsusage;
_glibtop_get_fsusage_read_write(server, buf, path);
}

View File

@@ -46,6 +46,7 @@ G_BEGIN_DECLS
#define GLIBTOP_SUID_SEM_LIMITS 0
#define GLIBTOP_SUID_NETLIST 0
#define GLIBTOP_SUID_PROC_WD 0
#define GLIBTOP_SUID_PROC_AFFINITY 0
G_END_DECLS

168
sysdeps/freebsd/mountlist.c Normal file
View File

@@ -0,0 +1,168 @@
/* mountlist.c -- return a list of mounted filesystems
Copyright (C) 1991, 1992 Free Software Foundation, Inc.
This program 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, or (at your option)
any later version.
This program 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 this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <string.h>
#include <glibtop.h>
#include <glibtop/mountlist.h>
/* A mount table entry. */
struct mount_entry
{
char *me_devname; /* Device node pathname, including "/dev/". */
char *me_mountdir; /* Mount point directory pathname. */
char *me_type; /* "nfs", "4.2", etc. */
dev_t me_dev; /* Device number of me_mountdir. */
struct mount_entry *me_next;
};
static struct mount_entry *read_filesystem_list (void);
/* Return a list of the currently mounted filesystems, or NULL on error.
Add each entry to the tail of the list so that they stay in order.
*/
static struct mount_entry *
read_filesystem_list (void)
{
struct mount_entry *mount_list;
struct mount_entry *me;
struct mount_entry *mtail;
/* Start the list off with a dummy entry. */
me = g_new (struct mount_entry, 1);
me->me_next = NULL;
mount_list = mtail = me;
{
struct statfs *fsp;
int entries;
entries = getmntinfo (&fsp, MNT_NOWAIT);
if (entries < 0)
return NULL;
while (entries-- > 0)
{
me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry));
me->me_devname = g_strdup (fsp->f_mntfromname);
me->me_mountdir = g_strdup (fsp->f_mntonname);
me->me_type = g_strdup (fsp->f_fstypename);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
me->me_next = NULL;
/* Add to the linked list. */
mtail->me_next = me;
mtail = me;
fsp++;
}
}
/* Free the dummy head. */
me = mount_list;
mount_list = mount_list->me_next;
g_free (me);
return mount_list;
}
static gboolean ignore_mount_entry(const struct mount_entry *me)
{
/* keep sorted */
static const char ignored[][17] = {
"autofs",
"devfs",
"fusectl",
"linprocfs",
"linsysfs",
"mfs",
"none",
"nfs",
"nullfs",
"nwfs",
"portalfs",
"proc",
"procfs",
"smbfs",
"tmpfs",
"unionfs",
"unknown"
};
typedef int (*Comparator)(const void*, const void*);
return bsearch(me->me_type,
ignored, G_N_ELEMENTS(ignored), sizeof ignored[0],
(Comparator) strcmp) != NULL;
}
glibtop_mountentry *
glibtop_get_mountlist_s (glibtop *server, glibtop_mountlist *buf, int all_fs)
{
struct mount_entry *entries, *cur, *next;
GArray *mount_array = g_array_new(FALSE, FALSE,
sizeof(glibtop_mountentry));
glibtop_init_r (&server, 0, 0);
memset (buf, 0, sizeof (glibtop_mountlist));
/* Read filesystem list. */
if((entries = read_filesystem_list ()) == NULL)
return NULL;
for (cur = &entries[0]; cur != NULL; cur = next) {
if(all_fs || !ignore_mount_entry(cur)) {
/* add a new glibtop_mountentry */
glibtop_mountentry e;
g_strlcpy(e.devname, cur->me_devname, sizeof e.devname);
g_strlcpy(e.mountdir, cur->me_mountdir, sizeof e.mountdir);
g_strlcpy(e.type, cur->me_type, sizeof e.type);
e.dev = cur->me_dev;
g_array_append_val(mount_array, e);
}
/* free current mount_entry and move to the next */
next = cur->me_next;
g_free(cur->me_devname);
g_free(cur->me_mountdir);
g_free(cur->me_type);
g_free(cur);
}
buf->size = sizeof (glibtop_mountentry);
buf->number = mount_array->len;
buf->total = buf->number * buf->size;
buf->flags = (1 << GLIBTOP_MOUNTLIST_SIZE)
| (1 << GLIBTOP_MOUNTLIST_NUMBER)
| (1 << GLIBTOP_MOUNTLIST_TOTAL);
return (glibtop_mountentry*) g_array_free(mount_array, FALSE);
}

View File

@@ -0,0 +1,84 @@
/* Copyright (C) 2007 Joe Marcus Clarke <marcus@FreeBSD.org>
This file is part of LibGTop 2.
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/procaffinity.h>
#include <glibtop/error.h>
#include <glibtop_private.h>
#include <sys/param.h>
#if __FreeBSD_version > 800024
#include <sys/cpuset.h>
#endif
void
_glibtop_init_proc_affinity_s(glibtop *server)
{
server->sysdeps.proc_affinity =
(1 << GLIBTOP_PROC_AFFINITY_NUMBER) |
(1 << GLIBTOP_PROC_AFFINITY_ALL);
}
guint16 *
glibtop_get_proc_affinity_s(glibtop *server, glibtop_proc_affinity *buf, pid_t pid)
{
#if __FreeBSD_version > 800024
id_t id;
cpulevel_t level;
cpuwhich_t which;
cpuset_t mask;
size_t i;
GArray* cpus;
memset(buf, 0, sizeof *buf);
which = CPU_WHICH_PID;
level = CPU_LEVEL_WHICH;
id = pid;
if (cpuset_getaffinity(level, which, id, sizeof(mask), &mask) != 0) {
glibtop_error_r(server, "cpuset_getaffinity failed");
return NULL;
}
cpus = g_array_new(FALSE, FALSE, sizeof(guint16));
for (i = 0; i < MIN(CPU_SETSIZE, (size_t)(server->ncpu + 1)); i++) {
if (CPU_ISSET(i, &mask)) {
guint16 n = i;
g_array_append_val(cpus, n);
}
}
buf->number = cpus->len;
buf->all = (cpus->len == (size_t)(server->ncpu + 1));
buf->flags = (1 << GLIBTOP_PROC_AFFINITY_NUMBER)
| (1 << GLIBTOP_PROC_AFFINITY_ALL);
return (guint16*) g_array_free(cpus, FALSE);
#else
memset(buf, 0, sizeof *buf);
return NULL;
#endif
}

View File

@@ -41,7 +41,17 @@
#define _KERNEL
#include <sys/pipe.h>
#include <sys/conf.h>
#undef _KERNEL
#if __FreeBSD_version >= 800038
#define _WANT_FILE
#include <sys/file.h>
#undef _WANT_FILE
#else
#define _KERNEL
#include <sys/file.h>
#undef _KERNEL
#endif
#define _KERNEL
#include <sys/mount.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
@@ -103,8 +113,14 @@ _glibtop_sysdeps_freebsd_dev_inode (glibtop *server, struct vnode *vnode,
if (kvm_read (server->machine.kd, (gulong) inode.i_dev, (char *) &si,
sizeof (si)) != sizeof (si) ||
#if __FreeBSD_version >= 800039
kvm_read (server->machine.kd, (gulong) cdev2priv(&si), (char *) &priv,
sizeof (priv))
#else
kvm_read (server->machine.kd, (gulong) si.si_priv, (char *) &priv,
sizeof (priv)) != sizeof (priv))
sizeof (priv))
#endif
!= sizeof (priv))
{
glibtop_warn_io_r (server, "kvm_read (si)");
return;

View File

@@ -28,6 +28,13 @@
#include <glibtop/error.h>
#include <glibtop/procopenfiles.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/un.h>
#include <sys/user.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <stdlib.h>
@@ -46,6 +53,63 @@ _glibtop_init_proc_open_files_s (glibtop *server)
server->sysdeps.proc_open_files = _glibtop_sysdeps_proc_open_files;
}
#if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
static char *
addr_to_string(struct sockaddr_storage *ss)
{
char *buffer = NULL;
char buffer2[INET6_ADDRSTRLEN];
struct sockaddr_in6 *sin6;
struct sockaddr_in *sin;
struct sockaddr_un *sun;
switch (ss->ss_family) {
case AF_LOCAL:
sun = (struct sockaddr_un *)ss;
if (strlen(sun->sun_path) == 0)
buffer = g_strdup("-");
else
buffer = g_strdup(sun->sun_path);
break;
case AF_INET:
sin = (struct sockaddr_in *)ss;
buffer = g_strdup(inet_ntoa(sin->sin_addr));
break;
case AF_INET6:
sin6 = (struct sockaddr_in6 *)ss;
if (inet_ntop(AF_INET6, &sin6->sin6_addr, buffer2,
sizeof(buffer2)) != NULL)
buffer = g_strdup(buffer2);
else
buffer = g_strdup("-");
break;
}
return buffer;
}
static int
addr_to_port(struct sockaddr_storage *ss)
{
int port = 0;
struct sockaddr_in6 *sin6;
struct sockaddr_in *sin;
switch (ss->ss_family) {
case AF_INET:
sin = (struct sockaddr_in *)ss;
port = ntohs(sin->sin_port);
break;
case AF_INET6:
sin6 = (struct sockaddr_in6 *)ss;
port = ntohs(sin6->sin6_port);
break;
}
return port;
}
#else
static GArray *
parse_output(const char *output) {
GArray *entries;
@@ -142,6 +206,39 @@ parse_output(const char *output) {
sizeof(entry.info.sock.dest_host));
entry.info.sock.dest_port = atoi(remote_host[1]);
g_strfreev(remote_host);
} else if (!strcmp(ftype, "IPv6")) {
char **hosts;
char **remote_host;
if (!strstr(fname, "->")) {
remote_host = g_strsplit(fname, ":", 0);
} else {
hosts = g_strsplit(fname, "->", 0);
if (g_strv_length(hosts) < 2) {
g_strfreev(hosts);
continue;
}
remote_host = g_strsplit(hosts[1], "]", 0);
g_strfreev(hosts);
}
if (g_strv_length(remote_host) < 2) {
g_strfreev(remote_host);
continue;
}
entry.type = GLIBTOP_FILE_TYPE_INET6SOCKET;
if (!strcmp(remote_host[0], "*"))
g_strlcpy(entry.info.sock.dest_host, "0.0.0.0",
sizeof(entry.info.sock.dest_host));
else
g_strlcpy(entry.info.sock.dest_host,
remote_host[0] + 1,
sizeof(entry.info.sock.dest_host));
entry.info.sock.dest_port = atoi(remote_host[1] + 1);
g_strfreev(remote_host);
} else
continue;
@@ -159,21 +256,108 @@ parse_output(const char *output) {
return entries;
}
#endif
glibtop_open_files_entry *
glibtop_get_proc_open_files_s (glibtop *server, glibtop_proc_open_files *buf, pid_t pid)
{
#if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
struct kinfo_file *freep, *kif;
int name[4];
size_t len;
size_t i;
#else
char *output;
#endif
GArray *entries;
memset(buf, 0, sizeof (glibtop_proc_open_files));
#if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
name[0] = CTL_KERN;
name[1] = KERN_PROC;
name[2] = KERN_PROC_FILEDESC;
name[3] = pid;
if (sysctl(name, 4, NULL, &len, NULL, 0) < 0)
return NULL;
freep = kif = g_malloc(len);
if (sysctl(name, 4, kif, &len, NULL, 0) < 0) {
g_free(freep);
return NULL;
}
entries = g_array_new(FALSE, FALSE, sizeof(glibtop_open_files_entry));
for (i = 0; i < len / sizeof(*kif); i++, kif++) {
glibtop_open_files_entry entry = {0};
if (kif->kf_fd < 0)
continue;
if (kif->kf_type == KF_TYPE_SOCKET) {
if (kif->kf_sock_domain == AF_LOCAL) {
struct sockaddr_un *sun;
entry.type = GLIBTOP_FILE_TYPE_LOCALSOCKET;
sun = (struct sockaddr_un *)&kif->kf_sa_local;
if (sun->sun_path[0]) {
char *addrstr;
addrstr = addr_to_string(&kif->kf_sa_local);
g_strlcpy(entry.info.localsock.name,
addrstr,
sizeof(entry.info.localsock.name));
g_free(addrstr);
} else {
char *addrstr;
addrstr = addr_to_string(&kif->kf_sa_peer);
g_strlcpy(entry.info.localsock.name,
addrstr,
sizeof(entry.info.localsock.name));
g_free(addrstr);
}
} else if (kif->kf_sock_domain == AF_INET ||
kif->kf_sock_domain == AF_INET6) {
char *addrstr;
if (kif->kf_sock_domain == AF_INET)
entry.type = GLIBTOP_FILE_TYPE_INETSOCKET;
else
entry.type = GLIBTOP_FILE_TYPE_INET6SOCKET;
addrstr = addr_to_string(&kif->kf_sa_peer);
g_strlcpy(entry.info.sock.dest_host,
addrstr,
sizeof(entry.info.sock.dest_host));
g_free(addrstr);
entry.info.sock.dest_port = addr_to_port(&kif->kf_sa_peer);
}
} else if (kif->kf_type == KF_TYPE_PIPE) {
entry.type = GLIBTOP_FILE_TYPE_PIPE;
} else if (kif->kf_type == KF_TYPE_VNODE) {
entry.type = GLIBTOP_FILE_TYPE_FILE;
g_strlcpy(entry.info.file.name, kif->kf_path,
sizeof(entry.info.file.name));
} else
continue;
entry.fd = kif->kf_fd;
g_array_append_val(entries, entry);
}
g_free(freep);
#else
output = execute_lsof(pid);
if (output == NULL) return NULL;
entries = parse_output(output);
g_free(output);
#endif
buf->flags = _glibtop_sysdeps_proc_open_files;
buf->number = entries->len;

View File

@@ -24,7 +24,9 @@
#include <glibtop_private.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/param.h>
#include <sys/user.h>
#include <string.h>
static const unsigned long _glibtop_sysdeps_proc_wd =
@@ -38,6 +40,7 @@ _glibtop_init_proc_wd_s(glibtop *server)
server->sysdeps.proc_wd = _glibtop_sysdeps_proc_wd;
}
#if (__FreeBSD_version >= 800000 && __FreeBSD_version < 800019) || _FreeBSD_version < 700104
static GPtrArray *
parse_output(const char *output, glibtop_proc_wd *buf)
{
@@ -89,12 +92,21 @@ parse_output(const char *output, glibtop_proc_wd *buf)
return dirs;
}
#endif
char**
glibtop_get_proc_wd_s(glibtop *server, glibtop_proc_wd *buf, pid_t pid)
{
char path[MAXPATHLEN];
#if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
struct kinfo_file *freep, *kif;
GPtrArray *dirs;
size_t len;
int i;
int name[4];
#else
char *output;
#endif
memset (buf, 0, sizeof (glibtop_proc_wd));
@@ -102,6 +114,43 @@ glibtop_get_proc_wd_s(glibtop *server, glibtop_proc_wd *buf, pid_t pid)
if (safe_readlink(path, buf->exe, sizeof(buf->exe)))
buf->flags |= (1 << GLIBTOP_PROC_WD_EXE);
#if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
name[0] = CTL_KERN;
name[1] = KERN_PROC;
name[2] = KERN_PROC_FILEDESC;
name[3] = pid;
if (sysctl(name, 4, NULL, &len, NULL, 0) < 0)
return NULL;
freep = kif = g_malloc(len);
if (sysctl(name, 4, kif, &len, NULL, 0) < 0) {
g_free(freep);
return NULL;
}
dirs = g_ptr_array_sized_new(1);
for (i = 0; i < len / sizeof(*kif); i++, kif++) {
switch (kif->kf_fd) {
case KF_FD_TYPE_ROOT:
g_strlcpy(buf->root, kif->kf_path,
sizeof(buf->root));
buf->flags |= (1 << GLIBTOP_PROC_WD_ROOT);
break;
case KF_FD_TYPE_CWD:
g_ptr_array_add(dirs, g_strdup (kif->kf_path));
break;
}
}
g_free(freep);
buf->number = dirs->len;
buf->flags |= (1 << GLIBTOP_PROC_WD_NUMBER);
g_ptr_array_add(dirs, NULL);
return (char **)g_ptr_array_free(dirs, FALSE);
#else
output = execute_lsof(pid);
if (output != NULL) {
GPtrArray *dirs;
@@ -116,6 +165,7 @@ glibtop_get_proc_wd_s(glibtop *server, glibtop_proc_wd *buf, pid_t pid)
return (char **)g_ptr_array_free(dirs, FALSE);
}
#endif
return NULL;
}

View File

@@ -25,6 +25,7 @@
#include <glibtop/shm_limits.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/sysctl.h>
static unsigned long _glibtop_sysdeps_shm_limits =
@@ -46,7 +47,11 @@ void
glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf)
{
size_t len;
#if __FreeBSD_version < 700002
int shmmax, shmmin, shmmni, shmseg, shmall;
#else
unsigned long shmmax, shmmin, shmmni, shmseg, shmall;
#endif
glibtop_init_s (&server, GLIBTOP_SYSDEPS_SHM_LIMITS, 0);

View File

@@ -8,7 +8,7 @@ libgtop_sysdeps_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c procargs.c procmap.c siglist.c \
sysinfo.c netload.c ppp.c glibtop_private.c \
mountlist.c \
mountlist.c procaffinity.c \
fsusage.c netlist.c procopenfiles.c procwd.c
libgtop_sysdeps_2_0_la_LIBADD = @GLIB_LIBS@

View File

@@ -15,6 +15,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <mntent.h>
/*
@@ -25,66 +26,102 @@
static char *
get_partition(const char *mountpoint)
static gboolean
get_device(glibtop* server, const char *mountpoint,
char* device, size_t device_size)
{
FILE *partitions;
char *name = NULL;
char line[1024];
struct stat statb;
const struct mntent *mnt;
FILE *fp;
gboolean found = FALSE;
if(stat(mountpoint, &statb) == -1)
return NULL;
if((partitions = fopen("/proc/partitions", "r")) == NULL)
return NULL;
while(fgets(line, sizeof line, partitions))
{
unsigned major, minor;
char dev[32];
if(sscanf(line, "%u %u %*u %31s", &major, &minor, dev) != 3)
continue;
if(MKDEV(major, minor) != statb.st_dev)
continue;
name = g_strdup(dev);
break;
if (!(fp = setmntent(MOUNTED, "r"))) {
glibtop_warn_io_r(server, "Could not open %s", MOUNTED);
goto out;
}
fclose(partitions);
return name;
while ((mnt = getmntent(fp)))
{
if (!strcmp(mountpoint, mnt->mnt_dir)) {
if (!strncmp(mnt->mnt_fsname, "/dev/", 5)) {
g_strlcpy(device, mnt->mnt_fsname + 5, device_size);
found = TRUE;
}
break;
}
}
endmntent(fp);
out:
return found;
}
static void
get_sys_path(const char *device, char **stat_path, const char **parse_format)
/*
TRUE if device is like "hda3" and then set prefix to "hda".
*/
static gboolean
is_partition(const char* device, char* prefix, size_t prefix_size)
{
if(g_str_has_prefix(device, "hd") || g_str_has_prefix(device, "sd"))
{
char *prefix;
char *path;
size_t offset;
g_strlcpy(prefix, device, prefix_size);
offset = strcspn(device, "0123456789");
for ( ; *prefix; prefix++) {
if (isdigit(*prefix)) {
*prefix = '\0';
return TRUE;
}
}
prefix = g_strdup(device);
prefix [offset] = '\0';
return FALSE;
}
path = g_strdup_printf("/sys/block/%s/%s/stat",
prefix, device);
g_free(prefix);
/*
Bug #539360.
/sys/.../stat format is partially defined in
linux/Documentation/block/stat.txt (looks outdated). Before linux
2.5.25, /sys/block/%s/stat and /sys/block/%s/%s/stat were not the
same, but the following commit changed the latter to have the same
format and broke compatibility.
*stat_path = path;
*parse_format = "%*llu %llu %*llu %llu";
Commit 34e8beac92c27d292938065f8375842d2840767c
Author: Jerome Marchand <jmarchan@redhat.com>
Date: Fri Feb 8 11:04:55 2008 +0100
Enhanced partition statistics: sysfs
Reports enhanced partition statistics in sysfs.
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
fs/partitions/check.c | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
*/
static void
get_sys_path(glibtop* server, const char *device, char **stat_path, const char **parse_format)
{
const char* linux_2_6_25_format = "%*llu %*llu %llu %*llu"
"%*llu %*llu %llu %*llu";
char prefix[32];
if (is_partition(device, prefix, sizeof prefix)) {
*stat_path = g_strdup_printf("/sys/block/%s/%s/stat",
prefix, device);
if (server->os_version_code < LINUX_VERSION_CODE(2, 6, 25))
*parse_format = "%*llu %llu %*llu %llu";
else
*parse_format = linux_2_6_25_format;
}
else
{
*stat_path = g_strdup_printf("/sys/block/%s/stat", device);
*parse_format = "%*llu %*llu %llu %*llu %*llu %*llu %llu";
if (server->os_version_code < LINUX_VERSION_CODE(2, 6, 25))
*parse_format = "%*llu %*llu %llu %*llu %*llu %*llu %llu";
else
*parse_format = linux_2_6_25_format;
}
}
@@ -92,17 +129,16 @@ get_sys_path(const char *device, char **stat_path, const char **parse_format)
static void linux_2_6_0(glibtop *server, glibtop_fsusage *buf, const char *path)
{
char *device;
char *filename;
const char *format;
int ret;
char buffer[BUFSIZ];
char device[64];
device = get_partition(path);
if(!device) return;
if (!get_device(server, path, device, sizeof device))
return;
get_sys_path(device, &filename, &format);
g_free(device);
get_sys_path(server, device, &filename, &format);
ret = try_file_to_buffer(buffer, sizeof buffer, filename);

View File

@@ -17,7 +17,7 @@
unsigned long long
get_scaled(const char *buffer, const char *key)
{
const char *ptr = buffer;;
const char *ptr = buffer;
char *next;
unsigned long long value;
@@ -119,20 +119,27 @@ file_to_buffer(glibtop *server, char *buffer, size_t bufsiz, const char *filenam
static unsigned long
read_boot_time(glibtop *server)
{
char buffer[BUFSIZ];
char *btime;
char* line = NULL;
size_t size = 0;
FILE* stat;
unsigned long btime = 0;
file_to_buffer(server, buffer, sizeof buffer, "/proc/stat");
btime = strstr(buffer, "btime");
if (!btime) {
glibtop_warn_io_r(server, "cannot find btime in /proc/stat");
return 0UL;
if (!(stat = fopen("/proc/stat", "r"))) {
glibtop_error_io_r(server, "fopen(\"/proc/stat\")");
goto out;
}
btime = skip_token(btime);
return strtoul(btime, NULL, 10);
while (getline(&line, &size, stat) != -1) {
if (!strncmp(line, "btime", 5)) {
btime = strtoul(skip_token(line), NULL, 10);
break;
}
}
free(line);
fclose(stat);
out:
return btime;
}

View File

@@ -61,7 +61,11 @@ skip_line (const char *p)
return (char *) (*p ? p+1 : p);
}
/*
* Smart strtoul which handles binary suffixes
* e.g: get_scaled("Size: 32 kB", "Size:") == 32768
* key can be NULL if there's not prefix to strip (or prefix size is known
*/
unsigned long long
get_scaled(const char *buffer, const char *key);

View File

@@ -43,6 +43,7 @@
#define GLIBTOP_SUID_NETLOAD 0
#define GLIBTOP_SUID_NETLIST 0
#define GLIBTOP_SUID_PROC_WD 0
#define GLIBTOP_SUID_PROC_AFFINITY 0
#define GLIBTOP_SUID_PPP 0
#define GLIBTOP_SUID_PROC_FILE 0

View File

@@ -0,0 +1,69 @@
/* Copyright (C) 2007 Benoît Dejean
This file is part of LibGTop 2.
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/procaffinity.h>
#include <glibtop/error.h>
#include <glibtop_private.h>
#include <sched.h>
void
_glibtop_init_proc_affinity_s(glibtop *server)
{
server->sysdeps.proc_affinity =
(1 << GLIBTOP_PROC_AFFINITY_NUMBER) |
(1 << GLIBTOP_PROC_AFFINITY_ALL);
}
guint16 *
glibtop_get_proc_affinity_s(glibtop *server, glibtop_proc_affinity *buf, pid_t pid)
{
cpu_set_t set;
size_t i;
GArray* cpus;
memset(buf, 0, sizeof *buf);
if (sched_getaffinity(pid, sizeof set, &set) == -1) {
glibtop_error_r(server, "sched_getaffinity failed");
return NULL;
}
cpus = g_array_new(FALSE, FALSE, sizeof(guint16));
for (i = 0; i < MIN(CPU_SETSIZE, (size_t)(server->ncpu + 1)); i++) {
if (CPU_ISSET(i, &set)) {
guint16 n = i;
g_array_append_val(cpus, n);
}
}
buf->number = cpus->len;
buf->all = (cpus->len == (size_t)(server->ncpu + 1));
buf->flags = (1 << GLIBTOP_PROC_AFFINITY_NUMBER)
| (1 << GLIBTOP_PROC_AFFINITY_ALL);
return (guint16*) g_array_free(cpus, FALSE);
}

View File

@@ -27,21 +27,53 @@
#include "glibtop_private.h"
static const unsigned long _glibtop_sysdeps_proc_mem =
(1L << GLIBTOP_PROC_MEM_VSIZE) + (1L << GLIBTOP_PROC_MEM_RSS) +
(1L << GLIBTOP_PROC_MEM_RSS_RLIM);
static const unsigned long _glibtop_sysdeps_proc_mem_statm =
(1L << GLIBTOP_PROC_MEM_SIZE) + (1L << GLIBTOP_PROC_MEM_RESIDENT) +
(1L << GLIBTOP_PROC_MEM_SHARE);
static const unsigned long _glibtop_sysdeps_proc_mem_pss =
(1L << GLIBTOP_PROC_MEM_RSS);
static unsigned long
get_pss(glibtop* server, pid_t pid)
{
char filepath[128];
FILE* smaps;
char* line = NULL;
size_t line_size = 0;
unsigned long pss = 0;
snprintf(filepath, sizeof filepath, "/proc/%u/smaps", (unsigned)pid);
if (!(smaps = fopen(filepath, "r"))) {
glibtop_error_io_r(server, "Cannot open %s", filepath);
goto out;
}
while (getline(&line, &line_size, smaps) != -1) {
if (strncmp(line, "Pss:", 4))
continue;
pss += get_scaled(line + 4, NULL);
}
out:
if (smaps)
fclose(smaps);
free(line);
return pss;
}
/* Init function. */
void
_glibtop_init_proc_mem_s (glibtop *server)
{
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem |
_glibtop_sysdeps_proc_mem_statm;
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
if (server->os_version_code >= LINUX_VERSION_CODE(2, 6, 25))
server->sysdeps.proc_mem |= _glibtop_sysdeps_proc_mem_pss;
}
/* Provides detailed information about a process. */
@@ -54,19 +86,34 @@ glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
memset (buf, 0, sizeof (glibtop_proc_mem));
if (proc_stat_to_buffer(buffer, sizeof buffer, pid))
return;
/* As of 2.6.24 in fs/proc/*.c
p = proc_stat_after_cmd (buffer);
if (!p) return;
== rss vs. resident ==
p = skip_multiple_token (p, 20);
stat/rss:
get_mm_rss where
#define get_mm_rss(mm) \
(get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss))
buf->vsize = strtoull (p, &p, 0);
buf->rss = strtoull (p, &p, 0);
buf->rss_rlim = strtoull (p, &p, 0);
statm/resident:
*shared = get_mm_counter(mm, file_rss);
*resident = *shared + get_mm_counter(mm, anon_rss);
buf->flags = _glibtop_sysdeps_proc_mem;
== vsize vs. size ==
stat/vsize:
task_vsize(mm) ... total_vm * pagesize
statm/size
mm->total_vm
=================
rss == resident
vsize == size
rss_lim is not implemented in statm, but there's limits which
provides all limits
share is only implemented in statm
*/
if (proc_statm_to_buffer(buffer, sizeof buffer, pid))
return;
@@ -78,7 +125,20 @@ glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
buf->size *= pagesize;
buf->resident *= pagesize;
buf->share *= pagesize;
buf->rss *= pagesize;
buf->flags |= _glibtop_sysdeps_proc_mem_statm;
/* dummy values */
buf->vsize = buf->size;
buf->rss_rlim = ~0;
buf->flags |= _glibtop_sysdeps_proc_mem;
#if 0
/* FIXME: see previous comment */
if (server->os_version_code >= LINUX_VERSION_CODE(2, 6, 25)) {
buf->rss = get_pss(server, pid);
buf->flags |= _glibtop_sysdeps_proc_mem_pss;
}
#else
buf->rss = buf->resident;
#endif
}

View File

@@ -97,6 +97,48 @@ get_all(const char *filename, LineParser parser)
struct Inet6SocketEntry
{
char host[GLIBTOP_OPEN_DEST_HOST_LEN + 1];
int port;
};
static void
inet6_socket_parser(GHashTable *dict, const char* line)
{
struct Inet6SocketEntry *se;
int sock;
struct in6_addr addr;
se = g_malloc0(sizeof *se);
if(sscanf(line, "%*d: %*s %8x%8x%8x%8x:%4x %*x %*x:%*x %*x:%*x %*d %*d %*d %d",
&addr.s6_addr32[0], &addr.s6_addr32[1], &addr.s6_addr32[2],
&addr.s6_addr32[3], &se->port, &sock) != 6)
goto error;
if(!inet_ntop(AF_INET6, &addr, se->host, sizeof se->host))
goto error;
g_hash_table_insert(dict, GINT_TO_POINTER(sock), se);
return;
error:
g_free(se);
}
static inline GHashTable *
get_all_inet6_sockets()
{
return get_all("/proc/net/tcp6", inet6_socket_parser);
}
struct InetSocketEntry
{
char host[GLIBTOP_OPEN_DEST_HOST_LEN + 1];
@@ -178,7 +220,7 @@ glibtop_get_proc_open_files_s (glibtop *server, glibtop_proc_open_files *buf, pi
{
char fn [BUFSIZ];
GArray *entries;
GHashTable *inet_sockets = NULL, *local_sockets = NULL;
GHashTable *inet6_sockets = NULL, *inet_sockets = NULL, *local_sockets = NULL;
struct dirent *direntry;
DIR *dir;
@@ -209,14 +251,27 @@ glibtop_get_proc_open_files_s (glibtop *server, glibtop_proc_open_files *buf, pi
if(g_str_has_prefix(tgt, "socket:["))
{
int sockfd;
struct Inet6SocketEntry *i6se;
struct InetSocketEntry *ise;
struct LocalSocketEntry *lse;
if(!inet6_sockets) inet6_sockets = get_all_inet6_sockets();
if(!inet_sockets) inet_sockets = get_all_inet_sockets();
if(!local_sockets) local_sockets = get_all_local_sockets();
sockfd = atoi(tgt + 8);
i6se = g_hash_table_lookup(inet6_sockets,
GINT_TO_POINTER(sockfd));
if(i6se) {
entry.type = GLIBTOP_FILE_TYPE_INET6SOCKET;
entry.info.sock.dest_port = i6se->port;
g_strlcpy(entry.info.sock.dest_host, i6se->host,
sizeof entry.info.sock.dest_host);
goto found;
}
ise = g_hash_table_lookup(inet_sockets,
GINT_TO_POINTER(sockfd));
@@ -257,6 +312,7 @@ glibtop_get_proc_open_files_s (glibtop *server, glibtop_proc_open_files *buf, pi
closedir (dir);
if(inet_sockets) g_hash_table_destroy(inet_sockets);
if(inet6_sockets) g_hash_table_destroy(inet6_sockets);
if(local_sockets) g_hash_table_destroy(local_sockets);
buf->flags = _glibtop_sysdeps_proc_open_files;