Compare commits

..

25 Commits

Author SHA1 Message Date
Benoît Dejean
6768eddab9 Released 2.28.0. 2009-09-21 10:01:12 +02:00
Dumitru Mișu Moldovan
ed440c7d0b Updated Romanian translation 2009-09-20 00:45:03 +03:00
Rajesh Ranjan
643005349a maithili update, translated by Sangeeta Kumari 2009-09-18 18:23:11 +05:30
krishnababu k
cbb3f7dd5b Updated Telugu Translation 2009-09-17 22:12:55 +05:30
Ani
72537d102d Updaeted Malayalam Translations 2009-09-12 20:43:39 +05:30
Carles Ferrando
a43d48f67c Added Catalan (Valencian) translation 2009-09-02 18:33:04 +02:00
Og B. Maciel
c50eb6d494 Updated mailing list address. 2009-08-30 12:12:14 -04:00
Seán de Búrca
010e3a1c9d Updated Irish translation 2009-08-20 09:47:57 -06:00
Manoj Kumar Giri
3ea6e1caf0 Added entries for Hindi Translation updated by Rajesh Ranjan 2009-06-10 20:05:45 +05:30
Manoj Kumar Giri
f66c9665bd Updated Hindi Translation on behalf of Rajesh Ranjan 2009-06-10 20:04:23 +05:30
Benoît Dejean
a80c80ca69 Released 2.27.3. 2009-05-25 22:20:27 +02:00
Christian Persch
f41ab3beed Don't printf a string directly but use %s instead
Bug #581725.

Signed-off-by: Benoît Dejean <benoit@placenet.org>
2009-05-08 14:22:17 +02:00
Benoît Dejean
933683da39 Add -no-undefined for shared libraries on Cygwin.
Bug #578890.
2009-05-04 12:05:06 +02:00
Benoît Dejean
2679fdde9a Killed debug message. 2009-05-03 19:46:00 +02:00
Benoît Dejean
2458096acf Oops, fix segfault in linux/proc_map.
I've commited the wrong patch, got lost in the svn->git change.
2009-05-03 19:41:22 +02:00
Benoît Dejean
1f44dbb385 Released 2.27.1. 2009-05-03 18:57:33 +02:00
Benoît Dejean
d99a29d217 Looks for smaps member using a gperf table instead of using
bsearch.
Brings a 25% boost.
2009-05-03 16:40:13 +02:00
Benoît Dejean
15abcdbbf2 Bumped version number. 2009-05-03 16:40:02 +02:00
Benoît Dejean
62bafe804e Don't use sscanf anymore when parsins smaps.
That's more code but it brings a 20% speed improvement.
2009-05-03 16:25:31 +02:00
Benoît Dejean
9f051c9569 Added cygwin support.
Patch by Cygwin Ports maintainer <yselkowitz@users.sourceforge.net>.
See #578890.
2009-04-30 20:55:15 +02:00
Benoît Dejean
231f4d2a14 Fixed DOAP file. 2009-04-30 20:49:34 +02:00
Benoît Dejean
4af6777d76 Also ship DOAP file. 2009-04-30 17:31:46 +02:00
Benoît Dejean
c05776fa09 Added DOAP file. 2009-04-30 17:30:54 +02:00
Diego Elio 'Flameeyes' Pettenò
f6b31585bb Don't call AC_CANONICAL_SYSTEM but AC_CANONICAL_HOST.
The former macro checks for definitions for all the three definitions
(host, build and target) but the configure script only uses $host.

Refer to
http://www.flameeyes.eu/autotools-mythbuster/autoconf/canonical.html or to
http://blog.flameeyes.eu/s/canonical-target for more details.

Signed-off-by: Benoît Dejean <benoit@placenet.org>
2009-04-30 17:21:15 +02:00
Benoît Dejean
f3c86c8767 Bumped version number to 2.27.0. 2009-04-18 20:32:24 +02:00
57 changed files with 3775 additions and 331 deletions

View File

@@ -16,6 +16,7 @@ EXTRA_DIST = autogen.sh libgtop.spec.in copyright.txt \
libgtop-2.0.pc.in acinclude.m4 \
intltool-extract.in \
intltool-merge.in \
libgtop.doap \
intltool-update.in
DISTCLEANFILES = \

21
NEWS
View File

@@ -1,3 +1,24 @@
21 September 2009: Overview of changes in 2.28.0
================================================
* Updated translations.
25 May 2009: Overview of changes in 2.27.3
==========================================
* linux:
- fixed format error.
3 May 2009: Overview of changes in 2.27.2
=========================================
* linux:
- glibtop_get_proc_map: oops, fixed segfault.
3 May 2009: Overview of changes in 2.27.1
=========================================
* linux:
- glibtop_get_proc_map is ~40% faster. This should be noticeable
in system-monitor.
* New cygwin support.
13 April 2009: Overview of changes in 2.26.1
============================================
* linux:

View File

@@ -3,8 +3,8 @@ dnl Configure script for the Gnome library
dnl
m4_define([libgtop_major_version], [2])
m4_define([libgtop_minor_version], [26])
m4_define([libgtop_micro_version], [1])
m4_define([libgtop_minor_version], [28])
m4_define([libgtop_micro_version], [0])
m4_define([libgtop_version], [libgtop_major_version.libgtop_minor_version.libgtop_micro_version])
dnl increment if the interface has additions, changes, removals.
@@ -31,7 +31,7 @@ AC_INIT([libgtop], [libgtop_version],
AC_CONFIG_SRCDIR(copyright.txt)
AC_CONFIG_HEADERS(config.h)
AC_CANONICAL_SYSTEM
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE
AC_SUBST(ACLOCAL_AMFLAGS, [\${ACLOCAL_FLAGS}])
@@ -381,6 +381,7 @@ sysdeps/solaris/Makefile
sysdeps/aix/Makefile
sysdeps/bsd/Makefile
sysdeps/darwin/Makefile
sysdeps/cygwin/Makefile
src/Makefile
src/daemon/Makefile
lib/Makefile

View File

@@ -7,7 +7,7 @@ libgtop_2_0_la_SOURCES = init.c open.c close.c command.c read.c \
read_data.c write.c lib.c parameter.c \
sysdeps.c
libgtop_2_0_la_LDFLAGS = $(LT_VERSION_INFO) -export-symbols $(srcdir)/libgtop.sym
libgtop_2_0_la_LDFLAGS = $(LT_VERSION_INFO) -export-symbols $(srcdir)/libgtop.sym -no-undefined
libgtop_2_0_la_LIBADD = $(GLIB_LIBS) $(top_builddir)/sysdeps/common/libgtop_common-2.0.la $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps-2.0.la $(sysdeps_suid_lib)
BUILT_SOURCES = lib.c

View File

@@ -103,6 +103,12 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
libgtop_have_sysinfo=yes
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server2 && chmod g+s $(bindir)/libgtop_server2'
;;
cygwin*)
libgtop_sysdeps_dir=cygwin
libgtop_use_machine_h=no
libgtop_need_server=no
libgtop_have_sysinfo=yes
;;
*)
if test x$hacker_mode = xyes ; then
case "$host_os" in

21
libgtop.doap Normal file
View File

@@ -0,0 +1,21 @@
<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:gnome="http://api.gnome.org/doap-extensions#"
xmlns="http://usefulinc.com/ns/doap#">
<name xml:lang="en">libgtop</name>
<shortdesc xml:lang="en">LibGTop2</shortdesc>
<download-page rdf:resource="http://download.gnome.org/sources/libgtop/" />
<bug-database rdf:resource="http://bugzilla.gnome.org/browse.cgi?product=libgtop" />
<category rdf:resource="http://api.gnome.org/doap-extensions#desktop" />
<maintainer>
<foaf:Person>
<foaf:name>Benoît Dejean</foaf:name>
<foaf:mbox rdf:resource="mailto:benoit@placenet.org" />
<gnome:userid>bdejean</gnome:userid>
</foaf:Person>
</maintainer>
</Project>

View File

@@ -44,6 +44,7 @@ ky
la
lt
lv
mai
mg
mi
mk

View File

@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: libgtop.gnome-2-26\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-09-02 18:33+0200\n"
"POT-Creation-Date: 2009-09-02 18:32+0200\n"
"PO-Revision-Date: 2009-08-29 10:37+0200\n"
"Last-Translator: Carles Ferrando Garcia <carles.ferrando@gmail.com>\n"
"Language-Team: catalan <tradgnome@softcatala.org>\n"

216
po/ga.po
View File

@@ -1,203 +1,201 @@
# Irish (gaeilge) translations for libgtop.pot (Gnome)
# Copyright (C) 1998,2004 Free Software Foundation, Inc.
# Alastair McKinstry <mckinstry@computer.org>, 1998
# Paul Duffy <dubhthach@frink.nuigalway.ie>, 2003
# Irish translations for libgtop package.
# Copyright (C) 1998-2009 Free Software Foundation, Inc.
# This file is distributed under the same license as the libgtop package.
# Alastair McKinstry <mckinstry@computer.org>, 1998.
# Paul Duffy <dubhthach@frink.nuigalway.ie>, 2003.
# Seán de Búrca <leftmostcat@gmail.com>, 2009.
#
msgid ""
msgstr ""
"Project-Id-Version: libgtop-GNOME-2-0-port \n"
"Project-Id-Version: libgtop.master\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-09-25 18:15+0200\n"
"PO-Revision-Date: 2004-01-23 18:10+0000\n"
"Last-Translator: Alastair McKinstry <mckinstry@computer.org>\n"
"POT-Creation-Date: 2009-08-20 09:28-0600\n"
"PO-Revision-Date: 2009-08-20 09:47-0600\n"
"Last-Translator: Seán de Búrca <leftmostcat@gmail.com>\n"
"Language-Team: Irish <gaeilge-gnulinux@lists.sourceforge.net>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=5; plural=n==1 ? 0 : (n%10==1 || n%10==2) ? 1 : (n%"
"10>=3 && n%10<= 6) ? 2 : ((n%10>=7 && n%10<=9) || n==10) ? 3 : 4;\n"
#: lib/read.c:65
#: ../lib/read.c:51
#, c-format
msgid "read %d byte"
msgid_plural "read %d bytes"
msgstr[0] ""
msgstr[1] ""
msgstr[0] "léigh %d bheart"
msgstr[1] "léigh %d bheart"
msgstr[2] "léigh %d bheart"
msgstr[3] "léigh %d mbeart"
msgstr[4] "léigh %d beart"
#: lib/read_data.c:53
#: ../lib/read_data.c:51
msgid "read data size"
msgstr ""
msgstr "léigh méid sonraí"
#: 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] ""
msgstr[1] ""
msgstr[0] "léigh %lu bheart sonraí"
msgstr[1] "léigh %lu bheart sonraí"
msgstr[2] "léigh %lu bheart sonraí"
msgstr[3] "léigh %lu mbeart sonraí"
msgstr[4] "léigh %lu beart sonraí"
#: lib/write.c:52
#: ../lib/write.c:51
#, c-format
msgid "wrote %d byte"
msgid_plural "wrote %d bytes"
msgstr[0] ""
msgstr[1] ""
msgstr[0] "scríobh %d bheart"
msgstr[1] "scríobh %d bheart"
msgstr[2] "scríobh %d bheart"
msgstr[3] "scríobh %d mbeart"
msgstr[4] "scríobh %d beart"
#: src/daemon/gnuserv.c:460
#: ../src/daemon/gnuserv.c:455
msgid "Enable debugging"
msgstr ""
msgstr "Cumasaigh dífhabhtú"
#: src/daemon/gnuserv.c:460
msgid "DEBUG"
msgstr ""
#: src/daemon/gnuserv.c:462
#: ../src/daemon/gnuserv.c:457
msgid "Enable verbose output"
msgstr ""
msgstr "Cumasaigh aschur foclach"
#: src/daemon/gnuserv.c:462
msgid "VERBOSE"
msgstr ""
#: src/daemon/gnuserv.c:464
#: ../src/daemon/gnuserv.c:459
msgid "Don't fork into background"
msgstr ""
msgstr "Ná forc isteach sa chúlra"
#: src/daemon/gnuserv.c:464
msgid "NO-DAEMON"
msgstr ""
#: src/daemon/gnuserv.c:466
#: ../src/daemon/gnuserv.c:461
msgid "Invoked from inetd"
msgstr ""
msgstr "Glaodh ó inetd"
#: src/daemon/gnuserv.c:466
msgid "INETD"
msgstr ""
#: src/daemon/gnuserv.c:500
#: ../src/daemon/gnuserv.c:495
#, 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 ""
"Rith '%s --help' chun liosta iomlán roghanna líne na n-orduithe le fáil a "
"fheiceáil.\n"
#: sysdeps/osf1/siglist.c:28 sysdeps/sun4/siglist.c:28
#: ../sysdeps/osf1/siglist.c:27 ../sysdeps/sun4/siglist.c:27
msgid "Hangup"
msgstr ""
msgstr "Croch"
#: sysdeps/osf1/siglist.c:29 sysdeps/sun4/siglist.c:29
#: ../sysdeps/osf1/siglist.c:28 ../sysdeps/sun4/siglist.c:28
msgid "Interrupt"
msgstr "Idirbhrís"
msgstr "Idirbhriseadh"
#: sysdeps/osf1/siglist.c:30 sysdeps/sun4/siglist.c:30
#: ../sysdeps/osf1/siglist.c:29 ../sysdeps/sun4/siglist.c:29
msgid "Quit"
msgstr "Ealu"
msgstr "Scor"
#: sysdeps/osf1/siglist.c:31 sysdeps/sun4/siglist.c:31
#: ../sysdeps/osf1/siglist.c:30 ../sysdeps/sun4/siglist.c:30
msgid "Illegal instruction"
msgstr ""
msgstr "Treoir neamhcheadaithe"
#: sysdeps/osf1/siglist.c:32 sysdeps/sun4/siglist.c:32
#: ../sysdeps/osf1/siglist.c:31 ../sysdeps/sun4/siglist.c:31
msgid "Trace trap"
msgstr ""
msgstr "Gaiste loirg"
#: sysdeps/osf1/siglist.c:33 sysdeps/sun4/siglist.c:33
#: ../sysdeps/osf1/siglist.c:32 ../sysdeps/sun4/siglist.c:32
msgid "Abort"
msgstr ""
msgstr "Tobscor"
#: sysdeps/osf1/siglist.c:34 sysdeps/sun4/siglist.c:34
#: ../sysdeps/osf1/siglist.c:33 ../sysdeps/sun4/siglist.c:33
msgid "EMT error"
msgstr ""
msgstr "Earráid 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 ""
msgstr "Eisceacht snámhphointe"
#: sysdeps/osf1/siglist.c:36 sysdeps/sun4/siglist.c:36
#: ../sysdeps/osf1/siglist.c:35 ../sysdeps/sun4/siglist.c:35
msgid "Kill"
msgstr ""
msgstr "Marú"
#: sysdeps/osf1/siglist.c:37 sysdeps/sun4/siglist.c:37
#: ../sysdeps/osf1/siglist.c:36 ../sysdeps/sun4/siglist.c:36
msgid "Bus error"
msgstr "Earraidh Bus"
msgstr "Earráid bhus"
#: sysdeps/osf1/siglist.c:38 sysdeps/sun4/siglist.c:38
#: ../sysdeps/osf1/siglist.c:37 ../sysdeps/sun4/siglist.c:37
msgid "Segmentation violation"
msgstr ""
msgstr "Sárú deighilte"
#: 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 ""
msgstr "Drochargóint go glao córais"
#: sysdeps/osf1/siglist.c:40 sysdeps/sun4/siglist.c:40
#: ../sysdeps/osf1/siglist.c:39 ../sysdeps/sun4/siglist.c:39
msgid "Broken pipe"
msgstr "Píopa Briste"
msgstr "Píopa briste"
#: sysdeps/osf1/siglist.c:41 sysdeps/sun4/siglist.c:41
#: ../sysdeps/osf1/siglist.c:40 ../sysdeps/sun4/siglist.c:40
msgid "Alarm clock"
msgstr ""
msgstr "Clog aláraim"
#: sysdeps/osf1/siglist.c:42 sysdeps/sun4/siglist.c:42
#: ../sysdeps/osf1/siglist.c:41 ../sysdeps/sun4/siglist.c:41
msgid "Termination"
msgstr ""
msgstr "Críoch"
#: 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 ""
msgstr "Staid práinneach ar shoicéad"
#: sysdeps/osf1/siglist.c:44 sysdeps/sun4/siglist.c:44
#: ../sysdeps/osf1/siglist.c:43 ../sysdeps/sun4/siglist.c:43
msgid "Stop"
msgstr ""
msgstr "Stad"
#: sysdeps/osf1/siglist.c:45 sysdeps/sun4/siglist.c:45
#: ../sysdeps/osf1/siglist.c:44 ../sysdeps/sun4/siglist.c:44
msgid "Keyboard stop"
msgstr ""
msgstr "Stad méarchláir"
#: sysdeps/osf1/siglist.c:46 sysdeps/sun4/siglist.c:46
#: ../sysdeps/osf1/siglist.c:45 ../sysdeps/sun4/siglist.c:45
msgid "Continue"
msgstr ""
msgstr "Leanúint ar aghaidh"
#: 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 ""
msgstr "Athraíodh stádas mic"
#: 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 ""
msgstr "Léamh cúlrach ó 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 ""
msgstr "Scríobh cúlrach go 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 ""
msgstr "I/A indéanta anois"
#: 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 ""
msgstr "Imithe thar teorainn LAP"
#: 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 ""
msgstr "Imithe thar teorainn mhéid chomhaid"
#: 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 ""
msgstr "Clog aláraim fíorúil"
#: 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 ""
msgstr "Clog aláraim próifílithe"
#: 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 ""
msgstr "Athrú mhéid fhuinneoige"
#: sysdeps/osf1/siglist.c:56 sysdeps/sun4/siglist.c:56
#: ../sysdeps/osf1/siglist.c:55 ../sysdeps/sun4/siglist.c:55
msgid "Information request"
msgstr ""
msgstr "Iarratas eolais"
#: 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 ""
msgstr "Comhartha sainmhínithe ag an úsáideoir 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 ""
msgstr "Comhartha sainmhínithe ag an úsáideoir 2"

