Compare commits
205 Commits
LIBGTOP_0_
...
GNOME_STAB
Author | SHA1 | Date | |
---|---|---|---|
|
266d9e013f | ||
|
3b1626912d | ||
|
c0eb843fc4 | ||
|
b89011bce9 | ||
|
acd110f1cc | ||
|
b4d0ee6df2 | ||
|
6d62e9c466 | ||
|
6ea9c2e2cb | ||
|
d884adbf7f | ||
|
f2074892ae | ||
|
e890aaaf28 | ||
|
b1f8913794 | ||
|
3daeda7307 | ||
|
9e41d36684 | ||
|
e140f93bf5 | ||
|
3393adefa7 | ||
|
5599022989 | ||
|
1520ee7083 | ||
|
ee9812e9af | ||
|
2f20f2b7ff | ||
|
dd4ec711a9 | ||
|
c9f66159f0 | ||
|
34133fe238 | ||
|
d6e0aa2942 | ||
|
0bda0d4fc9 | ||
|
29145f7c11 | ||
|
3da3f1b03f | ||
|
cd7ca97fc5 | ||
|
e3dd231a3d | ||
|
d396bb6258 | ||
|
6ccd22ae04 | ||
|
f720f21e07 | ||
|
da51ae35c0 | ||
|
25a6834aae | ||
|
2795790ab6 | ||
|
4ca23b4e06 | ||
|
ceabdfd2dc | ||
|
20f3c3eb60 | ||
|
151c5ee80e | ||
|
213fb37f26 | ||
|
fd77db5f8d | ||
|
50e4bdfc93 | ||
|
b7e5a6da2d | ||
|
67a344b9d4 | ||
|
d414a22ee3 | ||
|
0b315c266b | ||
|
c90462bc26 | ||
|
6760a41ad9 | ||
|
83d51392dc | ||
|
6b736f1f87 | ||
|
5fed8969c6 | ||
|
079ddfae31 | ||
|
a701fc7aa6 | ||
|
cd7976f3cd | ||
|
bdbc251228 | ||
|
12b9e30f1c | ||
|
ef36d36060 | ||
|
11c7fad8d4 | ||
|
9c0ec8c69f | ||
|
4ac6972be6 | ||
|
7a0a779311 | ||
|
92f1bf261c | ||
|
6abcbd5458 | ||
|
a637c8b406 | ||
|
d59234afc2 | ||
|
8e67a4cad1 | ||
|
0afb34b0c1 | ||
|
f24a4d9d22 | ||
|
44b03ba60b | ||
|
d46c6227fb | ||
|
fffabe63b7 | ||
|
ecaa9d9a35 | ||
|
45b63f5131 | ||
|
ee2d10729c | ||
|
b3262820c5 | ||
|
4371bc81c9 | ||
|
a6f7f0259e | ||
|
0882a71244 | ||
|
213647b203 | ||
|
44ca3f22f3 | ||
|
82fdca61c2 | ||
|
0fec2b7fb0 | ||
|
b70d0570c7 | ||
|
13d9120f93 | ||
|
1289b92d06 | ||
|
bdc4e08454 | ||
|
65e3bf19ab | ||
|
bb545f9aaa | ||
|
30bd1f269c | ||
|
9114af9fdf | ||
|
0e57efd4e5 | ||
|
6b548d62dd | ||
|
afe57f9ee9 | ||
|
38b00dfae0 | ||
|
a5f0bed342 | ||
|
1b6eb7b27d | ||
|
8f4611fe34 | ||
|
27b46e687b | ||
|
260ecffab8 | ||
|
92a4453165 | ||
|
05eb7e1f76 | ||
|
6407e9cdbf | ||
|
492c7788d0 | ||
|
f14684a685 | ||
|
d74b27fcb9 | ||
|
46779ed121 | ||
|
27a961b25d | ||
|
a1fd1f436a | ||
|
bb997fff98 | ||
|
671c02c5f2 | ||
|
abf854c16a | ||
|
691ce2b843 | ||
|
63e37821f3 | ||
|
77e926d754 | ||
|
ade863b5e3 | ||
|
4aaa1f5356 | ||
|
c965b623f9 | ||
|
d27d97d07b | ||
|
3af9d90f4a | ||
|
70bbae9b75 | ||
|
669f7a6b17 | ||
|
754a69a79a | ||
|
e81082d8ed | ||
|
f87c35d7b2 | ||
|
960d4aa3a9 | ||
|
34ce0648de | ||
|
127baf677b | ||
|
616923612c | ||
|
d1f3444da1 | ||
|
f3c73befd2 | ||
|
e894161eb2 | ||
|
f8fbb9198d | ||
|
2af3fb1c03 | ||
|
3b22c01a66 | ||
|
4b261a3f80 | ||
|
9b0aa47f17 | ||
|
3af2e87c77 | ||
|
8014f2590b | ||
|
960018d198 | ||
|
27c03c773b | ||
|
ac2bd3eda8 | ||
|
b1bae173de | ||
|
e35db38422 | ||
|
95525908bf | ||
|
cf0e724f7d | ||
|
0659b93dff | ||
|
afb07a1f8b | ||
|
d2448ea6f3 | ||
|
dfda639756 | ||
|
be63bf2d42 | ||
|
06d907146d | ||
|
bd4cd7b570 | ||
|
a444c860d2 | ||
|
0289863af0 | ||
|
210fc000cd | ||
|
93568304b0 | ||
|
23cdbd5336 | ||
|
17a37aa394 | ||
|
f082d4cb85 | ||
|
b5c90ca5a4 | ||
|
f4cde0843d | ||
|
fce4841810 | ||
|
02dfde47ab | ||
|
a8b0903fe7 | ||
|
6eed554232 | ||
|
c591e6ef33 | ||
|
a72db75b78 | ||
|
8f3c38219a | ||
|
0d56ca7d04 | ||
|
70347bbfe9 | ||
|
06437c5866 | ||
|
72c987735e | ||
|
8e752ed036 | ||
|
36911a1239 | ||
|
7cadf4450c | ||
|
2a2677ea66 | ||
|
37283cfdad | ||
|
b85a419f28 | ||
|
507da6f040 | ||
|
11daaa2e1c | ||
|
0d3113e6b9 | ||
|
94d7978b44 | ||
|
86de0911cc | ||
|
8279241591 | ||
|
88c34d1415 | ||
|
a331fb8e03 | ||
|
9d564134de | ||
|
731b2879f0 | ||
|
2f140e2168 | ||
|
2bf9475dda | ||
|
6fe6cfdc15 | ||
|
a6584c2f75 | ||
|
bdefedae37 | ||
|
af50e25023 | ||
|
abfda54900 | ||
|
0ea8e591f4 | ||
|
db3d7adbaa | ||
|
f353017948 | ||
|
f66f7fde8c | ||
|
9049a19434 | ||
|
f7da79ed88 | ||
|
9d0aa0fdc1 | ||
|
fb552b8e31 | ||
|
a0b502df75 | ||
|
5a7f1d7621 |
@@ -5,6 +5,8 @@ config.cache
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.sub
|
||||
config.guess
|
||||
config.status
|
||||
configure
|
||||
gtopConf.sh
|
||||
@@ -25,3 +27,5 @@ support
|
||||
i386-freebsd
|
||||
alpha-dec-osf3.0
|
||||
i686-pc-linux-gnu-linux
|
||||
libgtop-config
|
||||
ABOUT-NLS
|
||||
|
225
ABOUT-NLS
225
ABOUT-NLS
@@ -1,225 +0,0 @@
|
||||
Notes on the Free Translation Project
|
||||
*************************************
|
||||
|
||||
Free software is going international! The Free Translation Project
|
||||
is a way to get maintainers of free software, translators, and users all
|
||||
together, so that will gradually become able to speak many languages.
|
||||
A few packages already provide translations for their messages.
|
||||
|
||||
If you found this `ABOUT-NLS' file inside a distribution, you may
|
||||
assume that the distributed package does use GNU `gettext' internally,
|
||||
itself available at your nearest GNU archive site. But you do *not*
|
||||
need to install GNU `gettext' prior to configuring, installing or using
|
||||
this package with messages translated.
|
||||
|
||||
Installers will find here some useful hints. These notes also
|
||||
explain how users should proceed for getting the programs to use the
|
||||
available translations. They tell how people wanting to contribute and
|
||||
work at translations should contact the appropriate team.
|
||||
|
||||
When reporting bugs in the `intl/' directory or bugs which may be
|
||||
related to internationalization, you should tell about the version of
|
||||
`gettext' which is used. The information can be found in the
|
||||
`intl/VERSION' file, in internationalized packages.
|
||||
|
||||
One advise in advance
|
||||
=====================
|
||||
|
||||
If you want to exploit the full power of internationalization, you
|
||||
should configure it using
|
||||
|
||||
./configure --with-included-gettext
|
||||
|
||||
to force usage of internationalizing routines provided within this
|
||||
package, despite the existence of internationalizing capabilities in the
|
||||
operating system where this package is being installed. So far, only
|
||||
the `gettext' implementation in the GNU C library version 2 provides as
|
||||
many features (such as locale alias or message inheritance) as the
|
||||
implementation here. It is also not possible to offer this additional
|
||||
functionality on top of a `catgets' implementation. Future versions of
|
||||
GNU `gettext' will very likely convey even more functionality. So it
|
||||
might be a good idea to change to GNU `gettext' as soon as possible.
|
||||
|
||||
So you need not provide this option if you are using GNU libc 2 or
|
||||
you have installed a recent copy of the GNU gettext package with the
|
||||
included `libintl'.
|
||||
|
||||
INSTALL Matters
|
||||
===============
|
||||
|
||||
Some packages are "localizable" when properly installed; the
|
||||
programs they contain can be made to speak your own native language.
|
||||
Most such packages use GNU `gettext'. Other packages have their own
|
||||
ways to internationalization, predating GNU `gettext'.
|
||||
|
||||
By default, this package will be installed to allow translation of
|
||||
messages. It will automatically detect whether the system provides
|
||||
usable `catgets' (if using this is selected by the installer) or
|
||||
`gettext' functions. If neither is available, the GNU `gettext' own
|
||||
library will be used. This library is wholly contained within this
|
||||
package, usually in the `intl/' subdirectory, so prior installation of
|
||||
the GNU `gettext' package is *not* required. Installers may use
|
||||
special options at configuration time for changing the default
|
||||
behaviour. The commands:
|
||||
|
||||
./configure --with-included-gettext
|
||||
./configure --with-catgets
|
||||
./configure --disable-nls
|
||||
|
||||
will respectively bypass any pre-existing `catgets' or `gettext' to use
|
||||
the internationalizing routines provided within this package, enable
|
||||
the use of the `catgets' functions (if found on the locale system), or
|
||||
else, *totally* disable translation of messages.
|
||||
|
||||
When you already have GNU `gettext' installed on your system and run
|
||||
configure without an option for your new package, `configure' will
|
||||
probably detect the previously built and installed `libintl.a' file and
|
||||
will decide to use this. This might be not what is desirable. You
|
||||
should use the more recent version of the GNU `gettext' library. I.e.
|
||||
if the file `intl/VERSION' shows that the library which comes with this
|
||||
package is more recent, you should use
|
||||
|
||||
./configure --with-included-gettext
|
||||
|
||||
to prevent auto-detection.
|
||||
|
||||
By default the configuration process will not test for the `catgets'
|
||||
function and therefore they will not be used. The reasons are already
|
||||
given above: the emulation on top of `catgets' cannot provide all the
|
||||
extensions provided by the GNU `gettext' library. If you nevertheless
|
||||
want to use the `catgets' functions use
|
||||
|
||||
./configure --with-catgets
|
||||
|
||||
to enable the test for `catgets' (this causes no harm if `catgets' is
|
||||
not available on your system). If you really select this option we
|
||||
would like to hear about the reasons because we cannot think of any
|
||||
good one ourself.
|
||||
|
||||
Internationalized packages have usually many `po/LL.po' files, where
|
||||
LL gives an ISO 639 two-letter code identifying the language. Unless
|
||||
translations have been forbidden at `configure' time by using the
|
||||
`--disable-nls' switch, all available translations are installed
|
||||
together with the package. However, the environment variable `LINGUAS'
|
||||
may be set, prior to configuration, to limit the installed set.
|
||||
`LINGUAS' should then contain a space separated list of two-letter
|
||||
codes, stating which languages are allowed.
|
||||
|
||||
Using This Package
|
||||
==================
|
||||
|
||||
As a user, if your language has been installed for this package, you
|
||||
only have to set the `LANG' environment variable to the appropriate
|
||||
ISO 639 `LL' two-letter code prior to using the programs in the
|
||||
package. For example, let's suppose that you speak German. At the
|
||||
shell prompt, merely execute `setenv LANG de' (in `csh'),
|
||||
`export LANG; LANG=de' (in `sh') or `export LANG=de' (in `bash'). This
|
||||
can be done from your `.login' or `.profile' file, once and for all.
|
||||
|
||||
An operating system might already offer message localization for
|
||||
many of its programs, while other programs have been installed locally
|
||||
with the full capabilities of GNU `gettext'. Just using `gettext'
|
||||
extended syntax for `LANG' would break proper localization of already
|
||||
available operating system programs. In this case, users should set
|
||||
both `LANGUAGE' and `LANG' variables in their environment, as programs
|
||||
using GNU `gettext' give preference to `LANGUAGE'. For example, some
|
||||
Swedish users would rather read translations in German than English for
|
||||
when Swedish is not available. This is easily accomplished by setting
|
||||
`LANGUAGE' to `sv:de' while leaving `LANG' to `sv'.
|
||||
|
||||
Translating Teams
|
||||
=================
|
||||
|
||||
For the Free Translation Project to be a success, we need interested
|
||||
people who like their own language and write it well, and who are also
|
||||
able to synergize with other translators speaking the same language.
|
||||
Each translation team has its own mailing list, courtesy of Linux
|
||||
International. You may reach your translation team at the address
|
||||
`LL@li.org', replacing LL by the two-letter ISO 639 code for your
|
||||
language. Language codes are *not* the same as the country codes given
|
||||
in ISO 3166. The following translation teams exist, as of August 1997:
|
||||
|
||||
Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en',
|
||||
Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian
|
||||
`hu', Irish `ga', Italian `it', Indonesian `id', Japanese `ja',
|
||||
Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish
|
||||
`pl', Portuguese `pt', Russian `ru', Slovenian `sl', Spanish `es',
|
||||
Swedish `sv', and Turkish `tr'.
|
||||
|
||||
For example, you may reach the Chinese translation team by writing to
|
||||
`zh@li.org'.
|
||||
|
||||
If you'd like to volunteer to *work* at translating messages, you
|
||||
should become a member of the translating team for your own language.
|
||||
The subscribing address is *not* the same as the list itself, it has
|
||||
`-request' appended. For example, speakers of Swedish can send a
|
||||
message to `sv-request@li.org', having this message body:
|
||||
|
||||
subscribe
|
||||
|
||||
Keep in mind that team members are expected to participate
|
||||
*actively* in translations, or at solving translational difficulties,
|
||||
rather than merely lurking around. If your team does not exist yet and
|
||||
you want to start one, or if you are unsure about what to do or how to
|
||||
get started, please write to `translation@iro.umontreal.ca' to reach the
|
||||
coordinator for all translator teams.
|
||||
|
||||
The English team is special. It works at improving and uniformizing
|
||||
the terminology in use. Proven linguistic skill are praised more than
|
||||
programming skill, here.
|
||||
|
||||
Available Packages
|
||||
==================
|
||||
|
||||
Languages are not equally supported in all packages. The following
|
||||
matrix shows the current state of internationalization, as of August
|
||||
1997. The matrix shows, in regard of each package, for which languages
|
||||
PO files have been submitted to translation coordination.
|
||||
|
||||
Ready PO files cs da de en es fi fr it ja ko nl no pl pt sl sv
|
||||
.-------------------------------------------------.
|
||||
bash | [] [] [] | 3
|
||||
bison | [] [] [] | 3
|
||||
clisp | [] [] [] [] | 4
|
||||
cpio | [] [] [] [] [] | 5
|
||||
diffutils | [] [] [] [] [] | 5
|
||||
enscript | [] [] [] [] [] [] | 6
|
||||
fileutils | [] [] [] [] [] [] [] [] [] [] | 10
|
||||
findutils | [] [] [] [] [] [] [] [] | 8
|
||||
flex | [] [] [] [] | 4
|
||||
gcal | [] [] [] [] [] | 5
|
||||
gettext | [] [] [] [] [] [] [] [] [] [] | 11
|
||||
grep | [] [] [] [] [] [] [] [] [] | 9
|
||||
hello | [] [] [] [] [] [] [] [] [] [] | 10
|
||||
id-utils | [] [] [] | 3
|
||||
indent | [] [] [] [] | 4
|
||||
libc | [] [] [] [] [] [] [] | 7
|
||||
m4 | [] [] [] [] [] | 5
|
||||
make | [] [] [] [] [] [] | 6
|
||||
music | [] [] | 2
|
||||
ptx | [] [] [] [] [] [] [] [] | 8
|
||||
recode | [] [] [] [] [] [] [] [] [] | 9
|
||||
sh-utils | [] [] [] [] [] [] [] | 7
|
||||
sharutils | [] [] [] [] [] | 5
|
||||
tar | [] [] [] [] [] [] [] [] [] [] | 10
|
||||
texinfo | [] | 1
|
||||
textutils | [] [] [] [] [] [] [] [] [] | 9
|
||||
wdiff | [] [] [] [] [] [] [] [] | 8
|
||||
`-------------------------------------------------'
|
||||
16 languages cs da de en es fi fr it ja ko nl no pl pt sl sv
|
||||
27 packages 3 2 24 1 17 1 26 2 1 11 20 9 19 7 7 17 167
|
||||
|
||||
Some counters in the preceding matrix are higher than the number of
|
||||
visible blocks let us expect. This is because a few extra PO files are
|
||||
used for implementing regional variants of languages, or language
|
||||
dialects.
|
||||
|
||||
For a PO file in the matrix above to be effective, the package to
|
||||
which it applies should also have been internationalized and
|
||||
distributed as such by its maintainer. There might be an observable
|
||||
lag between the mere existence a PO file and its wide availability in a
|
||||
distribution.
|
||||
|
||||
If August 1997 seems to be old, you may fetch a more recent copy of
|
||||
this `ABOUT-NLS' file on most GNU archive sites.
|
||||
|
280
ChangeLog
280
ChangeLog
@@ -1,3 +1,272 @@
|
||||
1998-12-15 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
Released LibGTop 0.99.0 which is a feature-freezed version
|
||||
for GNOME 1.0.
|
||||
|
||||
1998-12-09 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* configure.in: We need to define LIBSUPPORT and SUPPORTINCS under
|
||||
all circumstances as it is in gnome-libs.
|
||||
|
||||
* include/glibtop/procargs.h (glibtop_get_proc_args): Make the
|
||||
return value a `char *' instead of a `const char *'.
|
||||
|
||||
1998-12-09 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* LIBGTOP-VERSION: Set version number to 0.29.1.
|
||||
|
||||
1998-12-09 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* libgtop-sysdeps.m4: Moved here from the macros directory,
|
||||
formerly known as `macros/gnome-libgtop-sysdeps.m4'.
|
||||
(--enable-hacker-mode): New command line parameter to configure,
|
||||
enables building of unstable sysdeps directories.
|
||||
(LIBGTOP_HACKER_TESTS): New macro to check for unsafe things when
|
||||
hacker mode was enabled.
|
||||
|
||||
1998-12-06 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* configure.in: Make it abort if GNOME cannot be found and
|
||||
the --without-gnome parameter was not given.
|
||||
|
||||
1998-12-03 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* LIBGTOP-VERSION (LIBGTOP_VERSION_CODE): Pipe the expression
|
||||
through `dc' so we get a real number.
|
||||
|
||||
1998-12-03 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
LibGTop now requires gettext >= 0.10.35.
|
||||
|
||||
* intl: Removed &intl CVS alias.
|
||||
|
||||
1998-11-27 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* LIBGTOP-VERSION: Set version number to 0.29.0.
|
||||
|
||||
* TODO: Add things that need to be done before Dec 15.
|
||||
|
||||
This is basically a feature freeze for the C language part
|
||||
of LibGTop except for things that are marked with (***) in
|
||||
the TODO.
|
||||
|
||||
1998-11-20 Martin Baulig <baulig@merkur.uni-trier.de>
|
||||
|
||||
* sysdeps/common/mountlist.c: Applied a patch from Kenneth Stailey to
|
||||
make it work on OpenBSD.
|
||||
|
||||
1998-11-18 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* lib/open.c (glibtop_open_l): We need to set argv[0] in call
|
||||
to execl () to avoid a core dump in _init () on FreeBSD 3.0.
|
||||
|
||||
1998-11-11 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* include/glibtop/gnuserv.h (MCOOKIE_SCREEN): Don't define this
|
||||
any longer, we now use the port the daemon is listening on instead
|
||||
of a fixed screen.
|
||||
|
||||
1998-11-11 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* configure.in (--enable-debug): Define LIBGTOP_ENABLE_DEBUG
|
||||
if this parameter is given.
|
||||
(--enable-fatal-warnings): New parameter to make all warnings
|
||||
fatal; define `LIBGTOP_FATAL_WARNINGS' if given.
|
||||
|
||||
* sysdeps/common/error.c (glibtop_error_r): Use abort () instead
|
||||
of exit () if LIBGTOP_ENABLE_DEBUG.
|
||||
(glibtop_error_io_r): Likewise.
|
||||
(glibtop_warn_r): Call abort () if LIBGTOP_FATAL_WARNINGS.
|
||||
(glibtop_warn_io_r): Likewise.
|
||||
|
||||
[NOTE: To get a core dump of the libgtop_server, you need to
|
||||
remove all suid/sgid bits and invoke it as a priviledged user.]
|
||||
|
||||
1998-11-08 Raja R Harinath <harinath@cs.umn.edu>
|
||||
|
||||
* Makefile.am (support): Don't build if not BUILD_GNOME_SUPPORT.
|
||||
|
||||
1998-11-02 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* include/glibtop/parameter.h: Added `GLIBTOP_PARAM_REQUIRED'.
|
||||
|
||||
* lib/parameter.c (glibtop_set_parameter_l): It's no longer
|
||||
allowed to set GLIBTOP_PARAM_FEATURES.
|
||||
(glibtop_get_parameter_l): You can use `GLIBTOP_PARAM_REQUIRED'
|
||||
to read server->required and ...
|
||||
(glibtop_set_parameter_l): ... set it here.
|
||||
|
||||
1998-10-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
Added `Network Load' feature (netload).
|
||||
|
||||
* include/glibtop/netload.h: New file.
|
||||
* features.def: Added new feature `netload'.
|
||||
|
||||
1998-10-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
Added `Command Line Parameters' feature (proc_args).
|
||||
|
||||
* include/glibtop/proc_args.h: New file.
|
||||
* features.def: Added new feature `proc_args'.
|
||||
|
||||
* lib/lib.awk: New type `unsigned' for the features.def which
|
||||
is `unsigned'.
|
||||
|
||||
1998-10-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
Added PPP/ISDN support.
|
||||
|
||||
* include/glibtop/ppp.h: New file.
|
||||
* features.def: Added new feature `ppp'.
|
||||
|
||||
* acconfig.h (HAVE_I4B): Defined if we have the I4B package.
|
||||
(HAVE_I4B_ACCT): Defined if we have ISDN statistics with I4B.
|
||||
|
||||
* misc: New directory.
|
||||
* misc/i4b_acct.txt: Read this file to get ISDN statistics on BSD.
|
||||
|
||||
* lib/lib.awk: New type `ushort' for the features.def which is
|
||||
`unsigned short'.
|
||||
|
||||
1998-10-20 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* include/glibtop/proc_signal.h: Use a 2-element-array of
|
||||
type `u_int64_t' for all signal masks instead of just
|
||||
scalar numbers. This avoids problems on systems with more
|
||||
than 64 signals.
|
||||
|
||||
If there is any operating system out there with even more than
|
||||
128 signals, we can simply increase the number of array elements
|
||||
here.
|
||||
|
||||
[NOTE for people porting libgtop:
|
||||
|
||||
Please use all 64 bits of the `u_int64_t' and not just 32 - the
|
||||
signal number (as it is used in calls to kill () ...) should be
|
||||
a bit-index into this field; if a process ignores for instance
|
||||
signal 64, it has the 0-bit of sigcatch[1] set, if it ignores 63,
|
||||
this is the 63-bit of sigcatch[0] and so on ...
|
||||
|
||||
The mapping between signal numbers and their names is done via the
|
||||
glibtop_sys_siglist [] field which should be declared in
|
||||
sysdeps/@sysdeps_dir@/siglist.c - see linux for an example.
|
||||
]
|
||||
|
||||
* features.def: It's now safe to put things like `loadavg[3]'
|
||||
here - the awk skripts should correctly threat this as an array.
|
||||
|
||||
1998-10-12 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* configure.in (GNOME_COMPILE_WARNINGS): Let the user enable
|
||||
compiler warnings.
|
||||
(--with-libgtop-guile): Make the default to build the guile
|
||||
interface if guile can be found.
|
||||
|
||||
* Makefile.am (confexec_DATA): Install `feature.def' as
|
||||
`libgtop-features.def'.
|
||||
* libgtop.spec: Added `%{prefix}/lib/*.def' to the file list.
|
||||
|
||||
1998-10-11 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* configure.in: Don't create `guile/Makefile'.
|
||||
* Makefile.am (DIST_SUBDIRS): Removed.
|
||||
(SUBDIRS): Removed `guile'.
|
||||
|
||||
* include/glibtop/*.h: Removed external delarations of all
|
||||
`glibtop_guile_*' functions that were formerly defined in
|
||||
sysdeps/guile/guile.c and sysdeps/guile/names/guile-names.c.
|
||||
|
||||
1998-10-11 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* sysdeps/guile/ChangeLog: New file.
|
||||
|
||||
* LIBGTOP-VERSION: Set version number to 0.26.3.
|
||||
* libgtop.spec: Likewise.
|
||||
|
||||
* Makefile.am (confexec_DATA): Added `features.def'.
|
||||
* libgtop-config.in: Added `--features-def-file' parameter
|
||||
to get pathname of installed `features.def' file.
|
||||
|
||||
* perl: Removed everything in this subdirectory. This was
|
||||
only experimental. The real perl bindings for LibGTop are
|
||||
in the libgtop-bindings module.
|
||||
|
||||
1998-10-11 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* src/inodedb/Makefile.am: Removed @libs_xauth@ and -lgdbm
|
||||
from the _LDADD variables since libtool automatically gets
|
||||
the dependencies.
|
||||
* src/daemon/Makefile.am: Likewise.
|
||||
* examples/Makefile.am: Likewise.
|
||||
|
||||
1998-10-10 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* configure (LIBGTOP_EXTRA_LIBS): Added `GLIB_LIBS'.
|
||||
|
||||
* perl/ChangeLog: New file.
|
||||
|
||||
1998-10-07 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* configure.in (ALL_LINGUAS): Added `de'.
|
||||
|
||||
1998-10-03 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* include/glibtop/global.h: Only include system header files
|
||||
if we are `_IN_LIBGTOP'.
|
||||
(G_GNUC_NORETURN, G_GNUC_CONST, G_GNUC_UNUSED): Added those
|
||||
definitions if we are `_IN_LIBGTOP'.
|
||||
|
||||
1998-09-29 Sung-Hyun Nam <namsh@lgic.co.kr>
|
||||
|
||||
* configure.in (ALL_LINGUAS): add `ko'
|
||||
* po/ko.po: new file.
|
||||
|
||||
1998-09-27 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* configure.in: Make it really *require* GLIB >= 1.1.3.
|
||||
|
||||
1998-09-27 Raja R Harinath <harinath@cs.umn.edu>
|
||||
|
||||
* configure.in: Move check for `-lresolv', `-lsocket' and `-lnsl'
|
||||
after X11 checks.
|
||||
|
||||
1998-09-27 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* configure.in: Do not even check for guile if it is disabled.
|
||||
|
||||
1998-09-12 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* include/glibtop/sysinfo.h: New file. This is used in guname to
|
||||
fetch as many information about the system as possible like detailed
|
||||
information about hardware etc.
|
||||
|
||||
* configure.in (AM_PATH_GLIB): LibGTop now requires glib.
|
||||
|
||||
1998-09-09 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
|
||||
|
||||
* include/glibtop/proctime.h (glibtop_proc_time): Added `xcpu_utime'
|
||||
and `xcpu_stime'.
|
||||
|
||||
* sysdeps/linux/ChangeLog: New file.
|
||||
|
||||
* glibtop.h (glibtop): Added `ncpu'. This is zero for single processor
|
||||
systems and the number of CPUs otherwise.
|
||||
|
||||
* include/glibtop/cpu.h (glibtop_cpu): Added `xcpu_total', `xcpu_user',
|
||||
`xcpu_nice', `xcpu_sys' and `xcpu_idle'.
|
||||
(GLIBTOP_NCPU): #define this to 4.
|
||||
|
||||
1998-09-08 Martin Baulig <baulig@merkur.uni-trier.de>
|
||||
|
||||
* configure.in: Make the default to disable guile.
|
||||
|
||||
1998-08-30 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* LIBGTOP-VERSION (LIBGTOP_VERSION_CODE): Added. This is a numerical
|
||||
constant ("1.234.567" -> 1234567) to be used in C preprocessor
|
||||
conditionals.
|
||||
|
||||
1998-08-29 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* LIBGTOP-VERSION (LIBGTOP_INTERFACE_AGE, LIBGTOP_BINARY_AGE): Added.
|
||||
@@ -5,6 +274,17 @@
|
||||
(LT_RELEASE, LT_CURRENT, LT_REVISION, LT_AGE): AC_SUBST.
|
||||
(LT_VERSION_INFO): Sets `-version-info' for libtool.
|
||||
|
||||
* */Makefile.am: We now use the correct `-version-info' parameter
|
||||
for libtool.
|
||||
|
||||
1998-08-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* include/glibtop/command.h (glibtop_call): Third argument is
|
||||
now `const void *'.
|
||||
|
||||
* include/glibtop/xmalloc.h (glibtop_free): Now taking a
|
||||
`const void *'.
|
||||
|
||||
1998-08-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* src/daemon/ChangeLog: New file.
|
||||
|
@@ -7,16 +7,18 @@
|
||||
# set LIBGTOP_BINARY_AGE and LIBGTOP_INTERFACE_AGE to 0.
|
||||
#
|
||||
LIBGTOP_MAJOR_VERSION=0
|
||||
LIBGTOP_MINOR_VERSION=25
|
||||
LIBGTOP_MICRO_VERSION=1
|
||||
LIBGTOP_MINOR_VERSION=99
|
||||
LIBGTOP_MICRO_VERSION=0
|
||||
|
||||
LIBGTOP_INTERFACE_AGE=0
|
||||
LIBGTOP_BINARY_AGE=0
|
||||
|
||||
LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION.$LIBGTOP_MICRO_VERSION
|
||||
|
||||
# Increase each time you change the client/server protocol.
|
||||
LIBGTOP_SERVER_VERSION=1
|
||||
LIBGTOP_SERVER_VERSION=3
|
||||
|
||||
# Don't change this
|
||||
LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION.$LIBGTOP_MICRO_VERSION
|
||||
LIBGTOP_VERSION_CODE=`echo "$LIBGTOP_MAJOR_VERSION 1000000 * $LIBGTOP_MINOR_VERSION 1000 * + $LIBGTOP_MICRO_VERSION + p q" | dc`
|
||||
|
||||
# For automake.
|
||||
VERSION=$LIBGTOP_VERSION
|
||||
|
54
Makefile.am
54
Makefile.am
@@ -6,43 +6,38 @@ else
|
||||
examples_SUBDIRS =
|
||||
endif
|
||||
|
||||
if GUILE
|
||||
guile_SUBDIRS = guile
|
||||
else
|
||||
guile_SUBDIRS =
|
||||
if BUILD_GNOME_SUPPORT
|
||||
support = support
|
||||
endif
|
||||
|
||||
|
||||
SUBDIRS = po intl support macros include sysdeps lib src \
|
||||
SUBDIRS = po intl $(support) macros misc include sysdeps lib src \
|
||||
$(examples_SUBDIRS)
|
||||
|
||||
DIST_SUBDIRS = po intl support macros include sysdeps src lib guile examples
|
||||
|
||||
include_HEADERS = glibtop.h
|
||||
|
||||
EXTRA_DIST = autogen.sh libgtop.spec copyright.txt libgtopConf.sh.in \
|
||||
LIBGTOP-VERSION features.def perl/Makefile.PL.in perl/perl.awk \
|
||||
perl/MANIFEST perl/Changes libgtop-config.in RELNOTES-0.25
|
||||
LIBGTOP-VERSION features.def libgtop-config.in RELNOTES-0.25 \
|
||||
libgtop-sysdeps.m4
|
||||
|
||||
release:
|
||||
$(MAKE) dist distdir=$(PACKAGE)$(VERSION)
|
||||
$(MAKE) dist distdir=$(PACKAGE)-$(VERSION)
|
||||
|
||||
## Put `exec' in the name because this should be installed by
|
||||
## `install-exec', not `install-data'.
|
||||
confexecdir=$(libdir)
|
||||
confexec_DATA = $(top_builddir)/libgtopConf.sh
|
||||
confexecdir = $(libdir)
|
||||
confexec_DATA = $(top_builddir)/libgtopConf.sh \
|
||||
$(top_builddir)/libgtop-features.def
|
||||
|
||||
bin_SCRIPTS = $(top_builddir)/libgtop-config
|
||||
|
||||
noinst_DATA = $(top_builddir)/perl/Makefile.PL \
|
||||
$(top_builddir)/perl/Libgtop.xs
|
||||
|
||||
## to automatically rebuild aclocal.m4 if any of the macros in
|
||||
## `macros/' change
|
||||
@MAINT@include macros/macros.dep
|
||||
@MAINT@ include macros/macros.dep
|
||||
@MAINT@macros/macros.dep: macros/Makefile.am
|
||||
@MAINT@ cd macros && $(MAKE) macros.dep
|
||||
|
||||
@MAINT@$(top_srcdir)/aclocal.m4: libgtop-sysdeps.m4
|
||||
|
||||
## We create libgtopConf.sh here and not from configure because we want
|
||||
## to get the paths expanded correctly. Macros like srcdir are given
|
||||
## the value NONE in configure if the user doesn't specify them (this
|
||||
@@ -66,6 +61,7 @@ libgtopConf.sh: libgtopConf.sh.in Makefile
|
||||
-e 's,\@LIBGTOP_MINOR_VERSION\@,$(LIBGTOP_MINOR_VERSION),g' \
|
||||
-e 's,\@LIBGTOP_MICRO_VERSION\@,$(LIBGTOP_MICRO_VERSION),g' \
|
||||
-e 's,\@LIBGTOP_VERSION\@,$(LIBGTOP_VERSION),g' \
|
||||
-e 's,\@LIBGTOP_VERSION_CODE\@,$(LIBGTOP_VERSION_CODE),g' \
|
||||
-e 's,\@LIBGTOP_SERVER_VERSION\@,$(LIBGTOP_SERVER_VERSION),g' \
|
||||
-e 's,\@libgtop_sysdeps_dir\@,$(libgtop_sysdeps_dir),g' \
|
||||
-e 's,\@libgtop_need_server\@,$(libgtop_need_server),g' \
|
||||
@@ -81,26 +77,6 @@ libgtop-config: libgtop-config.in Makefile
|
||||
&& mv libgtop-config.tmp libgtop-config && \
|
||||
chmod 755 libgtop-config
|
||||
|
||||
perl/Makefile.PL: perl/Makefile.PL.in Makefile
|
||||
## Use sed and then mv to avoid problems if the user interrupts.
|
||||
sed -e 's,\@LIBGTOP_LIBDIR\@,$(libdir),g' \
|
||||
-e 's,\@LIBGTOP_INCLUDEDIR\@,$(includedir),g' \
|
||||
-e 's,\@LIBGTOP_LIBS\@,$(LIBGTOP_LIBS),g' \
|
||||
-e 's,\@LIBGTOP_INCS\@,$(LIBGTOP_INCS),g' \
|
||||
-e 's,\@LIBGTOP_GUILE_LIBS\@,$(LIBGTOP_GUILE_LIBS),g' \
|
||||
-e 's,\@LIBGTOP_GUILE_INCS\@,$(LIBGTOP_GUILE_INCS),g' \
|
||||
-e 's,\@LIBGTOP_BINDIR\@,$(LIBGTOP_BINDIR),g' \
|
||||
-e 's,\@LIBGTOP_SERVER\@,$(LIBGTOP_SERVER),g' \
|
||||
-e 's,\@libgtop_sysdeps_dir\@,$(libgtop_sysdeps_dir),g' \
|
||||
-e 's,\@libgtop_need_server\@,$(libgtop_need_server),g' \
|
||||
-e 's,\@libgtop_use_machine_h\@,$(libgtop_use_machine_h),g' \
|
||||
-e 's,\@libgtop_guile_found\@,$(libgtop_guile_found),g' \
|
||||
-e 's,\@libgtop_want_names\@,$(libgtop_want_names),g' \
|
||||
-e 's,\@libgtop_want_guile_names\@,$(libgtop_want_guile_names),g' \
|
||||
-e 's,\@libgtop_want_examples\@,$(libgtop_want_examples),g' \
|
||||
< $(srcdir)/perl/Makefile.PL.in > perl/Makefile.tmp \
|
||||
&& mv perl/Makefile.tmp perl/Makefile.PL
|
||||
libgtop-features.def: features.def
|
||||
@LN_S@ $< $@
|
||||
|
||||
perl/Libgtop.xs: perl/perl.awk $(top_builddir)/config.h $(top_srcdir)/features.def
|
||||
$(AWK) -f $(top_srcdir)/perl/perl.awk < $(top_srcdir)/features.def > perl/lgt-t
|
||||
mv perl/lgt-t perl/Libgtop.xs
|
||||
|
48
TODO
Normal file
48
TODO
Normal file
@@ -0,0 +1,48 @@
|
||||
This is LibGTop 0.30.0,
|
||||
|
||||
a feature-freezed version of LibGTop for GNOME 1.0.
|
||||
|
||||
You need to use the latest version of LibGTop from CVS for Gnome, it will
|
||||
no longer work with older releases.
|
||||
|
||||
Martin
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
NOTE: LibGTop is already feature-freezed for GNOME 1.0, so only bug fixes
|
||||
are ok, no API changes !
|
||||
|
||||
Sysdeps directory 'linux':
|
||||
==========================
|
||||
|
||||
* Add implementation `netload' and `ppp' with modems.
|
||||
|
||||
* Add implementation for `proc_args'.
|
||||
|
||||
Sysdeps directory 'freebsd':
|
||||
============================
|
||||
|
||||
* FreeBSD 3.0: It works fine on this system, so please make sure not
|
||||
to break it here.
|
||||
|
||||
* FreeBSD 2.2: Make sure it still works here.
|
||||
|
||||
* NetBSD/OpenBSD: Support was added on Dec 6, but we need to check
|
||||
whether all data are valid.
|
||||
|
||||
Sysdeps directories 'kernel', 'osf1' and 'sun4':
|
||||
================================================
|
||||
|
||||
* You need to use the `--enable-hacker-mode' parameter to configure
|
||||
to build this directories.
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Everything except sysdeps directories:
|
||||
======================================
|
||||
|
||||
* Ready for Gnome 1.0. [ALREADY FEATURE FREEZED]
|
||||
|
||||
December 15, 1998
|
||||
|
||||
Martin
|
14
acconfig.h
14
acconfig.h
@@ -118,7 +118,6 @@
|
||||
#undef HAVE_LIBTIFF
|
||||
#undef HAVE_LIBZ
|
||||
#undef HAVE_LIBPNG
|
||||
#undef GNOME_ENABLE_DEBUG
|
||||
#undef HAVE_GMP2_INCLUDE_DIR
|
||||
#undef HAVE_GUILE
|
||||
|
||||
@@ -137,6 +136,19 @@
|
||||
#undef NEED_LIBGTOP
|
||||
|
||||
#undef HAVE_LINUX_TABLE
|
||||
#undef HAVE_LIBGTOP_SMP
|
||||
|
||||
#undef HAVE_XAUTH
|
||||
|
||||
/* Define if your have the I4B package. */
|
||||
#undef HAVE_I4B
|
||||
#undef HAVE_I4B_ACCT
|
||||
|
||||
/* Define to enable debugging. */
|
||||
#undef LIBGTOP_ENABLE_DEBUG
|
||||
#undef LIBGTOP_FATAL_WARNINGS
|
||||
|
||||
/* Same as LINUX_VERSION_CODE either from <linux/version.h> or from
|
||||
* the running kernel (if we don't have configured kernel sources).
|
||||
*/
|
||||
#undef GLIBTOP_LINUX_VERSION_CODE
|
||||
|
400
acinclude.m4
400
acinclude.m4
@@ -1,400 +0,0 @@
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.2h
|
||||
|
||||
dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
dnl This Makefile.in is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
dnl PARTICULAR PURPOSE.
|
||||
|
||||
######################################################################
|
||||
# progtest.m4 from gettext 0.32
|
||||
######################################################################
|
||||
# Search path for a program which passes the given test.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
|
||||
[# Extract the first word of "$2", so it can be a program name with args.
|
||||
set dummy $2; ac_word=[$]2
|
||||
AC_MSG_CHECKING([for $ac_word])
|
||||
AC_CACHE_VAL(ac_cv_path_$1,
|
||||
[case "[$]$1" in
|
||||
/*)
|
||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
if [$3]; then
|
||||
ac_cv_path_$1="$ac_dir/$ac_word"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
dnl If no 4th arg is given, leave the cache variable unset,
|
||||
dnl so AC_PATH_PROGS will keep looking.
|
||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||
])dnl
|
||||
;;
|
||||
esac])dnl
|
||||
$1="$ac_cv_path_$1"
|
||||
if test -n "[$]$1"; then
|
||||
AC_MSG_RESULT([$]$1)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
|
||||
|
||||
######################################################################
|
||||
# lcmessage.m4 from gettext 0.32
|
||||
######################################################################
|
||||
# Check whether LC_MESSAGES is available in <locale.h>.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_LC_MESSAGES,
|
||||
[if test $ac_cv_header_locale_h = yes; then
|
||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
||||
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
||||
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
||||
if test $am_cv_val_LC_MESSAGES = yes; then
|
||||
AC_DEFINE(HAVE_LC_MESSAGES)
|
||||
fi
|
||||
fi])
|
||||
|
||||
|
||||
|
||||
######################################################################
|
||||
# gettext.m4 from gettext 0.32
|
||||
######################################################################
|
||||
# Macro to add for using GNU gettext.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 3
|
||||
|
||||
AC_DEFUN(AM_WITH_NLS,
|
||||
[AC_MSG_CHECKING([whether NLS is requested])
|
||||
dnl Default is enabled NLS
|
||||
AC_ARG_ENABLE(nls,
|
||||
[ --disable-nls do not use Native Language Support],
|
||||
USE_NLS=$enableval, USE_NLS=yes)
|
||||
AC_MSG_RESULT($USE_NLS)
|
||||
AC_SUBST(USE_NLS)
|
||||
|
||||
USE_INCLUDED_LIBINTL=no
|
||||
|
||||
dnl If we use NLS figure out what method
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
AC_DEFINE(ENABLE_NLS)
|
||||
AC_MSG_CHECKING([whether included gettext is requested])
|
||||
AC_ARG_WITH(included-gettext,
|
||||
[ --with-included-gettext use the GNU gettext library included here],
|
||||
nls_cv_force_use_gnu_gettext=$withval,
|
||||
nls_cv_force_use_gnu_gettext=no)
|
||||
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
|
||||
|
||||
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
||||
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
||||
dnl User does not insist on using GNU NLS library. Figure out what
|
||||
dnl to use. If gettext or catgets are available (in this order) we
|
||||
dnl use this. Else we have to fall back to GNU NLS library.
|
||||
dnl catgets is only used if permitted by option --with-catgets.
|
||||
nls_cv_header_intl=
|
||||
nls_cv_header_libgt=
|
||||
CATOBJEXT=NONE
|
||||
|
||||
AC_CHECK_HEADER(libintl.h,
|
||||
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||
AC_CHECK_LIB(intl, bindtextdomain,
|
||||
[AC_CACHE_CHECK([for gettext in libintl],
|
||||
gt_cv_func_gettext_libintl,
|
||||
[AC_TRY_LINK([], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libintl=yes,
|
||||
gt_cv_func_gettext_libintl=no)])])
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" = "yes" \
|
||||
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT)
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
||||
if test "$MSGFMT" != "no"; then
|
||||
AC_CHECK_FUNCS(dcgettext)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
|
||||
return _nl_msg_cat_cntr],
|
||||
[CATOBJEXT=.gmo
|
||||
DATADIRNAME=share],
|
||||
[CATOBJEXT=.mo
|
||||
DATADIRNAME=lib])
|
||||
INSTOBJEXT=.mo
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
AC_MSG_CHECKING([whether catgets can be used])
|
||||
AC_ARG_WITH(catgets,
|
||||
[ --with-catgets use catgets functions if available],
|
||||
nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
|
||||
AC_MSG_RESULT($nls_cv_use_catgets)
|
||||
|
||||
if test "$nls_cv_use_catgets" = "yes"; then
|
||||
dnl No gettext in C library. Try catgets next.
|
||||
AC_CHECK_LIB(i, main)
|
||||
AC_CHECK_FUNC(catgets,
|
||||
[AC_DEFINE(HAVE_CATGETS)
|
||||
INTLOBJS="\$(CATOBJS)"
|
||||
AC_PATH_PROG(GENCAT, gencat, no)dnl
|
||||
if test "$GENCAT" != "no"; then
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
|
||||
if test "$GMSGFMT" = "no"; then
|
||||
AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
|
||||
fi
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.cat
|
||||
INSTOBJEXT=.cat
|
||||
DATADIRNAME=lib
|
||||
INTLDEPS='$(top_builddir)/intl/libintl.a'
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
dnl Neither gettext nor catgets in included in the C library.
|
||||
dnl Fall back on GNU gettext library.
|
||||
nls_cv_use_gnu_gettext=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||
dnl Mark actions used to generate GNU NLS library.
|
||||
INTLOBJS="\$(GETTOBJS)"
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_SUBST(MSGFMT)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.gmo
|
||||
INSTOBJEXT=.mo
|
||||
DATADIRNAME=share
|
||||
INTLDEPS='$(top_builddir)/intl/libintl.a'
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi
|
||||
|
||||
dnl Test whether we really found GNU xgettext.
|
||||
if test "$XGETTEXT" != ":"; then
|
||||
dnl If it is no GNU xgettext we define it as : so that the
|
||||
dnl Makefiles still can work.
|
||||
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
|
||||
: ;
|
||||
else
|
||||
AC_MSG_RESULT(
|
||||
[found xgettext programs is not GNU xgettext; ignore it])
|
||||
XGETTEXT=":"
|
||||
fi
|
||||
fi
|
||||
|
||||
# We need to process the po/ directory.
|
||||
POSUB=po
|
||||
else
|
||||
DATADIRNAME=share
|
||||
nls_cv_header_intl=intl/libintl.h
|
||||
nls_cv_header_libgt=intl/libgettext.h
|
||||
fi
|
||||
|
||||
# If this is used in GNU gettext we have to set USE_NLS to `yes'
|
||||
# because some of the sources are only built for this goal.
|
||||
if test "$PACKAGE" = gettext; then
|
||||
USE_NLS=yes
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
fi
|
||||
|
||||
dnl These rules are solely for the distribution goal. While doing this
|
||||
dnl we only have to keep exactly one list of the available catalogs
|
||||
dnl in configure.in.
|
||||
for lang in $ALL_LINGUAS; do
|
||||
GMOFILES="$GMOFILES $lang.gmo"
|
||||
POFILES="$POFILES $lang.po"
|
||||
done
|
||||
|
||||
dnl Make all variables we use known to autoconf.
|
||||
AC_SUBST(USE_INCLUDED_LIBINTL)
|
||||
AC_SUBST(CATALOGS)
|
||||
AC_SUBST(CATOBJEXT)
|
||||
AC_SUBST(DATADIRNAME)
|
||||
AC_SUBST(GMOFILES)
|
||||
AC_SUBST(INSTOBJEXT)
|
||||
AC_SUBST(INTLDEPS)
|
||||
AC_SUBST(INTLLIBS)
|
||||
AC_SUBST(INTLOBJS)
|
||||
AC_SUBST(POFILES)
|
||||
AC_SUBST(POSUB)
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_GNU_GETTEXT,
|
||||
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_REQUIRE([AC_C_CONST])dnl
|
||||
AC_REQUIRE([AC_C_INLINE])dnl
|
||||
AC_REQUIRE([AC_TYPE_OFF_T])dnl
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
||||
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
|
||||
unistd.h values.h sys/param.h])
|
||||
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
|
||||
__argz_count __argz_stringify __argz_next])
|
||||
|
||||
if test "${ac_cv_func_stpcpy+set}" != "set"; then
|
||||
AC_CHECK_FUNCS(stpcpy)
|
||||
fi
|
||||
if test "${ac_cv_func_stpcpy}" = "yes"; then
|
||||
AC_DEFINE(HAVE_STPCPY)
|
||||
fi
|
||||
|
||||
AM_LC_MESSAGES
|
||||
AM_WITH_NLS
|
||||
|
||||
if test "x$CATOBJEXT" != "x"; then
|
||||
if test "x$ALL_LINGUAS" = "x"; then
|
||||
LINGUAS=
|
||||
else
|
||||
AC_MSG_CHECKING(for catalogs to be installed)
|
||||
NEW_LINGUAS=
|
||||
for lang in ${LINGUAS=$ALL_LINGUAS}; do
|
||||
case "$ALL_LINGUAS" in
|
||||
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
|
||||
esac
|
||||
done
|
||||
LINGUAS=$NEW_LINGUAS
|
||||
AC_MSG_RESULT($LINGUAS)
|
||||
fi
|
||||
|
||||
dnl Construct list of names of catalog files to be constructed.
|
||||
if test -n "$LINGUAS"; then
|
||||
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl The reference to <locale.h> in the installed <libintl.h> file
|
||||
dnl must be resolved because we cannot expect the users of this
|
||||
dnl to define HAVE_LOCALE_H.
|
||||
if test $ac_cv_header_locale_h = yes; then
|
||||
INCLUDE_LOCALE_H="#include <locale.h>"
|
||||
else
|
||||
INCLUDE_LOCALE_H="\
|
||||
/* The system does not provide the header <locale.h>. Take care yourself. */"
|
||||
fi
|
||||
AC_SUBST(INCLUDE_LOCALE_H)
|
||||
|
||||
dnl Determine which catalog format we have (if any is needed)
|
||||
dnl For now we know about two different formats:
|
||||
dnl Linux libc-5 and the normal X/Open format
|
||||
test -d intl || mkdir intl
|
||||
if test "$CATOBJEXT" = ".cat"; then
|
||||
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
|
||||
|
||||
dnl Transform the SED scripts while copying because some dumb SEDs
|
||||
dnl cannot handle comments.
|
||||
sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
|
||||
fi
|
||||
dnl po2tbl.sed is always needed.
|
||||
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
|
||||
$srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
|
||||
|
||||
dnl In the intl/Makefile.in we have a special dependency which makes
|
||||
dnl only sense for gettext. We comment this out for non-gettext
|
||||
dnl packages.
|
||||
if test "$PACKAGE" = "gettext"; then
|
||||
GT_NO="#NO#"
|
||||
GT_YES=
|
||||
else
|
||||
GT_NO=
|
||||
GT_YES="#YES#"
|
||||
fi
|
||||
AC_SUBST(GT_NO)
|
||||
AC_SUBST(GT_YES)
|
||||
|
||||
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
|
||||
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
|
||||
dnl Try to locate is.
|
||||
MKINSTALLDIRS=
|
||||
if test -n "$ac_aux_dir"; then
|
||||
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
|
||||
fi
|
||||
if test -z "$MKINSTALLDIRS"; then
|
||||
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
|
||||
fi
|
||||
AC_SUBST(MKINSTALLDIRS)
|
||||
|
||||
dnl *** For now the libtool support in intl/Makefile is not for real.
|
||||
l=
|
||||
AC_SUBST(l)
|
||||
|
||||
dnl Generate list of files to be processed by xgettext which will
|
||||
dnl be included in po/Makefile.
|
||||
test -d po || mkdir po
|
||||
if test "x$srcdir" != "x."; then
|
||||
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
|
||||
posrcprefix="$srcdir/"
|
||||
else
|
||||
posrcprefix="../$srcdir/"
|
||||
fi
|
||||
else
|
||||
posrcprefix="../"
|
||||
fi
|
||||
rm -f po/POTFILES
|
||||
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
|
||||
< $srcdir/po/POTFILES.in > po/POTFILES
|
||||
])
|
883
config.guess
vendored
883
config.guess
vendored
@@ -1,883 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Written by Per Bothner <bothner@cygnus.com>.
|
||||
# The master version of this file is at the FSF in /home/gd/gnu/lib.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
#
|
||||
# The plan is that this can be called by configure scripts if you
|
||||
# don't specify an explicit system type (host/target name).
|
||||
#
|
||||
# Only a few systems have been added to this list; please add others
|
||||
# (but try to keep the structure clean).
|
||||
#
|
||||
|
||||
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
|
||||
# (ghazi@noc.rutgers.edu 8/24/94.)
|
||||
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
|
||||
PATH=$PATH:/.attbin ; export PATH
|
||||
fi
|
||||
|
||||
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
|
||||
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
|
||||
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
alpha:OSF1:*:*)
|
||||
if test $UNAME_RELEASE = "V4.0"; then
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||
fi
|
||||
# A Vn.n version is a released version.
|
||||
# A Tn.n version is a released field test version.
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
cat <<EOF >dummy.s
|
||||
.globl main
|
||||
.ent main
|
||||
main:
|
||||
.frame \$30,0,\$26,0
|
||||
.prologue 0
|
||||
.long 0x47e03d80 # implver $0
|
||||
lda \$2,259
|
||||
.long 0x47e20c21 # amask $2,$1
|
||||
srl \$1,8,\$2
|
||||
sll \$2,2,\$2
|
||||
sll \$0,3,\$0
|
||||
addl \$1,\$0,\$0
|
||||
addl \$2,\$0,\$0
|
||||
ret \$31,(\$26),1
|
||||
.end main
|
||||
EOF
|
||||
${CC-cc} dummy.s -o dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
./dummy
|
||||
case "$?" in
|
||||
7)
|
||||
UNAME_MACHINE="alpha"
|
||||
;;
|
||||
15)
|
||||
UNAME_MACHINE="alphaev5"
|
||||
;;
|
||||
14)
|
||||
UNAME_MACHINE="alphaev56"
|
||||
;;
|
||||
10)
|
||||
UNAME_MACHINE="alphapca56"
|
||||
;;
|
||||
16)
|
||||
UNAME_MACHINE="alphaev6"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -f dummy.s dummy
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
|
||||
exit 0 ;;
|
||||
21064:Windows_NT:50:3)
|
||||
echo alpha-dec-winnt3.5
|
||||
exit 0 ;;
|
||||
Amiga*:UNIX_System_V:4.0:*)
|
||||
echo m68k-cbm-sysv4
|
||||
exit 0;;
|
||||
amiga:NetBSD:*:*)
|
||||
echo m68k-cbm-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc64:OpenBSD:*:*)
|
||||
echo mips64el-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hkmips:OpenBSD:*:*)
|
||||
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pmax:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sgi:OpenBSD:*:*)
|
||||
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
wgrisc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit 0;;
|
||||
arm32:NetBSD:*:*)
|
||||
echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
SR2?01:HI-UX/MPP:*:*)
|
||||
echo hppa1.1-hitachi-hiuxmpp
|
||||
exit 0;;
|
||||
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
|
||||
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
|
||||
if test "`(/bin/universe) 2>/dev/null`" = att ; then
|
||||
echo pyramid-pyramid-sysv3
|
||||
else
|
||||
echo pyramid-pyramid-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
NILE:*:*:dcosx)
|
||||
echo pyramid-pyramid-svr4
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
i86pc:SunOS:5.*:*)
|
||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:6*:*)
|
||||
# According to config.sub, this is the proper way to canonicalize
|
||||
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
|
||||
# it's likely to be more like Solaris than SunOS4.
|
||||
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:*:*)
|
||||
case "`/usr/bin/arch -k`" in
|
||||
Series*|S4*)
|
||||
UNAME_RELEASE=`uname -v`
|
||||
;;
|
||||
esac
|
||||
# Japanese Language versions have a version number like `4.1.3-JL'.
|
||||
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
|
||||
exit 0 ;;
|
||||
sun3*:SunOS:*:*)
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun*:*:4.2BSD:*)
|
||||
UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
|
||||
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
|
||||
case "`/bin/arch`" in
|
||||
sun3)
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
;;
|
||||
sun4)
|
||||
echo sparc-sun-sunos${UNAME_RELEASE}
|
||||
;;
|
||||
esac
|
||||
exit 0 ;;
|
||||
aushp:SunOS:*:*)
|
||||
echo sparc-auspex-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:NetBSD:*:*)
|
||||
echo m68k-atari-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:NetBSD:*:*)
|
||||
echo m68k-sun-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:NetBSD:*:*)
|
||||
echo m68k-apple-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme88k:OpenBSD:*:*)
|
||||
echo m88k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
powerpc:machten:*:*)
|
||||
echo powerpc-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RISC*:Mach:*:*)
|
||||
echo mips-dec-mach_bsd4.3
|
||||
exit 0 ;;
|
||||
RISC*:ULTRIX:*:*)
|
||||
echo mips-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
VAX*:ULTRIX*:*:*)
|
||||
echo vax-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
2020:CLIX:*:*)
|
||||
echo clipper-intergraph-clix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:*:*:UMIPS | mips:*:*:RISCos)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
int main (argc, argv) int argc; char **argv; {
|
||||
#if defined (host_mips) && defined (MIPSEB)
|
||||
#if defined (SYSTYPE_SYSV)
|
||||
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#if defined (SYSTYPE_SVR4)
|
||||
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
|
||||
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
exit (-1);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy \
|
||||
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
|
||||
&& rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo mips-mips-riscos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
Night_Hawk:Power_UNIX:*:*)
|
||||
echo powerpc-harris-powerunix
|
||||
exit 0 ;;
|
||||
m88k:CX/UX:7*:*)
|
||||
echo m88k-harris-cxux7
|
||||
exit 0 ;;
|
||||
m88k:*:4*:R4*)
|
||||
echo m88k-motorola-sysv4
|
||||
exit 0 ;;
|
||||
m88k:*:3*:R3*)
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
AViiON:dgux:*:*)
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
|
||||
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
|
||||
echo m88k-dg-dgux${UNAME_RELEASE}
|
||||
else
|
||||
echo m88k-dg-dguxbcs${UNAME_RELEASE}
|
||||
fi
|
||||
else echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
exit 0 ;;
|
||||
M88*:*:R3*:*)
|
||||
# Delta 88k system running SVR3
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
|
||||
echo m88k-tektronix-sysv3
|
||||
exit 0 ;;
|
||||
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
|
||||
echo m68k-tektronix-bsd
|
||||
exit 0 ;;
|
||||
*:IRIX*:*:*)
|
||||
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
|
||||
exit 0 ;;
|
||||
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
|
||||
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
|
||||
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
|
||||
i?86:AIX:*:*)
|
||||
echo i386-ibm-aix
|
||||
exit 0 ;;
|
||||
*:AIX:2:3)
|
||||
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <sys/systemcfg.h>
|
||||
|
||||
main()
|
||||
{
|
||||
if (!__power_pc())
|
||||
exit(1);
|
||||
puts("powerpc-ibm-aix3.2.5");
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo rs6000-ibm-aix3.2.5
|
||||
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
echo rs6000-ibm-aix3.2.4
|
||||
else
|
||||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit 0 ;;
|
||||
*:AIX:*:4)
|
||||
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
else
|
||||
IBM_ARCH=powerpc
|
||||
fi
|
||||
if [ -x /usr/bin/oslevel ] ; then
|
||||
IBM_REV=`/usr/bin/oslevel`
|
||||
else
|
||||
IBM_REV=4.${UNAME_RELEASE}
|
||||
fi
|
||||
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
|
||||
exit 0 ;;
|
||||
*:AIX:*:*)
|
||||
echo rs6000-ibm-aix
|
||||
exit 0 ;;
|
||||
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
|
||||
echo romp-ibm-bsd4.4
|
||||
exit 0 ;;
|
||||
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
|
||||
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
|
||||
exit 0 ;; # report: romp-ibm BSD 4.3
|
||||
*:BOSX:*:*)
|
||||
echo rs6000-bull-bosx
|
||||
exit 0 ;;
|
||||
DPX/2?00:B.O.S.:*:*)
|
||||
echo m68k-bull-sysv3
|
||||
exit 0 ;;
|
||||
9000/[34]??:4.3bsd:1.*:*)
|
||||
echo m68k-hp-bsd
|
||||
exit 0 ;;
|
||||
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
|
||||
echo m68k-hp-bsd4.4
|
||||
exit 0 ;;
|
||||
9000/[3478]??:HP-UX:*:*)
|
||||
case "${UNAME_MACHINE}" in
|
||||
9000/31? ) HP_ARCH=m68000 ;;
|
||||
9000/[34]?? ) HP_ARCH=m68k ;;
|
||||
9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
|
||||
9000/8?? ) HP_ARCH=hppa1.0 ;;
|
||||
esac
|
||||
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||
exit 0 ;;
|
||||
3050*:HI-UX:*:*)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <unistd.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
|
||||
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
|
||||
results, however. */
|
||||
if (CPU_IS_PA_RISC (cpu))
|
||||
{
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
|
||||
default: puts ("hppa-hitachi-hiuxwe2"); break;
|
||||
}
|
||||
}
|
||||
else if (CPU_IS_HP_MC68K (cpu))
|
||||
puts ("m68k-hitachi-hiuxwe2");
|
||||
else puts ("unknown-hitachi-hiuxwe2");
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo unknown-hitachi-hiuxwe2
|
||||
exit 0 ;;
|
||||
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
|
||||
echo hppa1.1-hp-bsd
|
||||
exit 0 ;;
|
||||
9000/8??:4.3bsd:*:*)
|
||||
echo hppa1.0-hp-bsd
|
||||
exit 0 ;;
|
||||
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
|
||||
echo hppa1.1-hp-osf
|
||||
exit 0 ;;
|
||||
hp8??:OSF1:*:*)
|
||||
echo hppa1.0-hp-osf
|
||||
exit 0 ;;
|
||||
i?86:OSF1:*:*)
|
||||
if [ -x /usr/sbin/sysversion ] ; then
|
||||
echo ${UNAME_MACHINE}-unknown-osf1mk
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-osf1
|
||||
fi
|
||||
exit 0 ;;
|
||||
parisc*:Lites*:*:*)
|
||||
echo hppa1.1-hp-lites
|
||||
exit 0 ;;
|
||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
CRAY*X-MP:*:*:*)
|
||||
echo xmp-cray-unicos
|
||||
exit 0 ;;
|
||||
CRAY*Y-MP:*:*:*)
|
||||
echo ymp-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY*[A-Z]90:*:*:*)
|
||||
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
|
||||
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
|
||||
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||
exit 0 ;;
|
||||
CRAY*TS:*:*:*)
|
||||
echo t90-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY-2:*:*:*)
|
||||
echo cray2-cray-unicos
|
||||
exit 0 ;;
|
||||
F300:UNIX_System_V:*:*)
|
||||
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit 0 ;;
|
||||
F301:UNIX_System_V:*:*)
|
||||
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
|
||||
exit 0 ;;
|
||||
hp3[0-9][05]:NetBSD:*:*)
|
||||
echo m68k-hp-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hp300:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i?86:BSD/386:*:* | *:BSD/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:FreeBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
*:NetBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo i386-pc-cygwin32
|
||||
exit 0 ;;
|
||||
i*:MINGW*:*)
|
||||
echo i386-pc-mingw32
|
||||
exit 0 ;;
|
||||
p*:CYGWIN*:*)
|
||||
echo powerpcle-unknown-cygwin32
|
||||
exit 0 ;;
|
||||
prep*:SunOS:5.*:*)
|
||||
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
*:GNU:*:*)
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
*:Linux:*:*)
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us.
|
||||
ld_help_string=`ld --help 2>&1`
|
||||
ld_supported_emulations=`echo $ld_help_string \
|
||||
| sed -ne '/supported emulations:/!d
|
||||
s/[ ][ ]*/ /g
|
||||
s/.*supported emulations: *//
|
||||
s/ .*//
|
||||
p'`
|
||||
case "$ld_supported_emulations" in
|
||||
i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
|
||||
i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
|
||||
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
|
||||
esac
|
||||
|
||||
if test "${UNAME_MACHINE}" = "alpha" ; then
|
||||
sed 's/^ //' <<EOF >dummy.s
|
||||
.globl main
|
||||
.ent main
|
||||
main:
|
||||
.frame \$30,0,\$26,0
|
||||
.prologue 0
|
||||
.long 0x47e03d80 # implver $0
|
||||
lda \$2,259
|
||||
.long 0x47e20c21 # amask $2,$1
|
||||
srl \$1,8,\$2
|
||||
sll \$2,2,\$2
|
||||
sll \$0,3,\$0
|
||||
addl \$1,\$0,\$0
|
||||
addl \$2,\$0,\$0
|
||||
ret \$31,(\$26),1
|
||||
.end main
|
||||
EOF
|
||||
LIBC=""
|
||||
${CC-cc} dummy.s -o dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
./dummy
|
||||
case "$?" in
|
||||
7)
|
||||
UNAME_MACHINE="alpha"
|
||||
;;
|
||||
15)
|
||||
UNAME_MACHINE="alphaev5"
|
||||
;;
|
||||
14)
|
||||
UNAME_MACHINE="alphaev56"
|
||||
;;
|
||||
10)
|
||||
UNAME_MACHINE="alphapca56"
|
||||
;;
|
||||
16)
|
||||
UNAME_MACHINE="alphaev6"
|
||||
;;
|
||||
esac
|
||||
|
||||
objdump --private-headers dummy | \
|
||||
grep ld.so.1 > /dev/null
|
||||
if test "$?" = 0 ; then
|
||||
LIBC="libc1"
|
||||
fi
|
||||
fi
|
||||
rm -f dummy.s dummy
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "mips" ; then
|
||||
cat >dummy.c <<EOF
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#ifdef __MIPSEB__
|
||||
printf ("%s-unknown-linux-gnu\n", argv[1]);
|
||||
#endif
|
||||
#ifdef __MIPSEL__
|
||||
printf ("%sel-unknown-linux-gnu\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
else
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld)
|
||||
# or one that does not give us useful --help.
|
||||
# GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
|
||||
# If ld does not provide *any* "supported emulations:"
|
||||
# that means it is gnuoldld.
|
||||
echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
|
||||
test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
|
||||
|
||||
case "${UNAME_MACHINE}" in
|
||||
i?86)
|
||||
VENDOR=pc;
|
||||
;;
|
||||
*)
|
||||
VENDOR=unknown;
|
||||
;;
|
||||
esac
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
cat >dummy.c <<EOF
|
||||
#include <features.h>
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#ifdef __ELF__
|
||||
# ifdef __GLIBC__
|
||||
# if __GLIBC__ >= 2
|
||||
printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
|
||||
# else
|
||||
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
|
||||
# endif
|
||||
# else
|
||||
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
|
||||
# endif
|
||||
#else
|
||||
printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
fi ;;
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
||||
# are messed up and put the nodename in both sysname and nodename.
|
||||
i?86:DYNIX/ptx:4*:*)
|
||||
echo i386-sequent-sysv4
|
||||
exit 0 ;;
|
||||
i?86:UNIX_SV:4.2MP:2.*)
|
||||
# Unixware is an offshoot of SVR4, but it has its own version
|
||||
# number series starting with 2...
|
||||
# I am not positive that other SVR4 systems won't match this,
|
||||
# I just have to hope. -- rms.
|
||||
# Use sysv4.2uw... so that sysv4* matches it.
|
||||
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||
exit 0 ;;
|
||||
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
|
||||
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i?86:*:3.2:*)
|
||||
if test -f /usr/options/cb.name; then
|
||||
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
|
||||
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
|
||||
elif /bin/uname -X 2>/dev/null >/dev/null ; then
|
||||
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
|
||||
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
|
||||
&& UNAME_MACHINE=i586
|
||||
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv32
|
||||
fi
|
||||
exit 0 ;;
|
||||
pc:*:*:*)
|
||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
# the processor, so we play safe by assuming i386.
|
||||
echo i386-pc-msdosdjgpp
|
||||
exit 0 ;;
|
||||
Intel:Mach:3*:*)
|
||||
echo i386-pc-mach3
|
||||
exit 0 ;;
|
||||
paragon:*:*:*)
|
||||
echo i860-intel-osf1
|
||||
exit 0 ;;
|
||||
i860:*:4.*:*) # i860-SVR4
|
||||
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
|
||||
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
|
||||
else # Add other i860-SVR4 vendors below as they are discovered.
|
||||
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
|
||||
fi
|
||||
exit 0 ;;
|
||||
mini*:CTIX:SYS*5:*)
|
||||
# "miniframe"
|
||||
echo m68010-convergent-sysv
|
||||
exit 0 ;;
|
||||
M68*:*:R3V[567]*:*)
|
||||
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
|
||||
OS_REL=''
|
||||
test -r /etc/.relid \
|
||||
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
|
||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
|
||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4 && exit 0 ;;
|
||||
m68*:LynxOS:2.*:*)
|
||||
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mc68030:UNIX_System_V:4.*:*)
|
||||
echo m68k-atari-sysv4
|
||||
exit 0 ;;
|
||||
i?86:LynxOS:2.*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
TSUNAMI:LynxOS:2.*:*)
|
||||
echo sparc-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
|
||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
SM[BE]S:UNIX_SV:*:*)
|
||||
echo mips-dde-sysv${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RM*:SINIX-*:*:*)
|
||||
echo mips-sni-sysv4
|
||||
exit 0 ;;
|
||||
*:SINIX-*:*:*)
|
||||
if uname -p 2>/dev/null >/dev/null ; then
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
echo ${UNAME_MACHINE}-sni-sysv4
|
||||
else
|
||||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit 0 ;;
|
||||
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit 0 ;;
|
||||
*:UNIX_System_V:4*:FTX*)
|
||||
# From Gerald Hewes <hewes@openmarket.com>.
|
||||
# How about differentiating between stratus architectures? -djm
|
||||
echo hppa1.1-stratus-sysv4
|
||||
exit 0 ;;
|
||||
*:*:*:FTX*)
|
||||
# From seanf@swdc.stratus.com.
|
||||
echo i860-stratus-sysv4
|
||||
exit 0 ;;
|
||||
mc68*:A/UX:*:*)
|
||||
echo m68k-apple-aux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
news*:NEWS-OS:*:6*)
|
||||
echo mips-sony-newsos6
|
||||
exit 0 ;;
|
||||
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
|
||||
if [ -d /usr/nec ]; then
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
cat >dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
main ()
|
||||
{
|
||||
#if defined (sony)
|
||||
#if defined (MIPSEB)
|
||||
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
|
||||
I don't know.... */
|
||||
printf ("mips-sony-bsd\n"); exit (0);
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
printf ("m68k-sony-newsos%s\n",
|
||||
#ifdef NEWSOS4
|
||||
"4"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__arm) && defined (__acorn) && defined (__unix)
|
||||
printf ("arm-acorn-riscix"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (hp300) && !defined (hpux)
|
||||
printf ("m68k-hp-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (NeXT)
|
||||
#if !defined (__ARCHITECTURE__)
|
||||
#define __ARCHITECTURE__ "m68k"
|
||||
#endif
|
||||
int version;
|
||||
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
|
||||
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
||||
exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (MULTIMAX) || defined (n16)
|
||||
#if defined (UMAXV)
|
||||
printf ("ns32k-encore-sysv\n"); exit (0);
|
||||
#else
|
||||
#if defined (CMU)
|
||||
printf ("ns32k-encore-mach\n"); exit (0);
|
||||
#else
|
||||
printf ("ns32k-encore-bsd\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__386BSD__)
|
||||
printf ("i386-pc-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (sequent)
|
||||
#if defined (i386)
|
||||
printf ("i386-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#if defined (ns32000)
|
||||
printf ("ns32k-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_SEQUENT_)
|
||||
struct utsname un;
|
||||
|
||||
uname(&un);
|
||||
|
||||
if (strncmp(un.version, "V2", 2) == 0) {
|
||||
printf ("i386-sequent-ptx2\n"); exit (0);
|
||||
}
|
||||
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
|
||||
printf ("i386-sequent-ptx1\n"); exit (0);
|
||||
}
|
||||
printf ("i386-sequent-ptx\n"); exit (0);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (vax)
|
||||
#if !defined (ultrix)
|
||||
printf ("vax-dec-bsd\n"); exit (0);
|
||||
#else
|
||||
printf ("vax-dec-ultrix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (alliant) && defined (i860)
|
||||
printf ("i860-alliant-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
exit (1);
|
||||
}
|
||||
EOF
|
||||
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
|
||||
# Apollos put the system type in the environment.
|
||||
|
||||
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
|
||||
|
||||
# Convex versions that predate uname can use getsysinfo(1)
|
||||
|
||||
if [ -x /usr/convex/getsysinfo ]
|
||||
then
|
||||
case `getsysinfo -f cpu_type` in
|
||||
c1*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
c2*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
c34*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
c38*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
c4*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#echo '(Unable to guess system type)' 1>&2
|
||||
|
||||
exit 1
|
954
config.sub
vendored
954
config.sub
vendored
@@ -1,954 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# This file 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.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
# that are meaningful with *any* GNU software.
|
||||
# Each package is responsible for reporting which valid configurations
|
||||
# it does not support. The user should be able to distinguish
|
||||
# a failure to support a valid configuration from a meaningless
|
||||
# configuration.
|
||||
|
||||
# The goal of this file is to map all the various variations of a given
|
||||
# machine specification into a single specification in the form:
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or in some cases, the newer four-part form:
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# It is wrong to echo any other type of specification.
|
||||
|
||||
if [ x$1 = x ]
|
||||
then
|
||||
echo Configuration name missing. 1>&2
|
||||
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
||||
echo "or $0 ALIAS" 1>&2
|
||||
echo where ALIAS is a recognized configuration type. 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# First pass through any local machine types.
|
||||
case $1 in
|
||||
*local*)
|
||||
echo $1
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
linux-gnu*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
then os=`echo $1 | sed 's/.*-/-/'`
|
||||
else os=; fi
|
||||
;;
|
||||
esac
|
||||
|
||||
### Let's recognize common machines as not being operating systems so
|
||||
### that things like config.sub decstation-3100 work. We also
|
||||
### recognize some manufacturers as not being operating systems, so we
|
||||
### can provide default operating systems below.
|
||||
case $os in
|
||||
-sun*os*)
|
||||
# Prevent following clause from handling this invalid input.
|
||||
;;
|
||||
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
|
||||
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
|
||||
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco5)
|
||||
os=sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco4)
|
||||
os=-sco3.2v4
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2.[4-9]*)
|
||||
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2v[4-9]*)
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco*)
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-isc)
|
||||
os=-isc2.2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-clix*)
|
||||
basic_machine=clipper-intergraph
|
||||
;;
|
||||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
;;
|
||||
-ptx*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
|
||||
;;
|
||||
-windowsnt*)
|
||||
os=`echo $os | sed -e 's/windowsnt/winnt/'`
|
||||
;;
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
|
||||
| arme[lb] | pyramid | mn10200 | mn10300 \
|
||||
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
|
||||
| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
|
||||
| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
|
||||
| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
|
||||
| mipstx39 | mipstx39el \
|
||||
| sparc | sparclet | sparclite | sparc64 | v850)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i[3456]86)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
*-*-*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
|
||||
| xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
|
||||
| alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
|
||||
| ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
|
||||
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||
| sparc64-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| f301-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||
basic_machine=m68000-att
|
||||
;;
|
||||
3b*)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
alliant | fx80)
|
||||
basic_machine=fx80-alliant
|
||||
;;
|
||||
altos | altos3068)
|
||||
basic_machine=m68k-altos
|
||||
;;
|
||||
am29k)
|
||||
basic_machine=a29k-none
|
||||
os=-bsd
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
;;
|
||||
amiga | amiga-*)
|
||||
basic_machine=m68k-cbm
|
||||
;;
|
||||
amigaos | amigados)
|
||||
basic_machine=m68k-cbm
|
||||
os=-amigaos
|
||||
;;
|
||||
amigaunix | amix)
|
||||
basic_machine=m68k-cbm
|
||||
os=-sysv4
|
||||
;;
|
||||
apollo68)
|
||||
basic_machine=m68k-apollo
|
||||
os=-sysv
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
;;
|
||||
balance)
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
convex-c1)
|
||||
basic_machine=c1-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c2)
|
||||
basic_machine=c2-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c32)
|
||||
basic_machine=c32-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c34)
|
||||
basic_machine=c34-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c38)
|
||||
basic_machine=c38-convex
|
||||
os=-bsd
|
||||
;;
|
||||
cray | ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cray2)
|
||||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
[ctj]90-cray)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
|
||||
basic_machine=mips-dec
|
||||
;;
|
||||
delta | 3300 | motorola-3300 | motorola-delta \
|
||||
| 3300-motorola | delta-motorola)
|
||||
basic_machine=m68k-motorola
|
||||
;;
|
||||
delta88)
|
||||
basic_machine=m88k-motorola
|
||||
os=-sysv3
|
||||
;;
|
||||
dpx20 | dpx20-*)
|
||||
basic_machine=rs6000-bull
|
||||
os=-bosx
|
||||
;;
|
||||
dpx2* | dpx2*-bull)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv3
|
||||
;;
|
||||
ebmon29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-ebmon
|
||||
;;
|
||||
elxsi)
|
||||
basic_machine=elxsi-elxsi
|
||||
os=-bsd
|
||||
;;
|
||||
encore | umax | mmax)
|
||||
basic_machine=ns32k-encore
|
||||
;;
|
||||
fx2800)
|
||||
basic_machine=i860-alliant
|
||||
;;
|
||||
genix)
|
||||
basic_machine=ns32k-ns
|
||||
;;
|
||||
gmicro)
|
||||
basic_machine=tron-gmicro
|
||||
os=-sysv
|
||||
;;
|
||||
h3050r* | hiux*)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
h8300hms)
|
||||
basic_machine=h8300-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
harris)
|
||||
basic_machine=m88k-harris
|
||||
os=-sysv3
|
||||
;;
|
||||
hp300-*)
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp300bsd)
|
||||
basic_machine=m68k-hp
|
||||
os=-bsd
|
||||
;;
|
||||
hp300hpux)
|
||||
basic_machine=m68k-hp
|
||||
os=-hpux
|
||||
;;
|
||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||
basic_machine=m68000-hp
|
||||
;;
|
||||
hp9k3[2-9][0-9])
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hppa-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[3456]86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i[3456]86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i[3456]86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i[3456]86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
-irix*)
|
||||
;;
|
||||
*)
|
||||
os=-irix4
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
isi68 | isi)
|
||||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
m88k-omron*)
|
||||
basic_machine=m88k-omron
|
||||
;;
|
||||
magnum | m3230)
|
||||
basic_machine=mips-mips
|
||||
os=-sysv
|
||||
;;
|
||||
merlin)
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
mipsel*-linux*)
|
||||
basic_machine=mipsel-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips*-linux*)
|
||||
basic_machine=mips-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips3*-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||
;;
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
basic_machine=m68k-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news1000)
|
||||
basic_machine=m68030-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news-3600 | risc-news)
|
||||
basic_machine=mips-sony
|
||||
os=-newsos
|
||||
;;
|
||||
next | m*-next )
|
||||
basic_machine=m68k-next
|
||||
case $os in
|
||||
-nextstep* )
|
||||
;;
|
||||
-ns2*)
|
||||
os=-nextstep2
|
||||
;;
|
||||
*)
|
||||
os=-nextstep3
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
nh3000)
|
||||
basic_machine=m68k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nh[45]000)
|
||||
basic_machine=m88k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nindy960)
|
||||
basic_machine=i960-intel
|
||||
os=-nindy
|
||||
;;
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
pa-hitachi)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
paragon)
|
||||
basic_machine=i860-intel
|
||||
os=-osf
|
||||
;;
|
||||
pbd)
|
||||
basic_machine=sparc-tti
|
||||
;;
|
||||
pbb)
|
||||
basic_machine=m68k-tti
|
||||
;;
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5)
|
||||
basic_machine=i586-intel
|
||||
;;
|
||||
pentiumpro | p6)
|
||||
basic_machine=i686-intel
|
||||
;;
|
||||
pentium-* | p5-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
k5)
|
||||
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
|
||||
basic_machine=i586-amd
|
||||
;;
|
||||
nexen)
|
||||
# We don't have specific support for Nexgen yet, so just call it a Pentium
|
||||
basic_machine=i586-nexgen
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=rs6000-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
basic_machine=powerpcle-unknown
|
||||
;;
|
||||
ppcle-* | powerpclittle-*)
|
||||
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
rm[46]00)
|
||||
basic_machine=mips-siemens
|
||||
;;
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
sh)
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sps7)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv2
|
||||
;;
|
||||
spur)
|
||||
basic_machine=spur-unknown
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
sun2os3)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun2os4)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun3os3)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun3os4)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4os3)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun4os4)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4sol2)
|
||||
basic_machine=sparc-sun
|
||||
os=-solaris2
|
||||
;;
|
||||
sun3 | sun3-*)
|
||||
basic_machine=m68k-sun
|
||||
;;
|
||||
sun4)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
sun386 | sun386i | roadrunner)
|
||||
basic_machine=i386-sun
|
||||
;;
|
||||
symmetry)
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
tx39el)
|
||||
basic_machine=mipstx39el-unknown
|
||||
;;
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
udi29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
ultra3)
|
||||
basic_machine=a29k-nyu
|
||||
os=-sym1
|
||||
;;
|
||||
vaxv)
|
||||
basic_machine=vax-dec
|
||||
os=-sysv
|
||||
;;
|
||||
vms)
|
||||
basic_machine=vax-dec
|
||||
os=-vms
|
||||
;;
|
||||
vpp*|vx|vx-*)
|
||||
basic_machine=f301-fujitsu
|
||||
;;
|
||||
vxworks960)
|
||||
basic_machine=i960-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks68)
|
||||
basic_machine=m68k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks29k)
|
||||
basic_machine=a29k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
;;
|
||||
|
||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||
# some cases the only manufacturer, in others, it is the most popular.
|
||||
mips)
|
||||
if [ x$os = x-linux-gnu ]; then
|
||||
basic_machine=mips-unknown
|
||||
else
|
||||
basic_machine=mips-mips
|
||||
fi
|
||||
;;
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
rs6000)
|
||||
basic_machine=rs6000-ibm
|
||||
;;
|
||||
vax)
|
||||
basic_machine=vax-dec
|
||||
;;
|
||||
pdp11)
|
||||
basic_machine=pdp11-dec
|
||||
;;
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sparc)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
basic_machine=cydra-cydrome
|
||||
;;
|
||||
orion)
|
||||
basic_machine=orion-highlevel
|
||||
;;
|
||||
orion105)
|
||||
basic_machine=clipper-highlevel
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Here we canonicalize certain aliases for manufacturers.
|
||||
case $basic_machine in
|
||||
*-digital*)
|
||||
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
|
||||
;;
|
||||
*-commodore*)
|
||||
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode manufacturer-specific aliases for certain operating systems.
|
||||
|
||||
if [ x"$os" != x"" ]
|
||||
then
|
||||
case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
;;
|
||||
-solaris)
|
||||
os=-solaris2
|
||||
;;
|
||||
-svr4*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-unixware*)
|
||||
os=-sysv4.2uw
|
||||
;;
|
||||
-gnu/linux*)
|
||||
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
||||
;;
|
||||
# First accept the basic system types.
|
||||
# The portable systems comes first.
|
||||
# Each alternative MUST END IN A *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
-sunos5*)
|
||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
||||
;;
|
||||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
-osf*)
|
||||
os=-osf
|
||||
;;
|
||||
-utek*)
|
||||
os=-bsd
|
||||
;;
|
||||
-dynix*)
|
||||
os=-bsd
|
||||
;;
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
# Preserve the version number of sinix5.
|
||||
-sinix5.*)
|
||||
os=`echo $os | sed -e 's|sinix|sysv|'`
|
||||
;;
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-triton*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-oss*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-svr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
-svr3)
|
||||
os=-sysv3
|
||||
;;
|
||||
-sysvr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
# This must come after -sysvr4.
|
||||
-sysv*)
|
||||
;;
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
# Get rid of the `-' at the beginning of $os.
|
||||
os=`echo $os | sed 's/[^-]*-//'`
|
||||
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
|
||||
# Here we handle the default operating systems that come with various machines.
|
||||
# The value should be what the vendor currently ships out the door with their
|
||||
# machine or put another way, the most popular os provided with the machine.
|
||||
|
||||
# Note that if you're going to try to match "-MANUFACTURER" here (say,
|
||||
# "-sun"), then you have to tell the case statement up towards the top
|
||||
# that MANUFACTURER isn't an operating system. Otherwise, code above
|
||||
# will signal an error saying that MANUFACTURER isn't an operating
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
pdp11-*)
|
||||
os=-none
|
||||
;;
|
||||
*-dec | vax-*)
|
||||
os=-ultrix4.2
|
||||
;;
|
||||
m68*-apollo)
|
||||
os=-domain
|
||||
;;
|
||||
i386-sun)
|
||||
os=-sunos4.0.2
|
||||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
sparc-* | *-sun)
|
||||
os=-sunos4.1.1
|
||||
;;
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-hp)
|
||||
os=-hpux
|
||||
;;
|
||||
*-hitachi)
|
||||
os=-hiux
|
||||
;;
|
||||
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
|
||||
os=-sysv
|
||||
;;
|
||||
*-cbm)
|
||||
os=-amigaos
|
||||
;;
|
||||
*-dg)
|
||||
os=-dgux
|
||||
;;
|
||||
*-dolphin)
|
||||
os=-sysv3
|
||||
;;
|
||||
m68k-ccur)
|
||||
os=-rtu
|
||||
;;
|
||||
m88k-omron*)
|
||||
os=-luna
|
||||
;;
|
||||
*-next )
|
||||
os=-nextstep
|
||||
;;
|
||||
*-sequent)
|
||||
os=-ptx
|
||||
;;
|
||||
*-crds)
|
||||
os=-unos
|
||||
;;
|
||||
*-ns)
|
||||
os=-genix
|
||||
;;
|
||||
i370-*)
|
||||
os=-mvs
|
||||
;;
|
||||
*-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
*-gould)
|
||||
os=-sysv
|
||||
;;
|
||||
*-highlevel)
|
||||
os=-bsd
|
||||
;;
|
||||
*-encore)
|
||||
os=-bsd
|
||||
;;
|
||||
*-sgi)
|
||||
os=-irix
|
||||
;;
|
||||
*-siemens)
|
||||
os=-sysv4
|
||||
;;
|
||||
*-masscomp)
|
||||
os=-rtu
|
||||
;;
|
||||
f301-fujitsu)
|
||||
os=-uxpv
|
||||
;;
|
||||
*)
|
||||
os=-none
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Here we handle the case where we know the os, and the CPU type, but not the
|
||||
# manufacturer. We pick the logical manufacturer.
|
||||
vendor=unknown
|
||||
case $basic_machine in
|
||||
*-unknown)
|
||||
case $os in
|
||||
-riscix*)
|
||||
vendor=acorn
|
||||
;;
|
||||
-sunos*)
|
||||
vendor=sun
|
||||
;;
|
||||
-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-hpux*)
|
||||
vendor=hp
|
||||
;;
|
||||
-hiux*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
-unos*)
|
||||
vendor=crds
|
||||
;;
|
||||
-dgux*)
|
||||
vendor=dg
|
||||
;;
|
||||
-luna*)
|
||||
vendor=omron
|
||||
;;
|
||||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-vxsim* | -vxworks*)
|
||||
vendor=wrs
|
||||
;;
|
||||
-aux*)
|
||||
vendor=apple
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
124
configure.in
124
configure.in
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
Mnl Configure script for the Gnome library
|
||||
dnl Configure script for the Gnome library
|
||||
dnl
|
||||
|
||||
AC_INIT(copyright.txt)
|
||||
@@ -16,6 +16,7 @@ AC_SUBST(LIBGTOP_INTERFACE_AGE)
|
||||
AC_SUBST(LIBGTOP_BINARY_AGE)
|
||||
AC_SUBST(LIBGTOP_SERVER_VERSION)
|
||||
AC_SUBST(LIBGTOP_VERSION)
|
||||
AC_SUBST(LIBGTOP_VERSION_CODE)
|
||||
|
||||
# libtool versioning
|
||||
LT_RELEASE=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION
|
||||
@@ -29,7 +30,7 @@ AC_SUBST(LT_CURRENT)
|
||||
AC_SUBST(LT_REVISION)
|
||||
AC_SUBST(LT_AGE)
|
||||
|
||||
AM_ACLOCAL_INCLUDE(macros)
|
||||
AM_ACLOCAL_INCLUDE(. macros)
|
||||
|
||||
AC_ISC_POSIX
|
||||
AC_PROG_CC
|
||||
@@ -58,10 +59,20 @@ export cross_compiling
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl If you want to use libgtop without gnome, comment the following line out.
|
||||
dnl Let the user enable compiler warnings
|
||||
GNOME_COMPILE_WARNINGS
|
||||
|
||||
GNOME_INIT_HOOK(gnome_found=yes)
|
||||
|
||||
if test "x$gnome_found" != xyes; then
|
||||
if test "x$want_gnome" != xno ; then
|
||||
AC_MSG_ERROR([
|
||||
*** GNOME was not found on this system. ***
|
||||
|
||||
*** If you want to use LibGTop without GNOME, you need
|
||||
*** to give configure the --without-gnome parameter.
|
||||
])
|
||||
fi
|
||||
GNOME_SUPPORT_CHECKS
|
||||
else
|
||||
AM_CONDITIONAL(BUILD_GNOME_SUPPORT, false)
|
||||
@@ -71,16 +82,13 @@ fi
|
||||
GNOME_LIBGTOP_SYSDEPS
|
||||
GNOME_LIBGTOP_TYPES
|
||||
|
||||
GNOME_CHECK_GUILE
|
||||
|
||||
dnl For Solaris
|
||||
AC_CHECK_LIB(socket, socket)
|
||||
|
||||
AC_ARG_WITH(libgtop-guile,
|
||||
[ --with-libgtop-guile Build the libgtop guile interface (default=yes)],
|
||||
[ --with-libgtop-guile Build the libgtop guile interface (default=no)],
|
||||
[build_guile="$withval"], [build_guile=yes])
|
||||
|
||||
test x$build_guile = xno && ac_cv_guile_found=no
|
||||
if test x$build_guile != xno ; then
|
||||
GNOME_CHECK_GUILE
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(libgtop-inodedb,
|
||||
[ --with-libgtop-inodedb Build the inodedb stuff (default=no)],
|
||||
@@ -104,20 +112,41 @@ if test x$ac_cv_guile_found = xyes ; then
|
||||
AC_DEFINE(GLIBTOP_GUILE)
|
||||
AC_DEFINE(GLIBTOP_GUILE_NAMES)
|
||||
libgtop_guile_found=yes
|
||||
guile_examples='third third_static'
|
||||
guile_examples='third'
|
||||
guile_static_examples='third_static'
|
||||
guile_subdirs='guile'
|
||||
else
|
||||
libgtop_guile_found=no
|
||||
guile_examples=
|
||||
guile_static_examples=
|
||||
guile_subdirs=
|
||||
fi
|
||||
|
||||
if test x$libgtop_smp = xyes ; then
|
||||
smp_examples='smp'
|
||||
smp_static_examples='smp_static'
|
||||
else
|
||||
smp_examples=
|
||||
smp_static_examples=
|
||||
fi
|
||||
|
||||
if test "x$enable_static" != xno; then
|
||||
static_targets="first_static second_static mountlist_static procmap_static netload_static sysdeps_static $guile_static_examples $smp_static_examples"
|
||||
else
|
||||
static_targets=""
|
||||
fi
|
||||
|
||||
AC_SUBST(static_targets)
|
||||
AC_SUBST(smp_examples)
|
||||
AC_SUBST(guile_examples)
|
||||
AC_SUBST(guile_subdirs)
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl You need to uncomment the following line if you want to use libgtop without Gnome.
|
||||
AM_PATH_GLIB(1.1.3,,AC_MSG_ERROR(GLIB >= 1.1.3 is required for LibGTop))
|
||||
|
||||
dnl You need to uncomment the following line if you want to use
|
||||
dnl libGTop without Gnome.
|
||||
dnl GNOME_SUPPORT_CHECKS
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
@@ -163,11 +192,18 @@ AC_TYPE_SIGNAL
|
||||
AC_FUNC_STRFTIME
|
||||
AC_CHECK_FUNCS(getcwd gettimeofday getwd putenv strdup strtoul uname)
|
||||
|
||||
ALL_LINGUAS="fr"
|
||||
AM_GNU_GETTEXT
|
||||
dnl ## all 'es_??' are only needed for format numbers different of 'es'
|
||||
ALL_LINGUAS="de es es_DO es_GT es_HN es_MX es_PA es_PE es_SV fr ko no"
|
||||
AM_GNOME_GETTEXT
|
||||
|
||||
AC_PATH_XTRA
|
||||
|
||||
dnl For Solaris
|
||||
dnl Please don't move this before AC_PATH_XTRA
|
||||
AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
|
||||
AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect)])
|
||||
AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton)])
|
||||
|
||||
dnl The construct foo=`echo $w1 $w2 $w3` fails on some systems if $w1 = -e or -n
|
||||
dnl So we use the following instead.
|
||||
dnl XE_SPACE(var, words)
|
||||
@@ -179,7 +215,8 @@ $1="$T"
|
||||
|
||||
dnl Autodetect Xauth
|
||||
dnl -lXau is only used by gnuclient, so use a special variable for Xauth X libs
|
||||
test -z "$with_xauth" && test "$window_system" = "none" && with_xauth=no
|
||||
saved_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
|
||||
test -z "$with_xauth" && { AC_CHECK_HEADER(X11/Xauth.h, ,with_xauth=no) }
|
||||
test -z "$with_xauth" && { AC_CHECK_LIB(Xau, XauGetAuthByAddr,[:],with_xauth=no, $X_LIBS) }
|
||||
test -z "$with_xauth" && with_xauth=yes
|
||||
@@ -187,44 +224,47 @@ if test "$with_xauth" = "yes"; then
|
||||
AC_DEFINE(HAVE_XAUTH)
|
||||
XE_SPACE(libs_xauth, $X_LIBS -lXau)
|
||||
fi
|
||||
CPPFLAGS="$saved_CPPFLAGS"
|
||||
AC_SUBST(libs_xauth)
|
||||
|
||||
dnl For diskusage stuff
|
||||
GNOME_FILEUTILS_CHECKS
|
||||
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],AC_DEFINE(GNOME_ENABLE_DEBUG),)
|
||||
dnl Debugging
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],AC_DEFINE(LIBGTOP_ENABLE_DEBUG),)
|
||||
AC_ARG_ENABLE(fatal-warnings, [ --enable-fatal-warnings make all warnings fatal [debug=no]],AC_DEFINE(LIBGTOP_FATAL_WARNINGS),)
|
||||
|
||||
LIBSUPPORT=
|
||||
SUPPORTINCS=
|
||||
if test "$need_gnome_support" = yes; then
|
||||
if test "x$gnome_found" = xyes ; then
|
||||
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
|
||||
SUPPORTINCS="$GNOME_INCLUDEDIR"
|
||||
else
|
||||
LIBSUPPORT='$(top_builddir)/support/libgnomesupport.la'
|
||||
SUPPORTINCS='-DNEED_GNOMESUPPORT_H -I$(top_builddir)/support -I$(top_srcdir)/support'
|
||||
fi
|
||||
if test "x$gnome_found" = xyes ; then
|
||||
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
|
||||
SUPPORTINCS="$GNOME_INCLUDEDIR"
|
||||
else
|
||||
LIBSUPPORT='$(top_builddir)/support/libgnomesupport.la'
|
||||
SUPPORTINCS='-DNEED_GNOMESUPPORT_H -I$(top_builddir)/support -I$(top_srcdir)/support'
|
||||
fi
|
||||
|
||||
dnl Some ugly hack; if '-lgnomesupport' is part of $GNOME_LIBS,
|
||||
dnl we include it here.
|
||||
echo "$GNOME_LIBS" | grep -q -e '-lgnomesupport'
|
||||
if test $? = 0 ; then
|
||||
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
|
||||
SUPPORTINCS="$GNOME_INCLUDEDIR"
|
||||
fi
|
||||
case "$GNOME_LIBS" in
|
||||
'*-lgnomesupport*' )
|
||||
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
|
||||
SUPPORTINCS="$GNOME_INCLUDEDIR" ;;
|
||||
esac
|
||||
AC_SUBST(LIBSUPPORT)
|
||||
AC_SUBST(SUPPORTINCS)
|
||||
|
||||
dnl These definitions are expanded in make.
|
||||
LIBGTOP_LIBS='-L$(libdir) -lgtop'
|
||||
LIBGTOP_LIBS='-L$(libdir)'
|
||||
LIBGTOP_INCS='-I$(includedir)'
|
||||
|
||||
if test x$build_inodedb = xyes ; then
|
||||
LIBGTOP_INCS="$LIBGTOP_INCS -DGLIBTOP_INODEDB"
|
||||
fi
|
||||
|
||||
LIBGTOP_INCS="$LIBGTOP_INCS $SUPPORTINCS"
|
||||
if test x$libgtop_have_sysinfo = xyes ; then
|
||||
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SYSINFO"
|
||||
fi
|
||||
|
||||
LIBGTOP_INCS="$LIBGTOP_INCS $SUPPORTINCS $GLIB_CFLAGS"
|
||||
|
||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_LIBS"
|
||||
LIBGTOP_GUILE_INCS="$LIBGTOP_INCS"
|
||||
@@ -243,18 +283,19 @@ fi
|
||||
|
||||
AC_SUBST(libgtop_guile_found)
|
||||
|
||||
if test -z $LIBGTOP_EXTRA_LIBS ; then
|
||||
if test -z "$LIBGTOP_EXTRA_LIBS" ; then
|
||||
LIBGTOP_EXTRA_LIBS="$libs_xauth"
|
||||
else
|
||||
LIBGTOP_EXTRA_LIBS="$LIBGTOP_EXTRA_LIBS $libs_xauth"
|
||||
fi
|
||||
|
||||
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop_common -lgtop_sysdeps"
|
||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_common -lgtop_sysdeps"
|
||||
LIBGTOP_EXTRA_LIBS="$LIBGTOP_EXTRA_LIBS $GLIB_LIBS"
|
||||
|
||||
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop_common -lgtop -lgtop_sysdeps"
|
||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_common -lgtop -lgtop_sysdeps"
|
||||
|
||||
LIBGTOP_NAMES_LIBS="$LIBGTOP_LIBS -lgtop_names"
|
||||
LIBGTOP_GUILE_NAMES_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_guile_names"
|
||||
LIBGTOP_GUILE_NAMES_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_names"
|
||||
LIBGTOP_GUILE_NAMES_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_guile_names -lgtop_names"
|
||||
|
||||
LIBGTOP_LIBS="$LIBGTOP_LIBS"
|
||||
LIBGTOP_NAMES_LIBS="$LIBGTOP_NAMES_LIBS"
|
||||
@@ -278,7 +319,7 @@ else
|
||||
guile_def=""
|
||||
fi
|
||||
|
||||
INCLUDES="-D_IN_LIBGTOP -D_GNU_SOURCE -DGLIBTOP_NAMES -I\$(top_builddir) -I\$(top_srcdir) -I\$(top_srcdir)/sysdeps/$sysdeps_dir -I\$(top_srcdir)/include -I\$(top_srcdir)/intl $SUPPORTINCS -W -Wall -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith $CFLAGS $guile_def "'-DGTOPLOCALEDIR=\"$(datadir)/locale\" -DLIBGTOP_VERSION=\"'"$LIBGTOP_VERSION"'\" -DLIBGTOP_SERVER_VERSION=\"'"$LIBGTOP_SERVER_VERSION"'\" -DLIBGTOP_SERVER=\"'"$LIBGTOP_SERVER"'\"'
|
||||
INCLUDES="-D_IN_LIBGTOP -D_GNU_SOURCE -DGLIBTOP_NAMES -I\$(top_builddir) -I\$(top_srcdir) -I\$(top_srcdir)/sysdeps/$sysdeps_dir -I\$(top_srcdir)/include -I\$(top_srcdir)/intl $SUPPORTINCS $GLIB_CFLAGS $CFLAGS $X_CFLAGS $guile_def "'-DGTOPLOCALEDIR=\"$(datadir)/locale\" -DLIBGTOP_VERSION=\"'"$LIBGTOP_VERSION"'\" -DLIBGTOP_SERVER_VERSION=\"'"$LIBGTOP_SERVER_VERSION"'\" -DLIBGTOP_SERVER=\"'"$LIBGTOP_SERVER"'\"'
|
||||
|
||||
AC_SUBST(INCLUDES)
|
||||
|
||||
@@ -309,6 +350,7 @@ AC_OUTPUT([
|
||||
Makefile
|
||||
po/Makefile.in
|
||||
intl/Makefile
|
||||
misc/Makefile
|
||||
include/Makefile
|
||||
include/glibtop/Makefile
|
||||
sysdeps/Makefile
|
||||
@@ -327,8 +369,6 @@ src/Makefile
|
||||
src/daemon/Makefile
|
||||
src/inodedb/Makefile
|
||||
lib/Makefile
|
||||
guile/Makefile
|
||||
examples/Makefile
|
||||
perl/Makefile.PL
|
||||
support/Makefile
|
||||
macros/Makefile],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
|
||||
macros/Makefile])
|
||||
|
@@ -1,10 +0,0 @@
|
||||
*.shml
|
||||
*.ced
|
||||
.timestamp
|
||||
.timestamp2
|
||||
.timestamp3
|
||||
.timestamp4
|
||||
gnome-hackers
|
||||
libgtop
|
||||
libgtop-ref
|
||||
table
|
@@ -1,18 +0,0 @@
|
||||
1998-08-12 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* features: New directory.
|
||||
* gnome-hackers.sgml: Updated documentation.
|
||||
|
||||
1998-08-11 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* gnome-hackers.sgml: Updated documentation.
|
||||
* autoconf.sgml: New file, included from `gnome-hackers.sgml'.
|
||||
|
||||
1998-07-21 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* gnome-hackers.sgml: Added note that this file is
|
||||
currently out of date and a link to the documentation
|
||||
of the table () function.
|
||||
|
||||
* table.sgml: New file - basic documentation for the
|
||||
table () system call.
|
39
doc/Makefile
39
doc/Makefile
@@ -1,39 +0,0 @@
|
||||
all: .timestamp .timestamp2 .timestamp3 .timestamp4
|
||||
|
||||
clean:
|
||||
-rm -f .timestamp*
|
||||
-rm -rf libgtop gnome-hackers libgtop-ref table
|
||||
|
||||
.timestamp: libgtop.sgml
|
||||
-rm -rf libgtop
|
||||
mkdir libgtop
|
||||
-rm -f .timestamp
|
||||
jade -D /usr/lib/sgml -d libgtop.dsl -t sgml \
|
||||
-V %no-make-index% libgtop.sgml > /dev/null && \
|
||||
touch .timestamp
|
||||
|
||||
.timestamp2: gnome-hackers.sgml autoconf.sgml ../guile/reference.sgml \
|
||||
features/uptime.sgml features/uptime.txt features/proclist.sgml \
|
||||
features/procmem.sgml
|
||||
-rm -rf gnome-hackers
|
||||
mkdir gnome-hackers
|
||||
-rm -f .timestamp2
|
||||
jade -D /usr/lib/sgml -d gnome-hackers.dsl -t sgml \
|
||||
-V %no-make-index% gnome-hackers.sgml > /dev/null && \
|
||||
touch .timestamp2
|
||||
|
||||
.timestamp3: libgtop-ref.sgml ../guile/reference.sgml
|
||||
-rm -rf libgtop-ref
|
||||
mkdir libgtop-ref
|
||||
-rm -f .timestamp3
|
||||
jade -D /usr/lib/sgml -d libgtop-ref.dsl -t sgml \
|
||||
-V %no-make-index% libgtop-ref.sgml > /dev/null && \
|
||||
touch .timestamp3
|
||||
|
||||
.timestamp4: table.sgml
|
||||
-rm -rf table
|
||||
mkdir table
|
||||
-rm -f .timestamp4
|
||||
jade -D /usr/lib/sgml -d table.dsl -t sgml \
|
||||
-V %no-make-index% table.sgml > /dev/null && \
|
||||
touch .timestamp4
|
@@ -1,253 +0,0 @@
|
||||
<sect1 id="macros">
|
||||
<title>Autoconf macros</title>
|
||||
|
||||
<para>
|
||||
All you need to check for &libgtop; is in &gnome-libgtop-check.m4;,
|
||||
just use <function>GNOME_INIT_LIBGTOP</function> with an optional
|
||||
<parameter>fail</parameter> argument in the same way like
|
||||
<function>GNOME_INIT</function>:
|
||||
|
||||
<example>
|
||||
<title>Warn if &libgtop; cannot be found</title>
|
||||
|
||||
<programlisting>GNOME_INIT_LIBGTOP</programlisting>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>Abort if &libgtop; cannot be found</title>
|
||||
|
||||
<programlisting>GNOME_INIT_LIBGTOP(fail)</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
This will define a <function>HAVE_LIBGTOP</function> automake
|
||||
conditional and everything from the configuration script of
|
||||
&libgtop;.
|
||||
|
||||
<sect1 id="libgtopConf.sh">
|
||||
<title>The configuration script of &libgtop; (&libgtopConf.sh;)</title>
|
||||
|
||||
<para>
|
||||
After a successful build of &libgtop;, a &libgtopConf.sh; script
|
||||
containing useful configuration variables is created.
|
||||
|
||||
<para>
|
||||
It defines the following variables which you can use in your
|
||||
<filename>Makefile.am</filename>:
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_LIBDIR</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
The directory where the library files of &libgtop; are installed.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_INCLUDEDIR</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
The directory where the header files of &libgtop; are installed.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_LIBS</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Use this to link your program with &libgtop;.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_INCS</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Use this to get the header files for &libgtop;.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_NAMES_LIBS</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Use this to link your program with &libgtop; and its
|
||||
names interface.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_NAMES_INCS</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Use this to get the header files for &libgtop; and the
|
||||
required <literal>-DGLIBTOP_NAMES</literal> to get its
|
||||
names interface.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_GUILE_LIBS</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Use this to link your program with &libgtop; and its
|
||||
guile interface. This will also include all the required
|
||||
guile libraries.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_GUILE_INCS</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Use this to get the header files for &libgtop; and guile
|
||||
and the required <literal>-DGLIBTOP_GUILE</literal> to get
|
||||
the guile interface of &libgtop;.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_GUILE_NAMES_LIBS</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Use this to link your program with &libgtop; and both its
|
||||
names and its guile interface. This will also include all the
|
||||
required guile libraries.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_GUILE_NAMES_INCS</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Use this to get the header files for &libgtop;, its guile
|
||||
and its names interface, the guile header files and the
|
||||
required <literal>-DGLIBTOP_GUILE</literal> and
|
||||
<literal>-DGLIBTOP_NAMES</literal>.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_BINDIR</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
The directory where the binaries of &libgtop; are installed.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_SERVER</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Full pathname of the &libgtop; server.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_MAJOR_VERSION</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Major version of &libgtop;.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_MINOR_VERSION</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Minor version of &libgtop;.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_VERSION</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Full version of &libgtop;.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>LIBGTOP_SERVER_VERSION</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Version of the &libgtop; server. This is incremented each
|
||||
time the client/server protocol changes.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>libgtop_sysdeps_dir</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
The sysdeps directory that is used on your system.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>libgtop_need_server</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Either <literal>yes</literal> or <literal>no</literal>.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>libgtop_use_machine_h</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Either <literal>yes</literal> or <literal>no</literal>.
|
||||
Intended for <emphasis>internal use only</emphasis>
|
||||
and may be removed in future versions.
|
||||
|
||||
<note>
|
||||
<title>Note for &libgtop; hackers</title>
|
||||
|
||||
<para>
|
||||
This variable gets set in
|
||||
<filename>macros/gnome-libgtop-sysdeps.m4</filename>.
|
||||
|
||||
<para>
|
||||
If this is enabled, you need to put a
|
||||
<filename>glibtop_machine.h</filename> header file in the
|
||||
sysdeps directory which needs to define a structure of
|
||||
type <type>glibtop_machine</type>.
|
||||
|
||||
<para>
|
||||
This structure represents the
|
||||
<structfield>machine</structfield> field of
|
||||
<type>glibtop</type> defined in
|
||||
<filename>glibtop.h</filename>
|
||||
and can be used to store some
|
||||
machine dependent data.
|
||||
</note>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>libgtop_guile_found</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Either <literal>yes</literal> or <literal>no</literal>.
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>libgtop_want_examples</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Considered obsolete.
|
||||
|
||||
</variablelist>
|
||||
|
||||
<para>
|
||||
All this variables are taken from the
|
||||
&libgtopConf.sh; script which is created during
|
||||
the installation of &libgtop;.
|
||||
|
||||
<example>
|
||||
<title>
|
||||
Sample &libgtopConf.sh; (gnome and guile are installed in
|
||||
<filename>/home/baulig/INSTALL</filename> and &libgtop; in
|
||||
<filename>/home/norwegen/TEST</filename>)
|
||||
</title>
|
||||
|
||||
<programlisting>&example-libgtopConf-sh;</programlisting>
|
||||
</example>
|
||||
|
||||
</sect1>
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:2
|
||||
sgml-indent-data: t
|
||||
sgml-parent-document: ("gnome-hackers.sgml" "book" "chapter" "")
|
||||
End:
|
||||
-->
|
@@ -1,3 +0,0 @@
|
||||
PUBLIC "-//James Clark//DTD DSSSL Flow Object Tree//EN" "fot.dtd"
|
||||
PUBLIC "ISO/IEC 10179:1996//DTD DSSSL Architecture//EN" "dsssl.dtd"
|
||||
PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" "style-sheet.dtd"
|
1627
doc/dbtohtml.dsl
1627
doc/dbtohtml.dsl
File diff suppressed because it is too large
Load Diff
@@ -1,153 +0,0 @@
|
||||
<para>
|
||||
This functions takes the following additional parameters:
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>which</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
You can use the following constants (defined in
|
||||
<filename>glibtop/proclist.h</filename>) to tell
|
||||
<function>glibtop_get_proclist ()</function> which processes
|
||||
to fetch:
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>GLIBTOP_KERN_PROC_ALL</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Fetch all processes.
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>GLIBTOP_KERN_PROC_PID</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Fetch process with pid <parameter>arg</parameter> or
|
||||
nothing if no such process exists.
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>GLIBTOP_KERN_PROC_PGRP</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Fetch only processes which are in process group
|
||||
<parameter>arg</parameter>.
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>GLIBTOP_KERN_PROC_SESSION</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Fetch only processes with session id
|
||||
<parameter>arg</parameter>.
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>GLIBTOP_KERN_PROC_TTY</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Fetch only processes with tty id
|
||||
<parameter>arg</parameter>.
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>GLIBTOP_KERN_PROC_UID</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Fetch only processes with effective user id
|
||||
<parameter>arg</parameter>.
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>GLIBTOP_KERN_PROC_RUID</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Fetch only processes with real user id
|
||||
<parameter>arg</parameter>.
|
||||
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
<para>
|
||||
You can use one or more of the following flags (with a
|
||||
logical or) to hide some processes:
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>GLIBTOP_EXCLUDE_IDLE</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Don't fetch idle processes.
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>GLIBTOP_EXCLUDE_SYSTEM</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Don't fetch system processes.
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>GLIBTOP_EXCLUDE_NOTTY</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Don't fetch processes that have no controlling tty.
|
||||
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><parameter>arg</parameter></term>
|
||||
<listitem>
|
||||
|
||||
<para>
|
||||
Additional argument depending upon the
|
||||
<parameter>which</parameter> argument.
|
||||
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<para>
|
||||
This function returns a pointer (of type <type>unsigned *</type>) to
|
||||
the list of process ids.
|
||||
|
||||
<para>
|
||||
You have to manually &glibtop-free; this pointer once finished with it.
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:2
|
||||
sgml-indent-data: t
|
||||
sgml-parent-document: ("../gnome-hackers.sgml" "book" "sect1" "")
|
||||
End:
|
||||
-->
|
||||
|
@@ -1,103 +0,0 @@
|
||||
<para>
|
||||
The automatically generated description above is taken from the
|
||||
manual page of the <filename>/proc</filename> filesystem under Linux
|
||||
and is a little bit confusing, so I make this clear here.
|
||||
|
||||
<note>
|
||||
<title>Note for people porting &libgtop; to other systems</title>
|
||||
|
||||
<para>
|
||||
Well, every operating system has its own idea about the memory usage
|
||||
of a processes, and also system utilities like <filename>ps</filename>
|
||||
show different things on different systems.
|
||||
|
||||
<para>
|
||||
Nevertheless, we should try to make &libgtop; as system independent
|
||||
as possible, so I give you some hints here how &glibtop-get-procmem;
|
||||
should work.
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
When you use &mmap; with either &MAP-SHARED; or &MAP-PRIVATE;,
|
||||
this should only affect the &pmem-vsize; of the process and
|
||||
none of its &pmem-size;, &pmem-resident;, &pmem-shared; and
|
||||
&pmem-rss; sizes.
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
As soon as you read some of the &mmap;ed pages, they will be
|
||||
demand-loaded and thus count towards the &pmem-size; of the
|
||||
process. Also - we assume there is enough free memory - they
|
||||
are resident in memory until they get stolen or swapped out
|
||||
and thus increase the &pmem-resident; and &pmem-rss; sizes of
|
||||
the process.
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
If the process has used &MAP-SHARED; and another process
|
||||
attaches the same file also &MAP-SHARED; some of the pages
|
||||
are shared with this process and thus increase the &pmem-shared;
|
||||
sizes of both processes.
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
If the process has used &MAP-PRIVATE; and writes to the &mmap;ed
|
||||
pages, the only difference to reading from them is that they
|
||||
get dirty and cannot be stolen any longer but will get swapped
|
||||
out.
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
If memory gets rare, clean pages are normally stolen which
|
||||
decreases the &pmem-size;, &pmem-resident;, &pmem-shared; and
|
||||
&pmem-rss; sizes of the process.
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
When dirty pages are swapped out, this will
|
||||
<emphasis>not</emphasis> decrease the &pmem-size; of the
|
||||
process but only its &pmem-resident; and &pmem-rss; sizes
|
||||
(dirty pages cannot be shared).
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
The &pmem-vsize; of a process can <emphasis>only</emphasis>
|
||||
be changed by the process itself when it requests or frees
|
||||
memory but <emphasis>never</emphasis> due to swapping
|
||||
activity of the system.
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
If the &pmem-shared; size changes, this
|
||||
<emphasis>only</emphasis> means that the number of pages that
|
||||
are currently shared with other processes has changed; if this
|
||||
happens, this will <emphasis>never</emphasis> affect any of the
|
||||
other sizes of the process.
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
</note>
|
||||
|
||||
<para>
|
||||
The hints above describe how it works under Linux - and we should try to
|
||||
make &glibtop-get-procmem; show the same behavior under every other
|
||||
system.
|
||||
|
||||
<para>
|
||||
If you want to make any comments, flames, suggestions about this, please
|
||||
feel free to do so.
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:2
|
||||
sgml-indent-data: t
|
||||
sgml-parent-document: ("../gnome-hackers.sgml" "book" "sect1" "")
|
||||
End:
|
||||
-->
|
||||
|
@@ -1,23 +0,0 @@
|
||||
<note>
|
||||
|
||||
<para>
|
||||
You can calculate this from the CPU usage (this one is taken
|
||||
from the FreeBSD port):
|
||||
|
||||
<programlisting>&include-uptime.txt;</programlisting>
|
||||
|
||||
</note>
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:2
|
||||
sgml-indent-data: t
|
||||
sgml-parent-document: ("../gnome-hackers.sgml" "book" "sect1" "")
|
||||
End:
|
||||
-->
|
||||
|
@@ -1,40 +0,0 @@
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/error.h>
|
||||
#include <glibtop/uptime.h>
|
||||
|
||||
#include <glibtop/cpu.h>
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_uptime =
|
||||
(1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME);
|
||||
|
||||
static const unsigned long _required_cpu_flags =
|
||||
(1 << GLIBTOP_CPU_TOTAL) + (1 << GLIBTOP_CPU_IDLE) +
|
||||
(1 << GLIBTOP_CPU_FREQUENCY);
|
||||
|
||||
void
|
||||
glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf)
|
||||
{
|
||||
glibtop_cpu cpu;
|
||||
|
||||
glibtop_init_p (server, GLIBTOP_SYSDEPS_UPTIME, 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_uptime));
|
||||
|
||||
/* We simply calculate it from the CPU usage. */
|
||||
|
||||
glibtop_get_cpu_p (server, &cpu);
|
||||
|
||||
/* Make sure all required fields are present. */
|
||||
|
||||
if ((cpu.flags & _required_cpu_flags) != _required_cpu_flags)
|
||||
return;
|
||||
|
||||
/* Calculate values. */
|
||||
|
||||
buf->uptime = (double) cpu.total / (double) cpu.frequency;
|
||||
buf->idletime = (double) cpu.idle / (double) cpu.frequency;
|
||||
|
||||
buf->flags = _glibtop_sysdeps_uptime;
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
|
||||
<!ENTITY dbtohtml.dsl SYSTEM "dbtohtml.dsl" CDATA DSSSL >
|
||||
]>
|
||||
|
||||
<style-specification id="gnomehackersdbotohtml" use="dbtohtml">
|
||||
|
||||
(define %output-basename% "gnome-hackers")
|
||||
(define %output-directory% "gnome-hackers")
|
||||
|
||||
</style-specification>
|
||||
|
||||
<external-specification id="dbtohtml" document="dbtohtml.dsl">
|
@@ -1,187 +0,0 @@
|
||||
<!-- $Id$ -->
|
||||
|
||||
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
|
||||
<!-- Site-specific entities, change them if you want to copy this
|
||||
document somewhere else. -->
|
||||
<!entity home-of-linux "http://www.home-of-linux.org/">
|
||||
|
||||
<!-- Some general entities -->
|
||||
|
||||
<!entity libgtop "<productname>libgtop</productname>">
|
||||
|
||||
<!-- Some abbreviations for often used filenames and functions. -->
|
||||
|
||||
<!entity gnome-libgtop-check.m4 "<filename>macros/gnome-libgtop-check.m4</filename>">
|
||||
<!entity libgtopConf.sh "<filename>libgtopConf.sh</filename>">
|
||||
<!entity glibtop-free "<function>glibtop_free ()</function>">
|
||||
<!entity glibtop-get-procmem "<function>glibtop_get_proc_mem ()</function>">
|
||||
<!entity mmap "<function>mmap ()</function>">
|
||||
<!entity MAP-SHARED "<parameter>MAP_SHARED</parameter>">
|
||||
<!entity MAP-PRIVATE "<parameter>MAP_PRIVATE</parameter>">
|
||||
<!entity pmem-vsize "<structfield>procmem.vsize</structfield>">
|
||||
<!entity pmem-size "<structfield>procmem.size</structfield>">
|
||||
<!entity pmem-resident "<structfield>procmem.resident</structfield>">
|
||||
<!entity pmem-shared "<structfield>procmem.shared</structfield>">
|
||||
<!entity pmem-rss "<structfield>procmem.rss</structfield>">
|
||||
|
||||
<!-- This will include a sample `libgtopConf.sh'. -->
|
||||
|
||||
<!entity example-libgtopConf-sh SYSTEM "libgtopConf.sh">
|
||||
|
||||
<!-- Some entities to include other files. -->
|
||||
|
||||
<!entity include-autoconf.sgml SYSTEM "autoconf.sgml">
|
||||
<!entity include-reference.sgml SYSTEM "../guile/reference.sgml">
|
||||
|
||||
<!-- The following entities are used in the automatically generated
|
||||
`reference.sgml' to include custom descriptions of the features.
|
||||
-->
|
||||
|
||||
<!entity include-cpu.sgml "">
|
||||
<!entity include-mem.sgml "">
|
||||
<!entity include-swap.sgml "">
|
||||
<!entity include-uptime.sgml SYSTEM "features/uptime.sgml">
|
||||
<!entity include-loadavg.sgml "">
|
||||
<!entity include-shm-limits.sgml "">
|
||||
<!entity include-msg-limits.sgml "">
|
||||
<!entity include-sem-limits.sgml "">
|
||||
<!entity include-proclist.sgml SYSTEM "features/proclist.sgml">
|
||||
<!entity include-proc-state.sgml "">
|
||||
<!entity include-proc-uid.sgml "">
|
||||
<!entity include-proc-mem.sgml SYSTEM "features/procmem.sgml">
|
||||
<!entity include-proc-time.sgml "">
|
||||
<!entity include-proc-signal.sgml "">
|
||||
<!entity include-proc-kernel.sgml "">
|
||||
<!entity include-proc-segment.sgml "">
|
||||
<!entity include-proc-map.sgml "">
|
||||
<!entity include-mountlist.sgml "">
|
||||
<!entity include-fsusage.sgml "">
|
||||
|
||||
<!entity include-uptime.txt SYSTEM "features/uptime.txt">
|
||||
]>
|
||||
<book>
|
||||
<bookinfo>
|
||||
<title>Using Libgtop in the Gnome Project</title>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Martin</firstname>
|
||||
<surname>Baulig</surname>
|
||||
<affiliation>
|
||||
<address>
|
||||
<email>martin@home-of-linux.org</email>
|
||||
</address>
|
||||
</affiliation>
|
||||
</author>
|
||||
</authorgroup>
|
||||
<copyright>
|
||||
<year>1998</year>
|
||||
<holder>Martin Baulig</holder>
|
||||
</copyright>
|
||||
|
||||
<legalnotice>
|
||||
|
||||
<para>
|
||||
This documentation 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.
|
||||
|
||||
<para>
|
||||
This library 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.
|
||||
|
||||
<para>
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this program; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
MA 02111-1307 USA
|
||||
|
||||
<para>
|
||||
For more details see the file COPYING in the source
|
||||
distribution of &libgtop;.</para>
|
||||
|
||||
</legalnotice>
|
||||
|
||||
<abstract>
|
||||
<para>
|
||||
<literal>
|
||||
$Id$
|
||||
</literal>
|
||||
|
||||
<para>
|
||||
This is a short introduction in how to use
|
||||
<productname>libgtop</productname> in the GNOME project.
|
||||
It describes the additional options <filename>configure</filename>
|
||||
takes and the information stored in the automatically generated
|
||||
<filename>libgtopConf.sh</filename> configuration script.
|
||||
|
||||
<note>
|
||||
<para>
|
||||
Documentation about the new <function>table ()</function>
|
||||
function can be found here:
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<ulink url="&home-of-linux;kernel/table/">
|
||||
&home-of-linux;kernel/table/
|
||||
</ulink>
|
||||
</itemizedlist>
|
||||
</note>
|
||||
|
||||
</abstract>
|
||||
|
||||
</bookinfo>
|
||||
|
||||
<toc></toc>
|
||||
|
||||
<chapter id="autoconf-automake">
|
||||
<title>Configuration</title>
|
||||
|
||||
&include-autoconf.sgml;
|
||||
|
||||
</chapter>
|
||||
|
||||
<chapter id="functions">
|
||||
<title>Function Reference List</title>
|
||||
|
||||
&include-reference.sgml;
|
||||
|
||||
</chapter>
|
||||
|
||||
<chapter id="porting-libgtop">
|
||||
<title>Porting &libgtop; to other systems</title>
|
||||
|
||||
<para>
|
||||
Here are some comments for people porting &libgtop; to other systems.
|
||||
|
||||
<sect1>
|
||||
<title>&glibtop-get-procmem; - Process Memory information</title>
|
||||
|
||||
<para>
|
||||
This section is copied here from the description of
|
||||
&glibtop-get-procmem;.
|
||||
</para>
|
||||
|
||||
&include-proc-mem.sgml;
|
||||
|
||||
</sect1>
|
||||
|
||||
</chapter>
|
||||
|
||||
</book>
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:2
|
||||
sgml-indent-data: t
|
||||
End:
|
||||
-->
|
@@ -1,12 +0,0 @@
|
||||
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
|
||||
<!ENTITY dbtohtml.dsl SYSTEM "dbtohtml.dsl" CDATA DSSSL >
|
||||
]>
|
||||
|
||||
<style-specification id="libgtoprefdbtohtml" use="dbtohtml">
|
||||
|
||||
(define %output-basename% "libgtop-ref")
|
||||
(define %output-directory% "libgtop-ref")
|
||||
|
||||
</style-specification>
|
||||
|
||||
<external-specification id="dbtohtml" document="dbtohtml.dsl">
|
@@ -1,108 +0,0 @@
|
||||
<!-- $Id$ -->
|
||||
|
||||
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
|
||||
<!entity include-reference.sgml SYSTEM "../guile/reference.sgml" >
|
||||
|
||||
<!-- The following entities are used in the automatically generated
|
||||
`reference.sgml' to include custom descriptions of the features.
|
||||
-->
|
||||
|
||||
<!entity include-cpu.sgml "">
|
||||
<!entity include-mem.sgml "">
|
||||
<!entity include-swap.sgml "">
|
||||
<!entity include-uptime.sgml "">
|
||||
<!entity include-loadavg.sgml "">
|
||||
<!entity include-shm-limits.sgml "">
|
||||
<!entity include-msg-limits.sgml "">
|
||||
<!entity include-sem-limits.sgml "">
|
||||
<!entity include-proclist.sgml "">
|
||||
<!entity include-proc-state.sgml "">
|
||||
<!entity include-proc-uid.sgml "">
|
||||
<!entity include-proc-mem.sgml "">
|
||||
<!entity include-proc-time.sgml "">
|
||||
<!entity include-proc-signal.sgml "">
|
||||
<!entity include-proc-kernel.sgml "">
|
||||
<!entity include-proc-segment.sgml "">
|
||||
<!entity include-proc-map.sgml "">
|
||||
<!entity include-mountlist.sgml "">
|
||||
<!entity include-fsusage.sgml "">
|
||||
]>
|
||||
<book>
|
||||
<bookinfo>
|
||||
<title>LibGTop Reference Manual</title>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Martin</firstname>
|
||||
<surname>Baulig</surname>
|
||||
<affiliation>
|
||||
<address>
|
||||
<email>martin@home-of-linux.org</email>
|
||||
</address>
|
||||
</affiliation>
|
||||
</author>
|
||||
</authorgroup>
|
||||
<abstract>
|
||||
<para>
|
||||
<literal>$Id$</literal>
|
||||
|
||||
<para>
|
||||
This reference manual is automatically generated from
|
||||
<filename>doc/make-docbook.scm</filename>. It uses the
|
||||
guile interface of <productname>libgtop</productname> to
|
||||
get the names of all features the library defines and a
|
||||
description of the structures.
|
||||
</abstract>
|
||||
|
||||
<copyright>
|
||||
<year>1998</year>
|
||||
<holder>Martin Baulig</holder>
|
||||
</copyright>
|
||||
<legalnotice>
|
||||
|
||||
<para>
|
||||
This documentation 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.
|
||||
|
||||
<para>
|
||||
This library 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.
|
||||
|
||||
<para>
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this program; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
MA 02111-1307 USA
|
||||
|
||||
<para>
|
||||
For more details see the file COPYING in the source
|
||||
distribution of LibGTop.</para>
|
||||
|
||||
</legalnotice>
|
||||
</bookinfo>
|
||||
|
||||
<toc></toc>
|
||||
|
||||
<chapter id="functions">
|
||||
<title>Function Reference List</title>
|
||||
|
||||
&include-reference.sgml;
|
||||
|
||||
</book>
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:2
|
||||
sgml-indent-data: t
|
||||
End:
|
||||
-->
|
@@ -1,12 +0,0 @@
|
||||
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
|
||||
<!ENTITY dbtohtml.dsl SYSTEM "dbtohtml.dsl" CDATA DSSSL >
|
||||
]>
|
||||
|
||||
<style-specification id="libgtopdbtohtml" use="dbtohtml">
|
||||
|
||||
(define %output-basename% "libgtop")
|
||||
(define %output-directory% "libgtop")
|
||||
|
||||
</style-specification>
|
||||
|
||||
<external-specification id="dbtohtml" document="dbtohtml.dsl">
|
1332
doc/libgtop.sgml
1332
doc/libgtop.sgml
File diff suppressed because it is too large
Load Diff
@@ -1,35 +0,0 @@
|
||||
#
|
||||
# Configuration of the libgtop package
|
||||
#
|
||||
|
||||
LIBGTOP_LIBDIR="/home/baulig/TEST/lib"
|
||||
LIBGTOP_INCLUDEDIR="/home/baulig/TEST/include"
|
||||
|
||||
LIBGTOP_LIBS="-L/home/baulig/TEST/lib -lgtop -lgtop_common -lgtop_sysdeps -L/usr/X11R6/lib -lXau"
|
||||
LIBGTOP_INCS="-I/home/baulig/TEST/include"
|
||||
|
||||
LIBGTOP_NAMES_LIBS="-L/home/baulig/TEST/lib -lgtop -lgtop_common -lgtop_sysdeps -lgtop_names -L/usr/X11R6/lib -lXau"
|
||||
LIBGTOP_NAMES_INCS="-I/home/baulig/TEST/include -DGLIBTOP_NAMES"
|
||||
|
||||
LIBGTOP_GUILE_LIBS="-L/home/baulig/TEST/lib -lgtop -lgtop_guile -lgtop_common -lgtop_sysdeps -L/usr/X11R6/lib -lXau -L/home/baulig/INSTALL/lib -lguile -ldl -lreadline -ltermcap -lm"
|
||||
LIBGTOP_GUILE_INCS="-I/home/baulig/TEST/include -I/home/baulig/INSTALL/include -DGLIBTOP_GUILE"
|
||||
|
||||
LIBGTOP_GUILE_NAMES_LIBS="-L/home/baulig/TEST/lib -lgtop -lgtop_guile -lgtop_common -lgtop_sysdeps -lgtop_names -L/usr/X11R6/lib -lXau"
|
||||
LIBGTOP_GUILE_NAMES_INCS="-I/home/baulig/TEST/include -I/home/baulig/INSTALL/include -DGLIBTOP_GUILE -DGLIBTOP_NAMES"
|
||||
|
||||
LIBGTOP_BINDIR="/home/baulig/TEST/bin"
|
||||
LIBGTOP_SERVER="/home/baulig/TEST/bin/libgtop_server"
|
||||
|
||||
LIBGTOP_MAJOR_VERSION="0"
|
||||
LIBGTOP_MINOR_VERSION="2a"
|
||||
LIBGTOP_VERSION="0.2a"
|
||||
|
||||
LIBGTOP_SERVER_VERSION="1"
|
||||
|
||||
libgtop_sysdeps_dir="linux"
|
||||
libgtop_need_server="no"
|
||||
libgtop_use_machine_h="no"
|
||||
|
||||
libgtop_guile_found="yes"
|
||||
|
||||
libgtop_want_examples=""
|
@@ -1,161 +0,0 @@
|
||||
Path: news.uni-stuttgart.de!fu-berlin.de!taurus.uni-trier.DE!baulig
|
||||
From: Martin Baulig <baulig@merkur.uni-trier.de>
|
||||
Newsgroups: comp.os.linux.development.system
|
||||
Subject: RFC: New system call for /proc information ?
|
||||
Date: 07 Jun 1998 20:22:47 +0200
|
||||
Lines: 143
|
||||
Sender: baulig@Taurus.uni-trier.de
|
||||
Message-ID: <of7zpfprs08.fsf@Taurus.uni-trier.de>
|
||||
NNTP-Posting-Host: taurus.uni-trier.de (136.199.14.201)
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain; charset=iso-8859-1
|
||||
Content-Transfer-Encoding: 8bit
|
||||
NNTP-Posting-User: baulig
|
||||
X-Access: 16 1542 1543
|
||||
X-Trace: fu-berlin.de 897243777 29527 baulig 136.199.14.201
|
||||
X-Newsreader: Gnus v5.6.11/XEmacs 20.3 - "Vatican City"
|
||||
Xref: news.uni-stuttgart.de comp.os.linux.development.system:73539
|
||||
|
||||
[Posted to the Gnome Mailing List and to comp.os.linux.development.system]
|
||||
|
||||
Request for Comments:
|
||||
====================
|
||||
|
||||
Should we have a new system call under Linux which fetches information
|
||||
from the /proc filesytem similar to the table() function of DEC OSF/1 ?
|
||||
|
||||
The whole story:
|
||||
===============
|
||||
|
||||
I am currently working on libgtop, a library that fetches information
|
||||
from the proc filesystem for user processes. This library uses a suid
|
||||
server on system where this is required. On Linux, the information are
|
||||
fetched directly from the proc filesystem.
|
||||
|
||||
Now, I made some profilings (fetches 50000 times cpu, memory, swap,
|
||||
uptime and loadavg):
|
||||
|
||||
Each sample counts as 0.01 seconds.
|
||||
% cumulative self self total
|
||||
time seconds seconds calls ns/call ns/call name
|
||||
91.86 348.03 348.03 read
|
||||
3.07 359.67 11.64 open
|
||||
0.67 362.22 2.55 close
|
||||
0.16 363.55 0.62 memset
|
||||
0.16 364.14 0.59 __ipc
|
||||
0.03 368.84 0.12 vsscanf (iovsscanf.c:31)
|
||||
0.01 374.49 0.05 sscanf (sscanf.c:28)
|
||||
0.00 378.71 0.01 semctl (semctl.c:32)
|
||||
0.00 378.73 0.01 shmctl (shmctl.c:30)
|
||||
|
||||
granularity: each sample hit covers 4 byte(s) for 0.00% of 378.88 seconds
|
||||
|
||||
index % time self children called name
|
||||
[1] 91.9 348.03 0.00 read [1]
|
||||
-----------------------------------------------
|
||||
[2] 3.1 11.64 0.00 open [2]
|
||||
-----------------------------------------------
|
||||
[3] 0.7 2.55 0.00 close [3]
|
||||
-----------------------------------------------
|
||||
[5] 0.2 0.62 0.00 memset [5]
|
||||
-----------------------------------------------
|
||||
[6] 0.2 0.59 0.00 __ipc [6]
|
||||
-----------------------------------------------
|
||||
[35] 0.0 0.12 0.00 vsscanf (iovsscanf.c:31) [35]
|
||||
-----------------------------------------------
|
||||
[96] 0.0 0.05 0.00 sscanf (sscanf.c:28) [96]
|
||||
-----------------------------------------------
|
||||
|
||||
You see, it spends a lot of time in read() which is only used to read the
|
||||
data from the files in /proc. Well, basically one can say that these
|
||||
timings are not so bad, normally a process periodically fetches those
|
||||
information say 10 times a seconds which makes 36000 invocations per
|
||||
hour.
|
||||
|
||||
This will make a total of about 250 seconds per hour or on even say:
|
||||
|
||||
``a program fetching those information at a frequency of 10 will take
|
||||
about 7 % of each hour just for reading files from /proc''.
|
||||
|
||||
Now look at timings of __ipc, they're about 350 times better 'cause this
|
||||
is done using system calls.
|
||||
|
||||
So far so good, now look at how this is done on the DEC OSF/1 port of the
|
||||
library (the following code is part of libgtop - GPL/LGPL):
|
||||
|
||||
CPU usage:
|
||||
{
|
||||
struct tbl_sysinfo sysinfo;
|
||||
int ret;
|
||||
|
||||
ret = table (TBL_SYSINFO, 0, (char *) &sysinfo, 1,
|
||||
sizeof (struct tbl_sysinfo));
|
||||
|
||||
buf->user = sysinfo.si_user;
|
||||
buf->nice = sysinfo.si_nice;
|
||||
buf->sys = sysinfo.si_sys;
|
||||
buf->idle = sysinfo.si_idle;
|
||||
}
|
||||
|
||||
Well, the table() command of DEC OSF/1 has may disadvantages, too - such
|
||||
as requiring to be root to fetch any information about processes (well, for
|
||||
each process that is not the current one).
|
||||
|
||||
But this works using system calls rather that reading and parsing files
|
||||
and should be about as fast as getting the IPC information on Linux.
|
||||
|
||||
Under Linux, the current trend seems to be to move anything into the /proc
|
||||
filesystem, but if you look at the timings, wouldn't it be better to also
|
||||
implement a system call interface ?
|
||||
|
||||
Don't understand me wrong:
|
||||
=========================
|
||||
|
||||
I *do not want* to *replace* the /proc filesystem - it's an excellent
|
||||
idea to be able to fetch all information on the command line without
|
||||
any program just a simple 'cat' - I want to *add* a *new* system call
|
||||
to allow programmers to fetch those information faster that reading
|
||||
from /proc.
|
||||
|
||||
To come to the point:
|
||||
=====================
|
||||
|
||||
Is there any public interest in having a new system call under Linux
|
||||
which can be used to fetch all information that are currently in the
|
||||
/proc filesystem.
|
||||
|
||||
Basically, this system would be defined like this:
|
||||
|
||||
asmlinkage int
|
||||
sys_table (int command, struct sysinfo_table *buf)
|
||||
|
||||
and be invoked like this:
|
||||
|
||||
#include <sys/table.h>
|
||||
|
||||
{
|
||||
struct sysinfo_cpu cpu;
|
||||
struct sysinfo_mem mem;
|
||||
|
||||
ret = table (TABLE_CPU, &cpu);
|
||||
if (ret == -1) return; /* or invoke any error handler */
|
||||
|
||||
ret = table (TABLE_MEM, &mem);
|
||||
if (ret == -1) return;
|
||||
}
|
||||
|
||||
What do you think, folks. Should we have such a system call under Linux ?
|
||||
I can do the implementation of this system call, but I want to have some
|
||||
feedback first.
|
||||
|
||||
Martin
|
||||
|
||||
--
|
||||
-----------------------------------------------------------------
|
||||
Martin Baulig - Angewandte Mathematik - Universitaet Trier
|
||||
|
||||
baulig@castor.uni-trier.de, http://www.home-of-linux.com/
|
||||
Key: 1024-bit key with ID C8178435 created 1997/01/24
|
||||
ID: 67 C1 84 A0 47 F5 11 C5 5F 68 4C 84 99 05 C3 92
|
||||
Finger me for public key or fetch finger.txt from the url above
|
||||
------------------------------------------------------------------
|
@@ -1,12 +0,0 @@
|
||||
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
|
||||
<!ENTITY dbtohtml.dsl SYSTEM "dbtohtml.dsl" CDATA DSSSL >
|
||||
]>
|
||||
|
||||
<style-specification id="tabledbotohtml" use="dbtohtml">
|
||||
|
||||
(define %output-basename% "table")
|
||||
(define %output-directory% "table")
|
||||
|
||||
</style-specification>
|
||||
|
||||
<external-specification id="dbtohtml" document="dbtohtml.dsl">
|
193
doc/table.sgml
193
doc/table.sgml
@@ -1,193 +0,0 @@
|
||||
<!-- $Id$ -->
|
||||
|
||||
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
|
||||
<!entity libgtopConf.sh SYSTEM "../libgtopConf.sh" >
|
||||
<!entity home-of-linux "http://www.home-of-linux.org/">
|
||||
<!entity table-announce-first "&home-of-linux;kernel/table/ANNOUNCE.FIRST">
|
||||
<!entity table20-tgz "&home-of-linux;kernel/table/table20.tgz">
|
||||
<!entity table21-tgz "&home-of-linux;kernel/table/table21.tgz">
|
||||
<!entity news-c-o-l-d-s "comp.os.linux.development.system">
|
||||
<!entity libgtop "<productname>libgtop</productname>">
|
||||
<!entity table "<function>table ()</function>">
|
||||
]>
|
||||
<book>
|
||||
<bookinfo>
|
||||
<title>The &table; system call under Linux</title>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Martin</firstname>
|
||||
<surname>Baulig</surname>
|
||||
<affiliation>
|
||||
<address>
|
||||
<email>martin@home-of-linux.org</email>
|
||||
</address>
|
||||
</affiliation>
|
||||
</author>
|
||||
</authorgroup>
|
||||
<copyright>
|
||||
<year>1998</year>
|
||||
<holder>Martin Baulig</holder>
|
||||
</copyright>
|
||||
|
||||
<legalnotice>
|
||||
|
||||
<para>
|
||||
This documentation 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.
|
||||
|
||||
<para>
|
||||
This library 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.
|
||||
|
||||
<para>
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this program; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
MA 02111-1307 USA
|
||||
|
||||
<para>
|
||||
For more details see the file COPYING in the source
|
||||
distribution of LibGTop.</para>
|
||||
|
||||
</legalnotice>
|
||||
|
||||
<abstract>
|
||||
<para>
|
||||
<literal>$Id$</literal>
|
||||
|
||||
<para>
|
||||
Under <productname>Linux</productname>, reading from
|
||||
<filename>/proc</filename> is somehow slow because the data
|
||||
needs to be converted into a stringified representation from
|
||||
the kernel and to be parsed from the application program to
|
||||
get the original data back.
|
||||
|
||||
While doing the <productname>DEC OSF/1</productname> port of
|
||||
&libgtop; I got the idea to add something similar to the &table;
|
||||
function there to the Linux kernel.
|
||||
|
||||
This is what this document is about.
|
||||
</abstract>
|
||||
|
||||
</bookinfo>
|
||||
|
||||
<toc></toc>
|
||||
|
||||
<chapter id="why-not-sysctl">
|
||||
<title>Why not <function>sysctl</function>?</title>
|
||||
|
||||
<para>
|
||||
Some weeks ago, I posted the initial proposal of the project to
|
||||
<ulink url="news:&news-c-o-l-d-s;">&news-c-o-l-d-s;</ulink> with
|
||||
Message-ID <literal><of7zpfprs08.fsf@Taurus.uni-trier.de></literal>.
|
||||
|
||||
<para>
|
||||
You can also read this article at my site:
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<ulink url="&table-announce-first;">&table-announce-first;</ulink>
|
||||
</itemizedlist>
|
||||
|
||||
<para>
|
||||
Some people told me to include all the stuff into
|
||||
<function>sysctl</function> instead of inventing a new system call.
|
||||
|
||||
<para>
|
||||
Basically this is a good idea, but the main problem with
|
||||
<function>sysctl</function> is that this should be applied to standard
|
||||
kernels and not just as a short patch. Well, AFAIK something similar
|
||||
is on the "wish list" for 2.2er kernels - but of cause it'll need some
|
||||
time until we have a real replacement of the <filename>/proc</filename>
|
||||
filesystem in <function>sysctl</function>.
|
||||
|
||||
<para>
|
||||
If someone thinks that this absolutely should be included in
|
||||
<function>sysctl</function>: think about some kind of interface,
|
||||
discuss it with the kernel developers, ...
|
||||
|
||||
<chapter id="about-table">
|
||||
<title>About the &table; function</title>
|
||||
|
||||
<para>
|
||||
Using the &table; function will not affect any existing kernel
|
||||
structures and can be done independent from kernel development.
|
||||
|
||||
<para>
|
||||
So it can easily be used in &libgtop; until we have something
|
||||
simliar in standard kernels.
|
||||
|
||||
<para>
|
||||
If you want to use the &table; function in your own programs, be
|
||||
aware that it is just intended to be some kind of quick solution
|
||||
for &libgtop; until there's something better in standard kernels.
|
||||
|
||||
<chapter id="how-to-use">
|
||||
<title>How to use the &table; function in &libgtop;</title>
|
||||
|
||||
<para>
|
||||
The source code of the &table; function is distributed together with
|
||||
&libgtop;. It can be found in the <filename>kernel/table20</filename>
|
||||
directory for 2.0.xx kernels and in the <filename>kernel/table21</filename>
|
||||
directory for 2.1.xx kernels.
|
||||
|
||||
<para>
|
||||
You can also download it from my site:
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<ulink url="&table20-tgz;">&table20-tgz</ulink>
|
||||
(for kernel 2.0.xx)
|
||||
<listitem><para>
|
||||
<ulink url="&table21-tgz;">&table21-tgz</ulink>
|
||||
(for kernel 2.1.xx)
|
||||
</itemizedlist>
|
||||
|
||||
<para>
|
||||
Copy the contents of the appropriate directory to
|
||||
<filename>/usr/src/linux/table</filename>, apply the
|
||||
patch to the kernel and re-configure &libgtop;.
|
||||
|
||||
<para>
|
||||
After that, you can unmount <filename>/proc</filename> and
|
||||
&libgtop; will still work !
|
||||
|
||||
<note>
|
||||
<para>
|
||||
Maybe one could consider this as a bug, but currently there
|
||||
isn't a configuration option to disable the &table; function
|
||||
once you applied the patch ...
|
||||
</note>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
Currently I'm working on the 2.1.x version to implement some
|
||||
features newer kernels have - so the 2.0.x version may not
|
||||
have all features the 2.1.x one has.
|
||||
</note>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
The 2.1.x version of the &table; function is implemented
|
||||
as a kernel module. You have to do a
|
||||
<command>insmod table/module.o</command> manually to use it.
|
||||
|
||||
<para>
|
||||
This has the advantage that you don't need to reboot if you
|
||||
want to play around with the code a little bit.
|
||||
</note>
|
||||
|
||||
</book>
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
mode: sgml
|
||||
sgml-indent-data: t
|
||||
End:
|
||||
-->
|
@@ -1,3 +1,35 @@
|
||||
1998-11-22 Martin Baulig <baulig@taurus.uni-trier.de>
|
||||
|
||||
* netload.c: Call inet_ntoa () to get address and subnet
|
||||
in quatted dot notation (like 136.199.14.201) and not just
|
||||
as a number (like 0xc90ec788).
|
||||
|
||||
1998-11-02 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* sysdeps.c: New example.
|
||||
|
||||
1998-10-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* netload.c: New file. Gets network load for the interface
|
||||
given as command line argument.
|
||||
|
||||
1998-10-26 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* first.c (glibtop_get_proc_args): Get command line arguments.
|
||||
* second.c: Likewise.
|
||||
|
||||
1998-10-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* first.c (glibtop_get_ppp): Get PPP/ISDN statistics.
|
||||
|
||||
1998-09-28 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* Makefile.am: Install everything in $(libexecdir)/libgtop.
|
||||
|
||||
1998-09-09 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
|
||||
|
||||
* smp.c: New file. Nice tool to show CPU statistics on SMP systems.
|
||||
|
||||
1998-08-25 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* first.c, second.c, procmap.c: Fixed some compiler warnings.
|
||||
|
@@ -9,18 +9,22 @@ DEFS = @DEFS@
|
||||
# We install it in `libexec' since this will make it more easy
|
||||
# to put the examples into an extra RPM package.
|
||||
|
||||
libexec_PROGRAMS = first first_static second second_static \
|
||||
mountlist mountlist_static \
|
||||
procmap procmap_static \
|
||||
@guile_examples@
|
||||
libgtopdir = $(libexecdir)/libgtop
|
||||
|
||||
EXTRA_PROGRAMS = third third_static
|
||||
libgtop_PROGRAMS = first second\
|
||||
mountlist procmap netload sysdeps\
|
||||
@static_targets@ @guile_examples@ @smp_examples@
|
||||
|
||||
EXTRA_PROGRAMS = first_static second_static \
|
||||
mountlist_static procmap_static \
|
||||
third third_static smp smp_static \
|
||||
netload_static sysdeps_static
|
||||
|
||||
first_SOURCES = first.c
|
||||
first_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||
@INTLLIBS@ @LIBSUPPORT@ @LIBGTOP_EXTRA_LIBS@
|
||||
@INTLLIBS@ @LIBSUPPORT@
|
||||
|
||||
first_static_SOURCES = $(first_SOURCES)
|
||||
first_static_LDADD = $(first_LDADD)
|
||||
@@ -30,7 +34,7 @@ second_SOURCES = second.c
|
||||
second_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||
@INTLLIBS@ @LIBSUPPORT@ @LIBGTOP_EXTRA_LIBS@
|
||||
@INTLLIBS@ @LIBSUPPORT@
|
||||
|
||||
second_static_SOURCES = $(second_SOURCES)
|
||||
second_static_LDADD = $(second_LDADD)
|
||||
@@ -40,13 +44,33 @@ procmap_SOURCES = procmap.c
|
||||
procmap_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||
@INTLLIBS@ @LIBSUPPORT@ @LIBGTOP_EXTRA_LIBS@
|
||||
@INTLLIBS@ @LIBSUPPORT@
|
||||
|
||||
|
||||
|
||||
procmap_static_SOURCES = $(procmap_SOURCES)
|
||||
procmap_static_LDADD = $(procmap_LDADD)
|
||||
procmap_static_LDFLAGS = -static
|
||||
|
||||
netload_SOURCES = netload.c
|
||||
netload_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||
@INTLLIBS@ @LIBSUPPORT@
|
||||
|
||||
netload_static_SOURCES = $(netload_SOURCES)
|
||||
netload_static_LDADD = $(netload_LDADD)
|
||||
netload_static_LDFLAGS = -static
|
||||
|
||||
sysdeps_SOURCES = sysdeps.c
|
||||
sysdeps_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||
@INTLLIBS@ @LIBSUPPORT@
|
||||
|
||||
sysdeps_static_SOURCES = $(sysdeps_SOURCES)
|
||||
sysdeps_static_LDADD = $(sysdeps_LDADD)
|
||||
sysdeps_static_LDFLAGS = -static
|
||||
|
||||
third_guile_names_LIBS = $(top_builddir)/sysdeps/guile/names/libgtop_guile_names.la
|
||||
third_names_LIBS = $(top_builddir)/sysdeps/names/libgtop_names.la
|
||||
@@ -57,8 +81,7 @@ third_LDADD = $(top_builddir)/sysdeps/guile/libgtop_guile.la \
|
||||
$(top_builddir)/lib/libgtop.la \
|
||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||
@GUILE_LIBS@ @INTLLIBS@ @LIBSUPPORT@ \
|
||||
@LIBGTOP_EXTRA_LIBS@
|
||||
@GUILE_LIBS@ @INTLLIBS@ @LIBSUPPORT@
|
||||
|
||||
third_static_SOURCES = $(third_SOURCES)
|
||||
third_static_LDADD = $(third_LDADD)
|
||||
@@ -68,9 +91,20 @@ mountlist_SOURCES = mountlist.c
|
||||
mountlist_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||
@INTLLIBS@ @LIBSUPPORT@ @LIBGTOP_EXTRA_LIBS@
|
||||
@INTLLIBS@ @LIBSUPPORT@
|
||||
|
||||
mountlist_static_SOURCES= $(mountlist_SOURCES)
|
||||
mountlist_static_LDADD = $(mountlist_LDADD)
|
||||
mountlist_static_LDFLAGS= -static
|
||||
|
||||
|
||||
smp_SOURCES = smp.c
|
||||
smp_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||
@INTLLIBS@ @LIBSUPPORT@
|
||||
|
||||
smp_static_SOURCES = $(smp_SOURCES)
|
||||
smp_static_LDADD = $(smp_LDADD)
|
||||
smp_static_LDFLAGS = -static
|
||||
|
||||
|
@@ -45,6 +45,7 @@ main (int argc, char *argv [])
|
||||
unsigned c, method, count, port, i, *ptr;
|
||||
char buffer [BUFSIZ];
|
||||
pid_t pid, ppid;
|
||||
char *args;
|
||||
|
||||
count = PROFILE_COUNT;
|
||||
|
||||
@@ -172,10 +173,22 @@ main (int argc, char *argv [])
|
||||
|
||||
printf ("\n");
|
||||
|
||||
for (c = 0; c < PROFILE_COUNT; c++)
|
||||
glibtop_get_ppp (&data.ppp, 0);
|
||||
|
||||
printf ("PPP (0x%08lx): %lu, %lu, %lu\n",
|
||||
(unsigned long) data.ppp.flags,
|
||||
(unsigned long) data.ppp.state,
|
||||
(unsigned long) data.ppp.bytes_in,
|
||||
(unsigned long) data.ppp.bytes_out);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
glibtop_get_sysdeps (&sysdeps);
|
||||
|
||||
printf ("Sysdeps (0x%08lx): %lu, %lu, %lu, %lu, %lu, "
|
||||
"%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu\n",
|
||||
"%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, "
|
||||
"%lu, %lu, %lu, %lu, %lu, %lu\n",
|
||||
(unsigned long) sysdeps.flags,
|
||||
(unsigned long) sysdeps.cpu,
|
||||
(unsigned long) sysdeps.mem,
|
||||
@@ -192,7 +205,13 @@ main (int argc, char *argv [])
|
||||
(unsigned long) sysdeps.proc_time,
|
||||
(unsigned long) sysdeps.proc_signal,
|
||||
(unsigned long) sysdeps.proc_kernel,
|
||||
(unsigned long) sysdeps.proc_segment);
|
||||
(unsigned long) sysdeps.proc_segment,
|
||||
(unsigned long) sysdeps.proc_args,
|
||||
(unsigned long) sysdeps.proc_map,
|
||||
(unsigned long) sysdeps.mountlist,
|
||||
(unsigned long) sysdeps.fsusage,
|
||||
(unsigned long) sysdeps.netload,
|
||||
(unsigned long) sysdeps.ppp);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
@@ -313,6 +332,22 @@ main (int argc, char *argv [])
|
||||
|
||||
printf ("\n");
|
||||
|
||||
args = glibtop_get_proc_args (&data.proc_args, pid, 0);
|
||||
|
||||
for (i = 0; i < data.proc_args.size; i++) {
|
||||
if (args [i]) continue;
|
||||
args [i] = '|';
|
||||
}
|
||||
|
||||
printf ("Proc_Args PID %5d (0x%08lx): %lu - '%s'\n", (int) pid,
|
||||
(unsigned long) data.proc_args.flags,
|
||||
(unsigned long) data.proc_args.size,
|
||||
args);
|
||||
|
||||
glibtop_free (args);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
for (c = 0; c < PROFILE_COUNT; c++)
|
||||
glibtop_get_proc_state (&data.proc_state, ppid);
|
||||
|
||||
@@ -407,6 +442,22 @@ main (int argc, char *argv [])
|
||||
|
||||
printf ("\n");
|
||||
|
||||
args = glibtop_get_proc_args (&data.proc_args, ppid, 0);
|
||||
|
||||
for (i = 0; i < data.proc_args.size; i++) {
|
||||
if (args [i]) continue;
|
||||
args [i] = '|';
|
||||
}
|
||||
|
||||
printf ("Proc_Args PID %5d (0x%08lx): %lu - '%s'\n", (int) ppid,
|
||||
(unsigned long) data.proc_args.flags,
|
||||
(unsigned long) data.proc_args.size,
|
||||
args);
|
||||
|
||||
glibtop_free (args);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
for (c = 0; c < PROFILE_COUNT; c++)
|
||||
glibtop_get_proc_state (&data.proc_state, 1);
|
||||
|
||||
@@ -500,6 +551,22 @@ main (int argc, char *argv [])
|
||||
(unsigned long) data.proc_kernel.nwchan,
|
||||
data.proc_kernel.wchan);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
args = glibtop_get_proc_args (&data.proc_args, 1, 0);
|
||||
|
||||
for (i = 0; i < data.proc_args.size; i++) {
|
||||
if (args [i]) continue;
|
||||
args [i] = '|';
|
||||
}
|
||||
|
||||
printf ("Proc_Args PID %5d (0x%08lx): %lu - '%s'\n", 1,
|
||||
(unsigned long) data.proc_args.flags,
|
||||
(unsigned long) data.proc_args.size,
|
||||
args);
|
||||
|
||||
glibtop_free (args);
|
||||
|
||||
glibtop_close ();
|
||||
|
||||
exit (0);
|
||||
|
123
examples/netload.c
Normal file
123
examples/netload.c
Normal file
@@ -0,0 +1,123 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/open.h>
|
||||
#include <glibtop/close.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
|
||||
#include <glibtop/parameter.h>
|
||||
|
||||
#include <glibtop/netload.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#ifndef PROFILE_COUNT
|
||||
#define PROFILE_COUNT 1
|
||||
#endif
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{
|
||||
glibtop_netload netload;
|
||||
unsigned method, count, port, i;
|
||||
struct in_addr addr, subnet;
|
||||
char *address_string, *subnet_string;
|
||||
char buffer [BUFSIZ];
|
||||
|
||||
count = PROFILE_COUNT;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, GTOPLOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
glibtop_init_r (&glibtop_global_server, 0, GLIBTOP_INIT_NO_OPEN);
|
||||
|
||||
glibtop_get_parameter (GLIBTOP_PARAM_METHOD, &method, sizeof (method));
|
||||
|
||||
printf ("Method = %d\n", method);
|
||||
|
||||
count = glibtop_get_parameter (GLIBTOP_PARAM_COMMAND, buffer, BUFSIZ);
|
||||
buffer [count] = 0;
|
||||
|
||||
printf ("Command = '%s'\n", buffer);
|
||||
|
||||
count = glibtop_get_parameter (GLIBTOP_PARAM_HOST, buffer, BUFSIZ);
|
||||
buffer [count] = 0;
|
||||
|
||||
glibtop_get_parameter (GLIBTOP_PARAM_PORT, &port, sizeof (port));
|
||||
|
||||
printf ("Host = '%s' - %u\n\n", buffer, port);
|
||||
|
||||
glibtop_init_r (&glibtop_global_server, 0, 0);
|
||||
|
||||
if (argc != 2)
|
||||
glibtop_error ("Usage: %s interface", argv [0]);
|
||||
|
||||
glibtop_get_netload (&netload, argv [1]);
|
||||
|
||||
addr.s_addr = netload.address;
|
||||
subnet.s_addr = netload.subnet;
|
||||
|
||||
address_string = glibtop_strdup (inet_ntoa (addr));
|
||||
subnet_string = glibtop_strdup (inet_ntoa (subnet));
|
||||
|
||||
printf ("Network Load (0x%08lx):\n\n"
|
||||
"\tInterface Flags:\t0x%08lx\n"
|
||||
"\tAddress:\t\t0x%08lx - %s\n"
|
||||
"\tSubnet:\t\t\t0x%08lx - %s\n\n"
|
||||
"\tMTU:\t\t\t%ld\n"
|
||||
"\tCollisions:\t\t%ld\n\n"
|
||||
"\tPackets In:\t\t%ld\n"
|
||||
"\tPackets Out:\t\t%ld\n"
|
||||
"\tPackets Total:\t\t%ld\n\n"
|
||||
"\tBytes In:\t\t%ld\n"
|
||||
"\tBytes Out:\t\t%ld\n"
|
||||
"\tBytes Total:\t\t%ld\n\n"
|
||||
"\tErrors In:\t\t%ld\n"
|
||||
"\tErrors Out:\t\t%ld\n"
|
||||
"\tErrors Total:\t\t%ld\n\n",
|
||||
(unsigned long) netload.flags,
|
||||
(unsigned long) netload.if_flags,
|
||||
(unsigned long) netload.address, address_string,
|
||||
(unsigned long) netload.subnet, subnet_string,
|
||||
(unsigned long) netload.mtu,
|
||||
(unsigned long) netload.collisions,
|
||||
(unsigned long) netload.packets_in,
|
||||
(unsigned long) netload.packets_out,
|
||||
(unsigned long) netload.packets_total,
|
||||
(unsigned long) netload.bytes_in,
|
||||
(unsigned long) netload.bytes_out,
|
||||
(unsigned long) netload.bytes_total,
|
||||
(unsigned long) netload.errors_in,
|
||||
(unsigned long) netload.errors_out,
|
||||
(unsigned long) netload.errors_total);
|
||||
|
||||
glibtop_free (address_string);
|
||||
glibtop_free (subnet_string);
|
||||
|
||||
glibtop_close ();
|
||||
|
||||
exit (0);
|
||||
}
|
@@ -29,10 +29,23 @@
|
||||
#include <glibtop/union.h>
|
||||
#include <glibtop/sysdeps.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
static void
|
||||
output (pid_t pid)
|
||||
{
|
||||
glibtop_union data;
|
||||
char *args;
|
||||
unsigned i;
|
||||
|
||||
#if HAVE_LIBGTOP_SMP
|
||||
unsigned long total;
|
||||
double p_total, p_utime, p_stime;
|
||||
double b_total, b_utime, b_stime;
|
||||
double s_total, s_utime, s_stime;
|
||||
double my_utime, my_stime;
|
||||
int ncpu;
|
||||
#endif
|
||||
|
||||
printf ("\n");
|
||||
|
||||
@@ -124,6 +137,97 @@ output (pid_t pid)
|
||||
data.proc_kernel.wchan);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
args = glibtop_get_proc_args (&data.proc_args, pid, 0);
|
||||
|
||||
for (i = 0; i < data.proc_args.size; i++) {
|
||||
if (args [i]) continue;
|
||||
args [i] = '|';
|
||||
}
|
||||
|
||||
printf ("Proc_Args PID %5d (0x%08lx): %lu - '%s'\n", (int) pid,
|
||||
(unsigned long) data.proc_args.flags,
|
||||
(unsigned long) data.proc_args.size,
|
||||
args);
|
||||
|
||||
glibtop_free (args);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
#if HAVE_LIBGTOP_SMP
|
||||
ncpu = glibtop_global_server->ncpu;
|
||||
|
||||
glibtop_get_proc_time (&data.proc_time, pid);
|
||||
|
||||
total = (unsigned long) data.proc_time.utime +
|
||||
(unsigned long) data.proc_time.stime;
|
||||
|
||||
p_total = total ? (double) total : 1.0;
|
||||
|
||||
p_utime = (double) data.proc_time.utime * 100.0 / p_total;
|
||||
p_stime = (double) data.proc_time.stime * 100.0 / p_total;
|
||||
|
||||
b_total = p_total / ncpu;
|
||||
b_utime = (double) data.proc_time.utime / ncpu;
|
||||
b_stime = (double) data.proc_time.stime / ncpu;
|
||||
|
||||
s_total = 0.0; s_utime = 0.0; s_stime = 0.0;
|
||||
|
||||
printf ("Proc_Time PID %5d (0x%08lx): %12lu %12lu %12lu\n", (int) pid,
|
||||
(unsigned long) data.proc_time.flags, total,
|
||||
(unsigned long) data.proc_time.utime,
|
||||
(unsigned long) data.proc_time.stime);
|
||||
|
||||
for (i = 0; i < ncpu; i++) {
|
||||
unsigned long this_total;
|
||||
|
||||
this_total = (unsigned long) data.proc_time.xcpu_utime [i] +
|
||||
(unsigned long) data.proc_time.xcpu_stime [i];
|
||||
|
||||
printf ("CPU %3d PID %5d (0x%08lx): %12lu %12lu %12lu\n", i,
|
||||
(int) pid, (unsigned long) data.proc_time.flags, this_total,
|
||||
(unsigned long) data.proc_time.xcpu_utime [i],
|
||||
(unsigned long) data.proc_time.xcpu_stime [i]);
|
||||
|
||||
s_total += fabs (((double) this_total) - b_total);
|
||||
s_utime += fabs (((double) data.proc_time.xcpu_utime [i]) - b_utime);
|
||||
s_stime += fabs (((double) data.proc_time.xcpu_stime [i]) - b_stime);
|
||||
}
|
||||
|
||||
printf ("\n");
|
||||
|
||||
printf ("Proc_Time PID %5d (0x%08lx): %12.3f %12.3f %12.3f\n", (int) pid,
|
||||
(unsigned long) data.proc_time.flags, 100.0, p_utime, p_stime);
|
||||
|
||||
for (i = 0; i < ncpu; i++) {
|
||||
double this_p_total, this_p_utime, this_p_stime;
|
||||
unsigned long this_total;
|
||||
|
||||
this_total = (unsigned long) data.proc_time.xcpu_utime [i] +
|
||||
(unsigned long) data.proc_time.xcpu_stime [i];
|
||||
|
||||
this_p_total = (double) this_total * 100.0 / p_total;
|
||||
|
||||
this_p_utime = (double) data.proc_time.xcpu_utime [i] * 100.0 / p_total;
|
||||
this_p_stime = (double) data.proc_time.xcpu_stime [i] * 100.0 / p_total;
|
||||
|
||||
printf ("CPU %3d PID %5d (0x%08lx): %12.3f %12.3f %12.3f\n", i,
|
||||
(int) pid, (unsigned long) data.proc_time.flags,
|
||||
this_p_total, this_p_utime, this_p_stime);
|
||||
}
|
||||
|
||||
printf ("\n");
|
||||
|
||||
my_utime = (unsigned long) data.proc_time.utime ?
|
||||
(double) data.proc_time.utime : 1.0;
|
||||
my_stime = (unsigned long) data.proc_time.stime ?
|
||||
(double) data.proc_time.stime : 1.0;
|
||||
|
||||
printf ("SPIN: %31s %12.3f %12.3f %12.3f\n", "", s_total * 100.0 / p_total,
|
||||
s_utime * 100.0 / my_utime, s_stime * 100.0 / my_stime);
|
||||
|
||||
printf ("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
@@ -190,3 +294,6 @@ main (int argc, char *argv [])
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
124
examples/smp.c
Normal file
124
examples/smp.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, September 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/cpu.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{
|
||||
glibtop_cpu cpu;
|
||||
unsigned long frequency;
|
||||
double total, user, nice, sys, idle;
|
||||
double b_total, b_user, b_nice, b_sys, b_idle;
|
||||
double s_total, s_user, s_nice, s_sys, s_idle;
|
||||
char separator [BUFSIZ], buffer [BUFSIZ];
|
||||
int ncpu, i;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, GTOPLOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
glibtop_get_cpu (&cpu);
|
||||
|
||||
ncpu = glibtop_global_server->ncpu ? glibtop_global_server->ncpu : 1;
|
||||
|
||||
frequency = (unsigned long) cpu.frequency;
|
||||
|
||||
total = ((unsigned long) cpu.total) ? ((double) cpu.total) : 1.0;
|
||||
user = ((unsigned long) cpu.user) ? ((double) cpu.user) : 1.0;
|
||||
nice = ((unsigned long) cpu.nice) ? ((double) cpu.nice) : 1.0;
|
||||
sys = ((unsigned long) cpu.sys) ? ((double) cpu.sys) : 1.0;
|
||||
idle = ((unsigned long) cpu.idle) ? ((double) cpu.idle) : 1.0;
|
||||
|
||||
s_total = s_user = s_nice = s_sys = s_idle = 0.0;
|
||||
|
||||
b_total = total / ncpu;
|
||||
b_user = user / ncpu;
|
||||
b_nice = nice / ncpu;
|
||||
b_sys = sys / ncpu;
|
||||
b_idle = idle / ncpu;
|
||||
|
||||
memset (separator, '-', 91);
|
||||
separator [92] = '\0';
|
||||
|
||||
sprintf (buffer, _("Ticks (%d per second):"), frequency);
|
||||
|
||||
printf ("\n\n%-26s %12s %12s %12s %12s %12s\n%s\n", buffer,
|
||||
_("Total"), _("User"), _("Nice"), _("Sys"), _("Idle"), separator);
|
||||
|
||||
printf (_("CPU (0x%08lx): %12.0f %12.0f %12.0f %12.0f %12.0f\n\n"),
|
||||
(unsigned long) cpu.flags, total, user, nice, sys, idle);
|
||||
|
||||
for (i = 0; i < glibtop_global_server->ncpu; i++) {
|
||||
printf (_("CPU %3d (0x%08lx): %12lu %12lu %12lu %12lu %12lu\n"), i,
|
||||
(unsigned long) cpu.flags,
|
||||
(unsigned long) cpu.xcpu_total [i],
|
||||
(unsigned long) cpu.xcpu_user [i],
|
||||
(unsigned long) cpu.xcpu_nice [i],
|
||||
(unsigned long) cpu.xcpu_sys [i],
|
||||
(unsigned long) cpu.xcpu_idle [i]);
|
||||
|
||||
s_total += fabs (((double) cpu.xcpu_total [i]) - b_total);
|
||||
s_user += fabs (((double) cpu.xcpu_user [i]) - b_user);
|
||||
s_nice += fabs (((double) cpu.xcpu_nice [i]) - b_nice);
|
||||
s_sys += fabs (((double) cpu.xcpu_sys [i]) - b_sys);
|
||||
s_idle += fabs (((double) cpu.xcpu_idle [i]) - b_idle);
|
||||
}
|
||||
|
||||
printf ("%s\n\n\n", separator);
|
||||
|
||||
printf ("%-26s %12s %12s %12s %12s %12s\n%s\n", _("Percent:"),
|
||||
_("Total (%)"), _("User (%)"), _("Nice (%)"), _("Sys (%)"),
|
||||
_("Idle (%)"), separator);
|
||||
|
||||
printf (_("CPU (0x%08lx): %12.3f %12.3f %12.3f %12.3f %12.3f\n\n"),
|
||||
(unsigned long) cpu.flags, (double) total * 100.0 / total,
|
||||
(double) user * 100.0 / total,
|
||||
(double) nice * 100.0 / total,
|
||||
(double) sys * 100.0 / total,
|
||||
(double) idle * 100.0 / total);
|
||||
|
||||
for (i = 0; i < glibtop_global_server->ncpu; i++) {
|
||||
double p_total, p_user, p_nice, p_sys, p_idle;
|
||||
|
||||
p_total = ((double) cpu.xcpu_total [i]) * 100.0 / total;
|
||||
p_user = ((double) cpu.xcpu_user [i]) * 100.0 / user;
|
||||
p_nice = ((double) cpu.xcpu_nice [i]) * 100.0 / nice;
|
||||
p_sys = ((double) cpu.xcpu_sys [i]) * 100.0 / sys;
|
||||
p_idle = ((double) cpu.xcpu_idle [i]) * 100.0 / idle;
|
||||
|
||||
printf (_("CPU %3d (0x%08lx): %12.3f %12.3f %12.3f %12.3f %12.3f\n"),
|
||||
i, (unsigned long) cpu.flags, p_total, p_user, p_nice,
|
||||
p_sys, p_idle);
|
||||
}
|
||||
|
||||
printf ("%s\n%-26s %12.3f %12.3f %12.3f %12.3f %12.3f\n\n", separator,
|
||||
_("Spin:"), s_total * 100.0 / total, s_user * 100.0 / user,
|
||||
s_nice * 100.0 / nice, s_sys * 100.0 / sys, s_idle * 100.0 / idle);
|
||||
|
||||
exit (0);
|
||||
}
|
146
examples/sysdeps.c
Normal file
146
examples/sysdeps.c
Normal file
@@ -0,0 +1,146 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/open.h>
|
||||
#include <glibtop/close.h>
|
||||
#include <glibtop/xmalloc.h>
|
||||
|
||||
#include <glibtop/parameter.h>
|
||||
|
||||
#ifndef PROFILE_COUNT
|
||||
#define PROFILE_COUNT 1
|
||||
#endif
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{
|
||||
glibtop_sysdeps sysdeps;
|
||||
unsigned method, count, port, i;
|
||||
char buffer [BUFSIZ];
|
||||
|
||||
count = PROFILE_COUNT;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, GTOPLOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
glibtop_init_r (&glibtop_global_server, 0, GLIBTOP_INIT_NO_OPEN);
|
||||
|
||||
glibtop_get_parameter (GLIBTOP_PARAM_METHOD, &method, sizeof (method));
|
||||
|
||||
printf ("Method = %d\n", method);
|
||||
|
||||
count = glibtop_get_parameter (GLIBTOP_PARAM_COMMAND, buffer, BUFSIZ);
|
||||
buffer [count] = 0;
|
||||
|
||||
printf ("Command = '%s'\n", buffer);
|
||||
|
||||
count = glibtop_get_parameter (GLIBTOP_PARAM_HOST, buffer, BUFSIZ);
|
||||
buffer [count] = 0;
|
||||
|
||||
glibtop_get_parameter (GLIBTOP_PARAM_PORT, &port, sizeof (port));
|
||||
|
||||
printf ("Host = '%s' - %u\n\n", buffer, port);
|
||||
|
||||
glibtop_init_r (&glibtop_global_server, 0, 0);
|
||||
|
||||
glibtop_get_sysdeps (&sysdeps);
|
||||
|
||||
#define FEATURE_CHECK(f) ((sysdeps.features & (1 << GLIBTOP_SYSDEPS_##f##)) ? 1 : 0)
|
||||
|
||||
printf ("Sysdeps (0x%08lx):\n\n"
|
||||
"\tfeatures:\t\t0x%08lx\n\n"
|
||||
"\tcpu:\t\t%d\t0x%08lx\n"
|
||||
"\tmem:\t\t%d\t0x%08lx\n"
|
||||
"\tswap:\t\t%d\t0x%08lx\n\n"
|
||||
"\tuptime:\t\t%d\t0x%08lx\n"
|
||||
"\tloadavg:\t%d\t0x%08lx\n\n"
|
||||
"\tshm_limits:\t%d\t0x%08lx\n"
|
||||
"\tmsg_limits:\t%d\t0x%08lx\n"
|
||||
"\tsem_limits:\t%d\t0x%08lx\n\n"
|
||||
"\tproclist:\t%d\t0x%08lx\n\n"
|
||||
"\tproc_state:\t%d\t0x%08lx\n"
|
||||
"\tproc_uid:\t%d\t0x%08lx\n"
|
||||
"\tproc_mem:\t%d\t0x%08lx\n"
|
||||
"\tproc_time:\t%d\t0x%08lx\n"
|
||||
"\tproc_signal:\t%d\t0x%08lx\n"
|
||||
"\tproc_kernel:\t%d\t0x%08lx\n"
|
||||
"\tproc_segment:\t%d\t0x%08lx\n\n"
|
||||
"\tproc_args:\t%d\t0x%08lx\n"
|
||||
"\tproc_map:\t%d\t0x%08lx\n\n"
|
||||
"\tmountlist:\t%d\t0x%08lx\n"
|
||||
"\tfsusage:\t%d\t0x%08lx\n\n"
|
||||
"\tnetload:\t%d\t0x%08lx\n"
|
||||
"\tppp:\t\t%d\t0x%08lx\n\n",
|
||||
(unsigned long) sysdeps.flags,
|
||||
(unsigned long) sysdeps.features,
|
||||
FEATURE_CHECK(CPU),
|
||||
(unsigned long) sysdeps.cpu,
|
||||
FEATURE_CHECK(MEM),
|
||||
(unsigned long) sysdeps.mem,
|
||||
FEATURE_CHECK(SWAP),
|
||||
(unsigned long) sysdeps.swap,
|
||||
FEATURE_CHECK(UPTIME),
|
||||
(unsigned long) sysdeps.uptime,
|
||||
FEATURE_CHECK(LOADAVG),
|
||||
(unsigned long) sysdeps.loadavg,
|
||||
FEATURE_CHECK(SHM_LIMITS),
|
||||
(unsigned long) sysdeps.shm_limits,
|
||||
FEATURE_CHECK(MSG_LIMITS),
|
||||
(unsigned long) sysdeps.msg_limits,
|
||||
FEATURE_CHECK(SEM_LIMITS),
|
||||
(unsigned long) sysdeps.sem_limits,
|
||||
FEATURE_CHECK(PROCLIST),
|
||||
(unsigned long) sysdeps.proclist,
|
||||
FEATURE_CHECK(PROC_STATE),
|
||||
(unsigned long) sysdeps.proc_state,
|
||||
FEATURE_CHECK(PROC_UID),
|
||||
(unsigned long) sysdeps.proc_uid,
|
||||
FEATURE_CHECK(PROC_MEM),
|
||||
(unsigned long) sysdeps.proc_mem,
|
||||
FEATURE_CHECK(PROC_TIME),
|
||||
(unsigned long) sysdeps.proc_time,
|
||||
FEATURE_CHECK(PROC_SIGNAL),
|
||||
(unsigned long) sysdeps.proc_signal,
|
||||
FEATURE_CHECK(PROC_KERNEL),
|
||||
(unsigned long) sysdeps.proc_kernel,
|
||||
FEATURE_CHECK(PROC_SEGMENT),
|
||||
(unsigned long) sysdeps.proc_segment,
|
||||
FEATURE_CHECK(PROC_ARGS),
|
||||
(unsigned long) sysdeps.proc_args,
|
||||
FEATURE_CHECK(PROC_MAP),
|
||||
(unsigned long) sysdeps.proc_map,
|
||||
FEATURE_CHECK(MOUNTLIST),
|
||||
(unsigned long) sysdeps.mountlist,
|
||||
FEATURE_CHECK(FSUSAGE),
|
||||
(unsigned long) sysdeps.fsusage,
|
||||
FEATURE_CHECK(NETLOAD),
|
||||
(unsigned long) sysdeps.netload,
|
||||
FEATURE_CHECK(PPP),
|
||||
(unsigned long) sysdeps.ppp);
|
||||
|
||||
glibtop_close ();
|
||||
|
||||
exit (0);
|
||||
}
|
11
features.def
11
features.def
@@ -1,8 +1,8 @@
|
||||
void|cpu|ulong(total,user,nice,sys,idle,frequency)
|
||||
void|cpu|ulong(total,user,nice,sys,idle,frequency,xcpu_total[4],xcpu_user[4],xcpu_nice[4],xcpu_sys[4],xcpu_idle[4])
|
||||
void|mem|ulong(total,used,free,shared,buffer,cached,user,locked)
|
||||
void|swap|ulong(total,used,free,pagein,pageout)
|
||||
void|uptime|double(uptime,idletime)
|
||||
void|loadavg|double(loadavg[0],loadavg[1],loadavg[2]):ulong(nr_running,nr_tasks,last_pid)
|
||||
void|loadavg|double(loadavg[3]):ulong(nr_running,nr_tasks,last_pid)
|
||||
void|shm_limits|ulong(shmmax,shmmin,shmmni,shmseg,shmall)
|
||||
void|msg_limits|ulong(msgpool,msgmap,msgmax,msgmnb,msgmni,msgssz,msgtql)
|
||||
void|sem_limits|ulong(semmap,semmni,semmns,semmnu,semmsl,semopm,semume,semusz,semvmx,semaem)
|
||||
@@ -10,10 +10,13 @@ unsigned *|proclist|ulong(number,size,total)|long(which,arg)
|
||||
void|proc_state|str(cmd):char(state):ulong(uid,gid)|pid_t(pid)
|
||||
void|proc_uid|long(uid,euid,gid,egid,pid,ppid,pgrp,session,tty,tpgid,priority,nice)|pid_t(pid)
|
||||
void|proc_mem|long(size,vsize,resident,share,rss,rss_rlim)|pid_t(pid)
|
||||
void|proc_time|long(start_time,rtime,utime,stime,cutime,cstime,timeout,it_real_value,frequency)|pid_t(pid)
|
||||
void|proc_signal|ulong(signal,blocked,sigignore,sigcatch)|pid_t(pid)
|
||||
void|proc_time|long(start_time,rtime,utime,stime,cutime,cstime,timeout,it_real_value,frequency,xcpu_utime[4],xcpu_stime[4])|pid_t(pid)
|
||||
void|proc_signal|ulong(signal[2],blocked[2],sigignore[2],sigcatch[2])|pid_t(pid)
|
||||
void|proc_kernel|ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,nwchan):str(wchan)|pid_t(pid)
|
||||
void|proc_segment|ulong(text_rss,shlib_rss,data_rss,stack_rss,dirty_size,start_code,end_code,start_stack)|pid_t(pid)
|
||||
char *|proc_args|ulong(size)|pid_t(pid):unsigned(max_len)
|
||||
glibtop_map_entry *|proc_map|ulong(number,size,total)|pid_t(pid)
|
||||
glibtop_mountentry *|@mountlist|ulong(number,size,total)|int(all_fs)
|
||||
void|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string|mount_dir
|
||||
void|netload|ulong(if_flags,mtu,subnet,address,packets_in,packets_out,packets_total,bytes_in,bytes_out,bytes_total,errors_in,errors_out,errors_total,collisions)|string|interface
|
||||
void|ppp|ulong(state,bytes_in,bytes_out)|ushort(device)
|
||||
|
@@ -50,6 +50,7 @@ struct _glibtop
|
||||
int input [2]; /* Pipe client <- server */
|
||||
int output [2]; /* Pipe client -> server */
|
||||
int socket; /* Accepted connection of a socket */
|
||||
int ncpu; /* Number of CPUs, zero if single-processor */
|
||||
unsigned long os_version_code; /* Version code of the operating system */
|
||||
const char *name; /* Program name for error messages */
|
||||
const char *server_command; /* Command used to invoke server */
|
||||
|
@@ -1,9 +0,0 @@
|
||||
1998-07-29 Martin Baulig <martin@home-of-linux.org>
|
||||
|
||||
* dynamic.c, dynamic_names.c: New files.
|
||||
|
||||
* Makefile.am: New file. Creates `libgtop.so' and
|
||||
`libnames.so' which will be installed in
|
||||
`$(datadir)/guile/libgtop'; just do a
|
||||
`(use-modules (libgtop libgtop) (libgtop names))' in
|
||||
guile to use them.
|
@@ -1,60 +0,0 @@
|
||||
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
CFLAGS = -Wall -W @CFLAGS@
|
||||
|
||||
sitedir = $(datadir)/guile/site
|
||||
libgtopmoduledir = $(datadir)/guile/libgtop
|
||||
|
||||
libgtopmodule_LTLIBRARIES = libgtop.la libnames.la
|
||||
|
||||
libgtop_la_SOURCES = dynamic.c
|
||||
|
||||
libnames_la_SOURCES = dynamic_names.c
|
||||
|
||||
libgtop_la_LIBADD = ../sysdeps/guile/guile.lo \
|
||||
../lib/init.lo \
|
||||
../lib/open.lo \
|
||||
../lib/close.lo \
|
||||
../lib/command.lo \
|
||||
../lib/read.lo \
|
||||
../lib/read_data.lo \
|
||||
../lib/write.lo \
|
||||
../lib/lib.lo \
|
||||
../lib/parameter.lo \
|
||||
../lib/sysdeps.lo \
|
||||
../sysdeps/common/error.lo \
|
||||
../sysdeps/common/fsusage.lo \
|
||||
../sysdeps/common/gnuslib.lo \
|
||||
../sysdeps/common/mountlist.lo \
|
||||
../sysdeps/common/xmalloc.lo \
|
||||
../sysdeps/@sysdeps_dir@/close.lo \
|
||||
../sysdeps/@sysdeps_dir@/proclist.lo \
|
||||
../sysdeps/@sysdeps_dir@/sem_limits.lo \
|
||||
../sysdeps/@sysdeps_dir@/cpu.lo \
|
||||
../sysdeps/@sysdeps_dir@/procmem.lo \
|
||||
../sysdeps/@sysdeps_dir@/shm_limits.lo \
|
||||
../sysdeps/@sysdeps_dir@/loadavg.lo \
|
||||
../sysdeps/@sysdeps_dir@/procsegment.lo \
|
||||
../sysdeps/@sysdeps_dir@/siglist.lo \
|
||||
../sysdeps/@sysdeps_dir@/mem.lo \
|
||||
../sysdeps/@sysdeps_dir@/procsignal.lo \
|
||||
../sysdeps/@sysdeps_dir@/swap.lo \
|
||||
../sysdeps/@sysdeps_dir@/msg_limits.lo \
|
||||
../sysdeps/@sysdeps_dir@/procstate.lo \
|
||||
../sysdeps/@sysdeps_dir@/uptime.lo \
|
||||
../sysdeps/@sysdeps_dir@/open.lo \
|
||||
../sysdeps/@sysdeps_dir@/proctime.lo \
|
||||
../sysdeps/@sysdeps_dir@/prockernel.lo \
|
||||
../sysdeps/@sysdeps_dir@/procuid.lo \
|
||||
../sysdeps/@sysdeps_dir@/procmap.lo
|
||||
|
||||
libnames_la_LIBADD = ../sysdeps/guile/names/guile-names.lo
|
||||
|
||||
EXTRA_DIST = features.awk
|
||||
|
||||
CLEANFILES = features.scm
|
||||
|
||||
features.scm: features.awk $(top_builddir)/config.h $(top_srcdir)/features.def
|
||||
$(AWK) -f $(srcdir)/features.awk < $(top_srcdir)/features.def > tmp-t
|
||||
mv tmp-t features.scm
|
||||
|
@@ -1,61 +0,0 @@
|
||||
BEGIN {
|
||||
string = "";
|
||||
names = "";
|
||||
}
|
||||
|
||||
function output(line) {
|
||||
split (line, line_fields, /\|/);
|
||||
retval = line_fields[1];
|
||||
feature = line_fields[2];
|
||||
param_def = line_fields[4];
|
||||
|
||||
orig = feature; sub(/^@/,"",feature);
|
||||
space = feature; gsub(/./," ",space);
|
||||
|
||||
if (string == "")
|
||||
string = " '(";
|
||||
else
|
||||
string = string" ";
|
||||
string = string"(\""feature"\" (\""retval"\"";
|
||||
|
||||
feature_nounder = feature;
|
||||
sub(/_/, "-", feature_nounder);
|
||||
|
||||
if (names == "")
|
||||
names = " '(";
|
||||
else
|
||||
names = names" ";
|
||||
names = names"(\""feature"\" \""feature_nounder"\")\n";
|
||||
|
||||
nr_params = split (param_def, params, /:/);
|
||||
for (param = 1; param <= nr_params; param++) {
|
||||
list = params[param];
|
||||
type = params[param];
|
||||
sub(/\(.*/, "", type);
|
||||
sub(/^\w+\(/, "", list); sub(/\)$/, "", list);
|
||||
|
||||
string = string" (\""type"\"";
|
||||
|
||||
count = split (list, fields, /,/);
|
||||
for (field = 1; field <= count; field++) {
|
||||
string = string" \""fields[field]"\"";
|
||||
}
|
||||
|
||||
string = string")";
|
||||
}
|
||||
|
||||
string = string"))\n";
|
||||
}
|
||||
|
||||
/^[^#]/ { output($0) }
|
||||
|
||||
|
||||
END {
|
||||
print "(define libgtop-features";
|
||||
print string" )";
|
||||
print ")\n";
|
||||
|
||||
print "(define libgtop-feature-names";
|
||||
print names" )";
|
||||
print ")\n";
|
||||
}
|
440
guile/header.scm
440
guile/header.scm
@@ -1,440 +0,0 @@
|
||||
;; $Id$
|
||||
|
||||
(define cpu-type '(("name" . "cpu")
|
||||
("label" . "CPU Usage")
|
||||
("fields" . (list
|
||||
(("name" . "total")
|
||||
("label" . "Total CPU Usage")
|
||||
("type" . "unsigned long"))
|
||||
(("name" . "user")
|
||||
("type" . "unsigned long"))
|
||||
(("name" . "nice")
|
||||
("type" . "unsigned long"))
|
||||
(("name" . "sys")
|
||||
("type" . "unsigned long"))
|
||||
(("name" . "idle")
|
||||
("type" . "unsigned long"))
|
||||
(("name" . "name")
|
||||
("type" . "const char")
|
||||
("pointer" . #t))
|
||||
(("name" . "test"))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define main-function
|
||||
(lambda (definition)
|
||||
(letrec ((default-type "unsigned long")
|
||||
(struct-label-comments #t)
|
||||
(struct-name-comments #f)
|
||||
(default-name-tabs-first 3)
|
||||
(default-name-tabs 4)
|
||||
(default-type-tabs 2)
|
||||
(default-comment-tabs 5)
|
||||
(default-definition-tabs 3)
|
||||
(default-definition-value-tabs 2)
|
||||
(default-max-line-length 60)
|
||||
;; set default values for unspecified fields
|
||||
(check-field-definition
|
||||
(lambda (fields)
|
||||
(let ((newlist (list)))
|
||||
(for-each
|
||||
(lambda (field)
|
||||
(if (not (assoc-ref field "type"))
|
||||
(set! field (assoc-set! field "type" default-type)))
|
||||
(if (assoc-ref field "label")
|
||||
(set! field (assoc-set! field "has-label" #t))
|
||||
(begin
|
||||
(set! field (assoc-set! field "label" (assoc-ref field "name")))
|
||||
(set! field (assoc-set! field "has-label" #f))
|
||||
)
|
||||
)
|
||||
(set! newlist (append newlist (list field)))
|
||||
)
|
||||
(cdr fields))
|
||||
(set-cdr! fields newlist)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; number fields sequentially
|
||||
(make-field-numbers
|
||||
(lambda (fields)
|
||||
(let ((pos 0) (newlist (list)))
|
||||
(for-each
|
||||
(lambda (field)
|
||||
(set! field (assoc-set! field "number" pos))
|
||||
(set! newlist (append newlist (list field)))
|
||||
(set! pos (+ pos 1))
|
||||
)
|
||||
(cdr fields))
|
||||
(set-cdr! fields newlist)
|
||||
(set! definition (assoc-set! definition "max-fields" pos))
|
||||
)
|
||||
)
|
||||
)
|
||||
;; pad string with up to 'tabs' tabs
|
||||
(tabify-string
|
||||
(lambda (string tabs)
|
||||
(let ((length (string-length string))
|
||||
(tlength (* tabs 8)))
|
||||
(if (> tlength length)
|
||||
(let* ((diff (- tlength length))
|
||||
(count (quotient (+ diff 7) 8)))
|
||||
(string-append string
|
||||
(make-string count #\tab))
|
||||
)
|
||||
(string-append string
|
||||
#\space)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; pad string with spaces
|
||||
(spacify-string
|
||||
(lambda (string tabs)
|
||||
(let ((length (string-length string))
|
||||
(tlength (* tabs 8)))
|
||||
(if (> tlength length)
|
||||
(string-append string
|
||||
(make-string (- tlength length) #\space))
|
||||
(string-append string
|
||||
#\space)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; creates comment string
|
||||
(make-comment-string
|
||||
(lambda (comment)
|
||||
(if comment
|
||||
(string "/* "
|
||||
(spacify-string comment
|
||||
default-comment-tabs)
|
||||
" */")
|
||||
(string)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; create constant for entry (eg. GLIBTOP_CPU_TOTAL)
|
||||
(entry-constant-name
|
||||
(lambda (name)
|
||||
(string-upcase! (string "GLIBTOP_"
|
||||
(assoc-ref definition "name")
|
||||
"_"
|
||||
name
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; create text that is displayed as comment along with entry
|
||||
(entry-comment-text
|
||||
(lambda (name label)
|
||||
(if label
|
||||
(if struct-label-comments label #f)
|
||||
(if struct-name-comments (entry-constant-name name) #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; starts struct definition
|
||||
(make-struct-definition-head
|
||||
(lambda ()
|
||||
(let* ((class (assoc-ref definition "name"))
|
||||
)
|
||||
(string "struct _glibtop_" class "\n"
|
||||
"{\n"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; terminates struct definition
|
||||
(make-struct-definition-tail
|
||||
(lambda ()
|
||||
(string "};\n\n")
|
||||
)
|
||||
)
|
||||
;; generate struct definition body
|
||||
(make-struct-definition-body
|
||||
(lambda (fields)
|
||||
(letrec ((output (string))
|
||||
(is-first-entry #t)
|
||||
(current-type #f)
|
||||
(current-name #f)
|
||||
(current-label #f)
|
||||
(current-pointer #f)
|
||||
;; close entry (other = next entry is of other type)
|
||||
(entry-end
|
||||
(lambda (other)
|
||||
(let ((old-first is-first-entry))
|
||||
(set! is-first-entry other)
|
||||
(if current-type
|
||||
(string (tabify-string (string (string (if current-pointer "*" ""))
|
||||
current-name
|
||||
(string (if other ";" ","))
|
||||
)
|
||||
(if old-first
|
||||
default-name-tabs-first
|
||||
default-name-tabs
|
||||
)
|
||||
)
|
||||
(make-comment-string (entry-comment-text
|
||||
current-name current-label))
|
||||
"\n")
|
||||
(string)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; start new entry
|
||||
(entry-start
|
||||
(lambda (name type)
|
||||
(if current-type
|
||||
(if (equal? current-type type)
|
||||
(string (entry-end #f) "\t\t")
|
||||
(string (entry-end #t) "\t"
|
||||
(tabify-string type default-type-tabs)
|
||||
)
|
||||
)
|
||||
(string "\t"
|
||||
(tabify-string type default-type-tabs)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; main function
|
||||
(for-each
|
||||
(lambda (field)
|
||||
(let ((name (assoc-ref field "name"))
|
||||
(type (assoc-ref field "type"))
|
||||
(pointer (assoc-ref field "pointer"))
|
||||
(label (if (assoc-ref field "has-label")
|
||||
(assoc-ref field "label")
|
||||
#f)
|
||||
)
|
||||
)
|
||||
(set! output (string-append output
|
||||
(string (entry-start name type))
|
||||
)
|
||||
)
|
||||
;; save current data
|
||||
(set! current-type type)
|
||||
(set! current-name name)
|
||||
(set! current-label label)
|
||||
(set! current-pointer pointer)
|
||||
)
|
||||
)
|
||||
(cdr fields))
|
||||
;; close last entry
|
||||
(string-append output (entry-end #t))
|
||||
)
|
||||
)
|
||||
)
|
||||
;; display complete struct definition
|
||||
(make-struct-definition
|
||||
(lambda (fields)
|
||||
(string-append (make-struct-definition-head)
|
||||
(make-struct-definition-body fields)
|
||||
(make-struct-definition-tail)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; make constant definition
|
||||
(make-const-definition
|
||||
(lambda (name value comment)
|
||||
(let* ((nstring (string-upcase! (string "GLIBTOP_" name)))
|
||||
(tabname (tabify-string nstring default-definition-tabs))
|
||||
(tabvalue (if comment
|
||||
(tabify-string (string value) default-definition-value-tabs)
|
||||
(string value))
|
||||
)
|
||||
(ctext (make-comment-string comment))
|
||||
(line (string "#define " tabname tabvalue ctext "\n"))
|
||||
)
|
||||
line)
|
||||
)
|
||||
)
|
||||
;; creates constant definitions
|
||||
(make-struct-constants
|
||||
(lambda (fields)
|
||||
(let ((class (assoc-ref definition "name"))
|
||||
(output (string))
|
||||
)
|
||||
(for-each
|
||||
(lambda (field)
|
||||
(let* ((name (assoc-ref field "name"))
|
||||
(number (assoc-ref field "number"))
|
||||
(key (string class "_" name))
|
||||
(value (number->string number))
|
||||
(label (if (assoc-ref field "has-label")
|
||||
(assoc-ref field "label")
|
||||
#f)
|
||||
)
|
||||
(line (make-const-definition key
|
||||
value
|
||||
(entry-comment-text name label)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! output (string-append output line))
|
||||
)
|
||||
)
|
||||
(cdr fields))
|
||||
output)
|
||||
)
|
||||
)
|
||||
;; creates definition of maximum constant
|
||||
(make-struct-max-constant
|
||||
(lambda ()
|
||||
(let* ((class (assoc-ref definition "name"))
|
||||
(max (assoc-ref definition "max-fields"))
|
||||
)
|
||||
(make-const-definition (string "MAX_" class)
|
||||
(number->string max)
|
||||
#f)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; adds new list element to string, inserting newline if necessary
|
||||
(add-to-string
|
||||
(lambda (output line element separator indent max-length)
|
||||
(let* ((slen (string-length line))
|
||||
(elen (string-length element))
|
||||
(tlen (+ slen elen))
|
||||
(bsep (if separator
|
||||
(string separator " ")
|
||||
(string)
|
||||
)
|
||||
)
|
||||
(nsep (string (if separator separator "") "\n"))
|
||||
)
|
||||
(if (and (> slen 0) (> tlen max-length))
|
||||
(begin
|
||||
(set! output (string-append output line nsep))
|
||||
(set! line (string indent element))
|
||||
)
|
||||
(set! line (string-append line bsep element))
|
||||
)
|
||||
(list output line)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; create general list definition
|
||||
(make-general-list-definition
|
||||
(lambda (fields name symbol line-length make-element-string)
|
||||
(letrec ((class (assoc-ref definition "name"))
|
||||
(make-general-list-definition-head
|
||||
(lambda ()
|
||||
(string "const char *"
|
||||
"glibtop_"
|
||||
symbol
|
||||
"_"
|
||||
class
|
||||
" "
|
||||
"[GLIBTOP_MAX_"
|
||||
(string-upcase! (string class))
|
||||
"] = \n{ "
|
||||
)
|
||||
)
|
||||
)
|
||||
(make-general-list-definition-tail
|
||||
(lambda ()
|
||||
(string "\n};\n")
|
||||
)
|
||||
)
|
||||
(make-general-list-definition-body
|
||||
(lambda ()
|
||||
(let* ((first #t) (output (string)) (line (string)))
|
||||
(for-each
|
||||
(lambda (field)
|
||||
(let* ((element (assoc-ref field name))
|
||||
(olist (add-to-string output line
|
||||
(make-element-string element)
|
||||
(if first #f ",")
|
||||
" "
|
||||
line-length))
|
||||
)
|
||||
(set! output (car olist))
|
||||
(set! line (car (cdr olist)))
|
||||
(set! first #f)
|
||||
)
|
||||
)
|
||||
(cdr fields))
|
||||
(set! output (string-append output line))
|
||||
output)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; main function
|
||||
(string-append (make-general-list-definition-head)
|
||||
(make-general-list-definition-body)
|
||||
(make-general-list-definition-tail)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; create name list definition
|
||||
(make-name-list-definition
|
||||
(lambda (fields)
|
||||
(make-general-list-definition fields
|
||||
"name"
|
||||
"names"
|
||||
default-max-line-length
|
||||
(lambda (x)
|
||||
(string #\" x #\")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; create label list definition
|
||||
(make-label-list-definition
|
||||
(lambda (fields)
|
||||
(make-general-list-definition fields
|
||||
"label"
|
||||
"labels"
|
||||
0
|
||||
(lambda (x)
|
||||
(string "gettext_noop (" #\" x #\" ")")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; create description list definition
|
||||
(make-description-list-definition
|
||||
(lambda (fields)
|
||||
(make-general-list-definition fields
|
||||
"description"
|
||||
"descriptions"
|
||||
default-max-line-length
|
||||
(lambda (x)
|
||||
(if x
|
||||
(string "gettext_noop (" #\" x #\" ")")
|
||||
(string "NULL")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; start of main function
|
||||
(let ((fielddef (assoc-ref definition "fields")))
|
||||
(display fielddef) (newline) (newline)
|
||||
(check-field-definition fielddef)
|
||||
(make-field-numbers fielddef)
|
||||
(display fielddef) (newline) (newline)
|
||||
(display (make-struct-definition fielddef))
|
||||
(display (make-struct-constants fielddef)) (newline)
|
||||
(display (make-struct-max-constant)) (newline) (newline)
|
||||
(display (make-name-list-definition fielddef)) (newline)
|
||||
(display (make-label-list-definition fielddef)) (newline)
|
||||
(display (make-description-list-definition fielddef)) (newline)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(begin
|
||||
(main-function cpu-type)
|
||||
(newline)
|
||||
)
|
||||
|
@@ -1,346 +0,0 @@
|
||||
;; $Id$
|
||||
|
||||
(load "features.scm")
|
||||
|
||||
(define sysdeps-list '())
|
||||
|
||||
(define type-names '("void"
|
||||
"int64_t" "u_int64_t" "double"
|
||||
"int" "char" "const char *"))
|
||||
|
||||
(define make-sysdeps-list
|
||||
(lambda ()
|
||||
(letrec ((names (cdr (glibtop-names-sysdeps)))
|
||||
(labels (cdr (glibtop-labels-sysdeps)))
|
||||
(descriptions (cdr (glibtop-descriptions-sysdeps)))
|
||||
)
|
||||
(for-each (lambda (feature)
|
||||
(let* ((label (car labels))
|
||||
(description (car descriptions))
|
||||
(list '())
|
||||
)
|
||||
(set! labels (cdr labels))
|
||||
(set! descriptions (cdr descriptions))
|
||||
(set! list (assoc-set! list 'name feature))
|
||||
(set! list (assoc-set! list 'label label))
|
||||
(set! list (assoc-set! list 'description description))
|
||||
(set! sysdeps-list (assoc-set! sysdeps-list feature list))
|
||||
)
|
||||
)
|
||||
names)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define make-function-reference
|
||||
(lambda (feature)
|
||||
(let* ((names (eval-string (string "(glibtop-names-" feature ")")))
|
||||
(types (eval-string (string "(glibtop-types-" feature ")")))
|
||||
(labels (eval-string (string "(glibtop-labels-" feature ")")))
|
||||
(sysdeps (assoc-ref sysdeps-list feature))
|
||||
(retval (car (car (assoc-ref libgtop-features feature))))
|
||||
(name (assoc-ref sysdeps 'name))
|
||||
(label (assoc-ref sysdeps 'label))
|
||||
(description (assoc-ref sysdeps 'description))
|
||||
(descriptions (eval-string (string "(glibtop-descriptions-" feature ")")))
|
||||
(feature_nounder (car (assoc-ref libgtop-feature-names feature)))
|
||||
(decl-list '()) (field-list '())
|
||||
|
||||
(synopsis-start-string
|
||||
(string "<para>Automatically generated function synopsis:\n\n"))
|
||||
|
||||
(section-string
|
||||
(string "<sect1>\n"
|
||||
"<title><function>glibtop_get_" feature "()</function> - "
|
||||
label "</title>\n\n")
|
||||
)
|
||||
|
||||
(description-string
|
||||
(string "<para>\nAutomatically generated description:\n\n"
|
||||
"<blockquote>\n<literallayout>\n"
|
||||
description "\n"
|
||||
"</literallayout>\n</blockquote>\n\n")
|
||||
)
|
||||
|
||||
(definition-start-string
|
||||
(string "<para>Automatically generated declaration of "
|
||||
"<structname>_glibtop_" feature "</structname>:\n\n")
|
||||
)
|
||||
|
||||
(param-description-start-string
|
||||
(string "<para>Automatically generated descriptions of "
|
||||
"<structname>_glibtop_" feature "</structname>:\n\n")
|
||||
)
|
||||
|
||||
(funcsynopsisinfo-string
|
||||
(string "<funcsynopsisinfo>\n"
|
||||
"#include <glibtop.h>\n"
|
||||
"#include <glibtop/" feature ".h>"
|
||||
"</funcsynopsisinfo>")
|
||||
)
|
||||
|
||||
(funcdef-string
|
||||
(string "<funcdef>" retval " "
|
||||
"<function>glibtop_get_" feature "_l</function>"
|
||||
"</funcdef>\n")
|
||||
)
|
||||
|
||||
(paramdef-string
|
||||
(lambda ()
|
||||
(let ((start (string "<paramdef>glibtop *<parameter>"
|
||||
"server</parameter>, glibtop_"
|
||||
feature " *<parameter>" feature
|
||||
"</parameter>")
|
||||
)
|
||||
(param_string (string))
|
||||
(end (string "\n</paramdef>"))
|
||||
(param_lists
|
||||
(cdr (car (assoc-ref libgtop-features feature))))
|
||||
)
|
||||
(for-each
|
||||
(lambda (x)
|
||||
(let ((type (car x))
|
||||
(params (cdr x))
|
||||
)
|
||||
(for-each
|
||||
(lambda (param)
|
||||
(set! param_string (string param_string
|
||||
", " type
|
||||
" <parameter>"
|
||||
param
|
||||
"</parameter>"
|
||||
)
|
||||
)
|
||||
)
|
||||
params)
|
||||
)
|
||||
)
|
||||
param_lists)
|
||||
(string start param_string end))
|
||||
)
|
||||
)
|
||||
|
||||
(funcdef-noserver-string
|
||||
(string "<funcdef>" retval " "
|
||||
"<function>glibtop_get_" feature "</function>"
|
||||
"</funcdef>\n")
|
||||
)
|
||||
|
||||
(paramdef-noserver-string
|
||||
(string "<paramdef>glibtop_" feature " *"
|
||||
"<parameter>" feature "</parameter>\n"
|
||||
"</paramdef>")
|
||||
)
|
||||
|
||||
(field-name-constant
|
||||
(lambda (name field)
|
||||
(string "GLIBTOP_"
|
||||
(string-upcase! (string name))
|
||||
"_"
|
||||
(string-upcase! (string field)))
|
||||
)
|
||||
)
|
||||
|
||||
(make-struct-name
|
||||
(lambda (type)
|
||||
(string "glibtop_" (assoc-ref type "name"))
|
||||
)
|
||||
)
|
||||
|
||||
(tab-pad-string
|
||||
(lambda (string tabs)
|
||||
(let* ((slength (string-length string))
|
||||
(tlength (* tabs 8)))
|
||||
(string-append string
|
||||
(make-string
|
||||
(if (> tlength slength)
|
||||
(- tlength slength)
|
||||
1
|
||||
)
|
||||
#\space))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(make-field-list
|
||||
(lambda (name type fields)
|
||||
(let* ((output (string)) (pos 1))
|
||||
(map
|
||||
(lambda (x)
|
||||
(let* ((sep (if (= pos (length fields)) ";" ","))
|
||||
(start (if (= pos 1)
|
||||
(string "\t"
|
||||
(tab-pad-string (string type) 2))
|
||||
(string "\t\t"))
|
||||
)
|
||||
(comment (string (if (= pos 1) "" "\t") "/* "
|
||||
(tab-pad-string
|
||||
(field-name-constant name (car x)) 4)
|
||||
" */"))
|
||||
(field (tab-pad-string
|
||||
(string-append (string (car x)) sep) 2))
|
||||
)
|
||||
(set! pos (+ pos 1))
|
||||
(string-append start field comment "\n")
|
||||
)
|
||||
)
|
||||
fields)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(init-field-list
|
||||
(lambda ()
|
||||
(let* ((old-type #f)
|
||||
(type-list types)
|
||||
(new-type #f)
|
||||
(fields (list))
|
||||
)
|
||||
(for-each
|
||||
(lambda (x)
|
||||
(set! new-type (car type-list))
|
||||
(set! type-list (cdr type-list))
|
||||
(set! new-type (list-ref type-names new-type))
|
||||
(if (equal? old-type new-type)
|
||||
(set-car! fields
|
||||
(append (list new-type)
|
||||
(cdr (car fields))
|
||||
(list (list x))
|
||||
)
|
||||
)
|
||||
(if (equal? old-type #f)
|
||||
(set! fields (list (list new-type (list x))))
|
||||
(set! fields (append (list (list new-type (list x))) fields))
|
||||
)
|
||||
)
|
||||
(set! old-type new-type)
|
||||
)
|
||||
names)
|
||||
fields)
|
||||
)
|
||||
)
|
||||
|
||||
(make-struct-body
|
||||
(lambda (type)
|
||||
(let* ((name (assoc-ref type "name"))
|
||||
(data (assoc-ref type "fields"))
|
||||
(output (string))
|
||||
)
|
||||
(for-each
|
||||
(lambda (y)
|
||||
(for-each
|
||||
(lambda (z)
|
||||
(set! output (string-append output z))
|
||||
)
|
||||
y)
|
||||
)
|
||||
(map
|
||||
(lambda (x) (make-field-list name (car x) (cdr x)))
|
||||
data)
|
||||
)
|
||||
output)
|
||||
)
|
||||
)
|
||||
|
||||
(make-struct
|
||||
(lambda (type)
|
||||
(let* ((name (assoc-ref type "name"))
|
||||
(data (assoc-ref type "fields"))
|
||||
(output (string-append
|
||||
(tab-pad-string
|
||||
(string "typedef struct _glibtop_" name)
|
||||
5)
|
||||
(string "glibtop_" name ";\n\n"
|
||||
"struct _glibtop_" name "\n{\n\t"
|
||||
"u_int64_t\tflags;\n")
|
||||
)
|
||||
)
|
||||
)
|
||||
(string-append output (make-struct-body type) "};\n")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(make-param-description
|
||||
(lambda ()
|
||||
(let* ((label-list labels)
|
||||
(description-list descriptions)
|
||||
(output (string))
|
||||
)
|
||||
(for-each
|
||||
(lambda (name)
|
||||
(let* ((label (car label-list))
|
||||
(description (car description-list))
|
||||
)
|
||||
(set! label-list (cdr label-list))
|
||||
(set! description-list (cdr description-list))
|
||||
(set! output
|
||||
(string-append output
|
||||
(string "<varlistentry>\n"
|
||||
"<term><parameter>"
|
||||
name
|
||||
"</parameter></term>\n\n"
|
||||
"<listitem>\n<para>\n"
|
||||
description "\n\n")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
names)
|
||||
output)
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
(set! decl-list (assoc-set! decl-list "name" name))
|
||||
(set! decl-list (assoc-set! decl-list "label" label))
|
||||
(set! decl-list (assoc-set! decl-list "fields" (init-field-list)))
|
||||
|
||||
(string-append section-string
|
||||
description-string
|
||||
synopsis-start-string
|
||||
(string "<blockquote>\n<funcsynopsis>\n")
|
||||
funcsynopsisinfo-string
|
||||
funcdef-noserver-string
|
||||
paramdef-noserver-string
|
||||
(string "</funcsynopsis>\n")
|
||||
(string "<funcsynopsis>\n")
|
||||
funcdef-string
|
||||
(paramdef-string)
|
||||
(string "</funcsynopsis>\n</blockquote>\n")
|
||||
definition-start-string
|
||||
(string "<blockquote>\n<literallayout>\n")
|
||||
(make-struct decl-list)
|
||||
(string "</literallayout>\n</blockquote>\n")
|
||||
param-description-start-string
|
||||
"<variablelist>\n\n"
|
||||
(make-param-description)
|
||||
"</variablelist>\n\n"
|
||||
"&include-" feature_nounder ".sgml;\n\n"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; <sect2 id="glibtop-get-cpu">
|
||||
;; <title><function>glibtop_get_cpu()</function> - get CPU usage</title>
|
||||
;;
|
||||
;; <funcsynopsis>
|
||||
;; <funcsynopsisinfo>
|
||||
;; #include <glibtop.h>
|
||||
;; #include <glibtop/cpu.h></funcsynopsisinfo>
|
||||
;; <funcdef>void <function>glibtop_get_cpu</function></funcdef>
|
||||
;; <paramdef>glibtop *<parameter>server</parameter>, glibtop_cpu *<parameter>cpu_usage</parameter>
|
||||
;; </paramdef></funcsynopsis>
|
||||
|
||||
|
||||
|
||||
(begin
|
||||
(make-sysdeps-list)
|
||||
|
||||
(for-each (lambda (x)
|
||||
(display (make-function-reference x))
|
||||
)
|
||||
(cdr (glibtop-names-sysdeps)))
|
||||
)
|
@@ -1,195 +0,0 @@
|
||||
(define cpu-type '(("name" . "cpu")
|
||||
("label" . "CPU Usage")
|
||||
("fields" . (("unsigned long" ("total" "Total CPU Usage")
|
||||
("user") ("nice") ("sys") ("idle"))
|
||||
("const char" ("name"))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; computes constant for struct field (eg. GLIBTOP_CPU_TOTAL)
|
||||
|
||||
(define field-name-constant
|
||||
(lambda (name field)
|
||||
(string "GLIBTOP_"
|
||||
(string-upcase! (string name))
|
||||
"_"
|
||||
(string-upcase! (string field)))
|
||||
)
|
||||
)
|
||||
|
||||
;; computes structure name (eg. glibtop_cpu)
|
||||
|
||||
(define make-struct-name
|
||||
(lambda (type)
|
||||
(string "glibtop_" (assoc-ref type "name"))
|
||||
)
|
||||
)
|
||||
|
||||
(define tab-pad-string
|
||||
(lambda (string tabs)
|
||||
(string-append string (make-string (- (* tabs 8) (string-length string)) #\space))
|
||||
)
|
||||
)
|
||||
|
||||
(define make-field-list
|
||||
(lambda (name type fields)
|
||||
(let* ((output (string)) (pos 1))
|
||||
(map
|
||||
(lambda (x)
|
||||
(let* ((sep (if (= pos (length fields)) ";" ","))
|
||||
(start (if (= pos 1)
|
||||
(string "\t"
|
||||
(tab-pad-string (string type) 2))
|
||||
(string "\t\t"))
|
||||
)
|
||||
(comment (string (if (= pos 1) "" "\t") "/* "
|
||||
(tab-pad-string (field-name-constant name (car x)) 3)
|
||||
" */"))
|
||||
(field (tab-pad-string (string-append (string (car x)) sep) 2))
|
||||
)
|
||||
(set! pos (+ pos 1))
|
||||
(string-append start field comment "\n")
|
||||
)
|
||||
)
|
||||
fields)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define make-struct-body
|
||||
(lambda (type)
|
||||
(let* ((name (assoc-ref type "name"))
|
||||
(data (assoc-ref type "fields"))
|
||||
(output (string))
|
||||
)
|
||||
(for-each
|
||||
(lambda (y)
|
||||
(for-each
|
||||
(lambda (z)
|
||||
(set! output (string-append output z))
|
||||
)
|
||||
y)
|
||||
)
|
||||
(map
|
||||
(lambda (x) (make-field-list name (car x) (cdr x)))
|
||||
data)
|
||||
)
|
||||
output)
|
||||
)
|
||||
)
|
||||
|
||||
(define make-struct
|
||||
(lambda (type)
|
||||
(let* ((name (assoc-ref type "name"))
|
||||
(data (assoc-ref type "fields"))
|
||||
(output (string-append
|
||||
(tab-pad-string
|
||||
(string "typedef struct _glibtop_" name)
|
||||
5)
|
||||
(string "glibtop_" name ";\n\n"
|
||||
"struct glibtop_" name "\n{\n\t"
|
||||
"unsigned long\tflags;\n")
|
||||
)
|
||||
)
|
||||
)
|
||||
(string-append output (make-struct-body type) "};\n")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define make-field-name-list
|
||||
(lambda (type)
|
||||
(let* ((name (assoc-ref type "name"))
|
||||
(data (assoc-ref type "fields"))
|
||||
(return (list))
|
||||
)
|
||||
(map
|
||||
(lambda (x)
|
||||
(map
|
||||
(lambda (y) (set! return (append return (list (car y)))))
|
||||
(cdr x)
|
||||
)
|
||||
)
|
||||
data)
|
||||
return)
|
||||
)
|
||||
)
|
||||
|
||||
(define make-field-constants
|
||||
(lambda (type)
|
||||
(let* ((name (assoc-ref type "name"))
|
||||
(data (make-field-name-list type))
|
||||
(output (string
|
||||
(tab-pad-string
|
||||
(string "#define GLIBTOP_MAX_"
|
||||
(string-upcase! (string name))
|
||||
) 5)
|
||||
(number->string (length data))
|
||||
"\n\n"
|
||||
)
|
||||
)
|
||||
(pos 0)
|
||||
)
|
||||
(for-each
|
||||
(lambda (x)
|
||||
(set! output (string-append output (string
|
||||
(tab-pad-string
|
||||
(string "#define GLIBTOP_"
|
||||
(string-upcase! (string name))
|
||||
"_"
|
||||
(string-upcase! (string x))
|
||||
) 5)
|
||||
(number->string pos)
|
||||
"\n"
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! pos (+ pos 1))
|
||||
)
|
||||
data)
|
||||
output)
|
||||
)
|
||||
)
|
||||
|
||||
(define make-extern-defs
|
||||
(lambda (type)
|
||||
(let* ((name (assoc-ref type "name"))
|
||||
)
|
||||
(string
|
||||
(tab-pad-string (string "extern void glibtop_get_" name) 6)
|
||||
"__P(glibtop *, glibtop_" name " *);\n\n"
|
||||
"#ifdef HAVE_GUILE\n\n"
|
||||
"/* You need to link with -lgtop_guile to get this stuff here. */\n\n"
|
||||
(tab-pad-string (string "extern SCM glibtop_get_" name) 6)
|
||||
"__P(void);\n\n"
|
||||
"#endif /* HAVE_GUILE */\n\n"
|
||||
"#ifdef GLIBTOP_GUILE_NAMES\n\n"
|
||||
"/* You need to link with -lgtop_guile_names to get this stuff here. */\n\n"
|
||||
(tab-pad-string (string "extern SCM glibtop_guile_names_" name) 6)
|
||||
"__P(void);\n"
|
||||
(tab-pad-string (string "extern SCM glibtop_guile_labels_" name) 6)
|
||||
"__P(void);\n"
|
||||
(tab-pad-string (string "extern SCM glibtop_guile_descriptions_" name) 6)
|
||||
"__P(void);\n\n"
|
||||
"#endif /* GLIBTOP_GUILE_NAMES */\n\n"
|
||||
"#ifdef GLIBTOP_NAMES\n\n"
|
||||
"/* You need to link with -lgtop_names to get this stuff here. */\n\n"
|
||||
(tab-pad-string (string "extern const char *glibtop_names_" name) 6)
|
||||
"[];\n"
|
||||
(tab-pad-string (string "extern const char *glibtop_labels_" name) 6)
|
||||
"[];\n"
|
||||
(tab-pad-string (string "extern const char *glibtop_descriptions_" name) 6)
|
||||
"[];\n\n"
|
||||
"#endif /* GLIBTOP_NAMES */\n\n")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(begin
|
||||
(display (make-field-constants cpu-type)) (newline)
|
||||
(display (make-struct cpu-type)) (newline)
|
||||
(display (make-extern-defs cpu-type)) (newline)
|
||||
)
|
||||
|
1784
guile/reference.sgml
1784
guile/reference.sgml
File diff suppressed because it is too large
Load Diff
@@ -7,4 +7,4 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.h \
|
||||
procsegment.h read.h sysdeps.h xmalloc.h global.h \
|
||||
procsignal.h read_data.h union.h types.h gnuserv.h \
|
||||
parameter.h mountlist.h fsusage.h procmap.h signal.h \
|
||||
inodedb.h
|
||||
inodedb.h sysinfo.h ppp.h procargs.h netload.h
|
||||
|
@@ -48,12 +48,15 @@ __BEGIN_DECLS
|
||||
#define GLIBTOP_CMND_PROC_SIGNAL 15
|
||||
#define GLIBTOP_CMND_PROC_KERNEL 16
|
||||
#define GLIBTOP_CMND_PROC_SEGMENT 17
|
||||
#define GLIBTOP_CMND_PROC_MAP 18
|
||||
#define GLIBTOP_CMND_PROC_ARGS 18
|
||||
#define GLIBTOP_CMND_PROC_MAP 19
|
||||
|
||||
#define GLIBTOP_CMND_MOUNTLIST 19
|
||||
#define GLIBTOP_CMND_FSUSAGE 20
|
||||
#define GLIBTOP_CMND_MOUNTLIST 20
|
||||
#define GLIBTOP_CMND_FSUSAGE 21
|
||||
#define GLIBTOP_CMND_NETLOAD 22
|
||||
#define GLIBTOP_CMND_PPP 23
|
||||
|
||||
#define GLIBTOP_MAX_CMND 21
|
||||
#define GLIBTOP_MAX_CMND 24
|
||||
|
||||
#define _GLIBTOP_PARAM_SIZE 16
|
||||
|
||||
@@ -84,8 +87,8 @@ struct _glibtop_response
|
||||
|
||||
#define glibtop_call(p1, p2, p3, p4) glibtop_call_r(glibtop_global_server, p1, p2, p3, p4)
|
||||
|
||||
extern void *glibtop_call_l __P((glibtop *, unsigned, size_t, void *, size_t, void *));
|
||||
extern void *glibtop_call_s __P((glibtop *, unsigned, size_t, void *, size_t, void *));
|
||||
extern void *glibtop_call_l __P((glibtop *, unsigned, size_t, const void *, size_t, void *));
|
||||
extern void *glibtop_call_s __P((glibtop *, unsigned, size_t, const void *, size_t, void *));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
@@ -34,19 +34,33 @@ __BEGIN_DECLS
|
||||
#define GLIBTOP_CPU_IDLE 4
|
||||
#define GLIBTOP_CPU_FREQUENCY 5
|
||||
|
||||
#define GLIBTOP_MAX_CPU 6
|
||||
#define GLIBTOP_XCPU_TOTAL 6
|
||||
#define GLIBTOP_XCPU_USER 7
|
||||
#define GLIBTOP_XCPU_NICE 8
|
||||
#define GLIBTOP_XCPU_SYS 9
|
||||
#define GLIBTOP_XCPU_IDLE 10
|
||||
|
||||
#define GLIBTOP_MAX_CPU 11
|
||||
|
||||
/* Nobody should really be using more than 4 processors. */
|
||||
#define GLIBTOP_NCPU 4
|
||||
|
||||
typedef struct _glibtop_cpu glibtop_cpu;
|
||||
|
||||
struct _glibtop_cpu
|
||||
{
|
||||
u_int64_t flags,
|
||||
total, /* GLIBTOP_CPU_TOTAL */
|
||||
user, /* GLIBTOP_CPU_USER */
|
||||
nice, /* GLIBTOP_CPU_NICE */
|
||||
sys, /* GLIBTOP_CPU_SYS */
|
||||
idle, /* GLIBTOP_CPU_IDLE */
|
||||
frequency; /* GLIBTOP_CPU_FREQUENCY */
|
||||
total, /* GLIBTOP_CPU_TOTAL */
|
||||
user, /* GLIBTOP_CPU_USER */
|
||||
nice, /* GLIBTOP_CPU_NICE */
|
||||
sys, /* GLIBTOP_CPU_SYS */
|
||||
idle, /* GLIBTOP_CPU_IDLE */
|
||||
frequency, /* GLIBTOP_CPU_FREQUENCY */
|
||||
xcpu_total [GLIBTOP_NCPU], /* GLIBTOP_XCPU_TOTAL */
|
||||
xcpu_user [GLIBTOP_NCPU], /* GLIBTOP_XCPU_USER */
|
||||
xcpu_nice [GLIBTOP_NCPU], /* GLIBTOP_XCPU_NICE */
|
||||
xcpu_sys [GLIBTOP_NCPU], /* GLIBTOP_XCPU_SYS */
|
||||
xcpu_idle [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_IDLE */
|
||||
};
|
||||
|
||||
#define glibtop_get_cpu(cpu) glibtop_get_cpu_l(glibtop_global_server, cpu)
|
||||
@@ -67,25 +81,6 @@ extern void glibtop_init_cpu_s __P((glibtop *));
|
||||
extern void glibtop_get_cpu_s __P((glibtop *, glibtop_cpu *));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_cpu __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_cpu __P((void));
|
||||
extern SCM glibtop_guile_types_cpu __P((void));
|
||||
extern SCM glibtop_guile_labels_cpu __P((void));
|
||||
extern SCM glibtop_guile_descriptions_cpu __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -55,25 +55,6 @@ extern void glibtop_get_fsusage_l __P((glibtop *, glibtop_fsusage *, const char
|
||||
|
||||
extern void glibtop_get_fsusage_s __P((glibtop *, glibtop_fsusage *, const char *));
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_fsusage __P((SCM));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_fsusage __P((void));
|
||||
extern SCM glibtop_guile_types_fsusage __P((void));
|
||||
extern SCM glibtop_guile_labels_fsusage __P((void));
|
||||
extern SCM glibtop_guile_descriptions_fsusage __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -51,6 +51,25 @@
|
||||
# define __P(protos) ()
|
||||
#endif
|
||||
|
||||
#ifdef _IN_LIBGTOP
|
||||
|
||||
/* Provide macros to feature the GCC function attribute.
|
||||
*/
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
|
||||
#define G_GNUC_NORETURN \
|
||||
__attribute__((noreturn))
|
||||
#define G_GNUC_CONST \
|
||||
__attribute__((const))
|
||||
#define G_GNUC_UNUSED \
|
||||
__attribute__((unused))
|
||||
#else /* !__GNUC__ */
|
||||
#define G_GNUC_NORETURN
|
||||
#define G_GNUC_CONST
|
||||
#define G_GNUC_UNUSED
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
#endif /* _IN_LIBGTOP */
|
||||
|
||||
#if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
@@ -97,10 +116,16 @@
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _IN_LIBGTOP
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#endif /* _IN_LIBGTOP */
|
||||
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
@@ -75,7 +75,9 @@ static char header_rcsid [] = "!Header: gnuserv.h,v 2.4 95/02/16 11:58:11 arup a
|
||||
* stuff related to supporting MIT-MAGIC-COOKIE-1
|
||||
*/
|
||||
|
||||
#define MCOOKIE_SCREEN "42980" /* screen # to use as the gnuserv cookie */
|
||||
#if 0
|
||||
#define MCOOKIE_SCREEN "42980" /* screen # to use as the gnuserv cookie */
|
||||
#endif
|
||||
#define MCOOKIE_NAME "MAGIC-1" /* authentication protocol name */
|
||||
#define MCOOKIE_X_NAME "MIT-MAGIC-COOKIE-1" /* as needed by X */
|
||||
|
||||
|
@@ -63,25 +63,6 @@ extern void glibtop_init_loadavg_s __P((glibtop *));
|
||||
extern void glibtop_get_loadavg_s __P((glibtop *, glibtop_loadavg *));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_loadavg __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_loadavg __P((void));
|
||||
extern SCM glibtop_guile_types_loadavg __P((void));
|
||||
extern SCM glibtop_guile_labels_loadavg __P((void));
|
||||
extern SCM glibtop_guile_descriptions_loadavg __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -71,25 +71,6 @@ extern void glibtop_init_mem_s __P((glibtop *));
|
||||
extern void glibtop_get_mem_s __P((glibtop *, glibtop_mem *));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_mem __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_mem __P((void));
|
||||
extern SCM glibtop_guile_types_mem __P((void));
|
||||
extern SCM glibtop_guile_labels_mem __P((void));
|
||||
extern SCM glibtop_guile_descriptions_mem __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -61,25 +61,6 @@ extern glibtop_mountentry *glibtop_get_mountlist_l __P((glibtop *, glibtop_mount
|
||||
|
||||
extern glibtop_mountentry *glibtop_get_mountlist_s __P((glibtop *, glibtop_mountlist *, int));
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_mountlist __P((SCM));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_mountlist __P((void));
|
||||
extern SCM glibtop_guile_types_mountlist __P((void));
|
||||
extern SCM glibtop_guile_labels_mountlist __P((void));
|
||||
extern SCM glibtop_guile_descriptions_mountlist __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -69,25 +69,6 @@ extern void glibtop_init_msg_limits_s __P((glibtop *));
|
||||
extern void glibtop_get_msg_limits_s __P((glibtop *, glibtop_msg_limits *));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_msg_limits __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_msg_limits __P((void));
|
||||
extern SCM glibtop_guile_types_msg_limits __P((void));
|
||||
extern SCM glibtop_guile_labels_msg_limits __P((void));
|
||||
extern SCM glibtop_guile_descriptions_msg_limits __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
118
include/glibtop/netload.h
Normal file
118
include/glibtop/netload.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef __GLIBTOP_NETLOAD_H__
|
||||
#define __GLIBTOP_NETLOAD_H__
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/global.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define GLIBTOP_NETLOAD_IF_FLAGS 0
|
||||
#define GLIBTOP_NETLOAD_MTU 1
|
||||
#define GLIBTOP_NETLOAD_SUBNET 2
|
||||
#define GLIBTOP_NETLOAD_ADDRESS 3
|
||||
#define GLIBTOP_NETLOAD_PACKETS_IN 4
|
||||
#define GLIBTOP_NETLOAD_PACKETS_OUT 5
|
||||
#define GLIBTOP_NETLOAD_PACKETS_TOTAL 6
|
||||
#define GLIBTOP_NETLOAD_BYTES_IN 7
|
||||
#define GLIBTOP_NETLOAD_BYTES_OUT 8
|
||||
#define GLIBTOP_NETLOAD_BYTES_TOTAL 9
|
||||
#define GLIBTOP_NETLOAD_ERRORS_IN 10
|
||||
#define GLIBTOP_NETLOAD_ERRORS_OUT 11
|
||||
#define GLIBTOP_NETLOAD_ERRORS_TOTAL 12
|
||||
#define GLIBTOP_NETLOAD_COLLISIONS 13
|
||||
|
||||
#define GLIBTOP_MAX_NETLOAD 14
|
||||
|
||||
typedef struct _glibtop_netload glibtop_netload;
|
||||
|
||||
enum {
|
||||
GLIBTOP_IF_FLAGS_UP = 1,
|
||||
GLIBTOP_IF_FLAGS_BROADCAST,
|
||||
GLIBTOP_IF_FLAGS_DEBUG,
|
||||
GLIBTOP_IF_FLAGS_LOOPBACK,
|
||||
GLIBTOP_IF_FLAGS_POINTOPOINT,
|
||||
GLIBTOP_IF_FLAGS_RUNNING,
|
||||
GLIBTOP_IF_FLAGS_NOARP,
|
||||
GLIBTOP_IF_FLAGS_PROMISC,
|
||||
GLIBTOP_IF_FLAGS_ALLMULTI,
|
||||
GLIBTOP_IF_FLAGS_OACTIVE,
|
||||
GLIBTOP_IF_FLAGS_SIMPLEX,
|
||||
GLIBTOP_IF_FLAGS_LINK0,
|
||||
GLIBTOP_IF_FLAGS_LINK1,
|
||||
GLIBTOP_IF_FLAGS_LINK2,
|
||||
GLIBTOP_IF_FLAGS_ALTPHYS,
|
||||
GLIBTOP_IF_FLAGS_MULTICAST
|
||||
};
|
||||
|
||||
struct _glibtop_netload
|
||||
{
|
||||
u_int64_t flags,
|
||||
if_flags, /* GLIBTOP_NETLOAD_IF_FLAGS */
|
||||
mtu, /* GLIBTOP_NETLOAD_MTU */
|
||||
subnet, /* GLIBTOP_NETLOAD_SUBNET */
|
||||
address, /* GLIBTOP_NETLOAD_ADDRESS */
|
||||
packets_in, /* GLIBTOP_NETLOAD_PACKETS_IN */
|
||||
packets_out, /* GLIBTOP_NETLOAD_PACKETS_OUT */
|
||||
packets_total, /* GLIBTOP_NETLOAD_PACKETS_TOTAL*/
|
||||
bytes_in, /* GLIBTOP_NETLOAD_BYTES_IN */
|
||||
bytes_out, /* GLIBTOP_NETLOAD_BYTES_OUT */
|
||||
bytes_total, /* GLIBTOP_NETLOAD_BYTES_TOTAL */
|
||||
errors_in, /* GLIBTOP_NETLOAD_ERRORS_IN */
|
||||
errors_out, /* GLIBTOP_NETLOAD_ERRORS_OUT */
|
||||
errors_total, /* GLIBTOP_NETLOAD_ERRORS_TOTAL */
|
||||
collisions; /* GLIBTOP_NETLOAD_COLLISIONS */
|
||||
};
|
||||
|
||||
#define glibtop_get_netload(netload,interface) glibtop_get_netload_l(glibtop_global_server, netload, interface)
|
||||
|
||||
#if GLIBTOP_SUID_NETLOAD
|
||||
#define glibtop_get_netload_r glibtop_get_netload_p
|
||||
#else
|
||||
#define glibtop_get_netload_r glibtop_get_netload_s
|
||||
#endif
|
||||
|
||||
extern void glibtop_get_netload_l __P((glibtop *, glibtop_netload *, const char *));
|
||||
|
||||
#if GLIBTOP_SUID_NETLOAD
|
||||
extern void glibtop_init_netload_p __P((glibtop *));
|
||||
extern void glibtop_get_netload_p __P((glibtop *, glibtop_netload *, const char *));
|
||||
#else
|
||||
extern void glibtop_init_netload_s __P((glibtop *));
|
||||
extern void glibtop_get_netload_s __P((glibtop *, glibtop_netload *, const char *));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
||||
extern const char *glibtop_names_netload [];
|
||||
extern const unsigned glibtop_types_netload [];
|
||||
extern const char *glibtop_labels_netload [];
|
||||
extern const char *glibtop_descriptions_netload [];
|
||||
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
@@ -31,6 +31,7 @@ __BEGIN_DECLS
|
||||
#define GLIBTOP_PARAM_HOST 4
|
||||
#define GLIBTOP_PARAM_PORT 5
|
||||
#define GLIBTOP_PARAM_ERROR_METHOD 6
|
||||
#define GLIBTOP_PARAM_REQUIRED 7
|
||||
|
||||
#define glibtop_get_parameter(p1,p2,p3) glibtop_get_parameter_l(glibtop_global_server,p1,p2,p3)
|
||||
#define glibtop_set_parameter(p1,p2,p3) glibtop_set_parameter_l(glibtop_global_server,p1,p2,p3)
|
||||
|
83
include/glibtop/ppp.h
Normal file
83
include/glibtop/ppp.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef __GLIBTOP_PPP_H__
|
||||
#define __GLIBTOP_PPP_H__
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/global.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define GLIBTOP_PPP_STATE 0
|
||||
#define GLIBTOP_PPP_BYTES_IN 1
|
||||
#define GLIBTOP_PPP_BYTES_OUT 2
|
||||
|
||||
#define GLIBTOP_MAX_PPP 3
|
||||
|
||||
typedef struct _glibtop_ppp glibtop_ppp;
|
||||
|
||||
enum {
|
||||
GLIBTOP_PPP_STATE_UNKNOWN = 0,
|
||||
GLIBTOP_PPP_STATE_HANGUP,
|
||||
GLIBTOP_PPP_STATE_ONLINE
|
||||
};
|
||||
|
||||
struct _glibtop_ppp
|
||||
{
|
||||
u_int64_t flags,
|
||||
state, /* GLIBTOP_PPP_STATE */
|
||||
bytes_in, /* GLIBTOP_PPP_BYTES_IN */
|
||||
bytes_out; /* GLIBTOP_PPP_BYTES_OUT */
|
||||
};
|
||||
|
||||
#define glibtop_get_ppp(ppp,device) glibtop_get_ppp_l(glibtop_global_server, ppp, device)
|
||||
|
||||
#if GLIBTOP_SUID_PPP
|
||||
#define glibtop_get_ppp_r glibtop_get_ppp_p
|
||||
#else
|
||||
#define glibtop_get_ppp_r glibtop_get_ppp_s
|
||||
#endif
|
||||
|
||||
extern void glibtop_get_ppp_l __P((glibtop *, glibtop_ppp *, unsigned short));
|
||||
|
||||
#if GLIBTOP_SUID_PPP
|
||||
extern void glibtop_init_ppp_p __P((glibtop *));
|
||||
extern void glibtop_get_ppp_p __P((glibtop *, glibtop_ppp *, unsigned short));
|
||||
#else
|
||||
extern void glibtop_init_ppp_s __P((glibtop *));
|
||||
extern void glibtop_get_ppp_s __P((glibtop *, glibtop_ppp *, unsigned short));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
||||
extern const char *glibtop_names_ppp [];
|
||||
extern const unsigned glibtop_types_ppp [];
|
||||
extern const char *glibtop_labels_ppp [];
|
||||
extern const char *glibtop_descriptions_ppp [];
|
||||
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
73
include/glibtop/procargs.h
Normal file
73
include/glibtop/procargs.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef __GLIBTOP_PROC_ARGS_H__
|
||||
#define __GLIBTOP_PROC_ARGS_H__
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/global.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define GLIBTOP_PROC_ARGS_SIZE 0
|
||||
|
||||
#define GLIBTOP_MAX_PROC_ARGS 1
|
||||
|
||||
typedef struct _glibtop_proc_args glibtop_proc_args;
|
||||
|
||||
struct _glibtop_proc_args
|
||||
{
|
||||
u_int64_t flags,
|
||||
size; /* GLIBTOP_PROC_ARGS_SIZE */
|
||||
};
|
||||
|
||||
#define glibtop_get_proc_args(proc_args,pid,max_len) glibtop_get_proc_args_l(glibtop_global_server, proc_args, pid, max_len)
|
||||
|
||||
#if GLIBTOP_SUID_PROC_ARGS
|
||||
#define glibtop_get_proc_args_r glibtop_get_proc_args_p
|
||||
#else
|
||||
#define glibtop_get_proc_args_r glibtop_get_proc_args_s
|
||||
#endif
|
||||
|
||||
extern char *glibtop_get_proc_args_l __P((glibtop *, glibtop_proc_args *, pid_t, unsigned));
|
||||
|
||||
#if GLIBTOP_SUID_PROC_ARGS
|
||||
extern void glibtop_init_proc_args_p __P((glibtop *));
|
||||
extern char *glibtop_get_proc_args_p __P((glibtop *, glibtop_proc_args *, pid_t, unsigned));
|
||||
#else
|
||||
extern void glibtop_init_proc_args_s __P((glibtop *));
|
||||
extern char *glibtop_get_proc_args_s __P((glibtop *, glibtop_proc_args *, pid_t, unsigned));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
||||
extern const char *glibtop_names_proc_args [];
|
||||
extern const unsigned glibtop_types_proc_args [];
|
||||
extern const char *glibtop_labels_proc_args [];
|
||||
extern const char *glibtop_descriptions_proc_args [];
|
||||
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
@@ -80,25 +80,6 @@ extern void glibtop_init_proc_kernel_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_kernel_s __P((glibtop *, glibtop_proc_kernel *, pid_t));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_proc_kernel __P((SCM));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_types_proc_kernel __P((void));
|
||||
extern SCM glibtop_guile_names_proc_kernel __P((void));
|
||||
extern SCM glibtop_guile_labels_proc_kernel __P((void));
|
||||
extern SCM glibtop_guile_descriptions_proc_kernel __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -78,25 +78,6 @@ extern void glibtop_init_proclist_s __P((glibtop *));
|
||||
extern unsigned *glibtop_get_proclist_s __P((glibtop *, glibtop_proclist *, int64_t, int64_t));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_proclist __P((SCM, SCM));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_proclist __P((void));
|
||||
extern SCM glibtop_guile_types_proclist __P((void));
|
||||
extern SCM glibtop_guile_labels_proclist __P((void));
|
||||
extern SCM glibtop_guile_descriptions_proclist __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -87,25 +87,6 @@ extern void glibtop_init_proc_map_s __P((glibtop *));
|
||||
extern glibtop_map_entry *glibtop_get_proc_map_s __P((glibtop *, glibtop_proc_map *, pid_t));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_proc_map __P((SCM));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_proc_map __P((void));
|
||||
extern SCM glibtop_guile_types_proc_map __P((void));
|
||||
extern SCM glibtop_guile_labels_proc_map __P((void));
|
||||
extern SCM glibtop_guile_descriptions_proc_map __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -71,25 +71,6 @@ extern void glibtop_init_proc_mem_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_mem_s __P((glibtop *, glibtop_proc_mem *, pid_t));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_proc_mem __P((SCM));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_types_proc_mem __P((void));
|
||||
extern SCM glibtop_guile_names_proc_mem __P((void));
|
||||
extern SCM glibtop_guile_labels_proc_mem __P((void));
|
||||
extern SCM glibtop_guile_descriptions_proc_mem __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -74,25 +74,6 @@ extern void glibtop_init_proc_segment_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_segment_s __P((glibtop *, glibtop_proc_segment *, pid_t));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_proc_segment __P((SCM));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_proc_segment __P((void));
|
||||
extern SCM glibtop_guile_types_proc_segment __P((void));
|
||||
extern SCM glibtop_guile_labels_proc_segment __P((void));
|
||||
extern SCM glibtop_guile_descriptions_proc_segment __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -41,10 +41,10 @@ typedef struct _glibtop_proc_signal glibtop_proc_signal;
|
||||
struct _glibtop_proc_signal
|
||||
{
|
||||
u_int64_t flags,
|
||||
signal, /* mask of pending signals */
|
||||
blocked, /* mask of blocked signals */
|
||||
sigignore, /* mask of ignored signals */
|
||||
sigcatch; /* mask of caught signals */
|
||||
signal [2], /* mask of pending signals */
|
||||
blocked [2], /* mask of blocked signals */
|
||||
sigignore [2], /* mask of ignored signals */
|
||||
sigcatch [2]; /* mask of caught signals */
|
||||
};
|
||||
|
||||
#define glibtop_get_proc_signal(p1, p2) glibtop_get_proc_signal_l(glibtop_global_server, p1, p2)
|
||||
@@ -65,25 +65,6 @@ extern void glibtop_init_proc_signal_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_signal_s __P((glibtop *, glibtop_proc_signal *, pid_t));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_proc_signal __P((SCM));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_proc_signal __P((void));
|
||||
extern SCM glibtop_guile_types_proc_signal __P((void));
|
||||
extern SCM glibtop_guile_labels_proc_signal __P((void));
|
||||
extern SCM glibtop_guile_descriptions_proc_signal __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -72,25 +72,6 @@ extern void glibtop_init_proc_state_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_state_s __P((glibtop *, glibtop_proc_state *, pid_t));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_proc_state __P((SCM));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_proc_state __P((void));
|
||||
extern SCM glibtop_guile_types_proc_state __P((void));
|
||||
extern SCM glibtop_guile_labels_proc_state __P((void));
|
||||
extern SCM glibtop_guile_descriptions_proc_state __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#define __GLIBTOP_PROCTIME_H__
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/cpu.h>
|
||||
#include <glibtop/global.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
@@ -36,8 +37,10 @@ __BEGIN_DECLS
|
||||
#define GLIBTOP_PROC_TIME_TIMEOUT 6
|
||||
#define GLIBTOP_PROC_TIME_IT_REAL_VALUE 7
|
||||
#define GLIBTOP_PROC_TIME_FREQUENCY 8
|
||||
#define GLIBTOP_PROC_TIME_XCPU_UTIME 9
|
||||
#define GLIBTOP_PROC_TIME_XCPU_STIME 10
|
||||
|
||||
#define GLIBTOP_MAX_PROC_TIME 9
|
||||
#define GLIBTOP_MAX_PROC_TIME 11
|
||||
|
||||
typedef struct _glibtop_proc_time glibtop_proc_time;
|
||||
|
||||
@@ -60,7 +63,9 @@ struct _glibtop_proc_time
|
||||
it_real_value, /* The time (in jiffies) before the
|
||||
* next SIGALRM is sent to the process
|
||||
* due to an interval timer. */
|
||||
frequency; /* Tick frequency. */
|
||||
frequency, /* Tick frequency. */
|
||||
xcpu_utime [GLIBTOP_NCPU], /* utime and stime for all CPUs on */
|
||||
xcpu_stime [GLIBTOP_NCPU]; /* SMP machines. */
|
||||
};
|
||||
|
||||
#define glibtop_get_proc_time(p1, p2) glibtop_get_proc_time_l(glibtop_global_server, p1, p2)
|
||||
@@ -81,25 +86,6 @@ extern void glibtop_init_proc_time_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_time_s __P((glibtop *, glibtop_proc_time *, pid_t));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_proc_time __P((SCM));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_proc_time __P((void));
|
||||
extern SCM glibtop_guile_types_proc_time __P((void));
|
||||
extern SCM glibtop_guile_labels_proc_time __P((void));
|
||||
extern SCM glibtop_guile_descriptions_proc_time __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -81,25 +81,6 @@ extern void glibtop_init_proc_uid_s __P((glibtop *));
|
||||
extern void glibtop_get_proc_uid_s __P((glibtop *, glibtop_proc_uid *, pid_t));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_proc_uid __P((SCM));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_proc_uid __P((void));
|
||||
extern SCM glibtop_guile_types_proc_uid __P((void));
|
||||
extern SCM glibtop_guile_labels_proc_uid __P((void));
|
||||
extern SCM glibtop_guile_descriptions_proc_uid __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -75,25 +75,6 @@ extern void glibtop_init_sem_limits_s __P((glibtop *));
|
||||
extern void glibtop_get_sem_limits_s __P((glibtop *, glibtop_sem_limits *));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_sem_limits __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_sem_limits __P((void));
|
||||
extern SCM glibtop_guile_types_sem_limits __P((void));
|
||||
extern SCM glibtop_guile_labels_sem_limits __P((void));
|
||||
extern SCM glibtop_guile_descriptions_sem_limits __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -65,25 +65,6 @@ extern void glibtop_init_shm_limits_s __P((glibtop *));
|
||||
extern void glibtop_get_shm_limits_s __P((glibtop *, glibtop_shm_limits *));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_shm_limits __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_shm_limits __P((void));
|
||||
extern SCM glibtop_guile_types_shm_limits __P((void));
|
||||
extern SCM glibtop_guile_labels_shm_limits __P((void));
|
||||
extern SCM glibtop_guile_descriptions_shm_limits __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -65,25 +65,6 @@ extern void glibtop_init_swap_s __P((glibtop *));
|
||||
extern void glibtop_get_swap_s __P((glibtop *, glibtop_swap *));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_swap __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_swap __P((void));
|
||||
extern SCM glibtop_guile_types_swap __P((void));
|
||||
extern SCM glibtop_guile_labels_swap __P((void));
|
||||
extern SCM glibtop_guile_descriptions_swap __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -43,11 +43,14 @@ __BEGIN_DECLS
|
||||
#define GLIBTOP_SYSDEPS_PROC_SIGNAL 14
|
||||
#define GLIBTOP_SYSDEPS_PROC_KERNEL 15
|
||||
#define GLIBTOP_SYSDEPS_PROC_SEGMENT 16
|
||||
#define GLIBTOP_SYSDEPS_PROC_MAP 17
|
||||
#define GLIBTOP_SYSDEPS_MOUNTLIST 18
|
||||
#define GLIBTOP_SYSDEPS_FSUSAGE 19
|
||||
#define GLIBTOP_SYSDEPS_PROC_ARGS 17
|
||||
#define GLIBTOP_SYSDEPS_PROC_MAP 18
|
||||
#define GLIBTOP_SYSDEPS_MOUNTLIST 19
|
||||
#define GLIBTOP_SYSDEPS_FSUSAGE 20
|
||||
#define GLIBTOP_SYSDEPS_NETLOAD 21
|
||||
#define GLIBTOP_SYSDEPS_PPP 22
|
||||
|
||||
#define GLIBTOP_MAX_SYSDEPS 20
|
||||
#define GLIBTOP_MAX_SYSDEPS 23
|
||||
|
||||
#define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1)
|
||||
|
||||
@@ -77,34 +80,18 @@ struct _glibtop_sysdeps
|
||||
proc_signal, /* glibtop_proc_signal */
|
||||
proc_kernel, /* glibtop_proc_kernel */
|
||||
proc_segment, /* glibtop_proc_segment */
|
||||
proc_args, /* glibtop_proc_args */
|
||||
proc_map, /* glibtop_proc_map */
|
||||
mountlist, /* glibtop_mountlist */
|
||||
fsusage; /* glibtop_fsusage */
|
||||
fsusage, /* glibtop_fsusage */
|
||||
netload, /* glibtop_netload */
|
||||
ppp; /* glibtop_ppp */
|
||||
};
|
||||
|
||||
#define glibtop_get_sysdeps(sysdeps) glibtop_get_sysdeps_r(glibtop_global_server,sysdeps)
|
||||
|
||||
extern void glibtop_get_sysdeps_r __P((glibtop *, glibtop_sysdeps *));
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_sysdeps __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_sysdeps __P((void));
|
||||
extern SCM glibtop_guile_types_sysdeps __P((void));
|
||||
extern SCM glibtop_guile_labels_sysdeps __P((void));
|
||||
extern SCM glibtop_guile_descriptions_sysdeps __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
62
include/glibtop/sysinfo.h
Normal file
62
include/glibtop/sysinfo.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the Gnome Top Library.
|
||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||
|
||||
The Gnome Top Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Top Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef __GLIBTOP_SYSINFO_H__
|
||||
#define __GLIBTOP_SYSINFO_H__
|
||||
|
||||
#include <glibtop.h>
|
||||
#include <glibtop/cpu.h>
|
||||
#include <glibtop/global.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define GLIBTOP_SYSINFO_CPUINFO 0
|
||||
|
||||
#define GLIBTOP_MAX_SYSINFO 1
|
||||
|
||||
typedef struct _glibtop_sysinfo glibtop_sysinfo;
|
||||
|
||||
typedef struct _glibtop_entry glibtop_entry;
|
||||
|
||||
struct _glibtop_entry
|
||||
{
|
||||
GPtrArray *labels;
|
||||
GHashTable *values;
|
||||
GHashTable *descriptions;
|
||||
};
|
||||
|
||||
struct _glibtop_sysinfo
|
||||
{
|
||||
u_int64_t flags, ncpu;
|
||||
glibtop_entry cpuinfo [GLIBTOP_NCPU];
|
||||
};
|
||||
|
||||
#define glibtop_get_sysinfo() glibtop_get_sysinfo_s(glibtop_global_server)
|
||||
|
||||
#define glibtop_get_sysinfo_r glibtop_get_sysinfo_s
|
||||
|
||||
extern glibtop_sysinfo * glibtop_get_sysinfo_s __P((glibtop *));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
@@ -39,11 +39,15 @@
|
||||
#include <glibtop/procsignal.h>
|
||||
#include <glibtop/prockernel.h>
|
||||
#include <glibtop/procsegment.h>
|
||||
#include <glibtop/procargs.h>
|
||||
#include <glibtop/procmap.h>
|
||||
|
||||
#include <glibtop/mountlist.h>
|
||||
#include <glibtop/fsusage.h>
|
||||
|
||||
#include <glibtop/netload.h>
|
||||
#include <glibtop/ppp.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
typedef union _glibtop_union glibtop_union;
|
||||
@@ -66,9 +70,12 @@ union _glibtop_union
|
||||
glibtop_proc_signal proc_signal;
|
||||
glibtop_proc_kernel proc_kernel;
|
||||
glibtop_proc_segment proc_segment;
|
||||
glibtop_proc_args proc_args;
|
||||
glibtop_proc_map proc_map;
|
||||
glibtop_mountlist mountlist;
|
||||
glibtop_fsusage fsusage;
|
||||
glibtop_netload netload;
|
||||
glibtop_ppp ppp;
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
@@ -59,25 +59,6 @@ extern void glibtop_init_uptime_s __P((glibtop *));
|
||||
extern void glibtop_get_uptime_s __P((glibtop *, glibtop_uptime *));
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE
|
||||
|
||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_get_uptime __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_GUILE_NAMES
|
||||
|
||||
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||
|
||||
extern SCM glibtop_guile_names_uptime __P((void));
|
||||
extern SCM glibtop_guile_types_uptime __P((void));
|
||||
extern SCM glibtop_guile_labels_uptime __P((void));
|
||||
extern SCM glibtop_guile_descriptions_uptime __P((void));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef GLIBTOP_NAMES
|
||||
|
||||
/* You need to link with -lgtop_names to get this stuff here. */
|
||||
|
@@ -37,7 +37,7 @@ extern void *glibtop_malloc_r __P((glibtop *, size_t));
|
||||
extern void *glibtop_calloc_r __P((glibtop *, size_t, size_t));
|
||||
extern void *glibtop_realloc_r __P((glibtop *, void *, size_t));
|
||||
extern char *glibtop_strdup_r __P((glibtop *, const char *));
|
||||
extern void glibtop_free_r __P((glibtop *, void *));
|
||||
extern void glibtop_free_r __P((glibtop *, const void *));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
@@ -2,34 +2,6 @@
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
close.lo
|
||||
command.lo
|
||||
cpu.lo
|
||||
error.lo
|
||||
init.lo
|
||||
ipc_limits.lo
|
||||
libgtop.la
|
||||
loadavg.lo
|
||||
mem.lo
|
||||
msg_limits.lo
|
||||
open.lo
|
||||
procdata.lo
|
||||
prockernel.lo
|
||||
proclist.lo
|
||||
procmem.lo
|
||||
procsegment.lo
|
||||
procsignal.lo
|
||||
procstate.lo
|
||||
proctime.lo
|
||||
procuid.lo
|
||||
read.lo
|
||||
read_data.lo
|
||||
sem_limits.lo
|
||||
shm_limits.lo
|
||||
so_locations
|
||||
swap.lo
|
||||
sysinfo.lo
|
||||
uptime.lo
|
||||
write.lo
|
||||
xmalloc.lo
|
||||
*.lo
|
||||
lib.c
|
||||
|
@@ -8,6 +8,8 @@ libgtop_la_SOURCES = init.c open.c close.c command.c read.c \
|
||||
read_data.c write.c lib.c parameter.c \
|
||||
sysdeps.c
|
||||
|
||||
libgtop_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||
|
||||
BUILT_SOURCES = lib.c
|
||||
|
||||
lib.c: lib.awk $(top_builddir)/config.h $(top_srcdir)/features.def
|
||||
|
@@ -28,7 +28,7 @@
|
||||
|
||||
void *
|
||||
glibtop_call_l (glibtop *server, unsigned command, size_t send_size,
|
||||
void *send_buf, size_t recv_size, void *recv_buf)
|
||||
const void *send_buf, size_t recv_size, void *recv_buf)
|
||||
{
|
||||
glibtop_command cmnd;
|
||||
glibtop_response response;
|
||||
|
@@ -76,7 +76,8 @@ glibtop_inodedb_open_s (glibtop *server, unsigned databases,
|
||||
}
|
||||
|
||||
const char *
|
||||
glibtop_inodedb_lookup_s (glibtop *server, glibtop_inodedb *inodedb,
|
||||
glibtop_inodedb_lookup_s (glibtop *server,
|
||||
glibtop_inodedb *inodedb,
|
||||
u_int64_t device, u_int64_t inode)
|
||||
{
|
||||
glibtop_inodedb_key key;
|
||||
|
20
lib/lib.awk
20
lib/lib.awk
@@ -41,10 +41,12 @@ BEGIN {
|
||||
print "/* Library functions. */";
|
||||
print "";
|
||||
|
||||
convert["long"] = "int64_t";
|
||||
convert["ulong"] = "u_int64_t";
|
||||
convert["pid_t"] = "pid_t";
|
||||
convert["int"] = "int";
|
||||
convert["long"] = "int64_t";
|
||||
convert["ulong"] = "u_int64_t";
|
||||
convert["pid_t"] = "pid_t";
|
||||
convert["int"] = "int";
|
||||
convert["ushort"] = "unsigned short";
|
||||
convert["unsigned"] = "unsigned";
|
||||
}
|
||||
|
||||
function output(line) {
|
||||
@@ -68,7 +70,7 @@ function output(line) {
|
||||
if (param_def == "string") {
|
||||
call_param = ", "line_fields[5];
|
||||
param_decl = ",\n "space" const char *"line_fields[5];
|
||||
send_ptr = "\n\tvoid *send_ptr = "line_fields[5]";";
|
||||
send_ptr = "\n\tconst void *send_ptr = "line_fields[5]";";
|
||||
send_size = "\n\tconst size_t send_size =\n\t\tstrlen ("line_fields[5]") + 1;";
|
||||
} else {
|
||||
call_param = "";
|
||||
@@ -80,7 +82,7 @@ function output(line) {
|
||||
list = params[param];
|
||||
type = params[param];
|
||||
sub(/\(.*/, "", type);
|
||||
sub(/^\w+\(/, "", list); sub(/\)$/, "", list);
|
||||
sub(/^.*\(/, "", list); sub(/\)$/, "", list);
|
||||
count = split (list, fields, /,/);
|
||||
for (field = 1; field <= count; field++) {
|
||||
if (param_decl == "")
|
||||
@@ -90,7 +92,7 @@ function output(line) {
|
||||
param_decl = param_decl""convert[type]" "fields[field];
|
||||
call_param = call_param", "fields[field];
|
||||
if (send_ptr == "")
|
||||
send_ptr = "\n\tvoid *send_ptr = &"fields[field]";";
|
||||
send_ptr = "\n\tconst void *send_ptr = &"fields[field]";";
|
||||
if (send_size == "")
|
||||
send_size = "\n\tconst size_t send_size =\n\t\t";
|
||||
else
|
||||
@@ -103,14 +105,14 @@ function output(line) {
|
||||
else
|
||||
send_size = "\n\tconst size_t send_size = 0;";
|
||||
if (send_ptr == "")
|
||||
send_ptr = "\n\tvoid *send_ptr = NULL;";
|
||||
send_ptr = "\n\tconst void *send_ptr = NULL;";
|
||||
}
|
||||
|
||||
print "glibtop_get_"feature"_l (glibtop *server, glibtop_"feature" *buf"param_decl")";
|
||||
|
||||
print "{"send_ptr""send_size;
|
||||
if (retval !~ /^void$/)
|
||||
print "\t"retval" retval;";
|
||||
print "\t"retval" retval = ("retval") 0;";
|
||||
print "";
|
||||
|
||||
print "\tglibtop_init_r (&server, (1 << GLIBTOP_SYSDEPS_"toupper(feature)"), 0);";
|
||||
|
18
lib/open.c
18
lib/open.c
@@ -57,34 +57,44 @@ glibtop_open_l (glibtop *server, const char *program_name,
|
||||
server->features = 0;
|
||||
break;
|
||||
case GLIBTOP_METHOD_INET:
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "Connecting to '%s' port %ld.\n",
|
||||
server->server_host, server->server_port);
|
||||
#endif
|
||||
|
||||
connect_type = glibtop_make_connection
|
||||
(server->server_host, server->server_port,
|
||||
&server->socket);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "Connect Type is %d.\n", connect_type);
|
||||
#endif
|
||||
|
||||
server->flags |= _GLIBTOP_INIT_STATE_SERVER;
|
||||
|
||||
server->features = -1;
|
||||
break;
|
||||
case GLIBTOP_METHOD_UNIX:
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "Connecting to Unix Domain Socket.\n");
|
||||
#endif
|
||||
|
||||
connect_type = glibtop_make_connection
|
||||
("unix", 0, &server->socket);
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "Connect Type is %d.\n", connect_type);
|
||||
#endif
|
||||
|
||||
server->flags |= _GLIBTOP_INIT_STATE_SERVER;
|
||||
|
||||
server->features = -1;
|
||||
break;
|
||||
case GLIBTOP_METHOD_PIPE:
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "Opening pipe to server (%s).\n",
|
||||
LIBGTOP_SERVER);
|
||||
#endif
|
||||
|
||||
if (pipe (server->input) || pipe (server->output))
|
||||
glibtop_error_io_r (server, "cannot make a pipe");
|
||||
@@ -98,7 +108,7 @@ glibtop_open_l (glibtop *server, const char *program_name,
|
||||
close (server->input [0]); close (server->output [1]);
|
||||
dup2 (server->input [1], 1);
|
||||
dup2 (server->output [0], 0);
|
||||
execl (LIBGTOP_SERVER, NULL);
|
||||
execl (LIBGTOP_SERVER, "libgtop-server", NULL);
|
||||
glibtop_error_io_r (server, "execl (%s)",
|
||||
LIBGTOP_SERVER);
|
||||
_exit (2);
|
||||
@@ -153,14 +163,18 @@ glibtop_open_l (glibtop *server, const char *program_name,
|
||||
|
||||
memcpy (&server->sysdeps, &sysdeps, sizeof (glibtop_sysdeps));
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "Server features are %lu.\n",
|
||||
server->features);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* In any case, we call the open functions of our own sysdeps
|
||||
* directory. */
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "Calling sysdeps open function.\n");
|
||||
#endif
|
||||
|
||||
glibtop_init_s (&server, features, flags);
|
||||
}
|
||||
|
@@ -30,9 +30,9 @@
|
||||
|
||||
#define _check_data(size) \
|
||||
if ((data_ptr == NULL) || (data_size != size)) { \
|
||||
glibtop_error_r (server, "glibtop_set_parameter (%d): " \
|
||||
"Expected %lu bytes but got %lu.", \
|
||||
parameter, size, data_size); \
|
||||
glibtop_warn_r (server, "glibtop_set_parameter (%d): " \
|
||||
"Expected %lu bytes but got %lu.", \
|
||||
parameter, size, data_size); \
|
||||
return; \
|
||||
}
|
||||
|
||||
@@ -61,6 +61,9 @@ glibtop_get_parameter_l (glibtop *server, const unsigned parameter,
|
||||
case GLIBTOP_PARAM_ERROR_METHOD:
|
||||
_write_data (&server->error_method,
|
||||
sizeof (server->error_method));
|
||||
case GLIBTOP_PARAM_REQUIRED:
|
||||
_write_data (&server->required,
|
||||
sizeof (server->required));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -76,12 +79,18 @@ glibtop_set_parameter_l (glibtop *server, const unsigned parameter,
|
||||
memcpy (&server->method, data_ptr, data_size);
|
||||
break;
|
||||
case GLIBTOP_PARAM_FEATURES:
|
||||
_check_data (sizeof (server->features));
|
||||
memcpy (&server->features, data_ptr, data_size);
|
||||
/* You should not be allowed to set this field. */
|
||||
glibtop_warn_r (server, "glibtop_set_parameter (%d): " \
|
||||
"Cannot modify read-only value.",
|
||||
parameter);
|
||||
break;
|
||||
case GLIBTOP_PARAM_ERROR_METHOD:
|
||||
_check_data (sizeof (server->error_method));
|
||||
memcpy (&server->error_method, data_ptr, data_size);
|
||||
break;
|
||||
case GLIBTOP_PARAM_REQUIRED:
|
||||
_check_data (sizeof (server->required));
|
||||
memcpy (&server->required, data_ptr, data_size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -38,7 +38,9 @@ GLIBTOP_SUID_PROC_TIME +
|
||||
GLIBTOP_SUID_PROC_SIGNAL +
|
||||
GLIBTOP_SUID_PROC_KERNEL +
|
||||
GLIBTOP_SUID_PROC_SEGMENT +
|
||||
GLIBTOP_SUID_PROC_MAP;
|
||||
GLIBTOP_SUID_PROC_MAP +
|
||||
GLIBTOP_SUID_NETLOAD +
|
||||
GLIBTOP_SUID_PPP;
|
||||
|
||||
glibtop_init_func_t _glibtop_init_hook_s [] = {
|
||||
#if !GLIBTOP_SUID_CPU
|
||||
@@ -89,8 +91,17 @@ glibtop_init_func_t _glibtop_init_hook_s [] = {
|
||||
#if !GLIBTOP_SUID_PROC_SEGMENT
|
||||
glibtop_init_proc_segment_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_PROC_ARGS
|
||||
glibtop_init_proc_args_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_PROC_MAP
|
||||
glibtop_init_proc_map_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_NETLOAD
|
||||
glibtop_init_netload_s,
|
||||
#endif
|
||||
#if !GLIBTOP_SUID_PPP
|
||||
glibtop_init_ppp_s,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
@@ -1,11 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
usage="\
|
||||
Usage: libgtop-config [--version] [--config]"
|
||||
Usage: libgtop-config [--version] [--config] [--features-def-file]"
|
||||
|
||||
config_file="@LIBGTOP_LIBDIR@/libgtopConf.sh"
|
||||
. $config_file
|
||||
|
||||
features_def_file="@LIBGTOP_LIBDIR@/libgtop-features.def"
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
@@ -24,6 +26,9 @@ while test $# -gt 0; do
|
||||
--config)
|
||||
echo $config_file
|
||||
;;
|
||||
--features-def-file)
|
||||
echo $features_def_file
|
||||
;;
|
||||
*)
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
|
276
libgtop-sysdeps.m4
Normal file
276
libgtop-sysdeps.m4
Normal file
@@ -0,0 +1,276 @@
|
||||
dnl This file is intended for use both internally in libgtop and in every program
|
||||
dnl that wants to use it.
|
||||
dnl
|
||||
dnl It defines the following variables:
|
||||
dnl
|
||||
dnl * 'libgtop_sysdeps_dir' - sysdeps dir for libgtop.
|
||||
dnl * 'libgtop_use_machine_h' - some of system dependend parts of libgtop provide
|
||||
dnl their own header file. In this case we need to
|
||||
dnl define 'HAVE_GLIBTOP_MACHINE_H'.
|
||||
dnl * 'libgtop_need_server' - is the server really needed? Defines 'NEED_LIBGTOP'
|
||||
dnl if true; defines conditional 'NEED_LIBGTOP'.
|
||||
|
||||
AC_DEFUN([LIBGTOP_HACKER_TESTS],[
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
|
||||
case "$host_os" in
|
||||
linux*)
|
||||
AC_ARG_WITH(linux-table,
|
||||
[ --with-linux-table Use the table () function from Martin Baulig],[
|
||||
linux_table="$withval"],[linux_table=auto])
|
||||
if test $linux_table = yes ; then
|
||||
AC_CHECK_HEADER(linux/table.h, linux_table=yes, linux_table=no)
|
||||
elif test $linux_table = auto ; then
|
||||
AC_MSG_CHECKING(for table function in Linux Kernel)
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <linux/unistd.h>
|
||||
#include <linux/table.h>
|
||||
|
||||
#include <syscall.h>
|
||||
|
||||
static inline _syscall3 (int, table, int, type, union table *, tbl, const void *, param);
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
union table tbl;
|
||||
int ret;
|
||||
|
||||
ret = table (TABLE_VERSION, NULL, NULL);
|
||||
|
||||
if (ret == -1)
|
||||
exit (-errno);
|
||||
|
||||
exit (ret < 1 ? ret : 0);
|
||||
}
|
||||
], linux_table=yes, linux_table=no, linux_table=no)
|
||||
AC_MSG_RESULT($linux_table)
|
||||
fi
|
||||
if test $linux_table = yes ; then
|
||||
AC_DEFINE(HAVE_LINUX_TABLE)
|
||||
fi
|
||||
AM_CONDITIONAL(LINUX_TABLE, test $linux_table = yes)
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
|
||||
AC_SUBST(libgtop_sysdeps_dir)
|
||||
AC_SUBST(libgtop_use_machine_h)
|
||||
AC_SUBST(libgtop_need_server)
|
||||
|
||||
AC_ARG_WITH(libgtop-examples,
|
||||
[ --with-libgtop-examples Build the libgtop examples (default=no)],[
|
||||
build_examples="$withval"], [build_examples=no])
|
||||
|
||||
AM_CONDITIONAL(EXAMPLES, test x"$build_examples" = xyes)
|
||||
|
||||
AC_ARG_ENABLE(hacker-mode,
|
||||
[ --enable-hacker-mode Enable building of unstable sysdeps],
|
||||
[hacker_mode="$withval"], [hacker_mode=no])
|
||||
|
||||
AM_CONDITIONAL(HACKER_MODE, test x"$hacker_mode" = xyes)
|
||||
|
||||
if test x$hacker_mode = xyes ; then
|
||||
LIBGTOP_HACKER_TESTS
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(libgtop-smp,
|
||||
[ --with-libgtop-smp Enable SMP support (default-auto)],[
|
||||
libgtop_smp="$withval"],[libgtop_smp=auto])
|
||||
|
||||
if test $libgtop_smp = auto ; then
|
||||
AC_MSG_CHECKING(whether to enable SMP support)
|
||||
AC_TRY_RUN([
|
||||
#include <sys/utsname.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
struct utsname name;
|
||||
|
||||
if (uname (&name)) exit (1);
|
||||
|
||||
exit (strstr (name.version, "SMP") ? 0 : 1);
|
||||
}
|
||||
], libgtop_smp=yes, libgtop_smp=no, libgtop_smp=no)
|
||||
AC_MSG_RESULT($libgtop_smp)
|
||||
fi
|
||||
|
||||
if test $libgtop_smp = yes ; then
|
||||
AC_DEFINE(HAVE_LIBGTOP_SMP)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(LIBGTOP_SMP, test $libgtop_smp = yes)
|
||||
|
||||
AC_MSG_CHECKING(for libgtop sysdeps directory)
|
||||
|
||||
case "$host_os" in
|
||||
linux*)
|
||||
if test x$linux_table = xyes ; then
|
||||
libgtop_sysdeps_dir=kernel
|
||||
libgtop_use_machine_h=no
|
||||
else
|
||||
libgtop_sysdeps_dir=linux
|
||||
libgtop_use_machine_h=no
|
||||
libgtop_have_sysinfo=yes
|
||||
fi
|
||||
libgtop_need_server=no
|
||||
;;
|
||||
freebsd*|netbsd*|openbsd*)
|
||||
libgtop_sysdeps_dir=freebsd
|
||||
libgtop_use_machine_h=yes
|
||||
libgtop_need_server=yes
|
||||
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
|
||||
;;
|
||||
*)
|
||||
if test x$hacker_mode = xyes ; then
|
||||
case "$host_os" in
|
||||
sunos4*)
|
||||
libgtop_sysdeps_dir=sun4
|
||||
libgtop_use_machine_h=yes
|
||||
libgtop_need_server=yes
|
||||
;;
|
||||
osf*)
|
||||
libgtop_sysdeps_dir=osf1
|
||||
libgtop_use_machine_h=yes
|
||||
libgtop_need_server=yes
|
||||
;;
|
||||
*)
|
||||
libgtop_sysdeps_dir=stub
|
||||
libgtop_use_machine_h=no
|
||||
libgtop_need_server=no
|
||||
;;
|
||||
esac
|
||||
else
|
||||
libgtop_sysdeps_dir=stub
|
||||
libgtop_use_machine_h=no
|
||||
libgtop_need_server=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
test -z "$libgtop_postinstall" && libgtop_postinstall=:
|
||||
|
||||
AC_MSG_RESULT($libgtop_sysdeps_dir)
|
||||
|
||||
AC_SUBST(libgtop_sysdeps_dir)
|
||||
AC_SUBST(libgtop_postinstall)
|
||||
AC_SUBST(libgtop_have_sysinfo)
|
||||
|
||||
case "$host_os" in
|
||||
*bsd*)
|
||||
AC_CHECK_HEADERS(net/if_var.h)
|
||||
AC_MSG_CHECKING([for I4B])
|
||||
AC_TRY_COMPILE([
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_types.h>
|
||||
|
||||
#ifdef HAVE_NET_IF_VAR_H
|
||||
#include <net/if_var.h>
|
||||
#endif
|
||||
|
||||
#include <net/netisr.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <net/if_sppp.h>
|
||||
#else
|
||||
#include <i4b/sppp/if_sppp.h>
|
||||
#endif
|
||||
],[
|
||||
size_t size = sizeof (struct sppp);
|
||||
], have_i4b=yes, have_i4b=no)
|
||||
AC_MSG_RESULT($have_i4b)
|
||||
if test x$have_i4b = xyes; then
|
||||
AC_DEFINE(HAVE_I4B)
|
||||
AC_MSG_CHECKING([for I4B accounting])
|
||||
AC_TRY_COMPILE([
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_types.h>
|
||||
|
||||
#ifdef HAVE_NET_IF_VAR_H
|
||||
#include <net/if_var.h>
|
||||
#endif
|
||||
|
||||
#include <net/netisr.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <net/if_sppp.h>
|
||||
#else
|
||||
#include <i4b/sppp/if_sppp.h>
|
||||
#endif
|
||||
|
||||
#include <machine/i4b_acct.h>
|
||||
],[
|
||||
size_t size = sizeof (struct i4bisppp_softc);
|
||||
], have_i4b_acct=yes, have_i4b_acct=no)
|
||||
AC_MSG_RESULT($have_i4b_acct)
|
||||
if test x$have_i4b_acct = xyes ; then
|
||||
AC_DEFINE(HAVE_I4B_ACCT)
|
||||
else
|
||||
AC_WARN([
|
||||
*** I4B accounting disabled - you won't get any PPP statistics.
|
||||
*** Read "misc/i4b_acct.txt" in the LibGTop source directory
|
||||
*** to see how to enable it.])
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
linux*)
|
||||
os_major_version=`uname -r | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
os_minor_version=`uname -r | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
os_micro_version=`uname -r | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
os_version_expr="$os_major_version 65536 * $os_minor_version 256 * + $os_micro_version + p q"
|
||||
|
||||
AC_CHECK_HEADERS(linux/version.h, have_linux_version_h=yes,
|
||||
have_linux_version_h=no)
|
||||
|
||||
if test x$have_linux_version_h = xyes ; then
|
||||
version_code=`cat /usr/include/linux/version.h | \
|
||||
grep \#define | grep LINUX_VERSION_CODE`
|
||||
os_version_code=`echo $version_code | \
|
||||
sed 's/^.*LINUX_VERSION_CODE[[ \t]]*\([[0-9]]*\).*$/\1/'`
|
||||
else
|
||||
os_version_code=`echo "$os_version_expr" | dc`
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for Linux kernel version code)
|
||||
AC_DEFINE_UNQUOTED(GLIBTOP_LINUX_VERSION_CODE, $os_version_code)
|
||||
AC_MSG_RESULT($os_version_code)
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_MSG_CHECKING(for machine.h in libgtop sysdeps dir)
|
||||
AC_MSG_RESULT($libgtop_use_machine_h)
|
||||
|
||||
AC_MSG_CHECKING(whether we need libgtop)
|
||||
AC_MSG_RESULT($libgtop_need_server)
|
||||
|
||||
if test x$libgtop_need_server = xyes ; then
|
||||
AC_DEFINE(NEED_LIBGTOP)
|
||||
fi
|
||||
|
||||
if test x$libgtop_use_machine_h = xyes ; then
|
||||
AC_DEFINE(HAVE_GLIBTOP_MACHINE_H)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(NEED_LIBGTOP, test x$libgtop_need_server = xyes)
|
||||
])
|
||||
|
14
libgtop.spec
14
libgtop.spec
@@ -1,5 +1,5 @@
|
||||
# Note that this is NOT a relocatable package
|
||||
%define ver 0.25.1
|
||||
%define ver 0.99.0
|
||||
%define rel SNAP
|
||||
%define prefix /usr
|
||||
|
||||
@@ -58,9 +58,9 @@ Examples for LibGTop.
|
||||
%build
|
||||
# Needed for snapshot releases.
|
||||
if [ ! -f configure ]; then
|
||||
CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%prefix --without-linux-table --with-libgtop-inodedb
|
||||
CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%prefix --without-linux-table --with-libgtop-inodedb --with-libgtop-examples --with-libgtop-guile
|
||||
else
|
||||
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --without-linux-table --with-libgtop-inodedb
|
||||
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --without-linux-table --with-libgtop-inodedb --with-libgtop-examples --with-libgtop-guile
|
||||
fi
|
||||
|
||||
if [ "$SMP" != "" ]; then
|
||||
@@ -75,11 +75,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
make prefix=$RPM_BUILD_ROOT%{prefix} install
|
||||
|
||||
# Move all examples to %{prefix}/libexec/libgtop
|
||||
mv $RPM_BUILD_ROOT%{prefix}/libexec $RPM_BUILD_ROOT%{prefix}/libgtop
|
||||
mkdir -p $RPM_BUILD_ROOT%{prefix}/libexec
|
||||
mv $RPM_BUILD_ROOT%{prefix}/libgtop $RPM_BUILD_ROOT%{prefix}/libexec
|
||||
|
||||
#
|
||||
# msf - remove these as they are really supposed to come from gnome-libs
|
||||
#
|
||||
@@ -94,7 +89,7 @@ mv $RPM_BUILD_ROOT%{prefix}/libgtop $RPM_BUILD_ROOT%{prefix}/libexec
|
||||
rm -fr $RPM_BUILD_ROOT/%{prefix}/include/libgtop
|
||||
|
||||
%clean
|
||||
#rm -rf $RPM_BUILD_ROOT
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
|
||||
@@ -115,6 +110,7 @@ rm -fr $RPM_BUILD_ROOT/%{prefix}/include/libgtop
|
||||
%{prefix}/lib/lib*.so
|
||||
%{prefix}/lib/*a
|
||||
%{prefix}/lib/*.sh
|
||||
%{prefix}/lib/*.def
|
||||
%{prefix}/include/*
|
||||
|
||||
%files examples
|
||||
|
@@ -25,7 +25,9 @@ LIBGTOP_SERVER="@LIBGTOP_SERVER@"
|
||||
LIBGTOP_MAJOR_VERSION="@LIBGTOP_MAJOR_VERSION@"
|
||||
LIBGTOP_MINOR_VERSION="@LIBGTOP_MINOR_VERSION@"
|
||||
LIBGTOP_MICRO_VERSION="@LIBGTOP_MICRO_VERSION@"
|
||||
|
||||
LIBGTOP_VERSION="@LIBGTOP_VERSION@"
|
||||
LIBGTOP_VERSION_CODE="@LIBGTOP_VERSION_CODE@"
|
||||
|
||||
LIBGTOP_SERVER_VERSION="@LIBGTOP_SERVER_VERSION@"
|
||||
|
||||
|
111
libproc/Makefile
111
libproc/Makefile
@@ -1,111 +0,0 @@
|
||||
# Auto-adaptive C library Makefile adapted for libproc, Chuck Blake.
|
||||
# Assumptions are basically that all the .c files in the CWD are modules
|
||||
# for the library and that all .h files are the interface to the library.
|
||||
|
||||
# PROJECT SPECIFIC MACROS
|
||||
NAME = proc
|
||||
|
||||
# INSTALLATION OPTIONS
|
||||
TOPDIR = /usr
|
||||
HDRDIR = $(TOPDIR)/include/$(NAME)# where to put .h files
|
||||
LIBDIR = $(TOPDIR)/lib# where to put library files
|
||||
SHLIBDIR = /lib# where to put shared library files
|
||||
HDROWN = -o root -g root # owner of header files
|
||||
LIBOWN = -o root -g root # owner of library files
|
||||
INSTALL = install
|
||||
|
||||
# COMPILATION OPTIONS
|
||||
CC = gcc -O2 -D_GNU_SOURCE #-ggdb # easy to command-line override
|
||||
CFLAGS = -I.. -Wall
|
||||
|
||||
# ----------------------------------------------------------------#
|
||||
# The rest is the auto-magic section -- highly GNU make dependent #
|
||||
# You should never need to edit this. #
|
||||
# ----------------------------------------------------------------#
|
||||
|
||||
VC_SUF = ,v
|
||||
VC_PFX = RCS/
|
||||
RCSFILES = $(patsubst $(VC_PFX)%$(VC_SUF),%,$(wildcard $(VC_PFX)*$(VC_SUF)))
|
||||
|
||||
# We take the union of RCS files and other files in CWD so that new files do
|
||||
# not need to alter this makefile. 'sort' removes duplicates. This allows the
|
||||
# convenience of compiling and testing new files before the initial check-in.
|
||||
|
||||
SRC = $(sort $(wildcard *.c) $(filter %.c,$(RCSFILES)))
|
||||
HDR = $(sort $(wildcard *.h) $(filter %.h,$(RCSFILES)))
|
||||
|
||||
OBJ = $(SRC:.c=.o)
|
||||
SONAME = lib$(NAME).so.$(LIBVERSION)
|
||||
|
||||
ifeq ($(SHARED),1)
|
||||
CFLAGS += -fpic
|
||||
all: lib$(NAME).a $(SONAME)
|
||||
else
|
||||
all: lib$(NAME).a
|
||||
endif
|
||||
|
||||
lib$(NAME).a: $(OBJ)
|
||||
$(AR) rcs $@ $^
|
||||
|
||||
$(SONAME): $(OBJ)
|
||||
gcc -Wl,-shared -Wl,-soname,$(SONAME) -o $@ $^ -lc
|
||||
ln -sf $(SONAME) lib$(NAME).so
|
||||
|
||||
# AUTOMATIC DEPENDENCY GENERATION -- GCC AND GNUMAKE DEPENDENT
|
||||
|
||||
.depend:
|
||||
$(strip $(CC) $(CFLAGS) -MM -MG $(SRC) > .depend)
|
||||
include .depend
|
||||
|
||||
# INSTALLATION
|
||||
|
||||
install: all
|
||||
if ! [ -d $(HDRDIR) ] ; then mkdir $(HDRDIR) ; fi
|
||||
$(INSTALL) $(HDROWN) $(HDR) $(TOPDIR)/include/$(NAME)
|
||||
$(INSTALL) $(LIBOWN) lib$(NAME).a $(LIBDIR)
|
||||
ifeq ($(SHARED),1)
|
||||
$(INSTALL) $(LIBOWN) $(SONAME) $(SHLIBDIR)
|
||||
ln -sf $(SHLIBDIR)/$(SONAME) $(SHLIBDIR)/lib$(NAME).so
|
||||
ldconfig
|
||||
endif
|
||||
|
||||
# VARIOUS SHORT CUT TARGETS
|
||||
.PHONY: all install dep clean distclean checkout checkclean
|
||||
|
||||
dep: .depend
|
||||
|
||||
clean:
|
||||
$(RM) lib$(NAME).* *.o
|
||||
|
||||
distclean: clean
|
||||
$(RM) .depend signames.h
|
||||
|
||||
checkout:
|
||||
$(CO) $(RCSFILES)
|
||||
|
||||
checkclean:
|
||||
$(RM) $(RCSFILES)
|
||||
|
||||
# CUSTOM c -> o rule so that command-line has minimal whitespace
|
||||
|
||||
%.o : %.c
|
||||
$(strip $(CC) $(CFLAGS) -c $<)
|
||||
|
||||
# PROJECT SPECIFIC DEPENDENCIES/BUILD RULES
|
||||
|
||||
|
||||
version.o: version.c version.h
|
||||
ifdef MINORVERSION
|
||||
$(strip $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" -c version.c)
|
||||
else
|
||||
$(strip $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -c version.c)
|
||||
endif
|
||||
|
||||
signals.o : signames.h
|
||||
|
||||
signames.h ../proc/signames.h : /usr/include/signal.h
|
||||
/lib/cpp -dM </usr/include/signal.h | \
|
||||
tr -s '\t ' ' ' | sort -n +2 | sed \
|
||||
's:#define SIG\([A-Z]\+[0-9]*\) \([0-9]\+\) *\(\|/\*.*\)$$:{\
|
||||
\2,"\1" },:p;d' > signames.h
|
||||
|
@@ -1,49 +0,0 @@
|
||||
/***********************************************************************\
|
||||
* Copyright (C) 1992 by Michael K. Johnson, johnsonm@sunsite.unc.edu *
|
||||
* *
|
||||
* This file is placed under the conditions of the GNU public *
|
||||
* license, version 2, or any later version. See file COPYING *
|
||||
* for information on distribution conditions. *
|
||||
\***********************************************************************/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void *xcalloc(void *pointer, int size) {
|
||||
void * ret;
|
||||
if (pointer)
|
||||
free(pointer);
|
||||
if (!(ret = calloc(1, size))) {
|
||||
fprintf(stderr, "xcalloc: allocation error, size = %d\n", size);
|
||||
exit(1);
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
void *xmalloc(unsigned int size) {
|
||||
void *p;
|
||||
|
||||
if (size == 0)
|
||||
++size;
|
||||
p = malloc(size);
|
||||
if (!p) {
|
||||
fprintf(stderr, "xmalloc: malloc(%d) failed", size);
|
||||
perror(NULL);
|
||||
exit(1);
|
||||
}
|
||||
return(p);
|
||||
}
|
||||
|
||||
void *xrealloc(void *oldp, unsigned int size) {
|
||||
void *p;
|
||||
|
||||
if (size == 0)
|
||||
++size;
|
||||
p = realloc(oldp, size);
|
||||
if (!p) {
|
||||
fprintf(stderr, "xrealloc: realloc(%d) failed", size);
|
||||
perror(NULL);
|
||||
exit(1);
|
||||
}
|
||||
return(p);
|
||||
}
|
@@ -1,307 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 1994 Charles Blake and Michael K. Johnson
|
||||
* This file is a part of procps, which is distributable
|
||||
* under the conditions of the GNU Public License. See the
|
||||
* file COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h> /* for strcmp */
|
||||
#include <stdio.h> /* for parse error output */
|
||||
#include "readproc.h" /* for proc_t */
|
||||
#include "tree.h" /* for struct tree_node */
|
||||
|
||||
/*
|
||||
This module was written by Charles Blake for procps.
|
||||
|
||||
mult_lvl_cmp:
|
||||
slick general purpose multi-level compare function I invented.
|
||||
sort_depth:
|
||||
the number of levels of functions *to use*. This means many more levels
|
||||
can be defined than mult_lvl_cmp tres out. If this is 1 then mult_lvl_cmp
|
||||
is just a trivial wrapper around (*sort_function[0]).
|
||||
sort_direction:
|
||||
multiplicative factor for the output of cmp_whatever.
|
||||
1 ==> default order, -1 ==> reverse order, 0 ==> forced equality
|
||||
The 0 bit is the neat part. Since a value of zero is the code for equality
|
||||
multiplying the output of cmp_foo(a,b) forces a==b to be true. This is a
|
||||
convenient way to turn sorting off in middle levels of a multi-level sort.
|
||||
If time is a problem, reforming the whole sort_function array to not include
|
||||
these unsorted middle levels will be faster since then cmp_foo won't even
|
||||
be called. It might simplify some code depending upon how you organize it.
|
||||
sort_function[]:
|
||||
array of function pointers that points to our family of comparison functions
|
||||
(I have named them cmp_* but mult_lvl_cmp doesn't care what they're named).
|
||||
This may be declared and initialized like so:
|
||||
int (*sort_function[])(void* a, void* b)={&cmp_foo, &cmp_bar, &cmp_hiho};
|
||||
You could also use my command line '-O' parser below.
|
||||
|
||||
Note that we only descend levels until the order is determined. If we descend
|
||||
all levels, that means that the items are equal at all levels, so we return 0.
|
||||
Otherwise we return whatever the level's cmp_foo function would have returned.
|
||||
This allows whatever default behavior you want for cmp_foo. sort_direction[]
|
||||
reverses this default behavior, but mult_lvl_cmp doesn't decide that ascending
|
||||
or descending is the default. That is the job of your cmp_foo's.
|
||||
*/
|
||||
|
||||
/* the only reason these are global is because qsort(3) likes it that way.
|
||||
It's also a little more efficient if mult_lvl_cmp() is called many times.
|
||||
*/
|
||||
|
||||
typedef int (*cmp_t)(void*,void*); /* for function pointer casts */
|
||||
|
||||
int sort_depth = 0;
|
||||
int sort_direction[10]; /* storage for 10 levels, but 4 would be plenty!*/
|
||||
int (*sort_function[10])(void* a, void* b);
|
||||
|
||||
int mult_lvl_cmp(void* a, void* b) {
|
||||
int i, cmp_val;
|
||||
for(i = 0; i < sort_depth; i++) {
|
||||
cmp_val = sort_direction[i] * (*sort_function[i])(a,b);
|
||||
if (cmp_val != 0)
|
||||
return cmp_val;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int node_mult_lvl_cmp(void* a, void* b) {
|
||||
int i, cmp_val;
|
||||
for(i = 0; i < sort_depth; i++) {
|
||||
cmp_val = sort_direction[i] * (*sort_function[i])(&(((struct tree_node *)a)->proc),&(((struct tree_node *)b)->proc));
|
||||
if (cmp_val != 0)
|
||||
return cmp_val;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* qsort(3) compliant comparison functions for all members of the ps_proc
|
||||
structure (in the same order in which they appear in the proc_t declaration)
|
||||
return is {-1,0,1} as {a<b, a==b, a>b}
|
||||
default ordering is ascending for all members. (flip 1,-1 to reverse)
|
||||
*/
|
||||
/* pre-processor macros to cut down on source size (and typing!)
|
||||
Note the use of the string concatenation operator ##
|
||||
*/
|
||||
#define CMP_STR(NAME) \
|
||||
int cmp_ ## NAME(proc_t** P, proc_t** Q) { \
|
||||
return strcmp((*P)-> ## NAME, (*Q)-> ## NAME); \
|
||||
}
|
||||
|
||||
#define CMP_INT(NAME) \
|
||||
int cmp_ ## NAME (proc_t** P, proc_t** Q) { \
|
||||
if ((*P)-> ## NAME < (*Q)-> ## NAME) return -1; \
|
||||
if ((*P)-> ## NAME > (*Q)-> ## NAME) return 1; \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
/* Define the (46!) cmp_ functions with the above macros for every element
|
||||
of proc_t. If the binary gets too big, we could nuke inessentials.
|
||||
*/
|
||||
|
||||
/* CMP_STR(cmdline) */
|
||||
CMP_STR(user)
|
||||
CMP_STR(cmd)
|
||||
/* CMP_INT(state) */
|
||||
/* CMP_STR(ttyc) */
|
||||
CMP_INT(uid)
|
||||
CMP_INT(pid)
|
||||
CMP_INT(ppid)
|
||||
CMP_INT(pgrp)
|
||||
CMP_INT(session)
|
||||
CMP_INT(tty)
|
||||
CMP_INT(tpgid)
|
||||
CMP_INT(utime)
|
||||
CMP_INT(stime)
|
||||
CMP_INT(cutime)
|
||||
CMP_INT(cstime)
|
||||
/* CMP_INT(priority) */
|
||||
CMP_INT(nice)
|
||||
CMP_INT(start_time)
|
||||
/* CMP_INT(signal) */
|
||||
/* CMP_INT(blocked) */
|
||||
/* CMP_INT(sigignore) */
|
||||
/* CMP_INT(sigcatch) */
|
||||
CMP_INT(flags)
|
||||
CMP_INT(min_flt)
|
||||
CMP_INT(cmin_flt)
|
||||
CMP_INT(maj_flt)
|
||||
CMP_INT(cmaj_flt)
|
||||
/* CMP_INT(timeout) */
|
||||
CMP_INT(vsize)
|
||||
CMP_INT(rss)
|
||||
/* CMP_INT(rss_rlim) */
|
||||
/* CMP_INT(start_code) */
|
||||
/* CMP_INT(end_code) */
|
||||
/* CMP_INT(start_stack) */
|
||||
/* CMP_INT(kstk_esp) */
|
||||
/* CMP_INT(kstk_eip) */
|
||||
/* CMP_INT(wchan) */
|
||||
CMP_INT(pcpu)
|
||||
CMP_INT(size)
|
||||
CMP_INT(resident)
|
||||
CMP_INT(share)
|
||||
/* CMP_INT(trs) */
|
||||
/* CMP_INT(lrs) */
|
||||
/* CMP_INT(drs) */
|
||||
/* CMP_INT(dt) */
|
||||
|
||||
/* define user interface to sort keys. Fairly self-explanatory. */
|
||||
|
||||
struct cmp_fun_struct {
|
||||
char letter; /* single option-letter for key */
|
||||
char name[15]; /* long option name for key */
|
||||
int (*fun)(proc_t**, proc_t**); /* pointer to cmp_key */
|
||||
} cmp[] = {
|
||||
/* { '?', "cmdline", &cmp_cmdline }, */
|
||||
{ 'u', "user", &cmp_user },
|
||||
{ 'c', "cmd", &cmp_cmd },
|
||||
/* { '?', "state", &cmp_state }, */
|
||||
/* { '?', "ttyc", &cmp_ttyc }, */
|
||||
{ 'U', "uid", &cmp_uid },
|
||||
{ 'p', "pid", &cmp_pid },
|
||||
{ 'P', "ppid", &cmp_ppid },
|
||||
{ 'g', "pgrp", &cmp_pgrp },
|
||||
{ 'o', "session", &cmp_session },
|
||||
{ 't', "tty", &cmp_tty },
|
||||
{ 'G', "tpgid", &cmp_tpgid },
|
||||
{ 'k', "utime", &cmp_utime },
|
||||
{ 'K', "stime", &cmp_stime },
|
||||
{ 'j', "cutime", &cmp_cutime },
|
||||
{ 'J', "cstime", &cmp_cstime },
|
||||
/* { '?', "counter", &cmp_counter }, */
|
||||
{ 'y', "priority", &cmp_nice },
|
||||
{ 'T', "start_time", &cmp_start_time },
|
||||
/* { '?', "signal", &cmp_signal }, */
|
||||
/* { '?', "blocked", &cmp_blocked }, */
|
||||
/* { '?', "sigignore", &cmp_sigignore }, */
|
||||
/* { '?', "sigcatch", &cmp_sigcatch }, */
|
||||
{ 'f', "flags", &cmp_flags },
|
||||
{ 'm', "min_flt", &cmp_min_flt },
|
||||
{ 'n', "cmin_flt", &cmp_cmin_flt },
|
||||
{ 'M', "maj_flt", &cmp_maj_flt },
|
||||
{ 'N', "cmaj_flt", &cmp_cmaj_flt },
|
||||
/* { 'C', "timeout", &cmp_timeout }, */
|
||||
{ 'v', "vsize", &cmp_vsize },
|
||||
{ 'r', "rss", &cmp_rss },
|
||||
/* { '?', "rss_rlim", &cmp_rss_rlim }, */
|
||||
/* { '?', "start_code", &cmp_start_code }, */
|
||||
/* { '?', "end_code", &cmp_end_code }, */
|
||||
/* { '?', "start_stack", &cmp_start_stack }, */
|
||||
/* { '?', "kstk_esp", &cmp_kstk_esp }, */
|
||||
/* { '?', "kstk_eip", &cmp_kstk_eip }, */
|
||||
/* { '?', "wchan", &cmp_wchan }, */
|
||||
{ 'C', "pcpu", &cmp_pcpu },
|
||||
{ 's', "size", &cmp_size },
|
||||
{ 'R', "resident", &cmp_resident },
|
||||
{ 'S', "share", &cmp_share },
|
||||
/* { '?', "trs", &cmp_trs }, */
|
||||
/* { '?', "lrs", &cmp_lrs }, */
|
||||
/* { '?', "drs", &cmp_drs }, */
|
||||
/* { '?', "dt", &cmp_dt }, */
|
||||
{ '\0',"terminator", NULL }
|
||||
};
|
||||
|
||||
void dump_keys(void) {
|
||||
int i;
|
||||
for(i=0; cmp[i].letter; i++)
|
||||
fprintf(stderr, "%s-O%c , --sort:%-15.15s%s",
|
||||
i%2?"":" ",
|
||||
cmp[i].letter, cmp[i].name,
|
||||
i%2?"\n":"");
|
||||
if (i%2)
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
/* command line option parsing. Assign sort_{depth,direction[],function[]}
|
||||
based upon a string of the form:
|
||||
[+-]a[+-]b[+-]c...
|
||||
with a,b,c,... being letter flags corresponding to a particular sort
|
||||
key and the optional '-' specifying a reverse sort on that key. + doesn't
|
||||
mean anything, but it keeps things looking balanced...
|
||||
*/
|
||||
int parse_sort_opt(char* opt) {
|
||||
int i, next_dir=1;
|
||||
for(; *opt ; ++opt) {
|
||||
if (*opt == '-' || *opt == '+') {
|
||||
if (*opt == '-')
|
||||
next_dir = -1;
|
||||
opt++;
|
||||
continue;
|
||||
}
|
||||
for (i = 0; cmp[i].letter; i++)
|
||||
if (*opt == cmp[i].letter)
|
||||
break;
|
||||
if (!cmp[i].letter) {
|
||||
fprintf(stderr,
|
||||
"ps: no such sort key -- %c. Possibilities are:\n", *opt);
|
||||
dump_keys();
|
||||
return -1;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,
|
||||
"sort level %d: key %s, direction % d\n",
|
||||
sort_depth, cmp[i].name, next_dir);
|
||||
#endif
|
||||
sort_function[sort_depth] = (cmp_t)cmp[i].fun;
|
||||
sort_direction[sort_depth++] = next_dir;
|
||||
next_dir = 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int parse_long_sort(char* opt) {
|
||||
char* comma;
|
||||
int i, more_keys, next_dir=1;
|
||||
do {
|
||||
if (*opt == '-' || *opt == '+') {
|
||||
if (*opt == '-')
|
||||
next_dir = -1;
|
||||
more_keys = 1;
|
||||
opt++;
|
||||
continue;
|
||||
}
|
||||
more_keys = ((comma=index(opt,',')) != NULL);
|
||||
/* keys are ',' delimited */
|
||||
if (more_keys)
|
||||
*comma='\0'; /* terminate for strcmp() */
|
||||
for(i = 0; cmp[i].letter; ++i)
|
||||
if (strcmp(opt, cmp[i].name) == 0)
|
||||
break;
|
||||
if (!cmp[i].letter) {
|
||||
fprintf(stderr,
|
||||
"ps: no such sort key -- %s. Possibilities are:\n", opt);
|
||||
dump_keys();
|
||||
return -1;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,
|
||||
"sort level %d: key %s, direction % d\n",
|
||||
sort_depth, cmp[i].name, next_dir);
|
||||
#endif
|
||||
sort_function[sort_depth] = (cmp_t)cmp[i].fun;
|
||||
sort_direction[sort_depth++] = next_dir;
|
||||
next_dir = 1;
|
||||
}
|
||||
opt = comma + 1; /* do next loop on next key, if more keys, else done*/
|
||||
} while (more_keys);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void reset_sort_options (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
sort_depth=0;
|
||||
for (i=0;i<10;i++){
|
||||
sort_direction[i]=0;
|
||||
sort_function[i]=(cmp_t)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void register_sort_function (int dir, cmp_t func)
|
||||
{
|
||||
sort_function[sort_depth] = func;
|
||||
sort_direction[sort_depth++] = dir;
|
||||
}
|
@@ -1,269 +0,0 @@
|
||||
/* device name <-> number map system optimized for rapid, constant time lookup.
|
||||
Copyright Charles Blake, 1996, see COPYING for details.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define __KERNEL__
|
||||
#include <linux/kdev_t.h>
|
||||
#undef __KERNEL__
|
||||
|
||||
#define DEVDIR "/dev"
|
||||
#define DEVTAB "psdevtab"
|
||||
static char *devtab_paths[] = {
|
||||
"/etc/" DEVTAB,
|
||||
"%s/." DEVTAB,
|
||||
NULL
|
||||
};
|
||||
#define DEVINITIALMODE 0664
|
||||
#define DEV_MAX_PATH (5+256)
|
||||
#define DEV_NAME_MAX 8
|
||||
|
||||
static dev_t major[] = { 2, 3, 4, 5, 19, 20, 22, 23, 24, 25, 32, 33,
|
||||
46, 47, 48, 49 };
|
||||
#define Nminor 256
|
||||
#define Nmajor (sizeof(major)/sizeof(dev_t))
|
||||
#define Ndev (Nmajor*Nminor)
|
||||
#define Ndevtab (Ndev*DEV_NAME_MAX)
|
||||
|
||||
static char* devtab; /* the memory buffer holding all the name strings */
|
||||
|
||||
/* This macro evaluates to the address into the table of the string of
|
||||
DEV_NAME_MAX chars for the device with major m, minor n. */
|
||||
#define TAB(m,n) (devtab + (m)*(Nminor*DEV_NAME_MAX) + (n)*DEV_NAME_MAX)
|
||||
|
||||
static int devtab_initialized = 0;
|
||||
|
||||
static char* name_to_path(char* name); /* forward declarations */
|
||||
static int init_devtab (void);
|
||||
|
||||
/* Device Name -> Number Map
|
||||
many-to-one: -1 on failed match.
|
||||
*/
|
||||
dev_t name_to_dev(char* name) {
|
||||
static struct stat sbuf;
|
||||
return (stat(name_to_path(name), &sbuf) < 0) ? -1 : sbuf.st_rdev;
|
||||
}
|
||||
|
||||
/* find m in a[] assuming a is sorted into ascending order */
|
||||
/* in-line linear search placeholder until more majors warrant binary search */
|
||||
static __inline__ int lookup(dev_t m, dev_t* a, int n) {
|
||||
int k;
|
||||
for(k=0; k < n && a[k] != m; k++)
|
||||
;
|
||||
return (k < n) ? k : -1;
|
||||
}
|
||||
|
||||
/* Device Number -> Name Map
|
||||
one-to-many: first directory order match in DEVDIR, "" on failed match.
|
||||
*/
|
||||
char* dev_to_name(dev_t num) {
|
||||
static char rval[DEV_NAME_MAX+1];
|
||||
dev_t m = MAJOR(num), n = MINOR(num), tmp;
|
||||
if (!devtab_initialized && !init_devtab())
|
||||
return "";
|
||||
if ((tmp = lookup(m, major, Nmajor)) == (dev_t)-1)
|
||||
return "";
|
||||
strncpy(rval, TAB(tmp,n), DEV_NAME_MAX);
|
||||
rval[DEV_NAME_MAX] = '\0';
|
||||
return rval;
|
||||
}
|
||||
|
||||
static int dev_to_devtab(int);
|
||||
|
||||
static int init_devtab(void) {
|
||||
static struct stat sbuf, lbuf;
|
||||
static int fd;
|
||||
char **fmt, path[64], *HOME = getenv("HOME") ? getenv("HOME") : "";
|
||||
for (fmt = devtab_paths; *fmt; fmt++) {
|
||||
snprintf(path, sizeof path, *fmt, HOME);
|
||||
lbuf.st_ino = 0; /* initialize for test later */
|
||||
if (lstat(path, &lbuf) >= 0 && S_ISLNK(lbuf.st_mode))
|
||||
/* don't follow symlinks */
|
||||
continue;
|
||||
if ( (fd = open(path, O_RDONLY)) < 0 /* open DEVTAB file */
|
||||
|| fstat(fd, &sbuf) < 0 /* fstat it */
|
||||
|| (lbuf.st_ino && (sbuf.st_ino != lbuf.st_ino)) /* race */
|
||||
|| sbuf.st_nlink > 1 /* hardlink attack */
|
||||
|| sbuf.st_size != Ndevtab /* make sure it's the right size */
|
||||
|| (devtab = mmap(0, Ndevtab, PROT_READ, MAP_SHARED, fd, 0)) == (caddr_t) -1
|
||||
|| close(fd) == -1)
|
||||
{ /* could not open for read, attempt to fix/create */
|
||||
int oumsk = umask(0);
|
||||
if (devtab)
|
||||
munmap(devtab, Ndevtab);
|
||||
if (((fd = open(path, O_RDWR|O_TRUNC|O_CREAT, DEVINITIALMODE)) == -1 &&
|
||||
(unlink(path), fd = open(path, O_RDWR|O_TRUNC|O_CREAT, DEVINITIALMODE)) == -1)
|
||||
|| !dev_to_devtab(fd)) {
|
||||
close(fd); /* either both opens failed or the constructor failed */
|
||||
unlink(path); /* in case we created but could not fill a file */
|
||||
umask(oumsk);
|
||||
continue;
|
||||
} else {
|
||||
devtab_initialized = 1;
|
||||
close(fd);
|
||||
umask(oumsk);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
return devtab_initialized = 1;
|
||||
}
|
||||
return devtab_initialized;
|
||||
}
|
||||
|
||||
/* stat every file in DEVDIR saving its basename in devtab[] if it has
|
||||
a MAJOR(st_rdev) in our list of majors. return 0 on error otherwise 1. */
|
||||
static int dev_to_devtab(int fd) {
|
||||
static struct stat sbuf;
|
||||
int i;
|
||||
dev_t m;
|
||||
struct dirent* ent;
|
||||
DIR* dev;
|
||||
|
||||
if (!(dev = opendir(DEVDIR))) {
|
||||
fprintf(stderr, "%s: %s\nCannot generate device number -> name mapping.\n",
|
||||
DEVDIR, sys_errlist[errno]);
|
||||
return 0;
|
||||
}
|
||||
if (!(devtab = malloc(Ndevtab))) {
|
||||
fprintf(stderr, "%s: could not allocate memory\n", sys_errlist[errno]);
|
||||
return 0;
|
||||
}
|
||||
memset((void*)devtab, 0, Ndevtab);
|
||||
while ((ent = readdir(dev))) { /* loop over all dirents in DEVDIR */
|
||||
if (lstat(name_to_path(ent->d_name), &sbuf) < 0
|
||||
|| !S_ISCHR(sbuf.st_mode)) /* only look for char special devs */
|
||||
continue; /* due to overloading of majors */
|
||||
m = MAJOR(sbuf.st_rdev); /* copy name to appropriate spot */
|
||||
if ((i = lookup(m, major, Nmajor)) != -1)
|
||||
strncpy(TAB(i,MINOR(sbuf.st_rdev)), ent->d_name, DEV_NAME_MAX);
|
||||
}
|
||||
closedir(dev);
|
||||
if (write(fd, devtab, Ndevtab) != Ndevtab) /* probably no disk space */
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static char path[DEV_MAX_PATH];
|
||||
|
||||
static char* name_to_path(char* name) {
|
||||
static char* Path;
|
||||
if (!Path) {
|
||||
strcpy(path, DEVDIR); /* copy DEVDIR */
|
||||
path[sizeof(DEVDIR) - 1] = '/'; /* change NUL to '/' */
|
||||
Path = path + sizeof(DEVDIR); /* put Path at start of basename */
|
||||
}
|
||||
strncpy(Path, name, DEV_MAX_PATH - sizeof(DEVDIR));
|
||||
return path;
|
||||
}
|
||||
|
||||
#ifdef TEST_DEVNAME
|
||||
int main(int argc, char** argv) { /* usage: cmd [<major> <minor>|<name>] */
|
||||
dev_t tmp;
|
||||
if (argc < 2) {
|
||||
printf("%s: [ maj min... | name ... ]\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
if (argv[1][0] >= '0' && argv[1][0] <= '9')
|
||||
for(argv++ ; argv[0] && argv[1] ; argv+=2)
|
||||
printf("%s\n", dev_to_name(MKDEV( atoi(argv[0]), atoi(argv[1]) )));
|
||||
else
|
||||
for(argv++ ; *argv ; argv++) {
|
||||
tmp = name_to_dev(*argv);
|
||||
printf("%d, %d\n", MAJOR(tmp), MINOR(tmp));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
Using this program on over 700 files in /dev to perform number->name resolution
|
||||
took well under 300 microsecs per device number pair on a Pentium 90. It is
|
||||
somewhat tough to time because once the 3 pages have been mapped in, the time is
|
||||
almost zero. For things like top, this method may even be faster in the long
|
||||
run. Those interested can gprof it for me. This system has the virtue of being
|
||||
nearly perfectly adaptable to individual systems, self updating when /dev
|
||||
changes and pretty darn fast when it hasn't. It will be slow for users without
|
||||
perms to change the psdevtab file, though. So this is what I decided was
|
||||
reasonable. If the process does not have perms to create or update
|
||||
/etc/psdevtab and it is out of date, we try /tmp/psdevtab. If /tmp/psdevtab is
|
||||
either out of date or unreadable (malicious user creates it and chmods it),
|
||||
$HOME/.psdevtab is used. This secondarily allows for per-user naming of ttys,
|
||||
but is really so that at most one user sees only a single delay per /dev
|
||||
modification.
|
||||
|
||||
To do the timings I did something like this with zsh:
|
||||
a=(`ls -l *(%^@/) | awk '{print $5 $6}' | sed 's/,/ /'`);
|
||||
time ./test $a
|
||||
|
||||
Finally, for lack of a better file for these to be in, I have collected the
|
||||
old algorithmic device number <-> device name mappings.
|
||||
Let m = major device number and n = minor device number satisfy:
|
||||
devno = m<<8 + n , m = devno>>8 , n = devno && 0x00FF, and let
|
||||
char L[32]="pqrstuvwxyzABCDEFGHIJKLMNOPQRSTU", H[16]="01234567890abcdef";
|
||||
DEVICE NUMBERS SPECIAL FILE NAMES
|
||||
OLD SYSTEM (64 pseudoterminal devices):
|
||||
m=4:
|
||||
n=0..63: tty + itoa_dec(n+1)
|
||||
n=128..191: pty + L[(n-128)/16] + H[(n-128)%16]
|
||||
n=192..255: tty + L[(n-192)/16] + H[(n-192)%16]
|
||||
NEW SYSTEM (256/512 pseudoterminal devices):
|
||||
m=2, n: pty + L[n/16] + H[n%16]
|
||||
m=3, n: tty + L[n/16] + H[n%16]
|
||||
m=4, n: tty + itoa_dec(n+1)
|
||||
m=49, n: pty + L[16+n/16] + H[n%16]
|
||||
m=50, n: tty + L[16+n/16] + H[n%16]
|
||||
(THE SAME IN EITHER SYSTEM)
|
||||
CALL-UNIX AND CONTROLLING TERMINAL DEVICES
|
||||
m=5:
|
||||
n=0: tty
|
||||
n=64..128: cua + {'0' + (n-64)}
|
||||
CYCLADES MULTIPORT:
|
||||
m=19, n: ttyC + itoa_hex(n)
|
||||
m=20, n: cub + itoa_hex(n) */
|
||||
|
||||
/* Re-implementation of old interface with the new generic functions. */
|
||||
|
||||
/* This does exactly the same thing as name_to_dev only now a full "ttyXX"
|
||||
specification will work as well.
|
||||
*/
|
||||
int tty_to_dev(char *tty) {
|
||||
static char pref_name_1[32] = "tty", *pnam1 = pref_name_1 + 3,
|
||||
pref_name_2[32] = "cu", *pnam2 = pref_name_2 + 2;
|
||||
dev_t num;
|
||||
if ((num = name_to_dev(tty)) != (dev_t) -1) /* try tty straight up */
|
||||
return num;
|
||||
strncpy(pnam1, tty, 32 - 3); /* try with "tty" prepended */
|
||||
if ((num = name_to_dev(pref_name_1)) != (dev_t) -1)
|
||||
return num;
|
||||
strncpy(pnam2, tty, 32 - 2); /* try with "cu" prepended */
|
||||
if ((num = name_to_dev(pref_name_2)) != (dev_t) -1)
|
||||
return num;
|
||||
return -1; /* no match */
|
||||
}
|
||||
|
||||
/* new abstraction that can maybe be generalized a little better. */
|
||||
char* abbrev_of_tty(char *tty) {
|
||||
static char temp[32]; /* return buf: good only until next call */
|
||||
char *pos = strpbrk(tty, "yu"); /* end of (presumed) prefices: tty*, cu* */
|
||||
temp[0] = 0;
|
||||
if (tty && tty[0] && pos && pos[0] && pos[1])
|
||||
sprintf(temp, "%*.*s", 3, 3, pos + 1);
|
||||
else
|
||||
strncpy(temp, " ? ", 31);
|
||||
return temp;
|
||||
}
|
||||
|
||||
/* Do in-place modification of the 4-buffer `tty' based upon `dev' */
|
||||
void dev_to_tty(char *tty, int dev) {
|
||||
char* new = abbrev_of_tty(dev_to_name(dev));
|
||||
strncpy(tty, new, 4);
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
dev_t name_to_dev(char* name);
|
||||
char* dev_to_name(dev_t num);
|
||||
|
||||
dev_t tty_to_dev(char *tty);
|
||||
void dev_to_tty(char *tty, int dev);
|
||||
|
||||
char* abbrev_of_tty(char *tty);
|
252
libproc/ksym.c
252
libproc/ksym.c
@@ -1,252 +0,0 @@
|
||||
/* kernel address -> symbol with next lower address. Charles Blake, 1996.
|
||||
* Written to obviate the need for psdatabase initialization based upon kernel
|
||||
* binary formats, etc.
|
||||
*
|
||||
* The basic algorithm is an approximate (intervals split vaguely 50-50) binary
|
||||
* search taking advantage of the fact the System.map is already sorted in
|
||||
* ascending order by the kernel makefile. It needs to assume an average symbol
|
||||
* record length to avoid scanning the entire symbol table, but in practice the
|
||||
* search time does not seem to be especially sensitive to this choice.
|
||||
*
|
||||
* The search could be an exact binary search if the lines of System.map were
|
||||
* padded with blanks to the right. awk '{printf "%8s%2s %-21.21s\n",$1,$2,$3}'
|
||||
* would do the trick for this but either makes the file large or truncates
|
||||
* symbols. The approximate method seems to be plenty fast enough, costing
|
||||
* only about as much as one extra fstat() or so per process.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/utsname.h>
|
||||
#include "psdata.h"
|
||||
#include "ps.h"
|
||||
#include "version.h"
|
||||
|
||||
#define MAX_ADDR_SZ 32
|
||||
static char *sysmap, *sysmap_last, sysmap_fmt[10];
|
||||
static int sysmap_len, sysmap_mean = 32, sysmap_addrsz;
|
||||
|
||||
/* scan backward in a string no further than address beg looking for c */
|
||||
static char *strchrrev(char *a, char *beg, char c) {
|
||||
if (a)
|
||||
while (--a > beg && *a != c) ;
|
||||
return a;
|
||||
}
|
||||
|
||||
/* return ptr to the beg of approximately the i-th record */
|
||||
static char *addr_str(int i) {
|
||||
char *guess = sysmap + sysmap_mean * i;
|
||||
if (!i) return sysmap;
|
||||
if (guess - sysmap > sysmap_len - 2) guess = sysmap + sysmap_len - 2;
|
||||
for ( ; *guess != '\n' && guess > sysmap; guess--)
|
||||
;
|
||||
return guess + 1;
|
||||
|
||||
}
|
||||
|
||||
/* return ptr to symbol string (\n terminated) given beg of record ptr */
|
||||
static char *sym_put(char *buf, int len, char *addrptr) {
|
||||
char *s;
|
||||
while (*addrptr++ != ' ') ;
|
||||
while (*addrptr++ != ' ') ;
|
||||
strncpy(buf, addrptr, len);
|
||||
for (s = buf; s < buf + len; s++)
|
||||
if (*s == '\n')
|
||||
*s = '\0';
|
||||
buf[len - 1] = '\0';
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Try to open and mmap a single symbol table file and initialize globals */
|
||||
int sysmap_mmap(char *path) {
|
||||
int fd;
|
||||
struct stat sbuf;
|
||||
char *p;
|
||||
if (sysmap) /* do nothing if already mapped */
|
||||
return 1;
|
||||
if ((fd = open(path, O_RDONLY)) < 0
|
||||
|| fstat(fd, &sbuf) < 0
|
||||
|| (sysmap = mmap(0, sbuf.st_size,
|
||||
PROT_READ, MAP_SHARED,
|
||||
fd, 0)) == (caddr_t) -1)
|
||||
{
|
||||
close(fd);
|
||||
sysmap = NULL;
|
||||
return 0;
|
||||
}
|
||||
sysmap_len = sbuf.st_size;
|
||||
sysmap_last = strchrrev(sysmap + sysmap_len - 2, sysmap, '\n') + 1;
|
||||
|
||||
/* Now check first line of sysmap for hex numbers in first column. Note:
|
||||
0x/0X prefixes are disallowed, but easily addable. Capitalization is
|
||||
irrelevant because strncasecmp(3) is used below instead of strncmp. */
|
||||
for (p = sysmap; *p != ' '
|
||||
&& ((*p >= '0' && *p <= '9') ||
|
||||
(*p >= 'A' && *p <= 'F') ||
|
||||
(*p >= 'a' && *p <= 'f'))
|
||||
&& p < sysmap + MAX_ADDR_SZ;
|
||||
p++) /* no-op */ ;
|
||||
if (*p != ' ') { /* uh-oh: cannot understand format */
|
||||
fprintf(stderr, "warning: %s not parseable as a System.map.\n", path);
|
||||
munmap(sysmap, sysmap_len);
|
||||
sysmap = NULL;
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
sysmap_addrsz = p - sysmap;
|
||||
snprintf(sysmap_fmt, sizeof sysmap_fmt, "%%0%dlx", sysmap_addrsz);
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* kernel address -> name resolver.
|
||||
returned value is only good until the next call to the function.
|
||||
*/
|
||||
char *sysmap_symbol(unsigned long address) {
|
||||
static char rval[128], *pc, addr[MAX_ADDR_SZ];
|
||||
int i, p, n = sysmap_len / (double)sysmap_mean;
|
||||
|
||||
sprintf(addr, sysmap_fmt, address);
|
||||
p = 0; pc = sysmap;
|
||||
while (n) {
|
||||
i = p + (n >> 1);
|
||||
if (strncasecmp(addr, pc = addr_str(i), sysmap_addrsz) > 0)
|
||||
p = i + 1;
|
||||
n >>= 1;
|
||||
}
|
||||
if (pc == sysmap_last) /* scan forward but not past end */
|
||||
return sym_put(rval, sizeof rval, pc);
|
||||
while (strncasecmp(addr, pc, sysmap_addrsz) > 0)
|
||||
pc = strchr(pc, '\n') + 1;
|
||||
if (pc == sysmap) /* scan backward but not past beg */
|
||||
return sym_put(rval, sizeof rval, pc);
|
||||
while (strncasecmp(addr, pc, sysmap_addrsz) < 0)
|
||||
pc = strchrrev(pc - 1, sysmap, '\n') + 1;
|
||||
return sym_put(rval, sizeof rval, pc);
|
||||
}
|
||||
|
||||
/* extern struct nlist *namelist; */
|
||||
struct tbl_s vars, fncs;
|
||||
struct psdb_hdr db_hdr;
|
||||
int psdb = -1;
|
||||
|
||||
int open_psdb(void) {
|
||||
static char *sysmap_paths[] = {
|
||||
"/boot/System.map-%s",
|
||||
"/boot/System.map",
|
||||
"/lib/modules/%s/System.map",
|
||||
NULL
|
||||
};
|
||||
static char *psdb_paths[] = {
|
||||
"/etc/psdatabase",
|
||||
"/boot/psdatabase-%s",
|
||||
"/boot/psdatabase",
|
||||
"/lib/modules/%s/psdatabase",
|
||||
NULL
|
||||
};
|
||||
char **fmt, *env, path[64];
|
||||
struct utsname uts;
|
||||
uname(&uts);
|
||||
if ((env = getenv("PS_SYSMAP")) && sysmap_mmap(env))
|
||||
return 0;
|
||||
for (fmt = sysmap_paths; *fmt; fmt++) {
|
||||
snprintf(path, sizeof path, *fmt, uts.release);
|
||||
if (sysmap_mmap(path))
|
||||
return 0;
|
||||
}
|
||||
for (fmt = psdb_paths; *fmt; fmt++) {
|
||||
snprintf(path, sizeof path, *fmt, uts.release);
|
||||
if ((psdb = open(path, O_RDONLY)) != -1 &&
|
||||
read(psdb, (char*)&db_hdr, sizeof db_hdr) == sizeof db_hdr &&
|
||||
strncmp(db_hdr.magic, procps_version, sizeof(db_hdr.magic)) == 0)
|
||||
/* && version_cmp(kernel,psdatabase) */
|
||||
return 0;
|
||||
if (psdb != -1)
|
||||
fprintf(stderr,
|
||||
"psdatabase has magic no. %*s instead of %*s\n",
|
||||
(int) sizeof db_hdr.magic, db_hdr.magic,
|
||||
(int) sizeof db_hdr.magic, procps_version);
|
||||
close(psdb);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void close_psdb(void) {
|
||||
if (sysmap)
|
||||
munmap(sysmap, sysmap_len);
|
||||
else if (psdb != -1)
|
||||
close(psdb);
|
||||
psdb = -1;
|
||||
sysmap = NULL;
|
||||
}
|
||||
|
||||
int read_tbl(struct dbtbl_s *dbtbl, struct tbl_s *tbl) {
|
||||
lseek(psdb, dbtbl->off, SEEK_SET);
|
||||
tbl->tbl = (struct sym_s *) xmalloc(dbtbl->size);
|
||||
if (read(psdb, (char *) tbl->tbl, dbtbl->size) != dbtbl->size) {
|
||||
perror(PSDATABASE);
|
||||
exit(1);
|
||||
}
|
||||
tbl->nsym = dbtbl->nsym;
|
||||
tbl->strings = (char *) (tbl->tbl + tbl->nsym);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char * find_func(unsigned long address) {
|
||||
int n;
|
||||
struct sym_s *p;
|
||||
char *s;
|
||||
|
||||
if (sysmap)
|
||||
return sysmap_symbol(address);
|
||||
if (psdb == -1)
|
||||
return "(no psdb)";
|
||||
if (fncs.tbl == NULL)
|
||||
read_tbl(&db_hdr.fncs, &fncs);
|
||||
p = fncs.tbl;
|
||||
n = fncs.nsym;
|
||||
while (n) {
|
||||
int i = n / 2;
|
||||
if (p[i].addr < address) {
|
||||
p = &p[i+1];
|
||||
if (p->addr > address) {
|
||||
--p;
|
||||
break;
|
||||
}
|
||||
--n;
|
||||
}
|
||||
n /= 2;
|
||||
}
|
||||
s = p->name + fncs.strings;
|
||||
return *s=='_' ? s+1 : s;
|
||||
}
|
||||
|
||||
char * wchan(unsigned long address) {
|
||||
static char zero = 0;
|
||||
char *p;
|
||||
|
||||
if (address) {
|
||||
p = find_func(address);
|
||||
if (strncmp(p, "sys_", 4) == 0)
|
||||
p += 4;
|
||||
while (*p == '_' && *p)
|
||||
++p;
|
||||
} else /* 0 address means not in kernel space */
|
||||
p = &zero;
|
||||
return p;
|
||||
}
|
||||
|
||||
#ifdef SYSMAP_TEST
|
||||
int main(int ac, char** av) {
|
||||
if (ac < 3) {printf("%s System.map lines hexaddr ...\n",av[0]); return 1;}
|
||||
if (!sysmap_mmap(av[1])) return 1;
|
||||
if ((sysmap_mean = atoi(av[2])) <= 0) return 1;
|
||||
for (av += 3; *av; av++)
|
||||
printf("%s %s\n", *av, sysmap_symbol(strtoul(*av, NULL, 16)));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
Some output conversion routines for libproc
|
||||
Copyright (C) 1996, Charles Blake. See COPYING for details.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
/* output a string, converting unprintables to octal as we go, and stopping after
|
||||
processing max chars of output (accounting for expansion due to octal rep).
|
||||
*/
|
||||
unsigned print_str(FILE* file, char *s, unsigned max) {
|
||||
int i;
|
||||
for (i=0; s[i] && i < max; i++)
|
||||
if (isprint(s[i]) || s[i] == ' ')
|
||||
fputc(s[i], file);
|
||||
else {
|
||||
if (max - i > 3) {
|
||||
fprintf(file, "\\%03o", s[i]);
|
||||
i += 3; /* 4 printed, but i counts one */
|
||||
} else
|
||||
return max - i;
|
||||
}
|
||||
return max - i;
|
||||
}
|
||||
|
||||
/* output an argv style NULL-terminated string list, converting unprintables
|
||||
to octal as we go, separating items of the list by 'sep' and stopping after
|
||||
processing max chars of output (accounting for expansion due to octal rep).
|
||||
*/
|
||||
unsigned print_strlist(FILE* file, char **strs, char* sep, unsigned max) {
|
||||
int i, n, seplen = strlen(sep);
|
||||
for (n=0; *strs && n < max; strs++) {
|
||||
for (i=0; strs[0][i] && n+i < max; i++)
|
||||
if (isprint(strs[0][i]) || strs[0][i] == ' ')
|
||||
fputc(strs[0][i], file);
|
||||
else {
|
||||
if (max-(n+i) > 3) {
|
||||
fprintf(file, "\\%03o", strs[0][i]);
|
||||
n += 3; /* 4 printed, but i counts one */
|
||||
} else
|
||||
return max - n;
|
||||
}
|
||||
n += i;
|
||||
if (n + seplen < max) {
|
||||
fputs(sep, file);
|
||||
n += seplen;
|
||||
} else
|
||||
return max - n;
|
||||
}
|
||||
return max - n;
|
||||
}
|
30
libproc/ps.h
30
libproc/ps.h
@@ -1,30 +0,0 @@
|
||||
/* The shadow of the original with only common prototypes now. */
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* get definition of HZ */
|
||||
#include <asm/param.h>
|
||||
|
||||
/* get page info */
|
||||
#include <asm/page.h>
|
||||
|
||||
char *wchan(unsigned long);
|
||||
char *find_func(unsigned long address);
|
||||
void *xcalloc(void *pointer, int size);
|
||||
void *xmalloc(unsigned int size);
|
||||
void *xrealloc(void *oldp, unsigned int size);
|
||||
|
||||
int mult_lvl_cmp(void* a, void* b);
|
||||
int node_mult_lvl_cmp(void* a, void* b);
|
||||
void dump_keys(void);
|
||||
|
||||
char *user_from_uid(int uid);
|
||||
|
||||
int open_sysmap(void);
|
||||
int open_psdb(void);
|
||||
void close_psdb(void);
|
||||
void make_fnctbl(void);
|
||||
|
||||
unsigned print_str (FILE* file, char *s, unsigned max);
|
||||
unsigned print_strlist(FILE* file, char **strs, char* sep, unsigned max);
|
||||
unsigned snprint_strlist(char *buf, int max, char **strs, char *sep);
|
103
libproc/psdata.h
103
libproc/psdata.h
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
* psdata.h
|
||||
*
|
||||
* Jeffrey A. Uphoff <juphoff@nrao.edu>, 1995, 1996.
|
||||
* Michael K. Johnson.
|
||||
* Bruno Lankester.
|
||||
* (And others I'm sure...)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Capabilities are for reading system images and producing maps for
|
||||
* WCHAN output.
|
||||
*
|
||||
* AOUT_CAPABLE and ELF_CAPABLE may have 32-bit word size limitations
|
||||
* and have only been tested by the maintainer on Intel systems. They
|
||||
* are retained in the source tree in case they are useful; they are
|
||||
* intended to be generally deprecated.
|
||||
*
|
||||
* BFD_CAPABLE should work on any system with BFD.
|
||||
*
|
||||
* Set the capabilities in the top-level Makefile.
|
||||
*/
|
||||
|
||||
#if defined(ELF_CAPABLE)
|
||||
# define ELF_OBJECT 1
|
||||
# define ELF_FUNC 2
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <linux/utsname.h>
|
||||
|
||||
#define PSDATABASE "/etc/psdatabase"
|
||||
|
||||
struct dbtbl_s {
|
||||
off_t off; /* offset in psdatabase */
|
||||
int nsym; /* # symbols */
|
||||
int size; /* size of array + strings */
|
||||
};
|
||||
|
||||
/*
|
||||
* header of psdatabase
|
||||
*/
|
||||
struct psdb_hdr {
|
||||
/* Current procps package version goes here. kmemps doesn't like this. */
|
||||
char magic[32];
|
||||
/*
|
||||
* These are not functional--they only reside in the database for
|
||||
* informational purposes (i.e. if you want to look at the raw
|
||||
* database and see what kernel it's for).
|
||||
*/
|
||||
char uts_release[__NEW_UTS_LEN];
|
||||
char uts_version[__NEW_UTS_LEN];
|
||||
/*
|
||||
* Again, this is not functional, it's just there for information: it
|
||||
* shows the path to the uncompressed kernel image that was used to
|
||||
* generate this database.
|
||||
*/
|
||||
char sys_path[128];
|
||||
/* List of all functions. */
|
||||
struct dbtbl_s fncs;
|
||||
/*
|
||||
* This is currently only used to look up system_utsname while
|
||||
* psupdate is building the database--it really should be phased out!
|
||||
*/
|
||||
/* List of all bss and data symbols. */
|
||||
struct dbtbl_s vars;
|
||||
/*
|
||||
* The list of tty names that kmemps likes/uses in no longer present
|
||||
* in the procps psdatabase--it was never being built by procps'
|
||||
* psupdate anyway, so I removed the entry from the database header.
|
||||
*/
|
||||
};
|
||||
|
||||
struct sym_s {
|
||||
unsigned long addr; /* core address in kernel */
|
||||
int name; /* offset from strings ptr */
|
||||
};
|
||||
|
||||
struct tbl_s {
|
||||
struct sym_s *tbl;
|
||||
int nsym;
|
||||
char *strings; /* ptr to start of strings */
|
||||
};
|
||||
|
||||
extern struct psdb_hdr db_hdr;
|
||||
extern struct tbl_s fncs, vars;
|
||||
|
||||
int read_tbl (struct dbtbl_s *, struct tbl_s *);
|
||||
void *xmalloc (unsigned int);
|
||||
void *xrealloc (void *, unsigned int);
|
||||
|
||||
#define MLSEEK(FD, WHERE, WHENCE, ERROR)\
|
||||
if (lseek ((FD), (WHERE), (WHENCE)) == -1) {\
|
||||
perror ((ERROR));\
|
||||
exit (errno);\
|
||||
}
|
||||
|
||||
#define MREAD(FD, WHAT, SIZE, ERROR)\
|
||||
if (read ((FD), (WHAT), (SIZE)) != (SIZE)) {\
|
||||
perror ((ERROR));\
|
||||
exit (errno);\
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pwd.h>
|
||||
#include "ps.h"
|
||||
|
||||
#define HASHSIZE 16 /* power of 2 */
|
||||
#define HASH(x) ((x) & (HASHSIZE - 1))
|
||||
|
||||
|
||||
static struct pwbuf {
|
||||
int uid;
|
||||
char name[12];
|
||||
struct pwbuf *next;
|
||||
} *pwhash[HASHSIZE];
|
||||
|
||||
char *user_from_uid(int uid)
|
||||
{
|
||||
struct pwbuf **p;
|
||||
struct passwd *pw;
|
||||
|
||||
p = &pwhash[HASH(uid)];
|
||||
while (*p) {
|
||||
if ((*p)->uid == uid)
|
||||
return((*p)->name);
|
||||
p = &(*p)->next;
|
||||
}
|
||||
*p = (struct pwbuf *) xmalloc(sizeof(struct pwbuf));
|
||||
(*p)->uid = uid;
|
||||
if ((pw = getpwuid(uid)) == NULL)
|
||||
sprintf((*p)->name, "#%d", uid);
|
||||
else
|
||||
sprintf((*p)->name, "%-.8s", pw->pw_name);
|
||||
(*p)->next = NULL;
|
||||
return((*p)->name);
|
||||
}
|
||||
|
||||
void bad_user_access_length() { }
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user