109
po/kn.po
View File

@@ -1,23 +1,21 @@
# translation of libgtop.HEAD.po to Kannada
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
#
# Shankar Prasad <svenkate@redhat.com>, 2009.
msgid ""
msgstr ""
"Project-Id-Version: libgtop.HEAD\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product="
"libgtop&component=general\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=libgtop&component=general\n"
"POT-Creation-Date: 2009-03-01 23:08+0000\n"
"PO-Revision-Date: 2009-03-14 10:31-0400\n"
"PO-Revision-Date: 2009-03-14 20:01+0530\n"
"Last-Translator: Shankar Prasad <svenkate@redhat.com>\n"
"Language-Team: Kannada <en@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: kn\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Zanata 3.2.3\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: KBabel 1.11.4\n"
#: ../lib/read.c:51
#, c-format
@@ -63,160 +61,129 @@ msgstr "inetd ಇಂದ ರದ್ದು ಮಾಡಲಾದ"
#: ../src/daemon/gnuserv.c:495
#, c-format
msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr ""
"ಲಭ್ಯವಿರುವ ಆಜ್ಞೆಯ ಒಂದು ಸಂಪೂರ್ಣ ಪಟ್ಟಿಯನ್ನು ನೋಡಲು '%s --help' ಅನ್ನು ಚಲಾಯಿಸಿ.\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 "I/O ಈಗ ಸಾಧ್ಯವಿದೆ"
#: ../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 "CPU ಮಿತಿಯನ್ನು ಮೀರಲಾಗಿದೆ"
#: ../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 "ಬಳಕೆದಾರ ಸೂಚಿತ ಸಂಕೇತ ೧"
#: ../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 "ಬಳಕೆದಾರ ಸೂಚಿತ ಸಂಕೇತ ೨"

View File

@@ -20,10 +20,10 @@ msgstr ""
#: ../lib/read.c:65
#, c-format
#msgid "read %d byte"
#msgid_plural "read %d bytes"
#msgstr[0] "%d байт окулду"
#msgstr[1] ""
msgid "read %d byte"
msgid_plural "read %d bytes"
msgstr[0] "%d байт окулду"
msgstr[1] ""
#: ../lib/read_data.c:53
msgid "read data size"
@@ -31,17 +31,17 @@ msgstr "окулган берилиштердин көлөмү"
#: ../lib/read_data.c:72
#, c-format
#msgid "read %lu byte of data"
#msgid_plural "read %lu bytes of data"
#msgstr[0] "%lu байт берилиш окулду"
#msgstr[1] ""
msgid "read %lu byte of data"
msgid_plural "read %lu bytes of data"
msgstr[0] "%lu байт берилиш окулду"
msgstr[1] ""
#: ../lib/write.c:52
#, c-format
#msgid "wrote %d byte"
#msgid_plural "wrote %d bytes"
#msgstr[0] "%d байт жазылды"
#msgstr[1] ""
msgid "wrote %d byte"
msgid_plural "wrote %d bytes"
msgstr[0] "%d байт жазылды"
msgstr[1] ""
#: ../src/daemon/gnuserv.c:460
msgid "Enable debugging"

189
po/mai.po Normal file
View File

@@ -0,0 +1,189 @@
# translation of libgtop.master.po to Maithili
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Sangeeta Kumari <sangeeta09@gmail.com>, 2009.
msgid ""
msgstr ""
"Project-Id-Version: libgtop.master\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=libgtop&component=general\n"
"POT-Creation-Date: 2009-09-02 16:38+0000\n"
"PO-Revision-Date: 2009-09-11 20:50+0530\n"
"Last-Translator: Sangeeta Kumari <sangeeta09@gmail.com>\n"
"Language-Team: Maithili <maithili.sf.net>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n!=1);\n\n"
"X-Generator: KBabel 1.11.4\n"
#: ../lib/read.c:51
#, c-format
msgid "read %d byte"
msgid_plural "read %d bytes"
msgstr[0] "%d बाइट पढ़ू"
msgstr[1] "%d बाइट पढ़ू"
#: ../lib/read_data.c:51
msgid "read data size"
msgstr "आंकड़ाक आकार पढ़ू"
#: ../lib/read_data.c:70
#, c-format
msgid "read %lu byte of data"
msgid_plural "read %lu bytes of data"
msgstr[0] "%lu आंकड़ाक बाइट पढ़ू"
msgstr[1] "%lu आंकड़ाक बाइट पढ़ू"
#: ../lib/write.c:51
#, c-format
msgid "wrote %d byte"
msgid_plural "wrote %d bytes"
msgstr[0] "%d बाइट लिखलक"
msgstr[1] "%d बाइट लिखलक"
#: ../src/daemon/gnuserv.c:455
msgid "Enable debugging"
msgstr "डिबगिंग सक्षम करू"
#: ../src/daemon/gnuserv.c:457
msgid "Enable verbose output"
msgstr "वर्बोज आउटपुट सक्षम करू"
#: ../src/daemon/gnuserv.c:459
msgid "Don't fork into background"
msgstr "पृष्ठभूमिमे फॉर्क नहि करू"
#: ../src/daemon/gnuserv.c:461
msgid "Invoked from inetd"
msgstr "inetd मारफत बोलाएल गेल"
#: ../src/daemon/gnuserv.c:495
#, c-format
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
msgid "Hangup"
msgstr "हैंगअप"
#: ../sysdeps/osf1/siglist.c:28 ../sysdeps/sun4/siglist.c:28
msgid "Interrupt"
msgstr "रूकाबट"
#: ../sysdeps/osf1/siglist.c:29 ../sysdeps/sun4/siglist.c:29
msgid "Quit"
msgstr "बाहर"
#: ../sysdeps/osf1/siglist.c:30 ../sysdeps/sun4/siglist.c:30
msgid "Illegal instruction"
msgstr "अबैध निर्देश"
#: ../sysdeps/osf1/siglist.c:31 ../sysdeps/sun4/siglist.c:31
msgid "Trace trap"
msgstr "ट्रेस ट्रैप"
#: ../sysdeps/osf1/siglist.c:32 ../sysdeps/sun4/siglist.c:32
msgid "Abort"
msgstr "छोड़ू"
#: ../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
msgid "Floating-point exception"
msgstr "फ्लोटिंग-पाइंट अपबाद"
#: ../sysdeps/osf1/siglist.c:35 ../sysdeps/sun4/siglist.c:35
msgid "Kill"
msgstr "मारू"
#: ../sysdeps/osf1/siglist.c:36 ../sysdeps/sun4/siglist.c:36
msgid "Bus error"
msgstr "बस त्रुटि"
#: ../sysdeps/osf1/siglist.c:37 ../sysdeps/sun4/siglist.c:37
msgid "Segmentation violation"
msgstr "सेगमेंटेशन अतिक्रमण"
#: ../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
msgid "Broken pipe"
msgstr "टूटल पाइप"
#: ../sysdeps/osf1/siglist.c:40 ../sysdeps/sun4/siglist.c:40
msgid "Alarm clock"
msgstr "अलार्म घड़ी"
#: ../sysdeps/osf1/siglist.c:41 ../sysdeps/sun4/siglist.c:41
msgid "Termination"
msgstr "समाप्त"
#: ../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
msgid "Stop"
msgstr "रोकू"
#: ../sysdeps/osf1/siglist.c:44 ../sysdeps/sun4/siglist.c:44
msgid "Keyboard stop"
msgstr "कीबोर्ड रोकू"
#: ../sysdeps/osf1/siglist.c:45 ../sysdeps/sun4/siglist.c:45
msgid "Continue"
msgstr "जारी राखू"
#: ../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
msgid "Background read from tty"
msgstr "टीटीवाइ सँ पढ़बाक काज पृष्ठभूमिमे करू"
#: ../sysdeps/osf1/siglist.c:48 ../sysdeps/sun4/siglist.c:48
msgid "Background write to tty"
msgstr "टीटीवाइ पर लिखबाक काज पृष्ठभूमिमे करू"
#: ../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
msgid "CPU limit exceeded"
msgstr "सीपीयू सीमा सँ बाहर पहुँच गेल"
#: ../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
msgid "Virtual alarm clock"
msgstr "आभासी अलार्म घड़ी"
#: ../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
msgid "Window size change"
msgstr "विंडो आकार परिवर्तन"
#: ../sysdeps/osf1/siglist.c:55 ../sysdeps/sun4/siglist.c:55
msgid "Information request"
msgstr "जानकारी निवेदन"
#: ../sysdeps/osf1/siglist.c:56 ../sysdeps/sun4/siglist.c:56
msgid "User defined signal 1"
msgstr "प्रयोक्ता परिभाषित संकेत १"
#: ../sysdeps/osf1/siglist.c:57 ../sysdeps/sun4/siglist.c:57
msgid "User defined signal 2"
msgstr "प्रयोक्ता परिभाषित संकेत २"

126
po/ml.po
View File

@@ -1,4 +1,4 @@
# translation of libgtop.HEAD.ml.po to Malayalam
# translation of libgtop.master.ml.po to
# This file is distributed under the same license as the PACKAGE package.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER.
# FSF-India <locale@gnu.org.in>, 2003.
@@ -6,205 +6,189 @@
#
msgid ""
msgstr ""
"Project-Id-Version: libgtop.HEAD.ml\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-08-04 16:32+0200\n"
"PO-Revision-Date: 2006-08-05 01:18+0530\n"
"Last-Translator: Ani Peter <apeter@redhat.com>\n"
"Language-Team: Malayalam\n"
"Project-Id-Version: libgtop.master.ml\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=libgtop&component=general\n"
"POT-Creation-Date: 2009-04-17 10:17+0000\n"
"PO-Revision-Date: 2009-09-12 20:37+0530\n"
"Last-Translator: \n"
"Language-Team: <en@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.9.1\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n\n"
"X-Generator: KBabel 1.11.4\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"\n"
#: ../lib/read.c:65
#: ../lib/read.c:51
#, c-format
msgid "read %d byte"
msgid_plural "read %d bytes"
msgstr[0] "%d ബൈറ്റ് വായിക്കുക"
msgstr[1] "%d ബൈറ്റ്സ് വായിക്കുക"
#: ../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 ബൈറ്റ് ഡേറ്റാ വായിക്കുക"
msgstr[1] "%lu ബൈറ്റ്സ് ഡേറ്റാ വായിക്കുക"
#: ../lib/write.c:53
#: ../lib/write.c:51
#, c-format
msgid "wrote %d byte"
msgid_plural "wrote %d bytes"
msgstr[0] "%d ബൈറ്റ് എഴുതി"
msgstr[1] "%d ബൈറ്റ്സ് എഴുതി"
#: ../src/daemon/gnuserv.c:460
#: ../src/daemon/gnuserv.c:455
msgid "Enable debugging"
msgstr "ഡീബഗ്ഗിങ് പ്രവര്‍ത്തന സജ്ജമാക്കുക"
#: ../src/daemon/gnuserv.c:460
msgid "DEBUG"
msgstr "ഡീബഗ്"
#: ../src/daemon/gnuserv.c:462
#: ../src/daemon/gnuserv.c:457
msgid "Enable verbose output"
msgstr "വര്‍ബറോസ് ഔട്ട് പുട്ട് പ്രവര്‍ത്തന സജ്ജമാക്കുക"
#: ../src/daemon/gnuserv.c:462
msgid "VERBOSE"
msgstr "വര്‍ബറോസ്"
#: ../src/daemon/gnuserv.c:464
#: ../src/daemon/gnuserv.c:459
msgid "Don't fork into background"
msgstr "പശ്ചാത്തലത്തിലേക്ക് fork ചെയ്യുവാന്‍ പാടില്ല"
#: ../src/daemon/gnuserv.c:464
msgid "NO-DAEMON"
msgstr "ഡെമണ്‍ ഇല്ല"
#: ../src/daemon/gnuserv.c:466
#: ../src/daemon/gnuserv.c:461
msgid "Invoked from inetd"
msgstr "inetd-ല്‍ നിന്നുമുളള വിളി"
#: ../src/daemon/gnuserv.c:466
msgid "INETD"
msgstr "INETD"
#: ../src/daemon/gnuserv.c:500
#: ../src/daemon/gnuserv.c:495
#, c-format
msgid ""
"Error on option %s: %s.\n"
"Run '%s --help' to see a full list of available command line options.\n"
msgstr ""
"ഉപാധി %s-ല്‍ പിഴവ്: %s.\n"
"ലഭ്യമായ കമാന്‍ഡ് ലൈന്‍ ഉപാധികളുടെ മുഴുവന്‍ പട്ടികയ്ക്ക് '%s --help' പ്രവര്‍ത്തിപ്പിക്കുക.\n"
#| 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 --help' പ്രവര്‍ത്തിപ്പിക്കുക.\n"
#: ../sysdeps/osf1/siglist.c:29 ../sysdeps/sun4/siglist.c:29
#: ../sysdeps/osf1/siglist.c:27 ../sysdeps/sun4/siglist.c:27
msgid "Hangup"
msgstr "അവസാനിപ്പിക്കുക"
#: ../sysdeps/osf1/siglist.c:30 ../sysdeps/sun4/siglist.c:30
#: ../sysdeps/osf1/siglist.c:28 ../sysdeps/sun4/siglist.c:28
msgid "Interrupt"
msgstr "ഇന്‍ററപ്റ്റ്"
#: ../sysdeps/osf1/siglist.c:31 ../sysdeps/sun4/siglist.c:31
#: ../sysdeps/osf1/siglist.c:29 ../sysdeps/sun4/siglist.c:29
msgid "Quit"
msgstr "പുറത്ത് കടക്കുക"
#: ../sysdeps/osf1/siglist.c:32 ../sysdeps/sun4/siglist.c:32
#: ../sysdeps/osf1/siglist.c:30 ../sysdeps/sun4/siglist.c:30
msgid "Illegal instruction"
msgstr "തെറ്റായ നിര്‍ദ്ദേശം"
#: ../sysdeps/osf1/siglist.c:33 ../sysdeps/sun4/siglist.c:33
#: ../sysdeps/osf1/siglist.c:31 ../sysdeps/sun4/siglist.c:31
msgid "Trace trap"
msgstr "തടസ്സം കണ്ടുപിടിക്കുക"
#: ../sysdeps/osf1/siglist.c:34 ../sysdeps/sun4/siglist.c:34
#: ../sysdeps/osf1/siglist.c:32 ../sysdeps/sun4/siglist.c:32
msgid "Abort"
msgstr "നിര്‍ത്തലാക്കുക"
#: ../sysdeps/osf1/siglist.c:35 ../sysdeps/sun4/siglist.c:35
#: ../sysdeps/osf1/siglist.c:33 ../sysdeps/sun4/siglist.c:33
msgid "EMT error"
msgstr "EMT പിശക്"
#: ../sysdeps/osf1/siglist.c:36 ../sysdeps/sun4/siglist.c:36
#: ../sysdeps/osf1/siglist.c:34 ../sysdeps/sun4/siglist.c:34
msgid "Floating-point exception"
msgstr "ഫ്ളോട്ടിങ്-പോയിന്‍റ് എക്സെപ്ഷന്‍"
#: ../sysdeps/osf1/siglist.c:37 ../sysdeps/sun4/siglist.c:37
#: ../sysdeps/osf1/siglist.c:35 ../sysdeps/sun4/siglist.c:35
msgid "Kill"
msgstr "അവസാനിപ്പിക്കുക"
#: ../sysdeps/osf1/siglist.c:38 ../sysdeps/sun4/siglist.c:38
#: ../sysdeps/osf1/siglist.c:36 ../sysdeps/sun4/siglist.c:36
msgid "Bus error"
msgstr "ബസില്‍ പിശക്"
#: ../sysdeps/osf1/siglist.c:39 ../sysdeps/sun4/siglist.c:39
#: ../sysdeps/osf1/siglist.c:37 ../sysdeps/sun4/siglist.c:37
msgid "Segmentation violation"
msgstr "സെഗ്മന്‍റേഷനില്‍ തെറ്റ്"
#: ../sysdeps/osf1/siglist.c:40 ../sysdeps/sun4/siglist.c:40
#: ../sysdeps/osf1/siglist.c:38 ../sysdeps/sun4/siglist.c:38
msgid "Bad argument to system call"
msgstr "സിസ്റ്റം കോളിലേക്ക് തെറ്റായ ആര്‍ഗ്യുമെന്‍റ്"
#: ../sysdeps/osf1/siglist.c:41 ../sysdeps/sun4/siglist.c:41
#: ../sysdeps/osf1/siglist.c:39 ../sysdeps/sun4/siglist.c:39
msgid "Broken pipe"
msgstr "പൊട്ടിയ പൈപ്പ്"
#: ../sysdeps/osf1/siglist.c:42 ../sysdeps/sun4/siglist.c:42
#: ../sysdeps/osf1/siglist.c:40 ../sysdeps/sun4/siglist.c:40
msgid "Alarm clock"
msgstr "അലാറം ക്ളോക്ക്"
#: ../sysdeps/osf1/siglist.c:43 ../sysdeps/sun4/siglist.c:43
#: ../sysdeps/osf1/siglist.c:41 ../sysdeps/sun4/siglist.c:41
msgid "Termination"
msgstr "അവസാനിപ്പിക്കല്‍"
#: ../sysdeps/osf1/siglist.c:44 ../sysdeps/sun4/siglist.c:44
#: ../sysdeps/osf1/siglist.c:42 ../sysdeps/sun4/siglist.c:42
msgid "Urgent condition on socket"
msgstr "സോക്കന്‍റില്‍ ഗുരുതരമായ അവസ്ഥ"
#: ../sysdeps/osf1/siglist.c:45 ../sysdeps/sun4/siglist.c:45
#: ../sysdeps/osf1/siglist.c:43 ../sysdeps/sun4/siglist.c:43
msgid "Stop"
msgstr "നിര്‍ത്തുക"
#: ../sysdeps/osf1/siglist.c:46 ../sysdeps/sun4/siglist.c:46
#: ../sysdeps/osf1/siglist.c:44 ../sysdeps/sun4/siglist.c:44
msgid "Keyboard stop"
msgstr "കീബോര്‍ഡ് നിര്‍ത്തുക"
#: ../sysdeps/osf1/siglist.c:47 ../sysdeps/sun4/siglist.c:47
#: ../sysdeps/osf1/siglist.c:45 ../sysdeps/sun4/siglist.c:45
msgid "Continue"
msgstr "തുടരുക"
#: ../sysdeps/osf1/siglist.c:48 ../sysdeps/sun4/siglist.c:48
#: ../sysdeps/osf1/siglist.c:46 ../sysdeps/sun4/siglist.c:46
msgid "Child status has changed"
msgstr "ചൈള്‍ഡിന്‍റെ അവസ്ഥ മാറിയിരിക്കുന്നു"
#: ../sysdeps/osf1/siglist.c:49 ../sysdeps/sun4/siglist.c:49
#: ../sysdeps/osf1/siglist.c:47 ../sysdeps/sun4/siglist.c:47
msgid "Background read from tty"
msgstr "tty-ല്‍ നിന്നും പശ്ചാത്തലം വായിക്കുക"
#: ../sysdeps/osf1/siglist.c:50 ../sysdeps/sun4/siglist.c:50
#: ../sysdeps/osf1/siglist.c:48 ../sysdeps/sun4/siglist.c:48
msgid "Background write to tty"
msgstr "tty-ലേക്ക് പശ്ചാത്തലം എഴുതുക"
#: ../sysdeps/osf1/siglist.c:51 ../sysdeps/sun4/siglist.c:51
#: ../sysdeps/osf1/siglist.c:49 ../sysdeps/sun4/siglist.c:49
msgid "I/O now possible"
msgstr "I/O ഇപ്പോള്‍ സാധ്യമാണ്"
#: ../sysdeps/osf1/siglist.c:52 ../sysdeps/sun4/siglist.c:52
#: ../sysdeps/osf1/siglist.c:50 ../sysdeps/sun4/siglist.c:50
msgid "CPU limit exceeded"
msgstr "CPU പരിമിധി കവിഞ്ഞു"
#: ../sysdeps/osf1/siglist.c:53 ../sysdeps/sun4/siglist.c:53
#: ../sysdeps/osf1/siglist.c:51 ../sysdeps/sun4/siglist.c:51
msgid "File size limit exceeded"
msgstr "ഫയലിന്‍റെ വലിപ്പ പരിമിധി കവിഞ്ഞു"
#: ../sysdeps/osf1/siglist.c:54 ../sysdeps/sun4/siglist.c:54
#: ../sysdeps/osf1/siglist.c:52 ../sysdeps/sun4/siglist.c:52
msgid "Virtual alarm clock"
msgstr "വിര്‍ച്ച്വല്‍ അലാറം ക്ളോക്ക്"
#: ../sysdeps/osf1/siglist.c:55 ../sysdeps/sun4/siglist.c:55
#: ../sysdeps/osf1/siglist.c:53 ../sysdeps/sun4/siglist.c:53
msgid "Profiling alarm clock"
msgstr "അലാറം ക്ളോക്ക് പ്രൊഫൈല്‍ ചെയ്യുന്നു"
#: ../sysdeps/osf1/siglist.c:56 ../sysdeps/sun4/siglist.c:56
#: ../sysdeps/osf1/siglist.c:54 ../sysdeps/sun4/siglist.c:54
msgid "Window size change"
msgstr "ജീലകത്തിന്‍റെ വലിപ്പത്തലുളള മാറ്റം"
#: ../sysdeps/osf1/siglist.c:57 ../sysdeps/sun4/siglist.c:57
#: ../sysdeps/osf1/siglist.c:55 ../sysdeps/sun4/siglist.c:55
msgid "Information request"
msgstr "വിവരങ്ങള്‍ക്കായുളള അഭ്യര്‍ത്ഥന"
#: ../sysdeps/osf1/siglist.c:58 ../sysdeps/sun4/siglist.c:58
#: ../sysdeps/osf1/siglist.c:56 ../sysdeps/sun4/siglist.c:56
msgid "User defined signal 1"
msgstr "യൂസര്‍ ഡിഫൈന്‍ഡ് സിഗ്നല്‍ 1"
#: ../sysdeps/osf1/siglist.c:59 ../sysdeps/sun4/siglist.c:59
#: ../sysdeps/osf1/siglist.c:57 ../sysdeps/sun4/siglist.c:57
msgid "User defined signal 2"
msgstr "യൂസര്‍ ഡിഫൈന്‍ഡ് സിഗ്നല്‍ 2"

View File

@@ -34,8 +34,8 @@ msgstr "lesestorleik på data"
#, c-format
msgid "read %lu byte of data"
msgid_plural "read %lu bytes of data"
msgstr[0] "las %lu byte data"
msgstr[1] "las %lu byte data"
msgstr[0] "las %d byte data"
msgstr[1] "las %d byte data"
#: ../lib/write.c:51
#, c-format

View File

@@ -12,7 +12,7 @@ msgstr ""
"POT-Creation-Date: 2007-07-21 14:34-0300\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"
"Language-Team: Brazilian Portuguese <gnome-pt_br-list@gnome.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

View File

@@ -1,13 +1,13 @@
# Romanian translation for libgtop
# Copyright (C) 2003 - 2008, Free Software Foundation, Inc.
# Mișu Moldovan <dumol@gnome.ro>, 2003 - 2008.
# Copyright (C) 2003 - 2009, Free Software Foundation, Inc.
# Mișu Moldovan <dumol@gnome.ro>, 2003 - 2009.
#
msgid ""
msgstr ""
"Project-Id-Version: libgtop\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-09-13 08:49+0100\n"
"PO-Revision-Date: 2008-09-18 22:36+0300\n"
"PO-Revision-Date: 2009-09-20 00:44+0300\n"
"Last-Translator: Mișu Moldovan <dumol@gnome.ro>\n"
"Language-Team: Romanian <gnomero-list@lists.sourceforge.net>\n"
"MIME-Version: 1.0\n"
@@ -26,7 +26,7 @@ msgstr[2] "s-au citit %d de octeți"
#: ../lib/read_data.c:51
msgid "read data size"
msgstr "mărime date citire"
msgstr "mărime date citite"
#: ../lib/read_data.c:70
#, c-format
@@ -46,7 +46,7 @@ msgstr[2] "s-au scris %d de octeți"
#: ../src/daemon/gnuserv.c:458
msgid "Enable debugging"
msgstr "Activare depanare"
msgstr "Activează depanarea"
#: ../src/daemon/gnuserv.c:460
msgid "Enable verbose output"

View File

@@ -1,4 +1,4 @@
# translation of libgtop.gnome-2-26.te.po to Telugu
# translation of libgtop.master.te.po to Telugu
# Telugu translation of libgtop
# This file is distributed under the same license as the libgtop package.
# Copyright (C) Sree Ganesh <mrthottempudi@yahoo.com>, 2006.
@@ -6,10 +6,10 @@
# Krishna Babu K <kkrothap@redhat.com>, 2009.
msgid ""
msgstr ""
"Project-Id-Version: libgtop.gnome-2-26.te\n"
"Project-Id-Version: libgtop.master.te\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=libgtop&component=general\n"
"POT-Creation-Date: 2009-04-18 19:52+0000\n"
"PO-Revision-Date: 2009-05-15 17:15+0530\n"
"POT-Creation-Date: 2009-09-12 15:13+0000\n"
"PO-Revision-Date: 2009-09-17 19:09+0530\n"
"Last-Translator: Krishna Babu K <kkrothap@redhat.com>\n"
"Language-Team: Telugu <en@li.org>\n"
"MIME-Version: 1.0\n"
@@ -65,7 +65,7 @@ msgstr "ఇన్ఎటిదడ్ నుండీ లే"
#| "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 --help' నడుపండి.\n"
msgstr "అందుబాటులోవున్న ఆదేశ వరుస ఐచ్చికముల పూర్తి జాబితాను చూడుటకు '%s --help' నడుపుము.\n"
#: ../sysdeps/osf1/siglist.c:27 ../sysdeps/sun4/siglist.c:27
msgid "Hangup"
@@ -85,11 +85,11 @@ msgstr "చట్టవ్యతిరేక నిర్దేశాలు"
#: ../sysdeps/osf1/siglist.c:31 ../sysdeps/sun4/siglist.c:31
msgid "Trace trap"
msgstr "ట్రాప్ జాడపట్టుము"
msgstr "ట్రేస్ ట్రాప్"
#: ../sysdeps/osf1/siglist.c:32 ../sysdeps/sun4/siglist.c:32
msgid "Abort"
msgstr "నిలిపివేయి"
msgstr "విరమింపచేయి"
#: ../sysdeps/osf1/siglist.c:33 ../sysdeps/sun4/siglist.c:33
msgid "EMT error"

View File

@@ -2,4 +2,4 @@
SUBDIRS = common @sysdeps_dir@
DIST_SUBDIRS = bsd common linux osf1 \
stub stub_suid sun4 freebsd solaris aix darwin
stub stub_suid sun4 freebsd solaris aix darwin cygwin

View File

@@ -0,0 +1,18 @@
INCLUDES = @INCLUDES@
noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la
libgtop_sysdeps_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
uptime.c loadavg.c shm_limits.c msg_limits.c \
sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c procargs.c procmap.c siglist.c \
sysinfo.c netload.c ppp.c glibtop_private.c \
netlist.c procaffinity.c procopenfiles.c procwd.c
libgtop_sysdeps_2_0_la_LIBADD = @GLIB_LIBS@
libgtopinclude_HEADERS = glibtop_server.h glibtop_machine.h
libgtopincludedir = $(includedir)/libgtop-2.0
noinst_HEADERS = glibtop_private.h

29
sysdeps/cygwin/close.c Normal file
View File

@@ -0,0 +1,29 @@
/* 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/close.h>
/* Closes pipe to gtop server. */
void
glibtop_close_s (glibtop *server)
{ }

103
sysdeps/cygwin/cpu.c Normal file
View File

@@ -0,0 +1,103 @@
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <glibtop/error.h>
#include <glibtop/cpu.h>
#include "glibtop_private.h"
static const unsigned long _glibtop_sysdeps_cpu =
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
(1L << GLIBTOP_CPU_NICE) + (1L << GLIBTOP_CPU_SYS) +
(1L << GLIBTOP_CPU_IDLE) + (1L << GLIBTOP_CPU_FREQUENCY);
static const unsigned long _glibtop_sysdeps_cpu_smp =
(1L << GLIBTOP_XCPU_TOTAL) + (1L << GLIBTOP_XCPU_USER) +
(1L << GLIBTOP_XCPU_NICE) + (1L << GLIBTOP_XCPU_SYS) +
(1L << GLIBTOP_XCPU_IDLE);
/* Init function. */
void
_glibtop_init_cpu_s (glibtop *server)
{
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
if (server->ncpu)
server->sysdeps.cpu |= _glibtop_sysdeps_cpu_smp;
}
/* Provides information about cpu usage. */
#define FILENAME "/proc/stat"
void
glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
{
char buffer [BUFSIZ], *p;
int i;
memset (buf, 0, sizeof (glibtop_cpu));
file_to_buffer(server, buffer, sizeof buffer, FILENAME);
/*
* GLOBAL
*/
p = skip_token (buffer); /* "cpu" */
buf->user = strtoull (p, &p, 0);
buf->nice = strtoull (p, &p, 0);
buf->sys = strtoull (p, &p, 0);
buf->idle = strtoull (p, &p, 0);
buf->total = buf->user + buf->nice + buf->sys + buf->idle;
buf->frequency = 100;
buf->flags = _glibtop_sysdeps_cpu;
/*
* PER CPU
*/
for (i = 0; i <= server->ncpu; i++) {
p = skip_line(p); /* move to ^ */
if (!check_cpu_line_warn(server, p, i))
break;
p = skip_token(p); /* "cpuN" */
buf->xcpu_user [i] = strtoull (p, &p, 0);
buf->xcpu_nice [i] = strtoull (p, &p, 0);
buf->xcpu_sys [i] = strtoull (p, &p, 0);
buf->xcpu_idle [i] = strtoull (p, &p, 0);
buf->xcpu_total[i] = buf->xcpu_user [i] \
+ buf->xcpu_nice [i] \
+ buf->xcpu_sys [i] \
+ buf->xcpu_idle [i];
}
if(server->ncpu) /* ok, that's a real SMP */
buf->flags |= _glibtop_sysdeps_cpu_smp;
}

View File

@@ -0,0 +1,44 @@
/* 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_MACHINE_H__
#define __GLIBTOP_MACHINE_H__
#include <unistd.h>
#include <fcntl.h>
#include <ctype.h>
G_BEGIN_DECLS
typedef struct _glibtop_machine glibtop_machine;
struct _glibtop_machine
{
pid_t last_pid;
int no_update;
int fd_stat, fd_meminfo, fd_loadavg;
char proc_stat [BUFSIZ], proc_statm [BUFSIZ];
char proc_status [BUFSIZ];
};
G_END_DECLS
#endif

View File

@@ -0,0 +1,221 @@
#include <config.h>
#include <glibtop.h>
#include <glibtop/error.h>
#include "glibtop_private.h"
#include <glib.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <fcntl.h>
#include <unistd.h>
unsigned long long
get_scaled(const char *buffer, const char *key)
{
const char *ptr = buffer;
char *next;
unsigned long long value;
if (key) {
if (G_LIKELY((ptr = strstr(buffer, key))))
ptr += strlen(key);
else {
g_warning("Could not read key '%s' in buffer '%s'",
key, buffer);
return 0;
}
}
value = strtoull(ptr, &next, 0);
for ( ; *next; ++next) {
if (*next == 'k') {
value *= 1024;
break;
} else if (*next == 'M') {
value *= 1024 * 1024;
break;
}
}
return value;
}
char *
skip_token (const char *p)
{
p = next_token(p);
while (*p && !isspace(*p)) p++;
p = next_token(p);
return (char *)p;
}
/*
* Read functions
*/
enum TRY_FILE_TO_BUFFER
{
TRY_FILE_TO_BUFFER_OK = 0,
TRY_FILE_TO_BUFFER_OPEN = -1,
TRY_FILE_TO_BUFFER_READ = -2
};
/*
* Doesn't handle bufsiz == 0
*/
int try_file_to_buffer(char *buffer, size_t bufsiz, const char *format, ...)
{
char path[4096];
int fd;
size_t len = 0;
ssize_t nread = 0;
va_list pa;
if (G_UNLIKELY(bufsiz <= sizeof(char*)))
g_warning("Huhu, bufsiz of %lu looks bad", (gulong)bufsiz);
va_start(pa, format);
/* C99 also provides vsnprintf */
g_vsnprintf(path, sizeof path, format, pa);
va_end(pa);
bufsiz--; /* reserve 1 for trailing NUL */
buffer [0] = '\0';
if((fd = open (path, O_RDONLY)) < 0)
return TRY_FILE_TO_BUFFER_OPEN;
while (len < bufsiz) {
nread = read (fd, buffer + len, bufsiz - len);
if (G_UNLIKELY(nread < 0)) {
if (errno == EINTR)
continue;
else
break;
}
len += nread;
if (nread == 0)
break;
}
close (fd);
if (nread < 0)
return TRY_FILE_TO_BUFFER_READ;
buffer [len] = '\0';
return TRY_FILE_TO_BUFFER_OK;
}
void
file_to_buffer(glibtop *server, char *buffer, size_t bufsiz, const char *filename)
{
switch(try_file_to_buffer(buffer, bufsiz, filename))
{
case TRY_FILE_TO_BUFFER_OPEN:
glibtop_error_io_r (server, "open (%s)", filename);
case TRY_FILE_TO_BUFFER_READ:
glibtop_error_io_r (server, "read (%s)", filename);
}
}
static unsigned long
read_boot_time(glibtop *server)
{
char* line = NULL;
size_t size = 0;
FILE* stat;
unsigned long btime = 0;
if (!(stat = fopen("/proc/stat", "r"))) {
glibtop_error_io_r(server, "fopen(\"/proc/stat\")");
goto out;
}
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;
}
unsigned long
get_boot_time(glibtop *server)
{
static unsigned long boot_time = 0UL;
if(G_UNLIKELY(!boot_time))
{
boot_time = read_boot_time(server);
}
return boot_time;
}
size_t
get_page_size(void)
{
static size_t pagesize = 0;
if(G_UNLIKELY(!pagesize))
{
pagesize = getpagesize();
}
return pagesize;
}
gboolean
check_cpu_line(glibtop *server, const char *line, unsigned i)
{
char start[10];
g_snprintf(start, sizeof start, "cpu%u", i);
return g_str_has_prefix(line, start);
}
gboolean safe_readlink(const char *path, char *buf, size_t bufsiz)
{
ssize_t ret;
ret = readlink(path, buf, bufsiz - 1);
if (ret == -1) {
g_warning("Could not read link %s : %s", path, strerror(errno));
return FALSE;
}
buf[ret] = '\0';
return TRUE;
}

View File

@@ -0,0 +1,152 @@
/* Copyright (C) 2004 Benoît Dejean
This file is part of LibGTop 2.0.
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 __CYGWIN__GLIBTOP_PRIVATE_H__
#define __CYGWIN__GLIBTOP_PRIVATE_H__
#include <glibtop.h>
#include <glibtop/error.h>
#include <glib.h>
#include <fcntl.h>
#include <ctype.h>
#include <string.h>
G_BEGIN_DECLS
static inline char*
next_token(const char *p)
{
while (isspace(*p)) p++;
return (char*) p;
}
char *
skip_token (const char *p);
static inline char *
skip_multiple_token (const char *p, size_t count)
{
while(count--)
p = skip_token (p);
return (char *)p;
}
static inline char *
skip_line (const char *p)
{
while (*p && *p != '\n') 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);
/* aborts on error */
void
file_to_buffer(glibtop *server, char *buffer, size_t bufsiz, const char *filename);
/* return < 0 on error, otherwise 0 on success */
int
try_file_to_buffer(char *buffer, size_t bufsiz, const char *format, ...) G_GNUC_PRINTF(3, 4);
/* some inline functions that wrap proc path
* as fast as macros :)
*/
static inline int
proc_file_to_buffer (char *buffer, size_t bufsiz, const char *fmt, pid_t pid)
{
return try_file_to_buffer(buffer, bufsiz, fmt, pid);
}
static inline int
proc_stat_to_buffer (char *buffer, size_t bufsiz, pid_t pid)
{
return proc_file_to_buffer(buffer, bufsiz, "/proc/%d/stat", pid);
}
static inline int
proc_status_to_buffer (char *buffer, size_t bufsiz, pid_t pid)
{
return proc_file_to_buffer(buffer, bufsiz, "/proc/%d/status", pid);
}
static inline int
proc_statm_to_buffer (char *buffer, size_t bufsiz, pid_t pid)
{
return proc_file_to_buffer(buffer, bufsiz, "/proc/%d/statm", pid);
}
static inline char *
proc_stat_after_cmd (char *p)
{
p = strrchr (p, ')');
if (G_LIKELY(p))
*p++ = '\0';
return p;
}
unsigned long
get_boot_time(glibtop *server);
size_t
get_page_size(void);
gboolean
check_cpu_line(glibtop *server, const char *line, unsigned n);
static inline gboolean
check_cpu_line_warn(glibtop *server, const char *line, unsigned i)
{
gboolean ret;
ret = check_cpu_line(server, line, i);
if (G_UNLIKELY(!ret))
glibtop_warn_io_r(server,
"'%s' does not start with 'cpu%u'",
line, i);
return ret;
}
gboolean safe_readlink(const char *path, char *buf, size_t bufsiz);
G_END_DECLS
#endif /* __CYGWIN__GLIBTOP_PRIVATE_H__ */

View File

@@ -0,0 +1,50 @@
/* 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 __CYGWIN__GLIBTOP_SERVER_H__
#define __CYGWIN__GLIBTOP_SERVER_H__
#define GLIBTOP_SUID_CPU 0
#define GLIBTOP_SUID_MEM 0
#define GLIBTOP_SUID_SWAP 0
#define GLIBTOP_SUID_UPTIME 0
#define GLIBTOP_SUID_LOADAVG 0
#define GLIBTOP_SUID_SHM_LIMITS 0
#define GLIBTOP_SUID_MSG_LIMITS 0
#define GLIBTOP_SUID_SEM_LIMITS 0
#define GLIBTOP_SUID_PROCLIST 0
#define GLIBTOP_SUID_PROC_STATE 0
#define GLIBTOP_SUID_PROC_UID 0
#define GLIBTOP_SUID_PROC_MEM 0
#define GLIBTOP_SUID_PROC_TIME 0
#define GLIBTOP_SUID_PROC_SIGNAL 0
#define GLIBTOP_SUID_PROC_KERNEL 0
#define GLIBTOP_SUID_PROC_SEGMENT 0
#define GLIBTOP_SUID_PROC_ARGS 0
#define GLIBTOP_SUID_PROC_MAP 0
#define GLIBTOP_SUID_NETLOAD 0
#define GLIBTOP_SUID_NETLIST 0
#define GLIBTOP_SUID_PROC_AFFINITY 0
#define GLIBTOP_SUID_PROC_WD 0
#define GLIBTOP_SUID_PPP 0
#define GLIBTOP_SUID_PROC_FILE 0
#endif /* __CYGWIN__GLIBTOP_SERVER_H__ */

81
sysdeps/cygwin/loadavg.c Normal file
View File

@@ -0,0 +1,81 @@
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <glibtop/error.h>
#include <glibtop/loadavg.h>
#include "glibtop_private.h"
static const unsigned long _glibtop_sysdeps_loadavg =
(1L << GLIBTOP_LOADAVG_LOADAVG);
static const unsigned long _glibtop_sysdeps_loadavg_tasks =
(1L << GLIBTOP_LOADAVG_NR_RUNNING) +
(1L << GLIBTOP_LOADAVG_NR_TASKS) +
(1L << GLIBTOP_LOADAVG_LAST_PID);
/* Init function. */
void
_glibtop_init_loadavg_s (glibtop *server)
{
server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
}
/* Provides load load averange. */
#define FILENAME "/proc/loadavg"
void
glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf)
{
char buffer [BUFSIZ], *p, *old;
memset (buf, 0, sizeof (glibtop_loadavg));
file_to_buffer(server, buffer, sizeof buffer, FILENAME);
buf->loadavg [0] = g_ascii_strtod (buffer, &p);
buf->loadavg [1] = g_ascii_strtod (p, &p);
buf->loadavg [2] = g_ascii_strtod (p, &p);
buf->flags = _glibtop_sysdeps_loadavg;
p = next_token(p);
/* Older Linux versions don't have the nr_running/nr_tasks fields. */
old = p;
while (*p) {
if (*p == '/')
break;
if (!isdigit (*p))
return;
p++;
}
buf->nr_running = strtoull (old, &p, 0); p++;
buf->nr_tasks = strtoull (p, &p, 0);
buf->last_pid = strtoull (p, &p, 0);
buf->flags |= _glibtop_sysdeps_loadavg_tasks;
}

61
sysdeps/cygwin/mem.c Normal file
View File

@@ -0,0 +1,61 @@
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <glibtop/error.h>
#include <glibtop/mem.h>
#include "glibtop_private.h"
static const unsigned long _glibtop_sysdeps_mem =
(1L << GLIBTOP_MEM_TOTAL) + (1L << GLIBTOP_MEM_USED) +
(1L << GLIBTOP_MEM_FREE) + (1L << GLIBTOP_MEM_SHARED) +
(1L << GLIBTOP_MEM_USER);
/* Init function. */
void
_glibtop_init_mem_s (glibtop *server)
{
server->sysdeps.mem = _glibtop_sysdeps_mem;
}
/* Provides information about memory usage. */
#define FILENAME "/proc/meminfo"
void
glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
{
char buffer [BUFSIZ];
memset(buf, 0, sizeof *buf);
file_to_buffer(server, buffer, sizeof buffer, FILENAME);
buf->total = get_scaled(buffer, "MemTotal:");
buf->free = get_scaled(buffer, "MemFree:");
buf->used = buf->total - buf->free;
buf->shared = 0;
buf->user = buf->total - buf->free;
buf->flags = _glibtop_sysdeps_mem;
}

View File

@@ -0,0 +1,59 @@
/* 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/msg_limits.h>
#define _KERNEL
#include <sys/ipc.h>
#include <sys/msg.h>
static const unsigned long _glibtop_sysdeps_msg_limits =
(1L << GLIBTOP_IPC_MSGMAX) + (1L << GLIBTOP_IPC_MSGMNB) +
(1L << GLIBTOP_IPC_MSGMNI) + (1L << GLIBTOP_IPC_MSGSSZ) +
(1L << GLIBTOP_IPC_MSGTQL);
/* Init function. */
void
_glibtop_init_msg_limits_s (glibtop *server)
{
server->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits;
}
/* Provides information about sysv ipc limits. */
void
glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf)
{
struct msginfo msginfo;
memset (buf, 0, sizeof (glibtop_msg_limits));
msgctl (0, IPC_INFO, (void*) &msginfo);
buf->msgmax = msginfo.msgmax;
buf->msgmnb = msginfo.msgmnb;
buf->msgmni = msginfo.msgmni;
buf->msgssz = msginfo.msgssz;
buf->msgtql = msginfo.msgtql;
buf->flags = _glibtop_sysdeps_msg_limits;
}

39
sysdeps/cygwin/netlist.c Normal file
View File

@@ -0,0 +1,39 @@
/* This file is part of LibGTop 2.0.
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/netlist.h>
static const unsigned long _glibtop_sysdeps_netlist = 0;
/* Init function. */
void
_glibtop_init_netlist_s (glibtop *server)
{
server->sysdeps.netlist = _glibtop_sysdeps_netlist;
}
char**
glibtop_get_netlist_s (glibtop *server, glibtop_netlist *buf)
{
memset (buf, 0, sizeof (glibtop_netlist));
return NULL;
}

44
sysdeps/cygwin/netload.c Normal file
View File

@@ -0,0 +1,44 @@
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, October 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/netload.h>
static const unsigned long _glibtop_sysdeps_netload = 0;
/* Init function. */
void
_glibtop_init_netload_s (glibtop *server)
{
server->sysdeps.netload = _glibtop_sysdeps_netload;
}
/* Provides network statistics. */
void
glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
const char *interface)
{
memset (buf, 0, sizeof (glibtop_netload));
}

68
sysdeps/cygwin/open.c Normal file
View File

@@ -0,0 +1,68 @@
/* 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.h>
#include <glibtop/cpu.h>
#include <glibtop/open.h>
#include <glibtop/error.h>
#include "glibtop_private.h"
/* ======================================================= */
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
#define FILENAME "/proc/stat"
void
glibtop_open_s (glibtop *server, const char *program_name,
const unsigned long features,
const unsigned flags)
{
char buffer [BUFSIZ], *p = buffer;
server->name = program_name;
file_to_buffer(server, buffer, sizeof buffer, FILENAME);
p = skip_line(p); /* cpu */
for (server->real_ncpu = 0; /* nop */; server->real_ncpu++) {
if (!check_cpu_line(server, p, server->real_ncpu)) {
server->real_ncpu--;
break;
}
p = skip_line(p);
}
server->ncpu = MIN(GLIBTOP_NCPU - 1, server->real_ncpu);
if (server->real_ncpu != server->ncpu) {
glibtop_warn_r(server,
"This machine has %d CPUs, "
"%d are being monitored.",
server->real_ncpu + 1,
server->ncpu + 1);
}
}

43
sysdeps/cygwin/ppp.c Normal file
View File

@@ -0,0 +1,43 @@
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, October 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/ppp.h>
static const unsigned long _glibtop_sysdeps_ppp = 0;
/* Init function. */
void
_glibtop_init_ppp_s (glibtop *server)
{
server->sysdeps.ppp = _glibtop_sysdeps_ppp;
}
/* Provides PPP/ISDN information. */
void
glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device)
{
memset (buf, 0, sizeof (glibtop_ppp));
}

View File

@@ -0,0 +1,39 @@
/* This file is part of LibGTop 2.0.
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/procaffinity.h>
static const unsigned long _glibtop_sysdeps_proc_affinity = 0;
/* Init function. */
void
_glibtop_init_proc_affinity_s (glibtop *server)
{
server->sysdeps.proc_affinity = _glibtop_sysdeps_proc_affinity;
}
guint16*
glibtop_get_proc_affinity_s (glibtop *server, glibtop_proc_affinity *buf, pid_t pid)
{
memset (buf, 0, sizeof (glibtop_proc_affinity));
return NULL;
}

70
sysdeps/cygwin/procargs.c Normal file
View File

@@ -0,0 +1,70 @@
/* 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.h>
#include <glibtop/error.h>
#include <glibtop/procargs.h>
static const unsigned long _glibtop_sysdeps_proc_args =
(1L << GLIBTOP_PROC_ARGS_SIZE);
/* Init function. */
void
_glibtop_init_proc_args_s (glibtop *server)
{
server->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
}
/* Provides detailed information about a process. */
char *
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len)
{
char filename[48]; /* magiv */
char *args;
gsize length;
GError *error = NULL;
memset (buf, 0, sizeof (glibtop_proc_args));
sprintf (filename, "/proc/%d/cmdline", pid);
if(!g_file_get_contents(filename, &args, &length, &error)) {
g_error_free(error);
buf->size = 0;
return NULL;
}
if(max_len && max_len < length) {
args = g_realloc(args, max_len);
args[max_len - 1] = '\0';
length = max_len;
}
buf->size = length;
buf->flags = _glibtop_sysdeps_proc_args;
return args;
}

View File

@@ -0,0 +1,43 @@
/* 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.h>
#include <glibtop/prockernel.h>
static const unsigned long _glibtop_sysdeps_proc_kernel = 0;
/* Init function. */
void
_glibtop_init_proc_kernel_s (glibtop *server)
{
server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel;
}
/* Provides detailed information about a process. */
void
glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf,
pid_t pid)
{
memset (buf, 0, sizeof (glibtop_proc_kernel));
}

169
sysdeps/cygwin/proclist.c Normal file
View File

@@ -0,0 +1,169 @@
/* 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/proclist.h>
#include <glibtop/procuid.h>
#include <glibtop/procstate.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include <ctype.h>
static const unsigned long _glibtop_sysdeps_proclist =
(1L << GLIBTOP_PROCLIST_TOTAL) + (1L << GLIBTOP_PROCLIST_NUMBER) +
(1L << GLIBTOP_PROCLIST_SIZE);
/* Init function. */
void
_glibtop_init_proclist_s (glibtop *server)
{
server->sysdeps.proclist = _glibtop_sysdeps_proclist;
}
/* Fetch list of currently running processes.
*
* The interface of this function is a little bit different from the others:
* buf->flags is only set if the call succeeded, in this case pids_chain,
* a list of the pids of all currently running processes is returned,
* buf->number is the number of elements of this list and buf->size is
* the size of one single element (sizeof (unsigned)). The total size is
* stored in buf->total.
*
* The calling function has to free the memory to which a pointer is returned.
*
* On error, NULL is returned and buf->flags is zero. */
pid_t*
glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
gint64 which, gint64 arg)
{
DIR *proc;
struct dirent *entry;
GArray *pids;
glibtop_proc_uid procuid;
glibtop_proc_state procstate;
struct stat statb;
memset (buf, 0, sizeof (glibtop_proclist));
proc = opendir ("/proc");
if (!proc) return NULL;
if(fstat(dirfd(proc), &statb) != 0) return NULL;
pids = g_array_sized_new(FALSE, FALSE, sizeof(pid_t), statb.st_nlink);
/* read every every entry in /proc */
while((entry = readdir (proc))) {
pid_t pid;
if (entry->d_type != DT_DIR)
continue;
if (!(pid = strtoul(entry->d_name, NULL, 10)))
continue;
switch (which & GLIBTOP_KERN_PROC_MASK) {
case GLIBTOP_KERN_PROC_ALL:
break;
case GLIBTOP_KERN_PROC_PID:
if ((pid_t) arg != pid)
continue;
break;
case GLIBTOP_KERN_PROC_UID:
{
char path[32];
struct stat path_stat;
snprintf(path, sizeof path, "/proc/%u", (unsigned)pid);
if (stat(path, &path_stat))
continue;
if ((uid_t) arg != path_stat.st_uid)
continue;
}
break;
case GLIBTOP_KERN_PROC_PGRP:
/* Do you really, really need this ? */
glibtop_get_proc_uid_s (server, &procuid, pid);
if (procuid.flags & (1L << GLIBTOP_PROC_UID_PGRP))
if ((int) arg != procuid.pgrp)
continue;
break;
case GLIBTOP_KERN_PROC_SESSION:
/* Do you really, really need this ? */
glibtop_get_proc_uid_s (server, &procuid, pid);
if (procuid.flags & (1L << GLIBTOP_PROC_UID_SESSION))
if ((int) arg != procuid.session)
continue;
break;
case GLIBTOP_KERN_PROC_TTY:
/* Do you really, really need this ? */
glibtop_get_proc_uid_s (server, &procuid, pid);
if (procuid.flags & (1L << GLIBTOP_PROC_UID_TTY))
if ((int) arg != procuid.tty)
continue;
break;
case GLIBTOP_KERN_PROC_RUID:
/* Do you really, really need this ? */
glibtop_get_proc_uid_s (server, &procuid, pid);
if (procuid.flags & (1L << GLIBTOP_PROC_UID_EUID))
if ((int) arg != procuid.euid)
continue;
break;
}
if (which & GLIBTOP_EXCLUDE_NOTTY) {
glibtop_get_proc_uid_s (server, &procuid, pid);
if (procuid.flags & (1L << GLIBTOP_PROC_UID_TTY))
if (procuid.tty == -1) continue;
}
if (which & GLIBTOP_EXCLUDE_IDLE) {
glibtop_get_proc_state_s (server, &procstate, pid);
if (procstate.flags & (1L << GLIBTOP_PROC_STATE_STATE))
if (procstate.state != GLIBTOP_PROCESS_RUNNING) continue;
}
if (which & GLIBTOP_EXCLUDE_SYSTEM) {
glibtop_get_proc_uid_s (server, &procuid, pid);
if (procuid.flags & (1L << GLIBTOP_PROC_UID_UID))
if (procuid.uid == 0) continue;
}
g_array_append_val(pids, pid);
}
closedir (proc);
buf->flags = _glibtop_sysdeps_proclist;
buf->size = sizeof(pid_t);
buf->number = pids->len;
buf->total = buf->number * buf->size;
return (pid_t*)g_array_free(pids, FALSE);
}

162
sysdeps/cygwin/procmap.c Normal file
View File

@@ -0,0 +1,162 @@
/* 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 <glib.h>
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/procmap.h>
#include <stddef.h>
#include "glibtop_private.h"
#define MKDEV(ma,mi) (((ma) << 20) | (mi))
#define MAPS_FILE "/proc/%u/maps"
#define PROC_MAPS_FORMAT "%16" G_GINT64_MODIFIER "x-%16" G_GINT64_MODIFIER "x %4c %16" G_GINT64_MODIFIER "x %02hx:%02hx %" G_GINT64_MODIFIER "u%*[ ]%n"
static const unsigned long _glibtop_sysdeps_proc_map =
(1L << GLIBTOP_PROC_MAP_NUMBER) + (1L << GLIBTOP_PROC_MAP_TOTAL) +
(1L << GLIBTOP_PROC_MAP_SIZE);
static const unsigned long _glibtop_sysdeps_map_entry =
(1L << GLIBTOP_MAP_ENTRY_START) + (1L << GLIBTOP_MAP_ENTRY_END) +
(1L << GLIBTOP_MAP_ENTRY_OFFSET) + (1L << GLIBTOP_MAP_ENTRY_PERM) +
(1L << GLIBTOP_MAP_ENTRY_INODE) + (1L << GLIBTOP_MAP_ENTRY_DEVICE) +
(1L << GLIBTOP_MAP_ENTRY_FILENAME);
/* Init function. */
void
_glibtop_init_proc_map_s (glibtop *server)
{
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
}
glibtop_map_entry *
glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
{
char procfilename[GLIBTOP_MAP_FILENAME_LEN+1];
/*
default size of 100 maybe inaccurate.
It's the average number of entry per process on my laptop
*/
GArray *entry_list = g_array_sized_new(FALSE, FALSE,
sizeof(glibtop_map_entry),
100);
FILE *maps;
const char *filename;
char *line = NULL;
size_t line_size = 0;
memset (buf, 0, sizeof (glibtop_proc_map));
filename = MAPS_FILE;
snprintf (procfilename, sizeof procfilename, filename, (unsigned)pid);
if((maps = fopen (procfilename, "r")) == NULL) {
return (glibtop_map_entry*) g_array_free(entry_list, TRUE);
}
while(TRUE)
{
unsigned long perm;
guint len;
int line_end;
unsigned short dev_major, dev_minor;
guint64 start, end, offset, inode;
char flags[4];
char *filename;
glibtop_map_entry *entry;
if (getline(&line, &line_size, maps) == -1)
break;
new_entry_line:
if (sscanf(line, PROC_MAPS_FORMAT,
&start, &end, flags, &offset,
&dev_major, &dev_minor, &inode, &line_end) != 7)
continue;
filename = line + line_end;
g_strstrip(filename);
/* Compute access permissions. */
perm = 0;
if (flags [0] == 'r')
perm |= GLIBTOP_MAP_PERM_READ;
if (flags [1] == 'w')
perm |= GLIBTOP_MAP_PERM_WRITE;
if (flags [2] == 'x')
perm |= GLIBTOP_MAP_PERM_EXECUTE;
if (flags [3] == 's')
perm |= GLIBTOP_MAP_PERM_SHARED;
else if (flags [3] == 'p')
perm |= GLIBTOP_MAP_PERM_PRIVATE;
/*
avoid copying the entry, grow by 1 and point to the last
element.
*/
len = entry_list->len;
g_array_set_size(entry_list, len + 1);
entry = &g_array_index(entry_list, glibtop_map_entry, len);
entry->flags = _glibtop_sysdeps_map_entry;
entry->start = start;
entry->end = end;
entry->offset = offset;
entry->perm = perm;
entry->device = MKDEV(dev_major, dev_minor);
entry->inode = inode;
g_strlcpy(entry->filename, filename, sizeof entry->filename);
}
eof:
free(line);
fclose (maps);
buf->flags = _glibtop_sysdeps_proc_map;
buf->number = entry_list->len;
buf->size = sizeof (glibtop_map_entry);
buf->total = buf->number * buf->size;
return (glibtop_map_entry*) g_array_free(entry_list, FALSE);
}

68
sysdeps/cygwin/procmem.c Normal file
View File

@@ -0,0 +1,68 @@
/* 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.h>
#include <glibtop/error.h>
#include <glibtop/procmem.h>
#include "glibtop_private.h"
static const unsigned long _glibtop_sysdeps_proc_mem =
(1L << GLIBTOP_PROC_MEM_SIZE) + (1L << GLIBTOP_PROC_MEM_RESIDENT) +
(1L << GLIBTOP_PROC_MEM_SHARE);
/* Init function. */
void
_glibtop_init_proc_mem_s (glibtop *server)
{
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
}
/* Provides detailed information about a process. */
void
glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
{
char buffer [BUFSIZ], *p;
const size_t pagesize = get_page_size();
memset (buf, 0, sizeof (glibtop_proc_mem));
if (proc_statm_to_buffer(buffer, sizeof buffer, pid))
return;
buf->size = strtoull (buffer, &p, 0);
buf->resident = strtoull (p, &p, 0);
buf->share = strtoull (p, &p, 0);
buf->size *= pagesize;
buf->resident *= pagesize;
buf->share *= pagesize;
/* dummy values */
buf->vsize = buf->size;
buf->rss_rlim = ~0;
buf->flags |= _glibtop_sysdeps_proc_mem;
buf->rss = buf->resident;
}

View File

@@ -0,0 +1,324 @@
/* Copyright (C) 1998-99 Martin Baulig
Copyright (C) 2004 Nicolás Lichtmaier
This file is part of LibGTop 1.0.
Modified by Nicolás Lichtmaier to give a process open files.
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/error.h>
#include <glibtop/procopenfiles.h>
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
#include <stdio.h>
#include <arpa/inet.h>
#include "glibtop_private.h"
static const unsigned long _glibtop_sysdeps_proc_open_files =
(1L << GLIBTOP_PROC_OPEN_FILES_NUMBER)|
(1L << GLIBTOP_PROC_OPEN_FILES_TOTAL)|
(1L << GLIBTOP_PROC_OPEN_FILES_SIZE);
/* Init function. */
void
_glibtop_init_proc_open_files_s (glibtop *server)
{
server->sysdeps.proc_open_files = _glibtop_sysdeps_proc_open_files;
}
typedef void (*LineParser)(GHashTable *dict, const char *line);
static void
parse_file(const char *filename, LineParser parser, GHashTable *dict)
{
FILE *f;
char *line = NULL;
size_t size = 0;
f = fopen(filename, "r");
if(!f) {
g_warning("Cannot open '%s'", filename);
return;
}
/* skip the first line */
if (getline(&line, &size, f) == -1)
goto eof;
while (getline(&line, &size, f) != -1)
parser(dict, line);
eof:
free(line);
fclose(f);
}
static GHashTable*
get_all(const char *filename, LineParser parser)
{
GHashTable *dict;
dict = g_hash_table_new_full(g_direct_hash, g_direct_equal,
NULL, g_free);
parse_file(filename, parser, dict);
return dict;
}
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];
int port;
};
static void
inet_socket_parser(GHashTable *dict, const char* line)
{
struct InetSocketEntry *se;
int sock;
unsigned addr;
se = g_malloc0(sizeof *se);
if(sscanf(line, "%*d: %*x:%*x %8x:%4x %*x %*x:%*x %*x:%*x %*d %*d %*d %d",
&addr, &se->port, &sock) != 3)
goto error;
if(!inet_ntop(AF_INET, &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_inet_sockets()
{
return get_all("/proc/net/tcp", inet_socket_parser);
}
struct LocalSocketEntry
{
char name[GLIBTOP_OPEN_DEST_HOST_LEN + 1];
};
static void
local_socket_parser(GHashTable *dict, const char *line)
{
int sock;
struct LocalSocketEntry *use;
char *p;
use = g_malloc0(sizeof *use);
/* dfaf1640: 00000003 00000000 00000000 0001 03 6457 /dev/log */
p = skip_multiple_token(line, 6);
sock = strtoul(p, &p, 10);
g_strlcpy(use->name, p, sizeof use->name);
g_strstrip(use->name);
g_hash_table_insert(dict, GINT_TO_POINTER(sock), use);
}
static inline GHashTable *
get_all_local_sockets()
{
return get_all("/proc/net/unix", local_socket_parser);
}
/* Provides detailed information about a process' open files */
glibtop_open_files_entry *
glibtop_get_proc_open_files_s (glibtop *server, glibtop_proc_open_files *buf, pid_t pid)
{
char fn [BUFSIZ];
GArray *entries;
GHashTable *inet6_sockets = NULL, *inet_sockets = NULL, *local_sockets = NULL;
struct dirent *direntry;
DIR *dir;
memset (buf, 0, sizeof (glibtop_proc_open_files));
sprintf (fn, "/proc/%d/fd", pid);
dir = opendir (fn);
if (!dir) return NULL;
entries = g_array_new(FALSE, FALSE, sizeof(glibtop_open_files_entry));
while((direntry = readdir(dir))) {
char tgt [BUFSIZ];
glibtop_open_files_entry entry = {0};
if(direntry->d_name[0] == '.')
continue;
g_snprintf(fn, sizeof fn, "/proc/%d/fd/%s",
pid, direntry->d_name);
if (!safe_readlink(fn, tgt, sizeof tgt))
continue;
entry.fd = atoi(direntry->d_name);
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));
if(ise) {
entry.type = GLIBTOP_FILE_TYPE_INETSOCKET;
entry.info.sock.dest_port = ise->port;
g_strlcpy(entry.info.sock.dest_host, ise->host,
sizeof entry.info.sock.dest_host);
goto found;
}
lse = g_hash_table_lookup(local_sockets,
GINT_TO_POINTER(sockfd));
if(lse) {
entry.type = GLIBTOP_FILE_TYPE_LOCALSOCKET;
g_strlcpy(entry.info.localsock.name, lse->name,
sizeof entry.info.localsock.name);
goto found;
}
found:
(void)0; /* kills warning */
}
else if(g_str_has_prefix(tgt, "pipe:["))
{
entry.type = GLIBTOP_FILE_TYPE_PIPE;
}
else
{
entry.type = GLIBTOP_FILE_TYPE_FILE;
g_strlcpy(entry.info.file.name, tgt, sizeof entry.info.file.name);
}
g_array_append_val(entries, entry);
}
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;
buf->number = entries->len;
buf->size = sizeof(glibtop_open_files_entry);
buf->total = buf->number * buf->size;
return (glibtop_open_files_entry*)g_array_free(entries, FALSE);
}

View File

@@ -0,0 +1,88 @@
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <glibtop/error.h>
#include <glibtop/procsegment.h>
#include "glibtop_private.h"
static const unsigned long _glibtop_sysdeps_proc_segment =
(1L << GLIBTOP_PROC_SEGMENT_START_CODE) +
(1L << GLIBTOP_PROC_SEGMENT_END_CODE) +
(1L << GLIBTOP_PROC_SEGMENT_START_STACK);
static const unsigned long _glibtop_sysdeps_proc_segment_statm =
(1L << GLIBTOP_PROC_SEGMENT_TEXT_RSS) +
(1L << GLIBTOP_PROC_SEGMENT_DATA_RSS) +
(1L << GLIBTOP_PROC_SEGMENT_DIRTY_SIZE);
/* Init function. */
void
_glibtop_init_proc_segment_s (glibtop *server)
{
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment |
_glibtop_sysdeps_proc_segment_statm;
}
/* Provides detailed information about a process. */
void
glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
pid_t pid)
{
char buffer [BUFSIZ], *p;
const size_t pagesize = get_page_size();
memset (buf, 0, sizeof (glibtop_proc_segment));
if (proc_stat_to_buffer(buffer, sizeof buffer, pid))
return;
p = proc_stat_after_cmd (buffer);
if (!p) return;
p = skip_multiple_token (p, 23);
buf->start_code = strtoull (p, &p, 0);
buf->end_code = strtoull (p, &p, 0);
buf->start_stack = strtoull (p, &p, 0);
buf->flags = _glibtop_sysdeps_proc_segment;
if (proc_statm_to_buffer(buffer, sizeof buffer, pid))
return;
p = skip_multiple_token (buffer, 3);
buf->text_rss = strtoull (p, &p, 0);
buf->shlib_rss = strtoull (p, &p, 0);
buf->data_rss = strtoull (p, &p, 0);
buf->dirty_size = strtoull (p, &p, 0);
buf->text_rss *= pagesize;
buf->shlib_rss *= pagesize;
buf->data_rss *= pagesize;
buf->dirty_size *= pagesize;
buf->flags |= _glibtop_sysdeps_proc_segment_statm;
}

View File

@@ -0,0 +1,64 @@
/* 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.h>
#include <glibtop/error.h>
#include <glibtop/procsignal.h>
#include "glibtop_private.h"
static const unsigned long _glibtop_sysdeps_proc_signal =
(1L << GLIBTOP_PROC_SIGNAL_SIGNAL) + (1L << GLIBTOP_PROC_SIGNAL_BLOCKED) +
(1L << GLIBTOP_PROC_SIGNAL_SIGIGNORE) + (1L << GLIBTOP_PROC_SIGNAL_SIGCATCH);
/* Init function. */
void
_glibtop_init_proc_signal_s (glibtop *server)
{
server->sysdeps.proc_signal = _glibtop_sysdeps_proc_signal;
}
/* Provides detailed information about a process. */
void
glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf, pid_t pid)
{
char buffer [BUFSIZ], *p;
memset (buf, 0, sizeof (glibtop_proc_signal));
if (proc_stat_to_buffer(buffer, sizeof buffer, pid))
return;
p = proc_stat_after_cmd (buffer);
if (!p) return;
p = skip_multiple_token (p, 28);
buf->signal [0] = strtoull (p, &p, 0);
buf->blocked [0] = strtoull (p, &p, 0);
buf->sigignore [0] = strtoull (p, &p, 0);
buf->sigcatch [0] = strtoull (p, &p, 0);
buf->flags = _glibtop_sysdeps_proc_signal;
}

120
sysdeps/cygwin/procstate.c Normal file
View File

@@ -0,0 +1,120 @@
/* 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.h>
#include <glibtop/error.h>
#include <glibtop/procstate.h>
#include "glibtop_private.h"
#include <sys/stat.h>
static const unsigned long _glibtop_sysdeps_proc_state =
(1L << GLIBTOP_PROC_STATE_CMD) + (1L << GLIBTOP_PROC_STATE_STATE);
static const unsigned long _glibtop_sysdeps_proc_state_uid =
(1L << GLIBTOP_PROC_STATE_UID) + (1L << GLIBTOP_PROC_STATE_GID);
/* Init function. */
void
_glibtop_init_proc_state_s (glibtop *server)
{
server->sysdeps.proc_state = _glibtop_sysdeps_proc_state |
_glibtop_sysdeps_proc_state_uid;
}
/* Provides detailed information about a process. */
void
glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid)
{
char buffer [BUFSIZ], *p;
struct stat statb;
memset (buf, 0, sizeof (glibtop_proc_state));
/* IMPORTANT NOTICE: For security reasons it is extremely important
* that the 'uid' and 'gid' fields have correct
* values; NEVER set their flags values if this
* is not the case !!! */
sprintf (buffer, "/proc/%d", pid);
if (stat (buffer, &statb))
return;
/* For security reasons we use stat () since it is
* more failsafe than parsing the file. */
buf->uid = statb.st_uid;
buf->gid = statb.st_gid;
buf->flags = _glibtop_sysdeps_proc_state_uid;
/* Now we read the remaining fields. */
if (proc_stat_to_buffer(buffer, sizeof buffer, pid))
return;
p = proc_stat_after_cmd(buffer);
p = next_token(p);
switch(*p)
{
case 'R':
buf->state = GLIBTOP_PROCESS_RUNNING;
break;
case 'Z':
buf->state = GLIBTOP_PROCESS_ZOMBIE;
break;
case 'S':
buf->state = GLIBTOP_PROCESS_INTERRUPTIBLE;
break;
case 'T':
buf->state = GLIBTOP_PROCESS_STOPPED;
break;
case 'D':
buf->state = GLIBTOP_PROCESS_UNINTERRUPTIBLE;
break;
case 'W':
buf->state = GLIBTOP_PROCESS_SWAPPING;
break;
case 'X':
buf->state = GLIBTOP_PROCESS_DEAD;
break;
}
p = skip_token (buffer); /* pid */
if (G_UNLIKELY(*p++ != '('))
glibtop_error_r (server, "Bad data in /proc/%d/stat", pid);
g_strlcpy (buf->cmd, p, sizeof buf->cmd);
buf->flags |= _glibtop_sysdeps_proc_state;
}

109
sysdeps/cygwin/proctime.c Normal file
View File

@@ -0,0 +1,109 @@
/* 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.h>
#include <glibtop/error.h>
#include <glibtop/proctime.h>
#include <glibtop/uptime.h>
#include "glibtop_private.h"
static const unsigned long _glibtop_sysdeps_proc_time =
(1L << GLIBTOP_PROC_TIME_UTIME) + (1L << GLIBTOP_PROC_TIME_CUTIME) +
(1L << GLIBTOP_PROC_TIME_RTIME) +
(1L << GLIBTOP_PROC_TIME_STIME) + (1L << GLIBTOP_PROC_TIME_CSTIME) +
(1L << GLIBTOP_PROC_TIME_FREQUENCY) + (1L << GLIBTOP_PROC_TIME_TIMEOUT) +
(1L << GLIBTOP_PROC_TIME_IT_REAL_VALUE) + (1L << GLIBTOP_PROC_TIME_START_TIME);
static const unsigned long _glibtop_sysdeps_proc_time_smp =
(1L << GLIBTOP_PROC_TIME_XCPU_UTIME) + (1L << GLIBTOP_PROC_TIME_XCPU_STIME);
/* Init function. */
void
_glibtop_init_proc_time_s (glibtop *server)
{
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time;
if (server->ncpu)
server->sysdeps.proc_time |= _glibtop_sysdeps_proc_time_smp;
}
/* Provides detailed information about a process. */
void
glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
{
char buffer [BUFSIZ], *p;
int i;
memset (buf, 0, sizeof (glibtop_proc_time));
if (proc_stat_to_buffer(buffer, sizeof buffer, pid))
return;
p = proc_stat_after_cmd (buffer);
if (!p) return;
p = skip_multiple_token (p, 11);
/* clock_t (1/100 s) */
buf->utime = strtoull (p, &p, 0);
buf->stime = strtoull (p, &p, 0);
buf->rtime = buf->utime + buf->stime;
buf->cutime = strtoull (p, &p, 0);
buf->cstime = strtoull (p, &p, 0);
p = skip_multiple_token (p, 3);
buf->it_real_value = strtoull (p, &p, 0);
/* seconds since epoch */
{
buf->start_time = get_boot_time(server) + strtoull (p, &p, 0) / 100;
}
buf->frequency = 100;
buf->flags = _glibtop_sysdeps_proc_time;
if (!server->ncpu)
return;
if (proc_file_to_buffer(buffer, sizeof buffer, "/proc/%d/cpu", pid))
return;
p = skip_multiple_token (p, 3);
for (i = 0; i <= server->ncpu; i++) {
if (!check_cpu_line_warn(server, p + 1, i))
break;
p = skip_token(p);
buf->xcpu_utime [i] = strtoull (p, &p, 0);
buf->xcpu_stime [i] = strtoull (p, &p, 0);
}
buf->flags |= _glibtop_sysdeps_proc_time_smp;
}

115
sysdeps/cygwin/procuid.c Normal file
View File

@@ -0,0 +1,115 @@
/* 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.h>
#include <glibtop/error.h>
#include <glibtop/procuid.h>
#include "glibtop_private.h"
static const unsigned long _glibtop_sysdeps_proc_uid =
(1L << GLIBTOP_PROC_UID_UID) + (1L << GLIBTOP_PROC_UID_EUID) +
(1L << GLIBTOP_PROC_UID_GID) + (1L << GLIBTOP_PROC_UID_EGID);
static const unsigned long _glibtop_sysdeps_proc_uid_stat =
(1L << GLIBTOP_PROC_UID_PID) + (1L << GLIBTOP_PROC_UID_PPID) +
(1L << GLIBTOP_PROC_UID_PGRP) + (1L << GLIBTOP_PROC_UID_SESSION) +
(1L << GLIBTOP_PROC_UID_TTY) + (1L << GLIBTOP_PROC_UID_TPGID) +
(1L << GLIBTOP_PROC_UID_PRIORITY) + (1L << GLIBTOP_PROC_UID_NICE);
/* Init function. */
void
_glibtop_init_proc_uid_s (glibtop *server)
{
server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid |
_glibtop_sysdeps_proc_uid_stat;
}
/* Provides detailed information about a process. */
void
glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf, pid_t pid)
{
char buffer [BUFSIZ], *p;
memset (buf, 0, sizeof (glibtop_proc_uid));
if (proc_status_to_buffer(buffer, sizeof buffer, pid))
return;
/* Search substring 'Pid:' */
p = strstr (buffer, "\nPid:");
if (!p) return;
p = skip_token (p); /* "Pid:" */
buf->pid = strtol (p, &p, 0);
p = skip_token (p); /* "PPid:" */
buf->ppid = strtol (p, &p, 0);
/* Maybe future Linux versions place something between
* "PPid" and "Uid", so we catch this here. */
p = strstr (p, "\nUid:");
if (!p) return;
p = skip_token (p); /* "Uid:" */
buf->uid = strtol (p, &p, 0);
buf->euid = strtol (p, &p, 0);
/* We don't know how many entries on the "Uid:" line
* future Linux version will have, so we catch this here. */
p = strstr (p, "\nGid:");
if (!p) return;
p = skip_token (p); /* "Gid:" */
buf->gid = strtol (p, &p, 0);
buf->egid = strtol (p, &p, 0);
buf->flags = _glibtop_sysdeps_proc_uid;
if (proc_stat_to_buffer(buffer, sizeof buffer, pid))
return;
p = proc_stat_after_cmd (buffer);
if (!p) return;
p = skip_multiple_token (p, 2);
buf->pgrp = strtol (p, &p, 0);
buf->session = strtol (p, &p, 0);
buf->tty = strtol (p, &p, 0);
buf->tpgid = strtol (p, &p, 0);
p = skip_multiple_token (p, 9);
buf->priority = strtol (p, &p, 0);
buf->nice = strtol (p, &p, 0);
if (buf->tty == 0)
/* the old notty val, update elsewhere bef. moving to 0 */
buf->tty = -1;
buf->flags |= _glibtop_sysdeps_proc_uid_stat;
}

99
sysdeps/cygwin/procwd.c Normal file
View File

@@ -0,0 +1,99 @@
/* 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/procwd.h>
#include <glibtop/error.h>
#include <glibtop_private.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
void
_glibtop_init_proc_wd_s(glibtop *server)
{
server->sysdeps.proc_wd =
(1 << GLIBTOP_PROC_WD_EXE) +
(1 << GLIBTOP_PROC_WD_ROOT) +
(1 << GLIBTOP_PROC_WD_NUMBER);
}
static gboolean is_in(GPtrArray *array, const char *str)
{
guint i;
for (i = 0; i != array->len; ++i) {
if (strcmp(g_ptr_array_index(array, i), str) == 0)
return TRUE;
}
return FALSE;
}
char**
glibtop_get_proc_wd_s(glibtop *server, glibtop_proc_wd *buf, pid_t pid)
{
GPtrArray *dirs;
char path[80];
char dir[256];
DIR *task;
memset(buf, 0, sizeof(glibtop_proc_wd));
g_snprintf(path, sizeof path, "/proc/%u/root", pid);
if (safe_readlink(path, buf->root, sizeof buf->root))
buf->flags |= (1 << GLIBTOP_PROC_WD_ROOT);
g_snprintf(path, sizeof path, "/proc/%u/exe", pid);
if (safe_readlink(path, buf->exe, sizeof buf->exe))
buf->flags |= (1 << GLIBTOP_PROC_WD_EXE);
dirs = g_ptr_array_sized_new(2);
g_snprintf(path, sizeof path, "/proc/%u/cwd", pid);
if (safe_readlink(path, dir, sizeof dir))
g_ptr_array_add(dirs, g_strdup(dir));
g_snprintf(path, sizeof path, "/proc/%u/task", pid);
if ((task = opendir(path)) != NULL) {
struct dirent *sub;
while ((sub = readdir(task)) != NULL) {
/* task dirs have numeric name */
if (!isdigit(sub->d_name[0]))
continue;
g_snprintf(path, sizeof path, "/proc/%u/task/%s/cwd", pid, sub->d_name);
if (safe_readlink(path, dir, sizeof dir) && !is_in(dirs, dir))
g_ptr_array_add(dirs, g_strdup(dir));
}
closedir(task);
}
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);
}

View File

@@ -0,0 +1,84 @@
/* 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/sem_limits.h>
#define _KERNEL
#include <sys/ipc.h>
#include <sys/sem.h>
#ifdef _SEM_SEMUN_UNDEFINED
/* glibc 2.1 will no longer defines semun, instead it defines
* _SEM_SEMUN_UNDEFINED so users can define semun on their own.
* Thanks to Albert K T Hui <avatar@deva.net>. */
union semun
{
int val;
struct semid_ds *buf;
unsigned short int *array;
struct seminfo *__buf;
};
#endif
static const unsigned long _glibtop_sysdeps_sem_limits =
(1L << GLIBTOP_IPC_SEMMAP) + (1L << GLIBTOP_IPC_SEMMNI) +
(1L << GLIBTOP_IPC_SEMMNS) + (1L << GLIBTOP_IPC_SEMMNU) +
(1L << GLIBTOP_IPC_SEMMSL) + (1L << GLIBTOP_IPC_SEMOPM) +
(1L << GLIBTOP_IPC_SEMUME) + (1L << GLIBTOP_IPC_SEMUSZ) +
(1L << GLIBTOP_IPC_SEMVMX) + (1L << GLIBTOP_IPC_SEMAEM);
/* Init function. */
void
_glibtop_init_sem_limits_s (glibtop *server)
{
server->sysdeps.sem_limits = _glibtop_sysdeps_sem_limits;
}
/* Provides information about sysv ipc limits. */
void
glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf)
{
struct seminfo seminfo;
union semun arg;
memset (buf, 0, sizeof (glibtop_sem_limits));
buf->flags = _glibtop_sysdeps_sem_limits;
arg.array = (void *) &seminfo;
semctl (0, 0, IPC_INFO, arg);
buf->semmap = seminfo.semmap;
buf->semmni = seminfo.semmni;
buf->semmns = seminfo.semmns;
buf->semmnu = seminfo.semmnu;
buf->semmsl = seminfo.semmsl;
buf->semopm = seminfo.semopm;
buf->semume = seminfo.semume;
buf->semusz = seminfo.semusz;
buf->semvmx = seminfo.semvmx;
buf->semaem = seminfo.semaem;
}

View File

@@ -0,0 +1,59 @@
/* 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/shm_limits.h>
#define _KERNEL
#include <sys/ipc.h>
#include <sys/shm.h>
static const unsigned long _glibtop_sysdeps_shm_limits =
(1L << GLIBTOP_IPC_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN) +
(1L << GLIBTOP_IPC_SHMMNI) + (1L << GLIBTOP_IPC_SHMSEG) +
(1L << GLIBTOP_IPC_SHMALL);
/* Init function. */
void
_glibtop_init_shm_limits_s (glibtop *server)
{
server->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits;
}
/* Provides information about sysv ipc limits. */
void
glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf)
{
struct shminfo shminfo;
memset (buf, 0, sizeof (glibtop_shm_limits));
shmctl (0, IPC_INFO, (void *) &shminfo);
buf->shmmax = shminfo.shmmax;
buf->shmmin = shminfo.shmmin;
buf->shmmni = shminfo.shmmni;
buf->shmseg = shminfo.shmseg;
buf->shmall = shminfo.shmall;
buf->flags = _glibtop_sysdeps_shm_limits;
}

143
sysdeps/cygwin/siglist.c Normal file
View File

@@ -0,0 +1,143 @@
/* 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/signal.h>
#include <signal.h>
#if 0 /* comment */
perl -nle 'print "{$1,\t\"$1\",\t\"$2\"}," if m|^#define\s*(SIG[A-Z0-9]+).*?/\*\s*(.*?)\s*\*/|'
< /usr/include/bits/signum.h
#endif
const glibtop_signame glibtop_sys_siglist [] =
{
#ifdef SIGHUP
{SIGHUP, "SIGHUP", "Hangup (POSIX)."},
#endif
#ifdef SIGINT
{SIGINT, "SIGINT", "Interrupt (ANSI)."},
#endif
#ifdef SIGQUIT
{SIGQUIT, "SIGQUIT", "Quit (POSIX)."},
#endif
#ifdef SIGILL
{SIGILL, "SIGILL", "Illegal instruction (ANSI)."},
#endif
#ifdef SIGTRAP
{SIGTRAP, "SIGTRAP", "Trace trap (POSIX)."},
#endif
#ifdef SIGABRT
{SIGABRT, "SIGABRT", "Abort (ANSI)."},
#endif
#ifdef SIGIOT
{SIGIOT, "SIGIOT", "IOT trap (4.2 BSD)."},
#endif
#ifdef SIGBUS
{SIGBUS, "SIGBUS", "BUS error (4.2 BSD)."},
#endif
#ifdef SIGFPE
{SIGFPE, "SIGFPE", "Floating-point exception (ANSI)."},
#endif
#ifdef SIGKILL
{SIGKILL, "SIGKILL", "Kill, unblockable (POSIX)."},
#endif
#ifdef SIGUSR1
{SIGUSR1, "SIGUSR1", "User-defined signal 1 (POSIX)."},
#endif
#ifdef SIGSEGV
{SIGSEGV, "SIGSEGV", "Segmentation violation (ANSI)."},
#endif
#ifdef SIGUSR2
{SIGUSR2, "SIGUSR2", "User-defined signal 2 (POSIX)."},
#endif
#ifdef SIGPIPE
{SIGPIPE, "SIGPIPE", "Broken pipe (POSIX)."},
#endif
#ifdef SIGALRM
{SIGALRM, "SIGALRM", "Alarm clock (POSIX)."},
#endif
#ifdef SIGTERM
{SIGTERM, "SIGTERM", "Termination (ANSI)."},
#endif
#ifdef SIGSTKFLT
{SIGSTKFLT, "SIGSTKFLT", "Stack fault."},
#endif
#ifdef SIGCLD
{SIGCLD, "SIGCLD", "Same as SIGCHLD (System V)."},
#endif
#ifdef SIGCHLD
{SIGCHLD, "SIGCHLD", "Child status has changed (POSIX)."},
#endif
#ifdef SIGCONT
{SIGCONT, "SIGCONT", "Continue (POSIX)."},
#endif
#ifdef SIGSTOP
{SIGSTOP, "SIGSTOP", "Stop, unblockable (POSIX)."},
#endif
#ifdef SIGTSTP
{SIGTSTP, "SIGTSTP", "Keyboard stop (POSIX)."},
#endif
#ifdef SIGTTIN
{SIGTTIN, "SIGTTIN", "Background read from tty (POSIX)."},
#endif
#ifdef SIGTTOU
{SIGTTOU, "SIGTTOU", "Background write to tty (POSIX)."},
#endif
#ifdef SIGURG
{SIGURG, "SIGURG", "Urgent condition on socket (4.2 BSD)."},
#endif
#ifdef SIGXCPU
{SIGXCPU, "SIGXCPU", "CPU limit exceeded (4.2 BSD)."},
#endif
#ifdef SIGXFSZ
{SIGXFSZ, "SIGXFSZ", "File size limit exceeded (4.2 BSD)."},
#endif
#ifdef SIGVTALRM
{SIGVTALRM, "SIGVTALRM", "Virtual alarm clock (4.2 BSD)."},
#endif
#ifdef SIGPROF
{SIGPROF, "SIGPROF", "Profiling alarm clock (4.2 BSD)."},
#endif
#ifdef SIGWINCH
{SIGWINCH, "SIGWINCH", "Window size change (4.3 BSD, Sun)."},
#endif
#ifdef SIGPOLL
{SIGPOLL, "SIGPOLL", "Pollable event occurred (System V)."},
#endif
#ifdef SIGIO
{SIGIO, "SIGIO", "I/O now possible (4.2 BSD)."},
#endif
#ifdef SIGPWR
{SIGPWR, "SIGPWR", "Power failure restart (System V)."},
#endif
#ifdef SIGSYS
{SIGSYS, "SIGSYS", "Bad system call."},
#endif
#ifdef SIGUNUSED
{SIGUNUSED, "SIGUNUSED", ""},
#endif
{0, NULL, NULL}
};

81
sysdeps/cygwin/swap.c Normal file
View File

@@ -0,0 +1,81 @@
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <glibtop/error.h>
#include <glibtop/swap.h>
#include "glibtop_private.h"
#include <fcntl.h>
static const unsigned long _glibtop_sysdeps_swap =
(1L << GLIBTOP_SWAP_TOTAL) + (1L << GLIBTOP_SWAP_USED) +
(1L << GLIBTOP_SWAP_FREE);
static const unsigned long _glibtop_sysdeps_swap_paging =
(1L << GLIBTOP_SWAP_PAGEIN) + (1L << GLIBTOP_SWAP_PAGEOUT);
/* Init function. */
void
_glibtop_init_swap_s (glibtop *server)
{
server->sysdeps.swap = _glibtop_sysdeps_swap |
_glibtop_sysdeps_swap_paging;
}
/* Provides information about swap usage. */
#define MEMINFO "/proc/meminfo"
#define PROC_STAT "/proc/stat"
void
glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
{
char buffer [BUFSIZ], *p;
memset (buf, 0, sizeof (glibtop_swap));
file_to_buffer(server, buffer, sizeof buffer, MEMINFO);
/* Kernel 2.6 with multiple lines */
buf->total = get_scaled(buffer, "SwapTotal:");
buf->free = get_scaled(buffer, "SwapFree:");
buf->used = buf->total - buf->free;
buf->flags = _glibtop_sysdeps_swap;
file_to_buffer (server, buffer, sizeof buffer, PROC_STAT);
p = strstr (buffer, "\nswap");
if(p)
{
p = skip_token (p);
buf->pagein = strtoull (p, &p, 0);
buf->pageout = strtoull (p, &p, 0);
buf->flags |= _glibtop_sysdeps_swap_paging;
}
}

99
sysdeps/cygwin/sysinfo.c Normal file
View File

@@ -0,0 +1,99 @@
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <glibtop/error.h>
#include <glibtop/cpu.h>
#include <glibtop/sysinfo.h>
#include "glibtop_private.h"
#define FILENAME "/proc/cpuinfo"
static const unsigned long _glibtop_sysdeps_sysinfo =
(1L << GLIBTOP_SYSINFO_CPUINFO);
static glibtop_sysinfo sysinfo = { .flags = 0 };
static void
init_sysinfo (glibtop *server)
{
char buffer [16384];
gchar ** processors;
if(G_LIKELY(sysinfo.flags)) return;
file_to_buffer(server, buffer, sizeof buffer, FILENAME);
/* cpuinfo records are seperated by a blank line */
processors = g_strsplit(buffer, "\n\n", 0);
for(sysinfo.ncpu = 0;
sysinfo.ncpu < GLIBTOP_NCPU && processors[sysinfo.ncpu] && *processors[sysinfo.ncpu];
sysinfo.ncpu++) {
gchar **parts, **p;
glibtop_entry * const cpuinfo = &sysinfo.cpuinfo[sysinfo.ncpu];
cpuinfo->labels = g_ptr_array_new ();
cpuinfo->values = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, g_free);
cpuinfo->descriptions = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, g_free);
/* "<key> : <value>" */
parts = g_strsplit_set(processors[sysinfo.ncpu], ":\n", 0);
for(p = parts; *p && *(p+1); p += 2) {
/* stole the allocated memory */
gchar * const key = g_strstrip( *p );
gchar * const value = g_strstrip( *(p+1) );
g_ptr_array_add(cpuinfo->labels, key);
g_hash_table_insert(cpuinfo->values, key, value);
}
/* the last key has no value and has not been added */
if(*p) g_free(*p);
/* just g_free instead of g_strvfree because we stole
the memory*/
g_free(parts);
}
g_strfreev(processors);
sysinfo.flags = _glibtop_sysdeps_sysinfo;
}
const glibtop_sysinfo *
glibtop_get_sysinfo_s (glibtop *server)
{
init_sysinfo (server);
return &sysinfo;
}

61
sysdeps/cygwin/uptime.c Normal file
View File

@@ -0,0 +1,61 @@
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <glibtop/error.h>
#include <glibtop/uptime.h>
#include "glibtop_private.h"
#include <time.h>
static const unsigned long _glibtop_sysdeps_uptime =
(1UL << GLIBTOP_UPTIME_UPTIME) \
+ (1UL << GLIBTOP_UPTIME_IDLETIME) \
+ (1UL << GLIBTOP_UPTIME_BOOT_TIME);
/* Init function. */
void
_glibtop_init_uptime_s (glibtop *server)
{
server->sysdeps.uptime = _glibtop_sysdeps_uptime;
}
/* Provides uptime and idle time. */
#define FILENAME "/proc/uptime"
void
glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf)
{
char buffer [BUFSIZ], *p;
memset (buf, 0, sizeof (glibtop_uptime));
file_to_buffer(server, buffer, sizeof buffer, FILENAME);
buf->uptime = g_ascii_strtod (buffer, &p);
buf->idletime = g_ascii_strtod (p, &p);
buf->boot_time = get_boot_time(server);
buf->flags = _glibtop_sysdeps_uptime;
}

View File

@@ -2,6 +2,8 @@ INCLUDES = @INCLUDES@
noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la
EXTRA_DIST = procmap_smaps.gperf procmap_smaps.c
libgtop_sysdeps_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
uptime.c loadavg.c shm_limits.c msg_limits.c \
sem_limits.c proclist.c procstate.c procuid.c \

View File

@@ -140,7 +140,7 @@ static void linux_2_6_0(glibtop *server, glibtop_fsusage *buf, const char *path)
get_sys_path(server, device, &filename, &format);
ret = try_file_to_buffer(buffer, sizeof buffer, filename);
ret = try_file_to_buffer(buffer, sizeof buffer, "%s", filename);
if (ret < 0) goto out;

View File

@@ -124,7 +124,7 @@ int try_file_to_buffer(char *buffer, size_t bufsiz, const char *format, ...)
void
file_to_buffer(glibtop *server, char *buffer, size_t bufsiz, const char *filename)
{
switch(try_file_to_buffer(buffer, bufsiz, filename))
switch(try_file_to_buffer(buffer, bufsiz, "%s", filename))
{
case TRY_FILE_TO_BUFFER_OPEN:
glibtop_error_io_r (server, "open (%s)", filename);

View File

@@ -31,6 +31,7 @@
#include "glibtop_private.h"
#include "procmap_smaps.c"
#define MAPS_FILE "/proc/%u/maps"
#define SMAPS_FILE "/proc/%u/smaps"
@@ -66,35 +67,19 @@ _glibtop_init_proc_map_s (glibtop *server)
/* Provides detailed information about a process. */
struct smap_value {
char name[16];
size_t name_len;
ptrdiff_t offset;
};
static int
compare(const void* a_key, const void* a_smap)
{
const char* key = a_key;
const struct smap_value* smap = a_smap;
return strncmp(key, smap->name, smap->name_len);
}
static gboolean
static const char*
is_smap_value(const char* s)
{
for ( ; *s; ++s) {
if (isspace(*s))
return FALSE;
return NULL;
if (*s == ':')
return TRUE;
return s;
}
return FALSE;
return NULL;
}
@@ -105,25 +90,18 @@ is_smap_value(const char* s)
static gboolean
parse_smaps(glibtop_map_entry *entry, const char* line)
{
#define SMAP_OFFSET(MEMBER) offsetof(glibtop_map_entry, MEMBER)
#define STR_AND_LEN(X) (X), (sizeof X - 1)
/* keep sorted */
const struct smap_value values[] = {
{ STR_AND_LEN("Private_Clean:"), SMAP_OFFSET(private_clean) },
{ STR_AND_LEN("Private_Dirty:"), SMAP_OFFSET(private_dirty) },
{ STR_AND_LEN("Rss:"), SMAP_OFFSET(rss) },
{ STR_AND_LEN("Shared_Clean:"), SMAP_OFFSET(shared_clean) },
{ STR_AND_LEN("Shared_Dirty:"), SMAP_OFFSET(shared_dirty) },
{ STR_AND_LEN("Size:"), SMAP_OFFSET(size) }
};
const struct smap_value* smap;
size_t len;
const char* colon;
#undef STR_AND_LEN
#undef SMAP_OFFSET
if ((colon = is_smap_value(line)) == NULL)
return FALSE;
struct smap_value* smap;
len = colon - line + 1;
smap = _glibtop_find_smap(line, len);
smap = bsearch(line, values, G_N_ELEMENTS(values), sizeof values[0], compare);
// g_debug("smap %s -> %p", line, smap);
if (smap) {
char *offset;
@@ -133,14 +111,75 @@ parse_smaps(glibtop_map_entry *entry, const char* line)
offset += smap->offset;
value = (void*) offset;
*value = get_scaled(line + smap->name_len, NULL);
return TRUE;
*value = get_scaled(line + len, NULL);
}
return is_smap_value(line);
return TRUE;
}
/*
sscanf is too slow
and system-monitor calls procmap for each pid every second
manual parsing is faster
error checking is weaker
*/
static gboolean
parse_line(char* line,
guint64* start, guint64* end, char flags[4], guint64* offset,
gushort* dev_major, gushort* dev_minor, guint64* inode,
char** filename)
{
/* %16llx-%16llx %4c %16llx %02hx:%02hx %llu%*[ ]%n */
char *p, *next;
p = line;
*start = strtoull(p, &p, 16);
if (G_UNLIKELY(*p != '-'))
return FALSE;
p++;
*end = strtoull(p, &p, 16);
p = next_token(p);
memcpy(flags, p, 4);
p += 4;
*offset = strtoull(p, &p, 16);
*dev_major = strtoul(p, &p, 16);
if (G_UNLIKELY(*p != ':'))
return FALSE;
p++;
*dev_minor = strtoul(p, &p, 16);
*inode = strtoull(p, &p, 10);
p = next_token(p);
*filename = p;
for ( ; *p; p++) {
if (*p == '\n') {
*p = '\0';
break;
}
}
return TRUE;
}
glibtop_map_entry *
@@ -153,9 +192,10 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
It's the average number of entry per process on my laptop
*/
size_t added = 0, entry_list_capacity = 100;
GArray *entry_list = g_array_sized_new(FALSE, FALSE,
sizeof(glibtop_map_entry),
100);
entry_list_capacity);
FILE *maps;
const char *filename;
gboolean has_smaps;
@@ -180,8 +220,7 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
while(TRUE)
{
unsigned long perm;
guint len;
int line_end;
/* int line_end; */
unsigned short dev_major, dev_minor;
guint64 start, end, offset, inode;
@@ -195,6 +234,12 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
new_entry_line:
if (!parse_line(line,
&start, &end, flags, &offset,
&dev_major, &dev_minor, &inode, &filename))
continue;
/*
if (sscanf(line, PROC_MAPS_FORMAT,
&start, &end, flags, &offset,
&dev_major, &dev_minor, &inode, &line_end) != 7)
@@ -202,6 +247,7 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
filename = line + line_end;
g_strstrip(filename);
*/
/* Compute access permissions. */
perm = 0;
@@ -224,9 +270,13 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
avoid copying the entry, grow by 1 and point to the last
element.
*/
len = entry_list->len;
g_array_set_size(entry_list, len + 1);
entry = &g_array_index(entry_list, glibtop_map_entry, len);
if (G_UNLIKELY(added >= entry_list_capacity)) {
entry_list_capacity *= 2;
g_array_set_size(entry_list, entry_list_capacity);
}
entry = &g_array_index(entry_list, glibtop_map_entry, added++);
entry->flags = _glibtop_sysdeps_map_entry;
entry->start = start;
@@ -253,12 +303,13 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
eof:
g_array_set_size(entry_list, added);
free(line);
fclose (maps);
buf->flags = _glibtop_sysdeps_proc_map;
buf->number = entry_list->len;
buf->number = added;
buf->size = sizeof (glibtop_map_entry);
buf->total = buf->number * buf->size;

View File

@@ -0,0 +1,172 @@
/* ANSI-C code produced by gperf version 3.0.3 */
/* Command-line: gperf sysdeps/linux/procmap_smaps.gperf */
/* Computed positions: -k'9' */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
/* The character set is not based on ISO-646. */
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
#endif
#line 8 "sysdeps/linux/procmap_smaps.gperf"
#include "glibtop_private.h"
#include <glibtop/procmap.h>
#include <stddef.h>
#define SMAP_OFFSET(MEMBER) offsetof(glibtop_map_entry, MEMBER)
#line 14 "sysdeps/linux/procmap_smaps.gperf"
struct smap_value { int name; ptrdiff_t offset; };
#include <string.h>
#define TOTAL_KEYWORDS 6
#define MIN_WORD_LENGTH 4
#define MAX_WORD_LENGTH 14
#define MIN_HASH_VALUE 4
#define MAX_HASH_VALUE 19
/* maximum key range = 16, duplicates = 0 */
#ifdef __GNUC__
__inline
#else
#ifdef __cplusplus
inline
#endif
#endif
static unsigned int
hash (register const char *str, register unsigned int len)
{
static const unsigned char asso_values[] =
{
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 5, 0, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 5, 20, 20, 0, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20
};
register int hval = len;
switch (hval)
{
default:
hval += asso_values[(unsigned char)str[8]];
/*FALLTHROUGH*/
case 8:
case 7:
case 6:
case 5:
case 4:
break;
}
return hval;
}
struct stringpool_t
{
char stringpool_str4[sizeof("Rss:")];
char stringpool_str5[sizeof("Size:")];
char stringpool_str13[sizeof("Shared_Clean:")];
char stringpool_str14[sizeof("Private_Dirty:")];
char stringpool_str18[sizeof("Shared_Dirty:")];
char stringpool_str19[sizeof("Private_Clean:")];
};
static const struct stringpool_t stringpool_contents =
{
"Rss:",
"Size:",
"Shared_Clean:",
"Private_Dirty:",
"Shared_Dirty:",
"Private_Clean:"
};
#define stringpool ((const char *) &stringpool_contents)
#ifdef __GNUC__
__inline
#ifdef __GNUC_STDC_INLINE__
__attribute__ ((__gnu_inline__))
#endif
#endif
static /* manually added */
const struct smap_value *
_glibtop_find_smap (register const char *str, register unsigned int len)
{
static const unsigned char lengthtable[] =
{
0, 0, 0, 0, 4, 5, 0, 0, 0, 0, 0, 0, 0, 13,
14, 0, 0, 0, 13, 14
};
static const struct smap_value wordlist[] =
{
{-1}, {-1}, {-1}, {-1},
#line 18 "sysdeps/linux/procmap_smaps.gperf"
{(int)(long)&((struct stringpool_t *)0)->stringpool_str4, SMAP_OFFSET(rss)},
#line 21 "sysdeps/linux/procmap_smaps.gperf"
{(int)(long)&((struct stringpool_t *)0)->stringpool_str5, SMAP_OFFSET(size)},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
#line 19 "sysdeps/linux/procmap_smaps.gperf"
{(int)(long)&((struct stringpool_t *)0)->stringpool_str13, SMAP_OFFSET(shared_clean)},
#line 17 "sysdeps/linux/procmap_smaps.gperf"
{(int)(long)&((struct stringpool_t *)0)->stringpool_str14, SMAP_OFFSET(private_dirty)},
{-1}, {-1}, {-1},
#line 20 "sysdeps/linux/procmap_smaps.gperf"
{(int)(long)&((struct stringpool_t *)0)->stringpool_str18, SMAP_OFFSET(shared_dirty)},
#line 16 "sysdeps/linux/procmap_smaps.gperf"
{(int)(long)&((struct stringpool_t *)0)->stringpool_str19, SMAP_OFFSET(private_clean)}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
register int key = hash (str, len);
if (key <= MAX_HASH_VALUE && key >= 0)
if (len == lengthtable[key])
{
register const char *s = wordlist[key].name + stringpool;
if (*str == *s && !memcmp (str + 1, s + 1, len - 1))
return &wordlist[key];
}
}
return 0;
}

View File

@@ -0,0 +1,21 @@
%language=ANSI-C
%includes
%struct-type
%readonly-tables
%pic
%define lookup-function-name _glibtop_find_smap
%compare-lengths
%{
#include "glibtop_private.h"
#include <glibtop/procmap.h>
#include <stddef.h>
#define SMAP_OFFSET(MEMBER) offsetof(glibtop_map_entry, MEMBER)
%}
struct smap_value { int name; ptrdiff_t offset; };
%%
Private_Clean:, SMAP_OFFSET(private_clean)
Private_Dirty:, SMAP_OFFSET(private_dirty)
Rss:, SMAP_OFFSET(rss)
Shared_Clean:, SMAP_OFFSET(shared_clean)
Shared_Dirty:, SMAP_OFFSET(shared_dirty)
Size:, SMAP_OFFSET(size)