Compare commits

...

641 Commits

Author SHA1 Message Date
2b713c3dd4 更新 src/os/linux/linux_sigar.c 2024-09-27 17:10:00 +08:00
Konstantin Makarchev
af03ded75f 2.0.11 2024-09-10 14:52:40 +03:00
Kostya M
00760eebda
Merge pull request #16 from wollistik/fix_build_issue
Fixing build issue on newer linux and also issues with newer Ruby
2024-09-10 14:49:54 +03:00
Wolfgang Wedelich-John
8b887b2380 Fixing build issue on newer linux and alos issue with newer Ruby 2024-09-10 12:58:09 +02:00
Konstantin Makarchev
9f918d1ae9 2.0.10 2021-10-31 05:29:09 +03:00
Konstantin Makarchev
49a9aeeff5 remove nfsstat methods on osx, because seems it not used, this should fix #11
TODO: return is back, if fix would be finded
2021-10-30 21:02:07 +03:00
Konstantin Makarchev
04754bdf48 fix 2021-06-28 12:24:24 +03:00
Konstantin Makarchev
9691f4bbf7 2.0.9 2021-06-28 12:17:33 +03:00
Konstantin Makarchev
b78b558fb7 fixed #10, apply path from https://svnweb.freebsd.org/ports/head/devel/sigar/files/patch-src_os_darwin_darwin__sigar.c?r1=438996&r2=544794 2021-06-28 11:59:40 +03:00
Konstantin Makarchev
01df5b7739 fix readme 2020-10-05 23:32:01 +03:00
Konstantin Makarchev
d521805a2d 2.0.8 2020-10-05 23:30:16 +03:00
Konstantin Makarchev
7898cebf27 2.0.7 2020-10-02 18:46:51 +03:00
Kostya M
68ba944840
Merge pull request #9 from yxhuvud/fix-compile-macos
Fix compilation on macos.
2020-10-02 18:42:01 +03:00
Linus Sellberg
ad39547629 Fix compilation on macos. 2020-10-02 14:55:03 +02:00
Konstantin Makarchev
c5f71e36b7 2.0.6 2019-01-18 09:31:25 +03:00
Konstantin Makarchev
ad4ff7f83f fix readme 2019-01-18 09:31:17 +03:00
Konstantin Makarchev
2bb67fa1bf apply freebsd12 compilation patch (#6)
https://svnweb.freebsd.org/ports/head/devel/sigar/files/patch-src_os_darwin_darwin__sigar.c?revision=438996&view=markup
2019-01-18 09:21:16 +03:00
Konstantin Makarchev
4aeac4dfe8 fix doc 2018-12-02 22:39:58 +03:00
Konstantin Makarchev
2c5dd8b674 2.0.5 2018-12-02 22:36:19 +03:00
Kostya M
d88f2121b8
Merge pull request #4 from jcoyne/patch-1
Fix compilation with musl libc
2018-12-02 22:33:16 +03:00
Natanael Copa
621764c13d only enable the GNU libc strerror_r on GNU libc
We don't want use the non-standard GNU libc variant of strerror_r on
musl libc, or any libc other than GNU.
2018-11-30 22:34:24 -06:00
Natanael Copa
cd07923dd2 fix compilation with musl libc
the HZ define is not exposed by musl libc.
2018-11-30 22:33:49 -06:00
Konstantin Makarchev
0d4fe42927 fix 2018-06-28 22:21:59 +03:00
Konstantin Makarchev
369e5b093e fix 2018-06-28 22:20:17 +03:00
Konstantin Makarchev
9f05d47620 fix doc 2018-06-28 22:19:23 +03:00
Konstantin Makarchev
9b60875c06 fix 2018-06-28 22:17:45 +03:00
Konstantin Makarchev
163745ad5d doc 2018-06-10 07:55:25 +03:00
Konstantin Makarchev
489de8187f add doc 2018-06-10 07:48:51 +03:00
Konstantin Makarchev
a2c67588d0 fix compilation with glibc 2.26, major/minor functions, fixed #2
compilation error was:
  linux_sigar.c:1156:22: error: called object ‘major’ is not a function or function pointer
  linux_sigar.c:1157:22: error: called object ‘minor’ is not a function or function pointer
2018-06-10 07:46:09 +03:00
Konstantin Makarchev
2f7284cd4c fix readme 2018-05-30 17:21:34 +03:00
Konstantin Makarchev
d07ba63c28 better readme 2018-05-30 16:25:01 +03:00
Konstantin Makarchev
0c11387456 fix building gem 2018-05-30 16:24:06 +03:00
Konstantin Makarchev
ced59e8ca6 forget remove from h files 2018-05-30 13:39:28 +03:00
Konstantin Makarchev
f46a9baeef update readme and version 2.0.2 2018-05-30 13:33:48 +03:00
Konstantin Makarchev
a971b9e8e1 Remove obsolete rpc usage
Fix compilation fail with glibc 2.27.
The latest version of glibc (2.27 at this time)
is compiled without --enable-obsolete-rpc flag.
2018-05-30 13:29:40 +03:00
Konstantin Makarchev
5478eb4be9 update readme 2018-04-10 19:47:33 +03:00
Konstantin Makarchev
cc726007b3 add to doc and new version 2018-04-10 19:30:16 +03:00
O_o
e9897b25b4
Merge pull request #1 from baughj/master
FreeBSD: don't use v_cache_min/max
2018-04-10 19:24:52 +03:00
Justin Baugh
800076db97 FreeBSD: don't use v_cache_min/max (https://github.com/hyperic/sigar/pull/68) 2018-04-10 09:02:28 -07:00
Konstantin Makarchev
1e23251b5c update readme 2018-01-22 13:08:12 +03:00
Konstantin Makarchev
5cb14da077 update readme 2018-01-22 13:05:46 +03:00
Konstantin Makarchev
cd0e5bf315 update readme 2018-01-22 13:02:23 +03:00
Konstantin Makarchev
368efdcd05 update readme 2018-01-22 12:59:44 +03:00
Konstantin Makarchev
5245b8f3e3 update version 2018-01-22 12:51:37 +03:00
Konstantin Makarchev
660259e572 fixed sigar_boot_time_get for linux, to work as gnu ps, this fixed some problems with start_time detection 2018-01-22 12:51:24 +03:00
Konstantin Makarchev
dfe8fece17 fix bug undefined symbol: sigar_skip_token, fixed #60 2018-01-22 12:50:15 +03:00
Konstantin Makarchev
c2a1af3c25 remove unused sigfaulted logger, fixed #28 2018-01-22 12:48:49 +03:00
ilanuriel
ad47dc3b49 Go sources update
With latest changes from Lean Agent
2016-01-04 12:30:16 +02:00
ilanuriel
9158290982 go code
to link with sigar c code
2016-01-04 12:23:11 +02:00
ilanuriel
0f0dbe34ce go bindings
statically build go with sigar using visual studio 2015 IDE
2016-01-04 12:14:32 +02:00
tgoldman
7a6aefc7fb Fix [SIGAR-253]- Remove a space from else if condition 2015-08-17 09:39:01 +03:00
BoazHarel
48ba690dd4 With Tomer.
Optimizing the performance counter queries on win32.

splitted performance counters cache to caches per counter_key.
2015-07-20 11:44:50 +03:00
Boaz
341e288e98 With Tomer.
Optimizing the performance counter queries on win32.

There is now a cache for 1 second to all performance counter data.
2015-07-16 16:11:16 +03:00
tgoldman
0928a780f4 Fix [SIGAR-252] - Add support for discovering Windows 2012 R2 2015-07-01 12:02:42 +03:00
Zvika Idelsberg
706f352e56 removing Override annotations 2015-03-25 04:25:43 -06:00
Zvika Idelsberg
6d4ff51b9c fix bug 1361953(bugzilla)/HQ-4820(jira) - changing the way MultiProcess cpu usage(%) is calculated 2015-03-25 03:40:28 -06:00
Doug MacEachern
236006e02d Bump ruby gem version to 0.7.3
Fixes github issue #49
2014-10-30 14:09:38 -07:00
Doug MacEachern
18c2856f75 nfs.h needs sys/socket.h 2014-10-30 11:00:40 -07:00
David Zhao
13bcf8ae45 Moving sigar includes until after system. Fixes compilation on Xcode 6.1 2014-10-06 16:14:45 -07:00
hananaharonof
b89060c481 Merge pull request #46 from hyperic/i18n
Some metrics are missing the '/sec' suffix. This fix first tries to add
2014-09-03 14:12:38 +03:00
unknown
4fcaa226bd Some metrics are missing the '/sec' suffix. This fix first tries to add
the counter without the '/sec' and if fails, try again with it. If the
second call fails, throw an exception.This issue must be addressed at the
java level (and not C code), since the counter names must be translated
before to support i18n native OS locals.
Please also note, the C code (at Pdh.c), tries to do the same, but at
this level we cannot use the translation mechanism the Java level offers,
hence this fix won't handle non-English i18n locals.
2014-09-03 13:22:19 +03:00
nira11
189843858e Merge pull request #33 from nettag/master
disk io per process, and a few bug fixes
2013-10-06 02:27:13 -07:00
tgoldman
47f01e0177 [SIGAR-248]- Sigar log monitoring ignores successive lines with same timestamp 2013-09-30 10:53:08 +02:00
nira11
6ed8f3c9b5 c on win compatability poblems 2013-09-15 14:14:42 +00:00
nira11
924c4c7476 removed; 2013-09-15 13:54:49 +00:00
nira11
07b221a253 disk io works using cache - also pid cache cleanup and pid cache dump 2013-09-15 12:00:23 +00:00
nira11
f2ba707d9f sigar hpux - disk io fix 2013-08-27 11:37:22 +00:00
nira11
6508b09304 disk io on aix 2013-08-18 11:45:47 +00:00
nira11
64f32dd125 solaris disk io 2013-08-18 08:24:25 +00:00
nira11
aee1d82fae disk io hpux 2013-08-14 10:20:58 +00:00
root
5a1d5e75f1 show windoes 2012 2013-08-12 09:34:24 +00:00
nettag
f15aa84dfe Fixed TestProcDiskIO
Added bytesTotal and some more verification.
2013-08-04 16:41:36 +03:00
nettag
0d91f7d6a4 Added total disk IO metric 2013-08-04 16:19:41 +03:00
nettag
b13b8dcbbb Implemented empty sigar_proc_disk_io_get on unsupported systems, to avoid breaking compilation. 2013-07-30 16:22:40 +03:00
Netta Gavrieli
273889f827 Implemented process disk IO metrics on Windows 2013-07-30 06:04:06 -07:00
nettag
a62558af50 Added Sigar.getProcDiskIO to Java API on Linux
Returns the total bytes read and written for a process using /proc/pid/io.
2013-07-30 10:37:01 +03:00
Netta Gavrieli
ec489fb336 Java - Fixed loading native libraries from paths that contain international characters.
This fixes Hyperic bug https://jira.hyperic.com/browse/HQ-4227
2013-07-30 10:22:50 +03:00
Martin Englund
907fe7a87f Merge pull request #24 from ville-k/master
OSX 10.8 - fix building java bindings
2013-05-08 09:00:57 -07:00
Martin Englund
83fbcbeb4e Merge pull request #11 from EdSchouten/master
Make utmp-handling more standards-compliant.
2013-05-08 08:30:09 -07:00
Ville Kallioniemi
a20ec372b7 Fix building java bindings on Mac OSX 10.8
* look for SDKs in their new location inside the
  application bundle of XCode
2012-10-28 14:27:00 -06:00
Doug MacEachern
91aead2fd3 fix gemspec files filter 2012-03-26 16:24:27 -07:00
Doug MacEachern
965051cdcf fix build with XCode 4.3
- avoid use of FlatCarbon headers

- remove sysroot/syslibroot

- fix gemspec files attribute
2012-03-26 15:23:42 -07:00
Ed Schouten
67b476efe0 Make utmp-handling more standards-compliant.
As utmpx is standardized by POSIX, first attempt to access the utmpx
database using the standard getutxent() function. If we don't have
utmpx, fall back to some simple utmp code that accesses the database
manually.

This code has been compile-tested on FreeBSD 8 (utmp), FreeBSD 9 (utmpx)
and Ubuntu Linux 11.10 (utmpx).
2011-12-07 23:57:05 +01:00
Doug MacEachern
edf041dc7a Merge branch 'sigar-1.6' 2011-07-18 10:51:02 -07:00
Doug MacEachern
a04f46a647 [SIGAR-233] Update sys_info API to recognize MacOSX 10.7 as 'Lion' 2011-07-18 10:50:53 -07:00
Doug MacEachern
d83284613b [SIGAR-232] change ProcUtil.getJavaMainClass to check Character.isJavaIdentifierPart 2011-07-18 10:47:57 -07:00
Doug MacEachern
012dcef75d Merge remote-tracking branch 'mimesis/noLog4jDefaultConf_param' into sigar-1.6 2011-07-18 10:14:48 -07:00
Doug MacEachern
f21897f93b [SIGAR-231] increase getpwuid_r buffer size 2011-07-18 10:12:42 -07:00
Doug MacEachern
710a3f791b update NOTICE file 2011-07-18 10:05:52 -07:00
Doug MacEachern
b88fb7c0c7 Merge branch 'sigar-1.6' 2011-07-08 13:26:45 -07:00
Doug MacEachern
510a4b5c89 no longer support building with 1.4 jdk 2011-07-08 13:26:37 -07:00
Ian Eure
4c76ea27c5 Update .gitignore. 2011-07-08 13:03:45 -07:00
Doug MacEachern
44a4062111 update files to clean 2011-07-08 13:03:11 -07:00
Ian Eure
8bd48cc477 Fix stupid build issues. 2011-07-08 12:48:21 -07:00
Doug MacEachern
ce23dbeec7 add unit tests 2011-06-28 17:29:26 -07:00
Doug MacEachern
5619873f02 expose sigar_version to Python 2011-06-20 16:53:17 -07:00
Doug MacEachern
73b0850a52 add net_stat Python binding 2011-06-15 15:53:39 -07:00
Doug MacEachern
129062d9cd add net_connection_list Python binding 2011-06-15 15:35:21 -07:00
Doug MacEachern
cb1e4f491d add proc_env Python binding 2011-06-15 15:24:03 -07:00
Doug MacEachern
de81b90497 add cpu list Python bindings 2011-06-15 14:59:31 -07:00
Doug MacEachern
fde00170d7 support ptql query in Python proc_list 2011-06-15 14:47:29 -07:00
Doug MacEachern
e0ef7a3616 propagate ptql error message to PyErr 2011-06-15 14:16:14 -07:00
Doug MacEachern
2f8090559e add Python ptql re op impl 2011-06-15 13:55:59 -07:00
Doug MacEachern
1f15289d75 add ptql support for Python 2011-06-15 09:19:04 -07:00
Doug MacEachern
7acf88a0bf add depends 2011-06-15 09:17:43 -07:00
Doug MacEachern
fcdf809ef5 add net_route_list Python binding 2011-06-14 10:50:18 -07:00
Doug MacEachern
dd8d2355cc add who_list Python binding 2011-06-14 10:49:17 -07:00
Doug MacEachern
c1ee0a18b9 add proc_args Python binding 2011-06-14 10:48:30 -07:00
mdoboi
0a3f546638 add noLog4jDefaultConf parameter 2011-04-22 14:51:23 +02:00
Doug MacEachern
58097d9743 bump copyright.year 2011-04-21 11:38:36 -07:00
Doug MacEachern
b44692d8e6 Merge branch 'sigar-1.6' 2011-04-21 11:37:54 -07:00
Doug MacEachern
a693ebce90 bump version 2011-04-21 11:37:46 -07:00
Doug MacEachern
216a2df541 Merge branch 'sigar-1.6' 2011-04-21 11:36:36 -07:00
Doug MacEachern
2d2c4c996d [SIGAR-230] bump windows proc_args max to 16k 2011-04-21 11:36:26 -07:00
Doug MacEachern
e09ad13a16 unify DLLMOD_ macros for ms and gnu 2011-04-21 09:58:45 -07:00
Doug MacEachern
59aeadaef2 SIGAR_NETIF_NAME_SHORT=1 env var will use the old eth%d names in sigar_net_interface_list_get 2011-04-12 15:28:01 -07:00
Doug MacEachern
73c3c287f7 use stack buffer instead of heap for sigar_net_interface_name_get 2011-04-12 15:16:58 -07:00
Doug MacEachern
4655d5e3df untabify/style 2011-04-12 15:06:33 -07:00
Doug MacEachern
cef810dafb don't use sigar->ifconf_buf in sigar_get_adapters_addresses 2011-04-12 15:03:06 -07:00
Doug MacEachern
240649b925 fixes to compile on MSVC again 2011-04-11 15:04:14 -07:00
Adam Stokes
7041d070f1 - Update list network interfaces win32 variant
Some utilities such as netsh require a friendly name when doing
  any administrative tasks such as stop/start network interfaces.
  Currently sigar list network interfaces as 'ethX, lo, laX'. This
  is fine for read only purposes but in order to make further use
  of the network interfaces on windows we need a friendlyname or at
  least the interface description.
2011-04-11 11:26:33 -07:00
Adam Stokes
8337f13d6c Patch to allow mingw32 compilation 2011-04-11 11:26:32 -07:00
Doug MacEachern
9b8ec6ec5a Merge branch 'sigar-1.6' 2011-04-08 13:03:40 -07:00
Doug MacEachern
639169e9cc [SIGAR-228] increase buflen for gethostbyname_r 2011-04-08 13:03:32 -07:00
Dan Sully
adfb6d4d0a Add proc_list to Python bindings. 2011-04-08 10:51:32 -07:00
Dan Sully
e0c289a34c Add loadavg to Python bindings. 2011-04-08 10:51:20 -07:00
Doug MacEachern
436ceb351a Merge branch 'sigar-1.6' 2011-04-08 10:49:37 -07:00
Trevor Pounds
8a4c9f6eb0 (SIGAR-227) fix to prevent missing file(s) from aborting add operation prematurely 2011-04-08 10:49:27 -07:00
Trevor Pounds
87f0aa7f6f (SIGAR-226) fix missing *.cpp files from source archive 2011-04-08 10:48:38 -07:00
Doug MacEachern
692f5a43ea fix invalid who.user assertion on win32 2011-04-08 10:48:14 -07:00
Doug MacEachern
f2aef38d02 escape colon in process ObjectName 2011-04-08 10:25:05 -07:00
Doug MacEachern
833ca18ecf Merge branch 'sigar-1.6' 2010-09-07 12:41:17 -07:00
Doug MacEachern
b8c6325123 [SIGAR-224] report 'nfs4' file system mounts as type network 2010-09-07 12:41:05 -07:00
Doug MacEachern
78f5683bfc remove dynamic runtime flag on ruby win32 2010-05-28 08:59:09 -07:00
Doug MacEachern
619e639eca fix rescue in file_system_test.rb 2010-05-28 08:58:54 -07:00
Doug MacEachern
d20d75908d link in sigar.res on win32 2010-05-28 08:23:32 -07:00
Doug MacEachern
642df76807 add resource_file helper to generate sigar.rc 2010-05-28 08:23:08 -07:00
Doug MacEachern
3598952e93 skip rake cleans unless ruby/Makefile exists 2010-05-20 16:01:46 -07:00
Doug MacEachern
98470f551f adjust ruby load path 2010-05-20 16:01:45 -07:00
Doug MacEachern
282c008aea Merge branch 'sigar-1.6' 2010-05-20 11:48:15 -07:00
Doug MacEachern
d1a4f8e55e (SIGAR-217) fix EventLog change detection for the Security log case 2010-05-20 11:48:08 -07:00
Doug MacEachern
bee9eb97a2 Merge branch 'sigar-1.6' 2010-05-19 11:36:40 -07:00
Doug MacEachern
ef5317a2da (SIGAR-217) win32.EventLogThread needs to re-open EventLog if it has been cleared 2010-05-19 11:36:31 -07:00
Doug MacEachern
6a8f3d3d79 Merge branch 'sigar-1.6' 2010-05-13 10:14:31 -07:00
Ian Springer
e43244a6e9 (SIGAR-216) avoid ArrayIndexOutOfBoundsException in Sigar.getCpuPercList() when number of CPUs has decreased 2010-05-13 10:13:45 -07:00
Doug MacEachern
7a23bd943d Merge branch 'sigar-1.6' 2010-05-13 09:20:37 -07:00
Doug MacEachern
4e0b8c02d0 bump version to 1.6.5 2010-05-13 09:20:24 -07:00
Doug MacEachern
c439f0e2b3 Merge branch 'sigar-1.6' 2010-04-28 16:19:34 -07:00
Doug MacEachern
4b67f577f4 add AUTHORS file 2010-04-28 16:19:25 -07:00
Doug MacEachern
8efd79546e Merge branch 'sigar-1.6' 2010-04-28 15:37:36 -07:00
Doug MacEachern
61837690b9 1.6.4 change summary 2010-04-28 15:37:31 -07:00
Doug MacEachern
f2b8f76711 Merge branch 'sigar-1.6' 2010-04-28 15:35:19 -07:00
Doug MacEachern
2378412774 GPL v2 license -> Apache 2 license
(grit-generated)
2010-04-28 15:29:15 -07:00
Doug MacEachern
57402b29dc Merge branch 'sigar-1.6' 2010-04-28 15:24:27 -07:00
Doug MacEachern
3774ce96fa adjust to file renames 2010-04-28 15:24:17 -07:00
Doug MacEachern
1a9dfe999e GPL v2 license -> Apache 2 license 2010-04-28 15:20:57 -07:00
Doug MacEachern
99c4228cad LICENSES -> NOTICE 2010-04-28 15:19:57 -07:00
Doug MacEachern
c9d4bf9758 no longer applies 2010-04-28 15:19:31 -07:00
Doug MacEachern
8016dbe364 GPL v2 license -> Apache 2 license
(grit-generated)
2010-04-28 15:08:39 -07:00
Doug MacEachern
4fe3feb198 Merge branch 'sigar-1.6'
Conflicts:
	bindings/java/src/org/hyperic/sigar/jmx/SigarCpu.java
	bindings/java/src/org/hyperic/sigar/jmx/SigarCpuInfo.java
	bindings/java/src/org/hyperic/sigar/jmx/SigarCpuPerc.java
	bindings/java/src/org/hyperic/sigar/jmx/SigarLoadAverage.java
	bindings/java/src/org/hyperic/sigar/jmx/SigarMem.java
	bindings/java/src/org/hyperic/sigar/jmx/SigarSwap.java
	bindings/ruby/examples/cpu_info.rb
	bindings/ruby/examples/df.rb
	bindings/ruby/examples/free.rb
	bindings/ruby/examples/ifconfig.rb
	bindings/ruby/examples/netstat.rb
	bindings/ruby/examples/pargs.rb
	bindings/ruby/examples/penv.rb
	bindings/ruby/examples/who.rb
2010-04-28 15:03:12 -07:00
Doug MacEachern
73f9b8cf84 GPL v2 license -> Apache 2 license
(grit-generated)
2010-04-28 14:57:11 -07:00
Doug MacEachern
37c22746b2 Merge branch 'sigar-1.6' 2010-04-28 11:10:57 -07:00
Doug MacEachern
1c9b45eab1 (SIGAR-188) implement mem actual free/used on Windows
This rev uses "System Cache Resident Bytes" aka file cache instead of PERFORMANCE_INFORMATION.SystemCache
2010-04-28 11:09:32 -07:00
Doug MacEachern
bb122cc1e4 fix Actual{Free,Used} assertions 2010-04-28 11:05:06 -07:00
Doug MacEachern
54ef26bab6 Revert "(SIGAR-188) implement mem actual free/used on Windows"
This reverts commit e4fda73a29.
2010-04-28 10:57:08 -07:00
Doug MacEachern
1f7f641473 Merge branch 'sigar-1.6' 2010-04-27 16:09:48 -07:00
Doug MacEachern
b40013def1 (SIGAR-215) use swapctl SC_LIST for Solaris swap_get impl 2010-04-27 16:09:26 -07:00
Doug MacEachern
6a806d1724 Merge branch 'sigar-1.6' 2010-04-21 15:44:48 -07:00
Doug MacEachern
30e8d0e2c1 fix ProcCpu.getPercent assertion per SIGAR-145 2010-04-21 15:20:05 -07:00
Doug MacEachern
b3078dca91 bring back closeSigar() call in shutdown (commented out in cd42290) 2010-04-21 15:02:01 -07:00
Doug MacEachern
a5dacd4d03 clear ProcessQueryFactory and Humidor instances on shutdown 2010-04-21 13:56:25 -07:00
Doug MacEachern
8cd05ddc64 mv ProcessQueryFactory.clear calls to tearDown() 2010-04-21 13:55:01 -07:00
Doug MacEachern
647f3d32c3 apply value_free to PTQL_VALUE_TYPE_ANY 2010-04-21 13:54:03 -07:00
Doug MacEachern
4b9e309c8b close_mib2 in sigar_os_close 2010-04-21 13:51:12 -07:00
Doug MacEachern
0bee437f85 don't set procargs.size = 0 else destroy won't free 2010-04-21 13:50:30 -07:00
Doug MacEachern
6259451277 leave proc_args_destroy to the caller 2010-04-21 13:49:24 -07:00
Doug MacEachern
bbc21090a1 proc_args_destroy if os_proc_args_get != SIGAR_OK 2010-04-21 13:48:10 -07:00
Doug MacEachern
c9ef9f4bb6 add close() method 2010-04-21 13:47:06 -07:00
Doug MacEachern
a8963528fc Merge branch 'sigar-1.6' 2010-04-16 11:01:17 -07:00
Doug MacEachern
aa2cbaa89b System.getenv throws Error in 1.4 jre 2010-04-16 11:01:02 -07:00
Doug MacEachern
21a7b096d5 rm hpux/dlpi.c 2010-04-15 14:20:01 -07:00
Doug MacEachern
4a0dc0cef3 Merge branch 'sigar-1.6' into cleanup
Conflicts:
	bindings/SigarWrapper.pm
	src/os/netware/Makefile.nw
	src/os/netware/netware_sigar.c
	src/os/osf1/osf1_sigar.c
	src/os/stub/stub_sigar.c
2010-04-15 14:14:38 -07:00
Doug MacEachern
277b80791c mv stub to sigar-stuff 2010-04-15 13:49:44 -07:00
Doug MacEachern
56e03d7243 osf1 no longer supported 2010-04-15 13:48:22 -07:00
Doug MacEachern
5d79c359d4 netware no longer supported 2010-04-15 13:46:19 -07:00
Doug MacEachern
f272cb2b5d netware no longer supported 2010-04-15 13:40:54 -07:00
Doug MacEachern
788c125c68 no longer using hpux dlpi 2010-04-15 13:30:20 -07:00
Doug MacEachern
5324c6f235 mv to sigar-stuff 2010-04-15 13:21:47 -07:00
Doug MacEachern
745508e3c0 update eclipse project classpath 2010-04-15 11:18:25 -07:00
Doug MacEachern
1d20d41304 remove hmekstat.h 2010-04-15 11:08:16 -07:00
Doug MacEachern
57176b2a24 Merge branch 'sigar-1.6' 2010-04-15 11:02:32 -07:00
Doug MacEachern
5f77c77158 remove unused header 2010-04-15 11:02:19 -07:00
Doug MacEachern
539056d24a Merge branch 'sigar-1.6' 2010-04-15 10:55:35 -07:00
Doug MacEachern
c46af75d74 (SIGAR-201) JNIEnv->ExceptionCheck to avoid possible SEGV on OutOfMemoryError 2010-04-15 10:55:09 -07:00
Doug MacEachern
247b90618b Merge branch 'sigar-1.6' 2010-04-14 13:56:17 -07:00
Doug MacEachern
6c1f0a9871 (SIGAR-192) avoid possible stack corruption in Windows proc_env impl 2010-04-14 13:55:57 -07:00
Doug MacEachern
a540dc045b Merge branch 'sigar-1.6' 2010-04-14 13:46:36 -07:00
Doug MacEachern
55002f1930 (SIGAR-213) check ENV.ANT_HOME/lib for junit in Main-Class 2010-04-14 13:46:28 -07:00
Doug MacEachern
7c94ba7164 Merge branch 'sigar-1.6' 2010-04-09 09:01:27 -07:00
Doug MacEachern
4227bf6ab9 (SIGAR-214) properly adjust jni.javahome when JAVA_HOME is not set 2010-04-09 09:01:13 -07:00
Doug MacEachern
d4a917c985 Merge branch 'sigar-1.6' 2010-04-08 13:53:22 -07:00
Doug MacEachern
9ce6361973 cpptasks patches moved to http://github.com/dougm/ant-contrib-cpptasks 2010-04-08 13:50:42 -07:00
Doug MacEachern
d467da754f Merge branch 'sigar-1.6' 2010-04-08 13:47:27 -07:00
Doug MacEachern
9fb759fb17 mv tools/PerfBrowser http://github.com/dougm/csharp-perfbrowser 2010-04-08 13:45:57 -07:00
Doug MacEachern
9dbbcce60a mv exp/ http://github.com/dougm/sigar-stuff 2010-04-08 13:45:42 -07:00
Doug MacEachern
cbfdc48167 Merge branch 'sigar-1.6' 2010-04-08 09:41:53 -07:00
Doug MacEachern
b94783b9ad s,env.ANT_HOME/lib,ant.library.dir 2010-04-08 09:41:45 -07:00
Doug MacEachern
c431fc185c Merge branch 'sigar-1.6'
Conflicts:
	bindings/java/src/org/hyperic/sigar/cmd/Shell.java
2010-04-07 21:27:57 -07:00
Doug MacEachern
cd422901c9 (SIGAR-213) remove junit.jar from distribution 2010-04-07 21:23:56 -07:00
Doug MacEachern
03210ee96f Merge branch 'sigar-1.6' 2010-04-07 13:24:26 -07:00
Doug MacEachern
7f4a3a3fd4 (SIGAR-188) implement mem actual free/used on HPUX 2010-04-07 13:23:58 -07:00
Doug MacEachern
924f694d7b Merge branch 'sigar-1.6' 2010-04-07 11:12:34 -07:00
Doug MacEachern
127099cd34 (SIGAR-188) implement mem actual free/used on AIX 2010-04-07 11:12:00 -07:00
Doug MacEachern
f14fc92e81 Merge branch 'sigar-1.6' 2010-04-05 16:30:37 -07:00
Doug MacEachern
d3acf798d5 (SIGAR-188) implement mem actual free/used on OpenBSD and NetBSD 2010-04-05 16:30:15 -07:00
Doug MacEachern
501adebd39 Merge branch 'sigar-1.6' 2010-04-05 15:52:06 -07:00
Doug MacEachern
1ba3abd3ab (SIGAR-188) implement mem actual free/used on Solaris 2010-04-05 15:51:47 -07:00
Doug MacEachern
cf22b7f0a1 Merge branch 'sigar-1.6' 2010-04-04 10:26:06 -07:00
Doug MacEachern
6a0cd93cf5 fix rev-parse when not on a local branch 2010-04-04 10:25:58 -07:00
Doug MacEachern
ccbd22fad6 Merge branch 'sigar-1.6' 2010-04-03 12:42:53 -07:00
Doug MacEachern
21a09f23d4 roll our own 'git rev-parse --short HEAD' 2010-04-03 12:41:06 -07:00
Doug MacEachern
f1ddda17c2 Merge branch 'sigar-1.6' 2010-04-02 15:51:06 -07:00
Doug MacEachern
b1da05dbe0 (SIGAR-212) pass LANG_ENGLISH to FormatMessage in Windows sigar_strerror impl 2010-04-02 15:50:55 -07:00
Doug MacEachern
aa46186a2d Merge branch 'sigar-1.6' 2010-04-01 17:37:28 -07:00
Doug MacEachern
e4fda73a29 (SIGAR-188) implement mem actual free/used on Windows 2010-04-01 17:36:46 -07:00
Doug MacEachern
600d4d5523 Merge branch 'sigar-1.6' 2010-04-01 16:44:31 -07:00
Trevor Pounds
f27542af5b (SIGAR-202)
Change CreateFile() access flags to prevent potential inode calculation
   errors on Windows when tailing a file.

   see: http://forums.hyperic.com/jiveforums/thread.jspa?messageID=30400
2010-04-01 16:37:11 -07:00
Doug MacEachern
48e01e86e3 Merge branch 'sigar-1.6' 2010-04-01 14:55:02 -07:00
Doug MacEachern
29c96e2343 (SIGAR-207) append instance index in Pdh.getInstances() 2010-04-01 14:53:25 -07:00
Doug MacEachern
bdfd156a63 Merge branch 'sigar-1.6' 2010-04-01 14:49:15 -07:00
Doug MacEachern
3c5fbbe022 (SIGAR-198) fix 64-bit AIX net_route_list impl 2010-04-01 11:23:23 -07:00
Doug MacEachern
2dc981dfa8 (SIGAR-207) Add Pdh.getCounterType method 2010-03-31 14:54:25 -07:00
Doug MacEachern
7905904cb6 (SIGAR-207) Add Pdh.getDescription method 2010-03-31 13:17:02 -07:00
Doug MacEachern
6c8e6e6d69 Merge branch 'sigar-1.6' 2010-03-31 10:53:55 -07:00
Doug MacEachern
b2d33467b8 (SIGAR-210) recognize cifs as a network file system 2010-03-31 10:53:48 -07:00
Doug MacEachern
8a2a8e2f6b Merge branch 'sigar-1.6' 2010-03-30 10:12:56 -08:00
Doug MacEachern
fd9acb0004 (SIGAR-211) HPUX file_system_list needs to read /etc/mnttab instead of /etc/fstab 2010-03-30 10:08:17 -08:00
Doug MacEachern
e008252b86 Merge branch 'sigar-1.6' 2010-02-09 18:01:44 -08:00
Doug MacEachern
e20e2eaa54 add -i (inode format) support to df command 2010-02-09 18:01:34 -08:00
Doug MacEachern
6193cb516f Merge branch 'sigar-1.6' 2010-02-05 14:41:45 -08:00
Doug MacEachern
a210aa7e23 (SIGAR-205) Vista and higher changed wireless card type to IF_TYPE_IEEE80211 2010-02-05 14:41:35 -08:00
Doug MacEachern
5e6ec3987e (SIGAR-199) add arp_list Erlang binding 2010-02-01 20:45:49 -08:00
Doug MacEachern
8eb87135e4 (SIGAR-199) arp_list win32 impl 2010-01-27 12:17:26 -08:00
Doug MacEachern
5da26ff5e4 (SIGAR-199) arp_list win32 impl 2010-01-25 18:01:29 -08:00
Doug MacEachern
02959a80a5 (SIGAR-199) arp_list aix impl 2010-01-20 17:34:55 -08:00
Doug MacEachern
0cf7c22d11 remove make_spec task dup 2010-01-19 15:18:41 -08:00
Matthew Kent
cc52694c7d (SIGAR-200) Fix undefined symbol in installed ruby binding.
Drop gemspec in favour of generating it on demand from the Rakefile with rake make_spec.
2010-01-19 00:06:53 -08:00
Doug MacEachern
105031e7c1 (SIGAR-199) arp_list hpux impl 2010-01-18 22:48:43 -08:00
Doug MacEachern
353a3e7b07 IFT_BRIDGE undef on darwin 2010-01-18 22:26:42 -08:00
Doug MacEachern
0b23dc0082 IFT_BRIDGE undef on darwin 2010-01-18 22:20:13 -08:00
Doug MacEachern
b71d5d67a9 (SIGAR-199) arp_list *bsd/darwin impl 2010-01-18 22:14:45 -08:00
Doug MacEachern
8e77198e0f (SIGAR-199) arp_list solaris impl 2010-01-18 19:09:12 -08:00
Doug MacEachern
3098fca444 (SIGAR-199) add arp_list Python binding 2010-01-18 19:09:12 -08:00
Doug MacEachern
3693661516 (SIGAR-199) add arp_list Perl binding 2010-01-18 19:09:12 -08:00
Doug MacEachern
9777e53988 (SIGAR-199) arp Ruby example 2010-01-18 19:09:12 -08:00
Doug MacEachern
6847888168 (SIGAR-199) add arp_list Ruby binding 2010-01-18 19:09:12 -08:00
Doug MacEachern
eec4ba7e97 (SIGAR-199) add arp shell command 2010-01-18 19:09:11 -08:00
Doug MacEachern
34c0007c9a (SIGAR-199) add arp_list test 2010-01-18 19:09:11 -08:00
Doug MacEachern
9847f6a454 (SIGAR-199) arp_list linux impl 2010-01-18 19:09:11 -08:00
Doug MacEachern
9207af5536 (SIGAR-199) add Java ArpList binding 2010-01-18 19:09:11 -08:00
Doug MacEachern
e804a1b405 (SIGAR-199) add Arp binding 2010-01-18 19:09:10 -08:00
Doug MacEachern
ecd0ad6ab8 (SIGAR-199) stub sigar_arp_list_get impls 2010-01-18 19:09:10 -08:00
Doug MacEachern
6bea72a540 (SIGAR-199) add arp_list_{create,grow,destroy} functions 2010-01-18 19:09:10 -08:00
Doug MacEachern
b5cf0dbef4 (SIGAR-199) add arp decls 2010-01-18 19:09:10 -08:00
Doug MacEachern
9c37813c57 Merge branch 'sigar-1.6' 2010-01-18 19:08:57 -08:00
Doug MacEachern
feabd736de rid dup in solaris route_list impl 2010-01-18 19:08:49 -08:00
Doug MacEachern
39fef6c396 (SIGAR-198) implement net_route_list on AIX 2010-01-17 23:02:16 -08:00
Doug MacEachern
a45a09478f Merge branch 'sigar-1.6' 2010-01-17 22:25:34 -08:00
Doug MacEachern
eac18a6b4e (SIGAR-181) fill-in sigar_net_route_t.ifname on HPUX 2010-01-17 22:24:50 -08:00
Doug MacEachern
d47fd1e3e7 refactor wrapper around get_physical_stat() for reuse 2010-01-17 21:53:28 -08:00
Doug MacEachern
b24274941e fix test target 2010-01-17 19:00:26 -08:00
Doug MacEachern
ef0dba2c4c update gemspec 2010-01-17 19:00:26 -08:00
Doug MacEachern
4e995b89f8 changing version to '0.7.x' until the sigar-1.7.0 release 2010-01-17 19:00:26 -08:00
Doug MacEachern
fd8274153c s/rbsigar/sigar/g 2010-01-17 19:00:26 -08:00
Doug MacEachern
57513b2d0a use helper 2010-01-17 19:00:26 -08:00
Doug MacEachern
1c049cfd33 start ruby port of java unit tests 2010-01-17 19:00:26 -08:00
Doug MacEachern
1e2f84f631 add FTYPE_* constants 2010-01-17 19:00:26 -08:00
Doug MacEachern
b2dd835f79 add loadavg binding 2010-01-17 19:00:26 -08:00
Doug MacEachern
f721376fc4 add cpu_list binding 2010-01-17 19:00:26 -08:00
Doug MacEachern
9ca7896ad1 Merge branch 'sigar-1.6' 2010-01-12 10:54:04 -08:00
Doug MacEachern
392f6325e0 (SIGAR-196) use pst_processor.psp_cpu_frequency to calculate cpu_info.mhz on HP-UX 11.31+ 2010-01-12 10:53:25 -08:00
Doug MacEachern
99ac66307a Merge branch 'sigar-1.6' 2010-01-04 13:50:31 -08:00
Doug MacEachern
3e98f20197 (SIGAR-194) sigar_file_system_t.dev_name on Windows should be the network path for remote drives 2010-01-04 13:48:20 -08:00
Doug MacEachern
3aec8d3886 Merge branch 'sigar-1.6' 2009-12-23 16:18:00 -08:00
Doug MacEachern
46897838f6 (SIGAR-193) Migrate from mach/shared_memory_server.h to mach/shared_region.h on Darwin 2009-12-23 16:16:21 -08:00
Doug MacEachern
1cb651d0e3 add ruby proc_port binding 2009-12-14 16:19:09 -08:00
Doug MacEachern
581143f74c add -D_CRT_SECURE_NO_DEPRECATE if win32 2009-11-18 13:26:52 -08:00
Doug MacEachern
2893440374 commands.getoutput does not work on win32, switch to popen 2009-11-18 13:26:33 -08:00
Doug MacEachern
818de4a64c Merge branch 'sigar-1.6' 2009-11-09 16:47:54 -08:00
Doug MacEachern
035a097325 only display event code in toString as the Event Viewer does 2009-11-09 16:45:06 -08:00
Doug MacEachern
e86a150a8d 'N/A' for null user in EventLogRecord.toString 2009-11-09 16:34:31 -08:00
Doug MacEachern
32512cde90 include the same fields as Event Viewer in EventLogRecord.toString 2009-11-09 16:30:47 -08:00
Doug MacEachern
7cc2308fc8 Merge branch 'sigar-1.6' 2009-11-09 16:27:46 -08:00
Doug MacEachern
9cc30ca006 (SIGAR-191) fix EventLogRecord.computerName 2009-11-09 16:27:22 -08:00
Doug MacEachern
f6be3e759e Merge branch 'sigar-1.6' 2009-11-09 16:18:25 -08:00
Doug MacEachern
3e4a408f74 (SIGAR-190) add category to EventLogRecord 2009-11-09 16:17:37 -08:00
Doug MacEachern
c7dc222b4a Merge branch 'sigar-1.6' 2009-11-05 14:03:16 -08:00
Doug MacEachern
b1352e2f76 (SIGAR-189) ignore CP_WAIT time on HPUX 2009-11-05 14:02:54 -08:00
Doug MacEachern
c2954ec027 Merge branch 'master' of github.com:hyperic/sigar 2009-11-03 16:23:38 -08:00
Doug MacEachern
ce7be03af5 (SIGAR-187) implement proc_exe on AIX 2009-11-03 16:21:11 -08:00
Doug MacEachern
1cc9a3e44d Merge branch 'sigar-1.6' 2009-11-03 16:19:16 -08:00
Doug MacEachern
850b00f1a9 (SIGAR-187) implement proc_exe on AIX 2009-11-03 16:17:28 -08:00
Doug MacEachern
7aa28d0ddc Merge branch 'sigar-1.6' 2009-11-03 14:19:28 -08:00
Doug MacEachern
a4915e8ed6 (SIGAR-188) implement mem actual free/used on MacOSX 2009-11-03 14:18:54 -08:00
Doug MacEachern
cd214a2562 Merge branch 'sigar-1.6' 2009-11-02 16:46:02 -08:00
Doug MacEachern
089ba0d93c (SIGAR-188) implement mem actual free/used on FreeBSD 2009-11-02 16:45:11 -08:00
Doug MacEachern
dec7508ed1 Merge branch 'sigar-1.6' 2009-10-23 14:59:07 -07:00
Doug MacEachern
a96bd1bc04 Pdh test adjustments for windows 2000 2009-10-23 14:52:51 -07:00
Doug MacEachern
32040563ce (SIGAR-185) fix RegistryKey open on windows 2000 2009-10-23 14:50:29 -07:00
Doug MacEachern
6eef4f7cdc (SIGAR-186) fix Win32.getFileVersion on windows 2000 2009-10-23 14:49:44 -07:00
Doug MacEachern
b43ead331d Merge branch 'sigar-1.6' 2009-09-30 15:56:44 -07:00
Doug MacEachern
6b9ac77afa Merge branch 'SIGAR-184' into sigar-1.6 2009-09-30 15:56:17 -07:00
Doug MacEachern
0d3d5e45da hpux pa 64-bit support 2009-09-30 15:46:36 -07:00
Doug MacEachern
e05568c00e more clean 2009-09-17 11:57:21 -07:00
Doug MacEachern
0a9ed4aa00 Merge branch 'sigar-1.6' 2009-09-17 11:48:43 -07:00
Doug MacEachern
55167b6ebe 64-bit MacOSX 10.6 sdk does not support ppc64, switch from universal build to i386 only 2009-09-17 11:48:31 -07:00
Doug MacEachern
623cbee5b5 Merge branch 'sigar-1.6' 2009-09-15 15:22:59 -07:00
Doug MacEachern
f16b3e3daa (SIGAR-181) net_route.ifname impl for Win32 2009-09-15 14:54:37 -07:00
Doug MacEachern
d3e019dd98 (SIGAR-181) net_route.ifname impl for MacOSX and *BSD 2009-09-15 14:54:37 -07:00
Doug MacEachern
52101bd408 Merge branch 'sigar-1.6' 2009-09-15 14:54:00 -07:00
Doug MacEachern
7a30f1e4a2 (SIGAR-182) use mib2_ip_t.ipRouteEntrySize to determine mib2_ipRouteEntry_t size 2009-09-15 14:53:30 -07:00
Doug MacEachern
e9fcf4b336 Merge branch 'sigar-1.6' 2009-09-10 21:44:26 -07:00
Doug MacEachern
f5766d5593 rm obsolete build-cpu.bat 2009-09-10 21:44:10 -07:00
Doug MacEachern
ac44312b5e remove msvc_iptypes.h 2009-09-10 21:42:55 -07:00
Doug MacEachern
d55a1fb20e Merge branch 'sigar-1.6' 2009-09-08 21:50:35 -07:00
Doug MacEachern
cb1f3dafe7 fix MacOSX10.6.sdk build issues 2009-09-08 21:50:10 -07:00
Doug MacEachern
84b073e889 Merge branch 'sigar-1.6' 2009-09-04 11:14:49 -07:00
Doug MacEachern
315c8474d9 fix Mac SDK selection 2009-09-02 17:48:38 -07:00
Doug MacEachern
6500952e5b use ArchNameTask to configure darwin sdk 2009-09-02 17:48:19 -07:00
Doug MacEachern
b877645615 update autoclean 2009-09-02 16:35:06 -07:00
Doug MacEachern
1676d54123 Merge branch 'sigar-1.6' 2009-09-01 15:39:42 -07:00
Doug MacEachern
fdc0cf5c1f add mapping from wmi HRESULT to NTRESULT 2009-09-01 15:39:33 -07:00
Doug MacEachern
c6b35167c8 fix proc_exe fallback to wmi 2009-09-01 14:31:22 -07:00
Doug MacEachern
c88b49abe2 (SIGAR-168) always fallback to wmi when peb fails for proc_args 2009-09-01 14:09:46 -07:00
Doug MacEachern
0b335d9025 6.1 == Windows 7 2009-08-30 12:40:54 -07:00
Doug MacEachern
a08120c323 10.6 == Snow Leopard 2009-08-30 12:39:39 -07:00
Doug MacEachern
aa4d8f40a5 Merge commit 'mdkent/SIGAR-180' 2009-08-24 22:19:26 -07:00
Matthew Kent
abda75748b Add an example of net_info usage. 2009-08-23 23:26:55 -07:00
Matthew Kent
49bc336919 (SIGAR-180) Expose sigar_fqdn_get in the ruby binding. 2009-08-23 23:24:50 -07:00
Doug MacEachern
499c7c8b0b Merge commit 'emonty/master' 2009-08-23 16:13:14 -07:00
Doug MacEachern
7dca6c58cc update .gitignore 2009-08-23 16:12:54 -07:00
Doug MacEachern
bf1543877a Merge branch 'SIGAR-179' 2009-08-23 15:59:14 -07:00
Doug MacEachern
e3b378ecd1 (SIGAR-179) Increase buffer size in cpu_list query from 16 to 128 2009-08-23 15:58:52 -07:00
Monty Taylor
4608cde968 Don't try to build lua if we don't ask for it. 2009-08-22 10:23:15 -07:00
Doug MacEachern
713e91d59a Merge commit 'weigon/lua' 2009-08-18 21:22:40 -07:00
Doug MacEachern
43b5297178 Merge commit 'weigon/autotools-and-unittest' 2009-08-18 21:19:52 -07:00
Doug MacEachern
a3260dc2fc fix Mac SDK selection 2009-08-18 13:20:17 -07:00
Doug MacEachern
75c2671110 ARPHRD_CISCO not in 2.2 kernel headers 2009-08-15 22:22:54 -07:00
Doug MacEachern
ff5aa70493 output NetInfo.getDefaultGatewayInterface 2009-08-15 06:11:02 -07:00
Matthew Kent
7496b795e4 Merge branch 'master' into SIGAR-172 2009-08-13 23:41:53 -07:00
Matthew Kent
4fdcee3635 Tweaking based on feedback: default_interface gets a more appropriate name and
sigar_get_default_gateway now gathers both pieces of information.
2009-08-13 23:38:45 -07:00
Doug MacEachern
085218e3fb add win32 comsupp and wbemuuid libs 2009-08-13 16:35:08 -07:00
Doug MacEachern
245e563857 .cpp -> .o 2009-08-13 16:34:11 -07:00
Doug MacEachern
ee15426546 need to use sysctlbyname with hw.cpufrequency_{min,max} 2009-08-13 15:45:03 -07:00
Doug MacEachern
326d6085a2 Merge commit 'mdkent/SIGAR-178' 2009-08-13 15:34:37 -07:00
Doug MacEachern
bd93c22d14 Merge commit 'mdkent/SIGAR-174' 2009-08-13 14:51:51 -07:00
Doug MacEachern
f69a3c10e5 Merge commit 'mdkent/SIGAR-173' 2009-08-13 14:34:41 -07:00
Jan Kneschke
8470738ff3 applied the configure-lua patch to the lua branch 2009-08-13 20:07:02 +02:00
Jan Kneschke
5d222575ef added lua bindings
added lua bindings for the majority of sigar functions
  look at sigar-test.lua on how to use it
2009-08-13 20:04:50 +02:00
Jan Kneschke
b3bfe99aea removed the lua-binding part 2009-08-13 20:00:53 +02:00
Matthew Kent
dcddb5f642 Untested stab at cpu mhz min/max support for Darwin. 2009-08-12 23:43:41 -07:00
Matthew Kent
09f3418c1a Add linux collection of cpu min/max.
Make cpu mhz default the current mhz.
2009-08-12 23:43:35 -07:00
Jan Kneschke
99d73258a9 added a few more missing files 2009-08-12 21:25:58 +02:00
Doug MacEachern
5c8d1edbae add IFF_DYNAMIC to NetFlags 2009-08-12 10:13:13 -07:00
Doug MacEachern
22c1b065dd add IFF_MASTER to NetFlags 2009-08-12 10:11:36 -07:00
Doug MacEachern
a77d7ef04f IFF_DYNAMIC not defined in linux 2.2 kernel 2009-08-12 10:07:08 -07:00
Doug MacEachern
6f75fc0668 Merge commit 'mdkent/SIGAR-171' 2009-08-12 09:57:00 -07:00
Doug MacEachern
1642acc6b0 Merge branch 'sigar-1.6' 2009-08-12 09:42:39 -07:00
Doug MacEachern
e3068f466a s/ift_name/ifr_name/g 2009-08-12 09:42:28 -07:00
Jan Kneschke
079dd9b09f (SIGAR-137) sdl_data isn't 0-terminated
fixed 2 more places where sdl_data is used as it would be 0-term'ed
  and doesn't honour sdl_nlen
2009-08-11 17:29:38 -07:00
Matthew Kent
ea3fcd5b45 Add more interface types from net-tools. 2009-08-10 00:29:23 -07:00
Matthew Kent
83996dda13 Add per interface support for tx_queue_len, Linux only.
Update the ifconfig example output.
2009-08-09 15:20:25 -07:00
Jan Kneschke
d65177559d fixed the autotools setup
* fixed compile on all Unixes
  * added unit-tests
  * added cmake to build natively on win32
  * fixed the "make dist" setup to include all os-dirs
2009-08-09 15:35:24 +02:00
Jan Kneschke
f88489dc73 added unit-tests
unit-tests for the majority of sigar functions including
  valgrind-leak-check
2009-08-09 15:34:27 +02:00
Matthew Kent
d9f37b39a4 Collect the default interface as part of net_info_get. 2009-08-09 02:13:45 -07:00
Matthew Kent
cfae297d9b Add IFF_DYNAMIC support for Linux.
Support in the ruby binding.
2009-08-08 14:44:58 -07:00
Doug MacEachern
c007175b21 update .gitignore 2009-08-05 17:24:28 -07:00
Doug MacEachern
c6e8679079 include src/os/*.cpp 2009-08-05 17:22:08 -07:00
Doug MacEachern
7ccd02ef91 Merge branch 'sigar-1.6' 2009-08-05 17:12:48 -07:00
Doug MacEachern
9149e907ef Merge branch 'SIGAR-168' into sigar-1.6 2009-08-05 17:12:26 -07:00
Doug MacEachern
b05f332705 fix compile against visual studio 6 2009-08-05 16:56:37 -07:00
Doug MacEachern
c310dffb84 try wmi if peb fails for proc_exe 2009-08-05 15:09:00 -07:00
Doug MacEachern
57b8fff72f add wmi proc_exe wrapper decl 2009-08-05 15:08:51 -07:00
Doug MacEachern
8c1608bb76 add wmi proc_exe wrapper 2009-08-05 15:08:43 -07:00
Doug MacEachern
2550c6373a try wmi if peb fails for proc_args 2009-08-05 14:30:16 -07:00
Doug MacEachern
7d236ebc39 add wmi proc_args wrapper decl 2009-08-05 14:29:44 -07:00
Doug MacEachern
e5c1e8ac07 return ERROR_DATATYPE_MISMATCH if query does not get PebBaseAddress 2009-08-05 14:29:16 -07:00
Doug MacEachern
8dd2a25568 add wmi proc_args wrapper 2009-08-05 14:27:08 -07:00
Doug MacEachern
5fb1bcdb15 include src/os/*.cpp 2009-08-05 13:47:13 -07:00
Doug MacEachern
00a4ebf85e wmi com interface wrapper 2009-08-05 13:46:40 -07:00
Doug MacEachern
c78c5fe899 Merge commit 'mdkent/SIGAR-170' 2009-08-05 06:57:22 -07:00
Matthew Kent
4e206baa61 Make ruby ifconfig example output a bit closer to net-tools default - only
showing interfaces that are up and suppressing the output of unconfigured ip
addresses.
2009-08-04 23:00:07 -07:00
Matthew Kent
4d19f54b94 Finish support for IFF_SLAVE and add IFF_MASTER.
Support both in ruby binding.
2009-08-04 22:27:13 -07:00
Doug MacEachern
48f9f8cc65 fix solaris 8 compile 2009-08-03 15:26:18 -07:00
Doug MacEachern
0cc4f6e8bb fix ruby win32 compile 2009-08-03 10:12:03 -07:00
Doug MacEachern
dc8c9ce0f6 Merge branch 'sigar-1.6' 2009-07-31 14:51:30 -07:00
Doug MacEachern
4a926f42d5 only exclude nfs/rpcv2.h on FreeBSD 8+ 2009-07-31 14:51:14 -07:00
Doug MacEachern
2ee2b7a154 Merge branch 'sigar-1.6' 2009-07-30 17:48:18 -07:00
Doug MacEachern
a355ba22c9 Merge branch 'SIGAR-161' into sigar-1.6 2009-07-30 17:48:08 -07:00
Doug MacEachern
60182c3f82 net_route_list bandaid for FreeBSD 8.0 2009-07-30 17:46:27 -07:00
Doug MacEachern
1a00826ebb sigar_proc_port_get does not compile on FreeBSD 8.0 2009-07-30 17:18:32 -07:00
Doug MacEachern
07f9d49931 only need nfs/rpcv2.h on darwin 2009-07-30 17:13:17 -07:00
Doug MacEachern
2733b90ee8 fix ruby compile on solaris 2009-07-30 11:35:28 -07:00
unknown
ba22cc0531 net_interface ipv6 support requires msvc7 or higher 2009-07-30 10:32:42 -07:00
Doug MacEachern
e2c74bb616 hpux net_interface_ipv6_config impl 2009-07-30 08:27:06 -07:00
Doug MacEachern
e3e45a39fe hpux has inet_ntop 2009-07-30 08:26:34 -07:00
Doug MacEachern
e92da5240f aix net_interface_ipv6_config impl 2009-07-29 21:37:31 -07:00
Doug MacEachern
f55e619bcd output string version of scope6 2009-07-29 16:08:48 -07:00
Doug MacEachern
6d35ab65b3 output string version of scope6 2009-07-29 16:08:42 -07:00
Doug MacEachern
e2bb79ca1c add net_scope_to_string ruby wrapper 2009-07-29 16:08:16 -07:00
Doug MacEachern
ffd7609c12 add net_scope_to_string java wrapper 2009-07-29 16:07:52 -07:00
Doug MacEachern
75b83e6cf5 add sigar_net_scope_to_string 2009-07-29 16:07:09 -07:00
Doug MacEachern
64fd05c615 Merge commit 'mdkent/SIGAR-167' 2009-07-29 15:45:21 -07:00
Doug MacEachern
a7797c7675 Merge commit 'mdkent/SIGAR-166' 2009-07-29 15:35:27 -07:00
Doug MacEachern
911abd2058 Merge branch 'SIGAR-165' 2009-07-29 15:29:12 -07:00
Doug MacEachern
10051fa8ff win32 net_interface_ipv6_config impl 2009-07-29 15:23:09 -07:00
Doug MacEachern
f0b96796e1 win32 sigar_inet_ntop impl 2009-07-29 15:20:38 -07:00
Doug MacEachern
3f1b24b7fc solaris net_interface_ipv6_config impl 2009-07-29 15:14:38 -07:00
Doug MacEachern
e90567d94b use new ipv6 macros 2009-07-29 15:14:11 -07:00
Doug MacEachern
54d1ee7cff add some ipv6 related macros 2009-07-29 15:13:25 -07:00
Matthew Kent
807aa955c1 No stats for aliased devices. 2009-07-28 23:18:11 -07:00
Matthew Kent
1347d44c78 Add logging ability to ruby bindings via Logger or Proc.
Heavily inspired by the Java implementation.
2009-07-28 22:54:16 -07:00
Doug MacEachern
1c7020c553 add inet6 addr 2009-07-25 08:13:44 -07:00
Doug MacEachern
0da8e9d95f prefix|scope .= 6 2009-07-25 08:09:53 -07:00
Doug MacEachern
8411da271e darwin/*bsd net_interface_ipv6_config impl 2009-07-25 08:00:24 -07:00
Doug MacEachern
9d50d859bf add IPV6_ADDR constants 2009-07-25 07:39:42 -07:00
Doug MacEachern
6cb7d6b398 test NetInterfaceConfig.getAddress6 2009-07-24 17:56:20 -07:00
Doug MacEachern
7c5e4e3a3b linux net_interface_ipv6_config impl 2009-07-24 17:46:56 -07:00
Doug MacEachern
1b28f2a4e3 add ipv6 fields 2009-07-24 17:38:13 -07:00
Doug MacEachern
380297ea2e add ipv6 fields to NetInterfaceConfig 2009-07-24 17:18:30 -07:00
Doug MacEachern
0e763c13e2 stub net_interface_config ipv6 support 2009-07-24 17:13:19 -07:00
Doug MacEachern
1a9eaa800f Merge branch 'ruby-version-properties' 2009-07-18 22:37:56 -07:00
Doug MacEachern
ce06f86292 ruby version of Version.java 2009-07-18 21:56:44 -07:00
Doug MacEachern
5d572585b0 add sigar version constants 2009-07-18 21:56:44 -07:00
Doug MacEachern
d1622a808d generate sigar_version.c 2009-07-18 21:56:44 -07:00
Doug MacEachern
3e7254f3f7 filter args in version_file 2009-07-18 21:56:44 -07:00
Doug MacEachern
78150c0d9b whitespace fixes 2009-07-18 21:56:44 -07:00
Doug MacEachern
5320b7bf2a -MSigarBuild -e version_file 2009-07-18 21:56:44 -07:00
Doug MacEachern
dc2d72f66b move sub archname to SigarBuild.pm 2009-07-18 21:56:43 -07:00
Doug MacEachern
6f9a8423fb Perl impl of version_file 2009-07-18 21:56:43 -07:00
Doug MacEachern
7c3fb1d10d update version.properties location 2009-07-18 21:56:43 -07:00
Doug MacEachern
cff9291fc2 update version.properties location 2009-07-18 21:56:43 -07:00
Doug MacEachern
ad961111c7 mv version.properties to top-level 2009-07-18 21:56:43 -07:00
Doug MacEachern
49e769bbd8 Merge branch 'sigar-1.6' 2009-07-18 18:44:26 -07:00
Doug MacEachern
ab8759261e Merge branch 'SIGAR-164' into sigar-1.6 2009-07-18 18:44:10 -07:00
Doug MacEachern
ceab542f7b (SIGAR-164) return ENXIO instead of ENOENT in disk_usage win32 impl 2009-07-18 18:43:54 -07:00
Doug MacEachern
90c2b19127 (SIGAR-164) return ENXIO instead of ENOENT in disk_usage linux impl 2009-07-18 18:43:39 -07:00
Doug MacEachern
9e699babc5 (SIGAR-164) return ENXIO instead of ENOENT in disk_usage aix impl 2009-07-18 18:43:28 -07:00
Doug MacEachern
4bd3ef75a9 (SIGAR-164) return ENXIO instead of ESRCH in disk_usage darwin impl 2009-07-18 18:43:04 -07:00
Doug MacEachern
ba079dc3c5 Merge branch 'sigar-1.6' 2009-07-17 14:16:53 -07:00
Doug MacEachern
8cef393365 (SIGAR-163) Recognize cvfs (StorNext) as local filesystem type 2009-07-17 14:16:42 -07:00
Doug MacEachern
7535a0efc2 Merge branch 'sigar-1.6' 2009-07-16 07:10:13 -07:00
Doug MacEachern
a3851c6b9a (SIGAR-162) plug possible memory leak in sigar_iodev_get util 2009-07-16 07:10:04 -07:00
Doug MacEachern
1039b12396 remove pdh.dll (only used on NT 4.0) 2009-07-14 17:22:11 -07:00
Doug MacEachern
f2bc7f088d Merge branch 'sigar-1.6' 2009-07-13 17:57:54 -07:00
Doug MacEachern
5145e6b8c8 (SIGAR-155) Plug memory leak sigar_proc_exe_get Darwin impl 2009-07-13 17:57:28 -07:00
Doug MacEachern
ea2a8f31a1 Merge branch 'sigar-1.6' 2009-07-13 15:18:45 -07:00
Doug MacEachern
d4ac7f1ecf bump version to 1.6.4 2009-07-13 15:18:20 -07:00
Matthew Kent
c7a5d127eb Refresh gemspec.
Signed-off-by: Hyperic <doug.maceachern@hyperic.com>
2009-07-09 21:47:14 +08:00
Doug MacEachern
39352f9290 Merge branch 'sigar-1.6' 2009-07-08 18:02:49 -07:00
Doug MacEachern
e0a4d10522 Merge branch 'sigar-1.6' 2009-07-08 17:38:19 -07:00
Doug MacEachern
e9c0ec7c87 Merge branch 'sigar-1.6' 2009-07-08 16:27:17 -07:00
Doug MacEachern
ba6404560e Merge branch 'sigar-1.6' 2009-07-08 16:02:17 -07:00
Doug MacEachern
a9533e619d Merge branch 'sigar-1.6' 2009-07-07 15:36:50 -07:00
Doug MacEachern
930de473be Merge branch 'sigar-1.6' 2009-07-07 15:31:07 -07:00
Doug MacEachern
9769d17c3d Merge branch 'sigar-1.6' 2009-07-03 15:50:17 -07:00
Doug MacEachern
14b916fdb6 Merge branch 'sigar-1.6' 2009-07-02 16:03:52 -07:00
Doug MacEachern
a19c5a3454 Merge branch 'sigar-1.6' 2009-07-02 13:58:29 -07:00
Doug MacEachern
b47f4b8b1b Merge branch 'sigar-1.6' 2009-07-01 16:28:03 -07:00
Doug MacEachern
6a5b8c00de Merge branch 'sigar-1.6' 2009-07-01 15:06:35 -07:00
Doug MacEachern
4c165819a3 Merge branch 'sigar-1.6'
Conflicts:
	bindings/java/hyperic_jni/src/org/hyperic/jni/ArchNameTask.java
2009-06-30 16:08:50 -07:00
Doug MacEachern
118a3e71fa Ruby example of route cmd 2009-06-29 17:21:03 -07:00
Doug MacEachern
38e2e85132 add RTF constants 2009-06-29 17:20:19 -07:00
Doug MacEachern
e81c50eeca Merge branch 'sigar-1.6' 2009-06-17 17:57:39 -07:00
Doug MacEachern
0008c56119 Merge branch 'erlang' 2009-06-14 21:29:29 -07:00
Doug MacEachern
22c0d9e356 experimental erlang driver 2009-06-14 21:29:08 -07:00
Doug MacEachern
0cecd10a4d Merge branch 'sigar-1.6' 2009-06-06 08:38:46 -07:00
Doug MacEachern
715b32f1a6 Merge branch 'sigar-1.6' 2009-06-01 13:30:38 -07:00
Doug MacEachern
099f021675 Merge branch 'sigar-1.6' 2009-05-24 18:19:15 -07:00
Doug MacEachern
c3feb6e8d7 fix compile on OpenBSD and older FreeBSD 2009-05-23 07:36:43 -07:00
Doug MacEachern
a76768c30f rid -Wall statvfs warning on solaris 8 2009-05-23 07:36:33 -07:00
Doug MacEachern
cb7b440c0c Merge branch 'sigar-1.6' 2009-05-22 12:06:04 -07:00
Doug MacEachern
474ccff730 Merge branch 'SIGAR-148' 2009-05-21 16:57:50 -07:00
Doug MacEachern
376409a403 (SIGAR-148) use sigar_statvfs 2009-05-21 14:26:34 -07:00
Doug MacEachern
b53121d071 (SIGAR-148) use sigar_statvfs 2009-05-21 14:26:29 -07:00
Doug MacEachern
94b3f884a2 (SIGAR-148) add generic sigar_statvfs built with LFS flags 2009-05-21 14:25:46 -07:00
Doug MacEachern
d3ceb14ff7 Merge branch 'master' of git@github.com:hyperic/sigar 2009-05-14 08:37:50 -07:00
Doug MacEachern
1f8db9098a Merge branch 'SIGAR-146' 2009-05-13 17:31:30 -07:00
Doug MacEachern
c43b43ae03 fix so SigarPermissionDeniedException is throw on open /dev/kmem EACCES 2009-05-13 16:56:08 -07:00
Doug MacEachern
90b2ade95e add 64-bit compile/link flags for AIX 2009-05-13 16:54:49 -07:00
Doug MacEachern
2643818a45 snapshot @c14dc0f: use '-qversion' for identifier, fixes 64-bit xlc_r compile on AIX 2009-05-13 16:54:13 -07:00
Doug MacEachern
f5881726fd test unregisterMBean 2009-04-29 18:08:55 -07:00
Doug MacEachern
806ee088d7 support no arg SigarRegistry constructor 2009-04-29 17:58:39 -07:00
Doug MacEachern
074d20d7b6 switch from Dynamic to Standard MBean 2009-04-29 17:41:46 -07:00
Doug MacEachern
7157234182 extend ReflectedMBean 2009-04-29 16:35:51 -07:00
Doug MacEachern
b004072d48 Object wrapper of double[] Sigar.getLoadAverage() for use in bean patterns (JMX) 2009-04-29 16:32:36 -07:00
Doug MacEachern
448b595e30 only SigarRegistry needs to implement MBeanRegistration 2009-04-29 15:16:17 -07:00
Doug MacEachern
25241fcc7a remove generated comments 2009-04-29 15:02:11 -07:00
Doug MacEachern
f6e85761d2 SigarProxy must implement InvocationHandler 2009-04-29 14:55:47 -07:00
Doug MacEachern
ad8325e616 remove MBeanConstructorInfo 2009-04-29 14:42:42 -07:00
Doug MacEachern
b3603f4489 SigarProcess.close only applies to SigarProcess(void) constructor 2009-04-29 14:34:40 -07:00
Doug MacEachern
bf361a1732 make SigarProxyCached.invoke synchronized 2009-04-29 13:09:15 -07:00
Doug MacEachern
1c87169bdb leave SigarProxy impl to the caller 2009-04-29 12:58:45 -07:00
Doug MacEachern
0eb3672642 add mx -jconsole option 2009-04-29 12:19:40 -07:00
Doug MacEachern
6ef73dcbcb use SigarVersion bean 2009-04-29 10:56:14 -07:00
Doug MacEachern
0a1a3de69f use SigarVersion bean 2009-04-29 10:53:07 -07:00
Doug MacEachern
96ca3970e1 add SigarVersion getter 2009-04-29 10:51:55 -07:00
Doug MacEachern
a84788f1a0 encapsulate version attributes 2009-04-29 10:51:32 -07:00
Doug MacEachern
3e0e08f088 rename SigarVersion -> Version 2009-04-29 10:17:58 -07:00
Doug MacEachern
ec3fbe993c remove unused code 2009-04-29 10:04:59 -07:00
Doug MacEachern
b9caed4157 getrusage on NetBSD may not return monotonically increasing values for CPU time.
See: http://archives.devshed.com/forums/bsd-93/kern-30115-getrusage-returns-bogus-ru-utime-values-220800.html
2009-04-25 09:52:07 -07:00
Doug MacEachern
a95b8a8b60 (SIGAR-130) Use pstat(PSTAT_GETCOMMANDLINE,...) on HP-UX < 11iv2 2009-04-25 07:46:40 -07:00
Doug MacEachern
8e6a2179dd (SIGAR-39) Use kern.cp_times in cpu_list on FreeBSD 7.x+ 2009-04-20 18:39:36 -07:00
Doug MacEachern
2fc550c8fd (SIGAR-130) Use pstat_getcommandline on HP-UX 11iv2+ 2009-04-18 08:57:41 -07:00
Doug MacEachern
0996361ec6 (SIGAR-131) switch to pst_fileinfo2 on all HPUX flavors 2009-04-17 18:31:35 -07:00
Doug MacEachern
19d9e00787 python/setup.py now builds all sigar srcs 2009-04-04 19:15:36 -07:00
Doug MacEachern
7f8bfd8195 support build dir other than '.' 2009-04-04 19:07:32 -07:00
Doug MacEachern
9eade5d21a (SIGAR-141) sigar.jar location is not required to find native library 2009-03-27 15:07:32 -07:00
Doug MacEachern
4333771fc3 fix compile against ruby 1.9 2009-03-25 20:10:19 -07:00
Doug MacEachern
eb05ff0760 fix compile against ruby 1.8.4 2009-03-25 14:58:06 -07:00
Doug MacEachern
6819b18af6 dont require pdh.dll on NT 4.0 2009-03-25 14:13:56 -07:00
Doug MacEachern
646fc226ea remove pdh.dll (only used on NT 4.0) 2009-03-25 13:46:24 -07:00
Doug MacEachern
85838c3512 remove msvc_iptypes.h 2009-03-25 13:44:30 -07:00
Doug MacEachern
891f30bf0d (SIGAR-140) interface aliases are valid in sigar_net_interface_config_primary_get 2009-03-25 11:18:04 -07:00
Doug MacEachern
f7b590cf27 ruby ptql_re_impl 2009-03-16 20:04:33 -07:00
Doug MacEachern
026d560a09 support optional ptql param in proc_list 2009-03-15 23:20:45 -07:00
Doug MacEachern
e6d9239844 add proc_list ruby wrapper 2009-03-15 12:47:08 -07:00
Doug MacEachern
4bd7310f9a add ptql support to proc methods 2009-03-15 12:33:54 -07:00
Doug MacEachern
63141c38b9 rid mac os 10.5 warning: utmp is deprecated 2009-03-14 12:37:29 -07:00
Doug MacEachern
3025c4554f (SIGAR-139) support scripted SIGAR_PROC_NET for testing 2009-03-12 21:30:50 -07:00
Doug MacEachern
1ce9a3209d Merge branch 'master' of git@github.com:hyperic/sigar 2009-03-07 06:40:41 -08:00
Doug MacEachern
634cd53a79 6.1 == Windows 7 2009-03-07 06:40:23 -08:00
Doug MacEachern
d34efe0474 10.6 == Snow Leopard 2009-03-07 06:37:36 -08:00
Doug MacEachern
1bd4f0e074 use ArchNameTask to configure darwin sdk 2009-02-25 21:35:54 -08:00
Doug MacEachern
839010d6c9 use SIGAR_INET6_ADDRSTRLEN 2009-02-24 19:47:41 -08:00
Doug MacEachern
24bf84a310 import File::Copy 2009-02-24 19:40:25 -08:00
Doug MacEachern
9935c592f6 avoid sigar.o/Sigar.o clash on case insensitive filesystems 2009-02-24 19:34:56 -08:00
Doug MacEachern
349b7caaf6 use SigarBuild.pm 2009-02-24 19:07:51 -08:00
Doug MacEachern
b2a1f5cbd5 sharable build utils 2009-02-24 19:07:32 -08:00
Doug MacEachern
59c7c1d975 ignore perl build files 2009-02-24 19:06:23 -08:00
Doug MacEachern
1320801e04 chdir to sigar root 2009-02-16 18:21:45 -08:00
Doug MacEachern
aa605fcde1 make distclean incase of nfs shared dir 2009-02-16 17:53:10 -08:00
Doug MacEachern
36f7289082 fix for ruby 1.8.4 2009-02-16 17:36:53 -08:00
Doug MacEachern
f81f9a52ab rake tasks for use from hudson 2009-02-16 13:51:24 -08:00
Doug MacEachern
52c3bb0191 fix for mswin64 2009-02-16 13:50:25 -08:00
Doug MacEachern
5fe0332f66 remove unused requires 2009-02-16 12:42:13 -08:00
Doug MacEachern
d99e55c9eb Merge branch 'gem' 2009-02-16 10:51:07 -08:00
Doug MacEachern
60e96f28b7 add ruby gemspec 2009-02-16 10:50:31 -08:00
Doug MacEachern
3d437dc78d catch file_system_usage exceptions 2009-02-15 20:23:45 -08:00
Doug MacEachern
9e2576f7d6 need ftools for File.copy on windows 2009-02-15 20:15:22 -08:00
Doug MacEachern
606940eba2 ruby 1.9 fix fix 2009-02-15 20:09:42 -08:00
Doug MacEachern
9c759f0185 hpux extconf 2009-02-15 19:55:57 -08:00
Doug MacEachern
68525d650c fixes for ruby 1.9 2009-02-15 19:51:40 -08:00
Doug MacEachern
9835ea40c7 dont need ftools 2009-02-15 19:48:22 -08:00
Doug MacEachern
9932201d2e require libperfstat on aix 2009-02-15 19:02:25 -08:00
Doug MacEachern
7a648166f1 add aix libs 2009-02-15 16:08:15 -08:00
Doug MacEachern
7cfb3b0570 ruby/extconf.rb now builds all sigar srcs 2009-02-15 15:21:59 -08:00
Doug MacEachern
696f62a637 mv exp/ http://github.com/dougm/sigar-stuff 2009-02-15 07:01:17 -08:00
Doug MacEachern
27aa0532c5 mv tools/PerfBrowser http://github.com/dougm/csharp-perfbrowser 2009-02-14 11:55:37 -08:00
Doug MacEachern
301ce06deb cpptasks patches moved to http://github.com/dougm/ant-contrib-cpptasks 2009-02-14 07:00:52 -08:00
Doug MacEachern
60c95368e6 Merge branch 'SIGAR-134' 2009-02-12 16:33:42 -08:00
Doug MacEachern
39af88f8c5 (SIGAR-134) use UNICODE in EventLog wrapper 2009-02-12 16:32:36 -08:00
Doug MacEachern
f48e3f9c07 s/SVN/SCM/ 2009-02-10 17:37:51 -08:00
Doug MacEachern
ae45e2c4f3 (SIGAR-73) check for 'ocfs' in addition to 'ocfs2' 2009-02-10 13:50:08 -08:00
Doug MacEachern
168c14e0ff dos2unix 2009-02-09 14:12:02 -08:00
Doug MacEachern
e1f64cfe2d dos2unix 2009-02-09 14:11:16 -08:00
Doug MacEachern
d573932902 Merge branch 'sigar-1.6-dos2unix' 2009-02-09 13:57:44 -08:00
Doug MacEachern
8edff557f0 Merge branch 'sigar-1.6'
Conflicts:

	bindings/java/version.properties
2009-02-08 18:15:26 -08:00
Doug MacEachern
b55603f2a5 bump version 2009-02-07 04:23:19 -08:00
Doug MacEachern
81a19487a9 Merge branch 'jk/pstat_getfile2' 2009-02-06 17:34:36 -08:00
Jan Kneschke
2d86ebadfb (SIGAR-131) use pstat_getfile2 in sigar_proc_fd_get on HP/UX 11iv2+
Signed-off-by: Doug MacEachern <dougm@hyperic.com>
2009-02-06 17:31:47 -08:00
Jan Kneschke
15bfbfef0e (SIGAR-137) ensure net_interface_list names are null-byte terminated
Signed-off-by: Doug MacEachern <dougm@hyperic.com>
2009-02-06 17:15:36 -08:00
Jan Kneschke
b48fd1e62f (SIGAR-136) plug memory leak in sigar_file_system_list_get
Signed-off-by: Doug MacEachern <dougm@hyperic.com>
2009-02-06 17:15:36 -08:00
Doug MacEachern
f0ef330989 .gitignore 2009-02-06 16:13:07 -08:00
Doug MacEachern
eab907beb1 fix git rev-parse 2009-02-06 15:52:06 -08:00
Doug MacEachern
68559e2d24 remove invalid assertion 2009-01-21 13:43:21 +00:00
Doug MacEachern
8aa5b486e8 no need for libarch in generated sigar_version.c 2009-01-19 19:35:18 +00:00
Doug MacEachern
2b7a46de89 fix osx version on 64-bit platforms 2009-01-18 06:31:36 +00:00
Doug MacEachern
8d63124b47 s/SVN/SCM/ 2009-01-18 04:02:44 +00:00
Doug MacEachern
b6f891c926 check for git revision 2009-01-18 04:00:07 +00:00
Doug MacEachern
641f42540b cp r157 from http://svn.hyperic.org/projects/hyperic_jni 2009-01-18 03:08:44 +00:00
Doug MacEachern
c98ee1cbc0 no more svn:externals 2009-01-18 03:02:57 +00:00
Doug MacEachern
26a3373352 no longer using BCEL 2009-01-14 05:10:29 +00:00
Doug MacEachern
9a270ec91e update copyright.year 2009-01-13 19:06:23 +00:00
Doug MacEachern
6c390d494a [SIGAR-133] use InputStream.skip (bytes) instead of Reader.skip (chars) in onChange 2009-01-09 05:41:52 +00:00
Doug MacEachern
5a602a0a06 handle case of process going away 2009-01-08 04:41:21 +00:00
Doug MacEachern
bb5dc06cba [SIGAR-132] Fix possible memory leak in sigar_rpc_ping 2009-01-06 17:25:15 +00:00
Doug MacEachern
48558541ad [SIGAR-129] fix possible integer overflow in time_now_millis 2008-12-20 16:09:49 +00:00
Doug MacEachern
901c6eeef4 [SIGAR-129] add another sanity check 2008-12-19 23:10:37 +00:00
Doug MacEachern
3c0541888f [SIGAR-129] prevent possible wrapping 2008-12-10 21:51:53 +00:00
Doug MacEachern
8537ee876c check for glibtoolize 2008-11-26 23:40:31 +00:00
Doug MacEachern
7630120869 start an autotools based build 2008-11-26 23:39:18 +00:00
Doug MacEachern
d716cef196 mv Makefile Makefile.nw 2008-11-26 23:27:53 +00:00
Doug MacEachern
08ed781e71 start an autotools based build 2008-11-26 23:27:32 +00:00
Doug MacEachern
ef907e95b6 [SIGAR-129] prevent possible integer overflow 2008-11-26 02:57:34 +00:00
Doug MacEachern
bdd27d6f36 handle processes that may have gone away 2008-11-26 01:08:02 +00:00
Doug MacEachern
c00dd5aec9 revert r3669 - requires vc6sp5+vcpp5 on windows 2008-11-25 22:46:58 +00:00
Doug MacEachern
c68246e8e1 bump version 2008-11-20 15:41:16 +00:00
Doug MacEachern
acefffcde4 add ProcStat MBean 2008-10-23 22:35:27 +00:00
Doug MacEachern
06945a8e31 test SigarProcessMBean 2008-10-18 23:37:21 +00:00
Doug MacEachern
6b46d63201 return NOTIMPL if ProcFd fails 2008-10-18 23:36:30 +00:00
Doug MacEachern
2bc3a6ce2a getObjectName method for SigarProcess 2008-10-18 23:31:03 +00:00
Doug MacEachern
27a8d74436 support pid other than self 2008-10-18 22:41:17 +00:00
Doug MacEachern
befbdf13d2 remove main method 2008-10-18 22:34:28 +00:00
Doug MacEachern
0d3be12ac6 [SIGAR-127] use KERN_ARGMAX for KERN_PROCARGS2 buffer size 2008-10-15 02:53:23 +00:00
Doug MacEachern
f7098e2c5b [SIGAR-126] /dev/kmem not usable in aix 6 2008-10-14 03:27:02 +00:00
Doug MacEachern
ddebab492b allow junit.mx override 2008-10-09 07:08:43 +00:00
Doug MacEachern
ed7562c0c7 use SigarInvokerJMX.PROP_TYPE 2008-10-09 06:38:11 +00:00
Doug MacEachern
c7b398b53a add query support 2008-10-09 06:36:46 +00:00
Doug MacEachern
63478f28ff add aggregate Cpu mbeans 2008-10-09 06:22:46 +00:00
Doug MacEachern
7985dea967 will be reusing CpuInfo 2008-10-09 06:15:02 +00:00
Doug MacEachern
1c75927eca convert Cpu*List to ReflectedMBeans 2008-10-09 06:13:05 +00:00
Doug MacEachern
c409cb469f handle List type MBeanClassName 2008-10-09 06:06:58 +00:00
Doug MacEachern
7ff83f9ba9 use SigarInvokerJMX 2008-10-09 05:55:17 +00:00
Doug MacEachern
14fc064709 prefer Name attribute to Arg 2008-10-09 05:54:35 +00:00
Doug MacEachern
f3abf92787 make setType public 2008-10-09 05:53:31 +00:00
Doug MacEachern
8240ca58d4 test getAttribute 2008-10-09 05:53:13 +00:00
Doug MacEachern
9756e558fc print MBean ObjectName 2008-10-09 04:45:36 +00:00
Doug MacEachern
5deb0a0c97 add NetInfo MBean 2008-10-08 14:11:17 +00:00
Doug MacEachern
d08a3cf189 rid "warning: cast from pointer to integer of different size" on 64-bit builds 2008-10-08 03:30:44 +00:00
Doug MacEachern
dd9dd214bd [SIGAR-125] bring back /private/var/vm swap impl for osx 10.3 2008-10-04 19:43:46 +00:00
Doug MacEachern
dd471219c4 catch NoClassDefFoundError on 1.4 jre 2008-10-04 19:06:23 +00:00
Doug MacEachern
29b9d5ada1 add -Dcom.sun.management.jmxremote for TestMx 2008-10-04 18:57:03 +00:00
Doug MacEachern
cedc189061 test MBean registration 2008-10-04 16:55:42 +00:00
Doug MacEachern
bd94719a4a regigster NetInterface beans 2008-10-04 16:38:24 +00:00
Doug MacEachern
273a7aad96 register FileSystem beans 2008-10-04 01:31:16 +00:00
Doug MacEachern
e2616dbac1 support additional static attributes 2008-10-04 00:58:08 +00:00
Doug MacEachern
ceec932585 support arguments 2008-10-04 00:29:44 +00:00
Doug MacEachern
6f7b2751f2 renames 2008-10-03 22:56:51 +00:00
Doug MacEachern
d7e835fa4f use ReflectedMBean for Swap and Mem 2008-10-03 22:46:40 +00:00
Doug MacEachern
2868942667 generic reflection based MBean impl 2008-10-03 22:45:16 +00:00
Doug MacEachern
857e4f0450 simplify MBean registration 2008-10-03 21:20:17 +00:00
Doug MacEachern
e6bb9c7f7e pull invoke and setAttribute methods up to superclass 2008-10-03 20:59:58 +00:00
Doug MacEachern
e0b67cf3fa add version attributes 2008-10-03 15:48:56 +00:00
Doug MacEachern
913f1ca5a6 mx cmd for testing MBeans 2008-10-03 01:27:01 +00:00
Doug MacEachern
df18aa6bbb [SIGAR-123] do not include global shared text+data region size 2008-09-29 03:22:48 +00:00
Doug MacEachern
062d08d9ce [SIGAR-122] ARG_MAX undefined on glibc 2.8 2008-09-27 15:59:39 +00:00
Doug MacEachern
25522f31c8 different case between XP (Eventlog) and 2008 (EventLog) 2008-09-26 20:36:56 +00:00
Doug MacEachern
2f11286b5f remove unused import 2008-09-26 19:19:26 +00:00
Doug MacEachern
eeb3f26ad4 [SIGAR-121] Add Service.Pid PTQL support 2008-09-25 17:54:22 +00:00
Doug MacEachern
80ef448f8c list service pid 2008-09-19 16:09:06 +00:00
548 changed files with 36111 additions and 12702 deletions

43
.gitignore vendored Normal file
View File

@ -0,0 +1,43 @@
pkg
Makefile
Makefile.in
*.o
*.lo
*.la
.deps
.libs
aclocal.m4
autom4te.cache
compile
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
libtool
ltmain.sh
missing
src/sigar_version_autoconf.c
examples/cpuinfo
examples/sigar_ps
debian/*.log
debian/stamp-*
debian/tmp
m4/
debian/python-sigar*
debian/python-module-stampdir
debian/*.debhelper
debian/*.substvars
debian/libsigar1/
debian/libsigar1-dev/
debian/libsigar-java-doc/
debian/libsigar-java/
debian/files
config.sub*
config.guess*
bindings/java/${dist}
bindings/python/build
TODO*
check*.rb

23
AUTHORS Normal file
View File

@ -0,0 +1,23 @@
Doug MacEachern <dougm at vmware.com>
Jan Kneschke <jan at kneschke.de>
Matthew Kent <mkent at magoazul.com>
Ryan Beasley <rbeasley at vmware.com>
Bjoern Martin <boris59 at boris59.de>
Kay Ropke <kroepke at classdump.local>
Ryan Morgan <rmorgan at hyperic.com>
Monty Taylor <mordred at inaugust.com>
Trevor Pounds <trevor.pounds at gmail.com>
Jon Travis <jtravis at hyperic.com>
Tony Ashburner <tashburner at emergency.qld.gov.au>
Ryan Bloom <rbloom at covalent.net>

35
CMakeLists.txt Normal file
View File

@ -0,0 +1,35 @@
PROJECT(sigar C)
cmake_minimum_required(VERSION 2.6)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckTypeSize)
INCLUDE(CTest)
INCLUDE(InstallRequiredSystemLibraries)
ENABLE_TESTING()
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "6")
SET(CPACK_PACKAGE_VERSION_PATCH "2")
SET(CPACK_PACKAGE_VENDOR "Hyperic")
## SET(CPACK_*) before the INCLUDE(CPack)
INCLUDE(CPack)
IF(WIN32)
## make sure we only use the smallest set of
## headers on win32. Otherwise we get clashes
## between winsock2.h and winsock.h
ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN)
# force the correct version for the redist manifest
ADD_DEFINITIONS(-D_BIND_TO_CURRENT_MFC_VERSION=1 -D_BIND_TO_CURRENT_CRT_VERSION=1)
# turn off security warnings for system calls
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ENDIF(WIN32)
ADD_SUBDIRECTORY(src build-src)
ADD_SUBDIRECTORY(tests build-tests)
ADD_SUBDIRECTORY(include build-include)

339
COPYING
View File

@ -1,339 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 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.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

227
ChangeLog
View File

@ -1,3 +1,230 @@
2010-04-28 Doug MacEachern <dougm@hyperic.com>
* 1.6.4 release
* GPL v2 license -> Apache 2 license
* (SIGAR-188) implement mem actual free/used on Windows
2010-04-27 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-215) use swapctl SC_LIST for Solaris swap_get impl
2010-04-15 Doug MacEachern <dougm@hyperic.com>
* osf1 no longer supported
* netware no longer supported
* (SIGAR-201) JNIEnv->ExceptionCheck to avoid possible SEGV on OutOfMemoryError
2010-04-14 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-192) avoid possible stack corruption in Windows proc_env impl
* (SIGAR-213) check ENV.ANT_HOME/lib for junit in Main-Class
2010-04-09 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-214) properly adjust jni.javahome when JAVA_HOME is not set
2010-04-08 Doug MacEachern <dougm@hyperic.com>
* cpptasks patches moved to http://github.com/dougm/ant-contrib-cpptasks
* mv tools/PerfBrowser http://github.com/dougm/csharp-perfbrowser
* mv exp/ http://github.com/dougm/sigar-stuff
2010-04-07 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-213) remove junit.jar from distribution
* (SIGAR-188) implement mem actual free/used on HPUX
* (SIGAR-188) implement mem actual free/used on AIX
2010-04-05 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-188) implement mem actual free/used on OpenBSD and NetBSD
* (SIGAR-188) implement mem actual free/used on Solaris
2010-04-02 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-212) pass LANG_ENGLISH to FormatMessage in Windows sigar_strerror impl
2010-04-01 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-188) implement mem actual free/used on Windows
2010-04-01 Trevor Pounds <trevor.pounds@gmail.com>
* (SIGAR-202) Change CreateFile() access flags to prevent potential inode calculation
errors on Windows when tailing a file.
2010-04-01 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-207) append instance index in Pdh.getInstances()
2010-03-31 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-207) Add Pdh.getCounterType method
* (SIGAR-207) Add Pdh.getDescription method
* (SIGAR-210) recognize cifs as a network file system
2010-03-30 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-211) HPUX file_system_list needs to read /etc/mnttab instead of /etc/fstab
2010-02-09 Doug MacEachern <dougm@hyperic.com>
* add -i (inode format) support to df command
2010-02-05 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-205) Vista and higher changed wireless card type to IF_TYPE_IEEE80211
2010-01-18 Doug MacEachern <dougm@hyperic.com>
* rid dup in solaris route_list impl
2010-01-17 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-181) fill-in sigar_net_route_t.ifname on HPUX
2010-01-12 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-196) use pst_processor.psp_cpu_frequency to calculate cpu_info.mhz on HP-UX 11.31+
2010-01-04 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-194) sigar_file_system_t.dev_name on Windows should be the network path for remote drives
2009-12-23 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-193) Migrate from mach/shared_memory_server.h to mach/shared_region.h on Darwin
2009-11-09 Doug MacEachern <dougm@hyperic.com>
* only display event code in toString as the Event Viewer does
* 'N/A' for null user in EventLogRecord.toString
* include the same fields as Event Viewer in EventLogRecord.toString
* (SIGAR-191) fix EventLogRecord.computerName
* (SIGAR-190) add category to EventLogRecord
2009-11-05 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-189) ignore CP_WAIT time on HPUX
2009-11-03 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-187) implement proc_exe on AIX
* (SIGAR-188) implement mem actual free/used on MacOSX
2009-11-02 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-188) implement mem actual free/used on FreeBSD
2009-10-23 Doug MacEachern <dougm@hyperic.com>
* Pdh test adjustments for windows 2000
* (SIGAR-185) fix RegistryKey open on windows 2000
* (SIGAR-186) fix Win32.getFileVersion on windows 2000
2009-09-30 Doug MacEachern <dougm@hyperic.com>
* hpux pa 64-bit support
2009-09-17 Doug MacEachern <dougm@hyperic.com>
* 64-bit MacOSX 10.6 sdk does not support ppc64, switch from universal build to i386 only
2009-09-15 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-181) net_route.ifname impl for Win32
* (SIGAR-181) net_route.ifname impl for MacOSX and *BSD
* (SIGAR-182) use mib2_ip_t.ipRouteEntrySize to determine mib2_ipRouteEntry_t size
2009-09-08 Doug MacEachern <dougm@hyperic.com>
* fix MacOSX10.6.sdk build issues
2009-09-01 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-168) always fallback to wmi when peb fails for proc_args
2009-08-30 Doug MacEachern <dougm@hyperic.com>
* 6.1 == Windows 7
* 10.6 == Snow Leopard
2009-08-23 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-179) Increase buffer size in cpu_list query from 16 to 128
2009-08-11 Jan Kneschke <jan@kneschke.de>
* (SIGAR-137) sdl_data isn't 0-terminated
2009-08-05 Doug MacEachern <dougm@hyperic.com>
* try wmi if peb fails for proc_exe
* add wmi proc_args wrapper
2009-07-31 Doug MacEachern <dougm@hyperic.com>
* only exclude nfs/rpcv2.h on FreeBSD 8+
2009-07-30 Doug MacEachern <dougm@hyperic.com>
* net_route_list bandaid for FreeBSD 8.0
* sigar_proc_port_get does not compile on FreeBSD 8.0
* only need nfs/rpcv2.h on darwin
2009-07-18 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-164) return ENXIO instead of ENOENT in disk_usage win32 impl
* (SIGAR-164) return ENXIO instead of ENOENT in disk_usage linux impl
* (SIGAR-164) return ENXIO instead of ENOENT in disk_usage aix impl
* (SIGAR-164) return ENXIO instead of ESRCH in disk_usage darwin impl
2009-07-17 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-163) Recognize cvfs (StorNext) as local filesystem type
2009-07-16 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-162) plug possible memory leak in sigar_iodev_get util
2009-07-14 Doug MacEachern <dougm@hyperic.com>
* remove pdh.dll (only used on NT 4.0)
2009-07-13 Doug MacEachern <dougm@hyperic.com>
* (SIGAR-155) Plug memory leak sigar_proc_exe_get Darwin impl
* bump version to 1.6.4
2008-07-13 Doug MacEachern <dougm@hyperic.com>
* 1.6.3 release

View File

@ -1,104 +0,0 @@
Hyperic FLOSS License Exception
The Hyperic Exception for Free/Libre and Open Source
Software-only Applications Using Hyperic SIGAR Libraries (the
"FLOSS Exception").
Version 0.1, September 6, 2008
Exception Intent
We want specified Free/Libre and Open Source Software (``FLOSS'')
applications to be able to use specified GPL-licensed Hyperic SIGAR
libraries (the ``Program'') despite the fact that not all FLOSS
licenses are compatible with version 2 of the GNU General Public
License (the ``GPL'').
Legal Terms and Conditions
As a special exception to the terms and conditions of version 2.0
of the GPL:
1. You are free to distribute a Derivative Work that is formed
entirely from the Program and one or more works (each, a
"FLOSS Work") licensed under one or more of the licenses
listed below in section 1, as long as:
a. You obey the GPL in all respects for the Program and the
Derivative Work, except for identifiable sections of the
Derivative Work which are not derived from the Program,
and which can reasonably be considered independent and
separate works in themselves,
b. all identifiable sections of the Derivative Work which
are not derived from the Program, and which can
reasonably be considered independent and separate works
in themselves,
i. are distributed subject to one of the FLOSS licenses
listed below, and
ii. the object code or executable form of those sections
are accompanied by the complete corresponding
machine-readable source code for those sections on
the same medium and under the same FLOSS license as
the corresponding object code or executable forms of
those sections, and
c. any works which are aggregated with the Program or with a
Derivative Work on a volume of a storage or distribution
medium in accordance with the GPL, can reasonably be
considered independent and separate works in themselves
which are not derivatives of either the Program, a
Derivative Work or a FLOSS Work.
If the above conditions are not met, then the Program may only
be copied, modified, distributed or used under the terms and
conditions of the GPL or another valid licensing option from
Hyperic, Inc.
2. FLOSS License List
License name Version(s)/Copyright Date
Apache Software License 1.0/1.1/2.0
Artistic license From Perl 5.8.0
BSD license "July 22 1999"
Eclipse Public License 1.0
Mozilla Public License (MPL) 1.0/1.1
Open Software License 2.0
PHP License 3.0
Python Software Foundation License 2.1.1
Due to the many variants of some of the above licenses, we
require that any version follow the 2003 version of the Free
Software Foundation's Free Software Definition
(http://www.gnu.org/philosophy/free-sw.html) or version 1.9 of
the Open Source Definition by the Open Source Initiative
(http://www.opensource.org/docs/definition.php).
3. Definitions
a. Terms used, but not defined, herein shall have the
meaning provided in the GPL.
b. Derivative Work means a derivative work under copyright
law.
4. Applicability: This FLOSS Exception applies to all Programs
that contain a notice placed by Hyperic, Inc. saying that the
Program may be distributed under the terms of this FLOSS
Exception. If you create or distribute a work which is a
Derivative Work of both the Program and any other work
licensed under the GPL, then this FLOSS Exception is not
available for that work; thus, you must remove the FLOSS
Exception notice from that work and comply with the GPL in all
respects, including by retaining all GPL notices. You may
choose to redistribute a copy of the Program exclusively under
the terms of the GPL by removing the FLOSS Exception notice
from that copy of the Program, provided that the copy has
never been modified by you or any third party.
Appendix A. Qualified Libraries and Packages
The following is a non-exhaustive list of libraries and packages
which are covered by the FLOSS License Exception. Please note that
this appendix is provided merely as an additional service to
specific FLOSS projects wishing to simplify licensing information
for their users. Compliance with one of the licenses noted under
the "FLOSS license list" section remains a prerequisite.
Package Name Qualifying License and Version
Apache Portable Runtime (APR) Apache Software License 2.0

201
LICENSE Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,39 +0,0 @@
Hyperic SIGAR includes some third-party open source components
in its distribution. The list below identifies the community or
organization and links to their appropriate license terms.
The Hyperic team would like to thank all the communities
of the projects listed below for their contributions.
---------------------------------------------------------------------
The following components are included without modification:
- log4j -
Information: http://logging.apache.org/
License: http://www.apache.org/licenses/LICENSE-2.0
- junit -
Information: http://www.junit.org/index.htm
License: http://www.opensource.org/licenses/cpl.php
The following components are included with modification:
- cpptasks -
Information: http://ant-contrib.sourceforge.net/
License: http://ant-contrib.sourceforge.net/LICENSE.txt
- (portions of) APR -
Information: http://apr.apache.org/
License: http://www.apache.org/licenses/LICENSE-2.0
- solaris get_mib2 -
Information: ftp://vic.cc.purdue.edu/pub/tools/unix/solaris/get_mib2/
License: within src/os/solaris/get_mib2.[ch]
- getline by Chris Thewalt -
Information: http://tinyurl.com/r438r
License: within src/sigar_getline.c
- PrintfFormat.java -
Information: http://java.sun.com/developer/technicalArticles/Programming/sprintf/PrintfFormat.java
License: within bindings/java/src/org/hyperic/sigar/util/PrintfFormat.java

5
Makefile.am Normal file
View File

@ -0,0 +1,5 @@
SUBDIRS = include src bindings examples tests
EXTRA_DIST=\
CMakeLists.txt \
winbuild.bat

117
NOTICE Normal file
View File

@ -0,0 +1,117 @@
Copyright (c) 2004-2011 VMware, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
ADDITIONAL LICENSE INFORMATION:
Hyperic SIGAR includes some third-party open source components
in its distribution. The list below identifies the community or
organization and links to their appropriate license terms.
The Hyperic team would like to thank all the communities
of the projects listed below for their contributions.
----------------------------------------------------------
Components under the Apache License 2.0:
----------------------------------------------------------
The following components are included without modification:
- log4j -
Information: http://logging.apache.org/
License: http://www.apache.org/licenses/LICENSE-2.0
The following components are included with modification:
- cpptasks -
Information: http://ant-contrib.sourceforge.net/
License: http://www.apache.org/licenses/LICENSE-2.0
- (portions of) APR -
Information: http://apr.apache.org/
License: http://www.apache.org/licenses/LICENSE-2.0
----------------------------------------------------------
Components under BSD/MIT Style Licenses:
----------------------------------------------------------
The following components are included with modification:
- solaris get_mib2 -
Information: ftp://vic.cc.purdue.edu/pub/tools/unix/solaris/get_mib2/
License: within src/os/solaris/get_mib2.[ch]
Copyright 1995 Purdue Research Foundation, West Lafayette, Indiana
47907. All rights reserved.
Written by Victor A. Abell <abe@cc.purdue.edu>
This software is not subject to any license of the American Telephone
and Telegraph Company or the Regents of the University of California.
Permission is granted to anyone to use this software for any purpose on
any computer system, and to alter it and redistribute it freely, subject
to the following restrictions:
1. Neither Victor A Abell nor Purdue University are responsible for
any consequences of the use of this software.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission. Credit to Victor A. Abell and Purdue
University must appear in documentation and sources.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software.
4. This notice may not be removed or altered.
- getline by Chris Thewalt -
Information: http://tinyurl.com/r438r
License: within src/sigar_getline.c
Copyright (C) 1991, 1992 by Chris Thewalt (thewalt@ce.berkeley.edu)
Permission to use, copy, modify, and distribute this software
for any purpose and without fee is hereby granted, provided
that the above copyright notices appear in all copies and that both the
copyright notice and this permission notice appear in supporting
documentation. This software is provided "as is" without express or
implied warranty.
- PrintfFormat.java -
Information: http://java.sun.com/developer/technicalArticles/Programming/sprintf/PrintfFormat.java
License: within bindings/java/src/org/hyperic/sigar/util/PrintfFormat.java
(c) 2000 Sun Microsystems, Inc.
ALL RIGHTS RESERVED
License Grant-
Permission to use, copy, modify, and distribute this Software and its
documentation for NON-COMMERCIAL or COMMERCIAL purposes and without fee is
hereby granted.
This Software is provided "AS IS". All express warranties, including any
implied warranty of merchantability, satisfactory quality, fitness for a
particular purpose, or non-infringement, are disclaimed, except to the extent
that such disclaimers are held to be legally invalid.
You acknowledge that Software is not designed, licensed or intended for use in
the design, construction, operation or maintenance of any nuclear facility
("High Risk Activities"). Sun disclaims any express or implied warranty of
fitness for such uses.
Please refer to the file http://www.sun.com/policies/trademarks/ for further
important trademark information and to
http://java.sun.com/nav/business/index.html for further important licensing
information for the Java Technology.

2
README
View File

@ -1,2 +0,0 @@
Visit the SIGAR Wiki for documentation, bugs, support, etc.:
http://sigar.hyperic.com/

42
README.md Normal file
View File

@ -0,0 +1,42 @@
# System Information Gatherer And Reporter.
Fork of hyperic/sigar with some fixes. Support only ruby binding. Part of [Eye gem](https://github.com/kostya/eye).
## Fixed:
### [2.0.11] 10-09-2024
* Fixing build issue on newer linux and also issues with newer Ruby [#16](https://github.com/kostya/sigar/pull/16)([commit](https://github.com/kostya/sigar/pull/16/commits/8b887b2380c4aadea82402904d9c1131bbb9c521))
### [2.0.10] 31-10-2021
* Fix compilation on MacOS 11.3.1 [#11](https://github.com/kostya/sigar/issues/11)([commit](https://github.com/kostya/sigar/commit/49a9aeeff54e97ac6f41d464c30ff6c8adf4bcf4))
### [2.0.9] 28-06-2021
* Fix compilation on FreeBSD 13 [#10](https://github.com/kostya/sigar/issues/10)([commit](https://github.com/kostya/sigar/commit/b78b558fb756a75dc7d6cbf704423be3c7098ae5))
### [2.0.8] 02-10-2020
* Fix compilation on MacOS [#8](https://github.com/kostya/sigar/issues/8)([commit](https://github.com/kostya/sigar/pull/9/commits/ad39547629fa328e115f7d7bc3c7c358247d1961))
### [2.0.6] 18-01-2019
* Fix compilation on FreeBSD 12 [#6](https://github.com/kostya/sigar/issues/6)([commit](https://github.com/kostya/sigar/commit/2bb67fa1bf6f6f0ddc2626cf028bcc0e4a8cb377))
### [2.0.5] 02-12-2018
* Fix compilation with musl libc [#4](https://github.com/kostya/sigar/pull/4)([commit](https://github.com/kostya/sigar/pull/4/commits/cd07923dd2ed34aca353dfd182f2f85c13853fd9))
### [2.0.4] 10-06-2018
* fix compilation with glibc 2.26, major/minor functions [#2](https://github.com/kostya/sigar/issues/2)([commit](https://github.com/kostya/sigar/commit/a2c67588d0f686e0007dadcaf0e4bbb35c0e1e83))
### [2.0.2] 30-05-2018
* Remove obsolete rpc usage (fix compilation fail with glibc 2.27) [#213](https://github.com/kostya/eye/issues/213)([commit](https://github.com/kostya/sigar/commit/a971b9e8e1443fdf236c5ffa199c1994c05fcd4b))
### [2.0.1] 10-04-2018
* FreeBSD: don't use v_cache_min/max [#68](https://github.com/hyperic/sigar/pull/68)([commit](https://github.com/kostya/sigar/commit/800076db97bcacb1ba90805d740b4f9a5a1d3cca))
### [2.0.0] 22-01-2018
* sigfaulted logger, [#28](https://github.com/hyperic/sigar/pull/28)([commit](https://github.com/kostya/sigar/commit/c2a1af))
* bug undefined symbol: sigar_skip_token, [#60](https://github.com/hyperic/sigar/pull/60)([commit](https://github.com/kostya/sigar/commit/dfe8fe))
* bug detection boot_time on linux (now it works like gnu ps, and fix some issues with process start_time) ([commit](https://github.com/kostya/sigar/commit/660259))
## Installation:
$ gem install kostya-sigar

102
Rakefile Normal file
View File

@ -0,0 +1,102 @@
require 'rubygems'
require 'rubygems/package_task'
require 'rake/testtask'
#so we can: ssh host rake -f $hudson_workspace/sigar/Rakefile
Dir.chdir(File.dirname(__FILE__))
props = {}
File.open("version.properties").each { |line|
next if line =~ /^#/
line.chomp!
line.strip!
next if line.empty?
key,val = line.split('=')
props[key] = val
}
GEM = props['project.name']
MAKE = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
spec = Gem::Specification.new do |s|
s.name = GEM
s.version = props['version.major'] + '.' + props['version.minor'] + '.' + props['version.maint']
s.summary = props['project.summary']
s.description = s.summary
s.author = props['project.author']
s.email = props['project.email']
s.homepage = props['project.homepage']
s.platform = Gem::Platform::RUBY
s.extensions = 'bindings/ruby/extconf.rb'
s.files =
%w(LICENSE NOTICE README.md Rakefile version.properties) +
%w(bindings/SigarWrapper.pm bindings/SigarBuild.pm) +
`git ls-files -- bindings/ruby/*.*`.split("\n") +
Dir.glob("include/*.h") +
Dir.glob("src/**/*.[ch]") +
Dir.glob("src/**/*.in")
end
Gem::PackageTask.new(spec) do |pkg|
pkg.gem_spec = spec
end
task :default => :test
def in_ext()
ext = 'bindings/ruby'
Dir.chdir(ext) if File.directory? ext
end
desc 'Build sigar extension'
task :build do
in_ext()
unless File.exist? "Makefile"
unless system("ruby extconf.rb")
STDERR.puts "Failed to configure"
next
end
end
unless system(MAKE)
STDERR.puts 'Failed to ' + MAKE
next
end
end
Rake::TestTask.new do |t|
t.pattern = 'test/*_test.rb'
t.libs << "."
end
task :test => [:build] do
in_ext()
end
desc 'Clean sigar extension'
task :clean do
in_ext()
system(MAKE + ' clean') if File.exist? "Makefile"
end
desc 'Dist Clean sigar extension'
task :distclean do
in_ext()
system(MAKE + ' distclean') if File.exist? "Makefile"
end
desc 'Run sigar examples (test)'
task :examples => [:build] do
in_ext()
Dir["examples/*.rb"].each do |file|
cmd = "ruby -I. #{file}"
print cmd + "\n"
system(cmd)
end
end
desc "create a gemspec file"
task :make_spec do
File.open("#{GEM}.gemspec", "w") do |file|
file.puts spec.to_ruby
end
end

61
autoclean.sh Executable file
View File

@ -0,0 +1,61 @@
#!/bin/sh
set -x
rm -f INSTALL NEWS \
&& rm -f -r m4 \
&& rm -f aclocal.m4 \
&& rm -f -r autom4te.cache \
&& rm -f compile \
&& rm -f config.guess \
&& rm -f config.log \
&& rm -f config.status \
&& rm -f config.sub \
&& rm -f configure \
&& rm -f depcomp \
&& rm -f src/config.h \
&& rm -f src/config.h.in \
&& rm -f install-sh \
&& rm -f -r libltdl \
&& rm -f libtool \
&& rm -f ltmain.sh \
&& rm -f Makefile \
&& rm -f Makefile.in \
&& rm -f missing \
&& rm -f src/*.la \
&& rm -f src/*.lo \
&& rm -f src/*.o \
&& rm -f src/sigar_version_autoconf.c \
&& rm -f -r src/.libs \
&& rm -f -r src/.deps \
&& rm -f src/os/Makefile \
&& rm -f src/os/Makefile.in \
&& rm -f src/os/*/Makefile \
&& rm -f src/os/*/Makefile.in \
&& rm -f src/os/*/*.la \
&& rm -f src/os/*/*.lo \
&& rm -f src/os/*/*.o \
&& rm -f -r src/os/*/.libs \
&& rm -f -r src/os/*/.deps \
&& rm -f src/Makefile \
&& rm -f src/Makefile.in \
&& rm -f src/stamp-h1 \
&& rm -f src/stamp-h1.in \
&& rm -f bindings/Makefile \
&& rm -f bindings/Makefile.in \
&& rm -f bindings/lua/Makefile \
&& rm -f bindings/*/Makefile.in \
&& rm -f -r bindings/*/.deps \
&& rm -f include/Makefile \
&& rm -f include/Makefile.in \
&& rm -f -r tests/.deps \
&& rm -f tests/Makefile \
&& rm -f tests/Makefile.in \
&& rm -f examples/Makefile \
&& rm -f examples/Makefile.in \
&& rm -f examples/*.o \
&& rm -f -r examples/.libs \
&& rm -f -r examples/.deps \
&& perl -le 's/\.c$// && unlink && print "rm $_" for <examples/*.c>'

96
autogen.sh Executable file
View File

@ -0,0 +1,96 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
# LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
LIBTOOLIZE_FLAGS="--copy --force"
# ACLOCAL=${ACLOCAL:-aclocal}
# AUTOHEADER=${AUTOHEADER:-autoheader}
# AUTOMAKE=${AUTOMAKE:-automake}
AUTOMAKE_FLAGS="--add-missing --copy"
# AUTOCONF=${AUTOCONF:-autoconf}
ARGV0=$0
ARGS="$@"
run() {
echo "$ARGV0: running \`$@' $ARGS"
$@ $ARGS
}
## jump out if one of the programs returns 'false'
set -e
## on macosx glibtoolize, others have libtool
if test x$LIBTOOLIZE = x; then
if test \! "x`which glibtoolize 2> /dev/null | grep -v '^no'`" = x; then
LIBTOOLIZE=glibtoolize
elif test \! "x`which libtoolize-1.5 2> /dev/null | grep -v '^no'`" = x; then
LIBTOOLIZE=libtoolize-1.5
elif test \! "x`which libtoolize 2> /dev/null | grep -v '^no'`" = x; then
LIBTOOLIZE=libtoolize
else
echo "libtoolize 1.5.x wasn't found, exiting"; exit 0
fi
fi
## suse has aclocal and aclocal-1.9
if test x$ACLOCAL = x; then
if test \! "x`which aclocal-1.9 2> /dev/null | grep -v '^no'`" = x; then
ACLOCAL=aclocal-1.9
elif test \! "x`which aclocal19 2> /dev/null | grep -v '^no'`" = x; then
ACLOCAL=aclocal19
elif test \! "x`which aclocal 2> /dev/null | grep -v '^no'`" = x; then
ACLOCAL=aclocal
else
echo "automake 1.9.x (aclocal) wasn't found, exiting"; exit 0
fi
fi
if test x$AUTOMAKE = x; then
if test \! "x`which automake-1.9 2> /dev/null | grep -v '^no'`" = x; then
AUTOMAKE=automake-1.9
elif test \! "x`which automake19 2> /dev/null | grep -v '^no'`" = x; then
AUTOMAKE=automake19
elif test \! "x`which automake 2> /dev/null | grep -v '^no'`" = x; then
AUTOMAKE=automake
else
echo "automake 1.9.x wasn't found, exiting"; exit 0
fi
fi
## macosx has autoconf-2.59 and autoconf-2.60
if test x$AUTOCONF = x; then
if test \! "x`which autoconf-2.59 2> /dev/null | grep -v '^no'`" = x; then
AUTOCONF=autoconf-2.59
elif test \! "x`which autoconf259 2> /dev/null | grep -v '^no'`" = x; then
AUTOCONF=autoconf259
elif test \! "x`which autoconf 2> /dev/null | grep -v '^no'`" = x; then
AUTOCONF=autoconf
else
echo "autoconf 2.59+ wasn't found, exiting"; exit 0
fi
fi
if test x$AUTOHEADER = x; then
if test \! "x`which autoheader-2.59 2> /dev/null | grep -v '^no'`" = x; then
AUTOHEADER=autoheader-2.59
elif test \! "x`which autoheader259 2> /dev/null | grep -v '^no'`" = x; then
AUTOHEADER=autoheader259
elif test \! "x`which autoheader 2> /dev/null | grep -v '^no'`" = x; then
AUTOHEADER=autoheader
else
echo "autoconf 2.59+ (autoheader) wasn't found, exiting"; exit 0
fi
fi
run $LIBTOOLIZE $LIBTOOLIZE_FLAGS
run $ACLOCAL $ACLOCAL_FLAGS
# we don't need autoheader as we don't have a config.h
# run $AUTOHEADER
run $AUTOMAKE $AUTOMAKE_FLAGS
run $AUTOCONF
test "$ARGS" = "" && echo "Now type './configure --enable-maintainer-mode ...' and 'make' to compile."

1
bindings/Makefile.am Normal file
View File

@ -0,0 +1 @@
SUBDIRS=lua

301
bindings/SigarBuild.pm Normal file
View File

@ -0,0 +1,301 @@
#
# Copyright (c) 2009 Hyperic, Inc.
# Copyright (c) 2009 SpringSource, Inc.
# Copyright (c) 2009 VMware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package SigarBuild;
use strict;
use Config;
use Exporter;
use File::Basename qw(basename);
use File::Copy qw(copy);
use File::Spec ();
use POSIX ();
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(cppflags ldflags libs os src inline_src version_file resource_file);
sub archname {
my $os = lc $^O;
my $vers = $Config{osvers};
my $arch = $Config{archname};
if ($os =~ /win32/) {
return 'x86-winnt';
}
elsif ($os =~ /linux/) {
if ($arch =~ /_64/) {
return 'amd64-linux';
}
else {
return 'x86-linux';
}
}
elsif ($os =~ /hpux/) {
if ($vers =~ /11\./) {
return 'pa-hpux-11';
}
}
elsif ($os =~ /aix/) {
return 'ppc-aix-5';
}
elsif ($os =~ /solaris/) {
if ($arch =~ /sun4/) {
return 'sparc-solaris';
}
elsif ($arch =~ /.86/) {
return 'x86-solaris';
}
}
elsif ($os =~ /darwin/) {
return 'universal-macosx';
}
elsif ($os =~ /freebsd/) {
if ($arch =~ /.86/) {
if($vers =~ /6\../ ) {
return 'x86-freebsd-6';
}
}
elsif ($arch =~ /amd64/) {
if ($vers =~ /6\../ ) {
return 'amd64-freebsd-6';
}
}
}
return '';
}
sub flags {
my $os = lc $^O;
my $is_win32 = 0;
my (@cppflags, @ldflags, @libs);
if ($os =~ /(win32)/) {
$os = $1;
$is_win32 = 1;
@cppflags = ('-DWIN32', '-D_CRT_SECURE_NO_DEPRECATE');
@libs = qw(kernel32 user32 advapi32 ws2_32 netapi32 shell32 pdh version comsupp wbemuuid);
}
elsif ($os =~ /(linux)/) {
$os = $1;
}
elsif ($os =~ /(hpux)/) {
$os = $1;
@libs = qw(nsl nm);
}
elsif ($os =~ /(aix)/) {
$os = $1;
@libs = qw(odm cfg perfstat);
}
elsif ($os =~ /(solaris)/) {
$os = $1;
@libs = qw(nsl socket kstat);
}
elsif ($os =~ /(darwin)/) {
$os = $1;
@cppflags = ('-DDARWIN');
@ldflags = ('-framework CoreServices', '-framework IOKit');
if (-e "/usr/local/libproc.h") {
push @cppflags, '-DDARWIN_HAS_LIBPROC_H';
}
}
elsif ($os =~ /bsd/) {
$os = 'darwin';
@libs = qw(kvm);
}
push @cppflags,
'-I../../include',
"-I../../src/os/$os";
unless ($is_win32) {
push @cppflags, '-U_FILE_OFFSET_BITS';
}
my(@src) = (<../../src/*.c>, <../../src/os/$os/*.c>, <../../src/os/$os/*.cpp>);
return {
is_win32 => $is_win32,
os => $os,
libs => \@libs,
cppflags => \@cppflags,
ldflags => \@ldflags,
src => \@src,
};
}
#perl -Mlib=.. -MSigarBuild -e cppflags
sub cppflags {
print join ' ', @{ flags()->{cppflags} };
}
sub ldflags {
print join ' ', @{ flags()->{ldflags} };
}
sub libs {
print join ' ', @{ flags()->{libs} };
}
sub os {
print flags()->{os};
}
sub src {
print join ' ', @{ flags()->{src} };
}
sub inline_src {
my $stdout = @_ ? 0 : 1;
my $flags = shift || flags();
my $src = $flags->{src};
my $dir = $flags->{build_dir} || $ARGV[0];
my(@files);
#unlink symlinks incase of nfs shared dir...
for my $file (grep { -l } <*.c>) {
unlink $file;
}
for my $file (@$src) {
my $cf = basename $file;
#sigar.c -> libsigar.c else
#sigar.o and perl Sigar.o clash on case insensitive filesystems
$cf = 'libsigar.c' if $cf eq 'sigar.c';
if ($dir) {
$cf = join '/', $dir, $cf;
$file = File::Spec->rel2abs($file);
}
push @files, $cf;
if ($flags->{is_win32}) {
copy($file, $cf);
}
else {
symlink($file, $cf) unless -e $cf;
}
}
if ($stdout) {
print join ' ', @files;
}
else {
return @files;
}
}
sub scm_revision {
my $rev;
$rev = `git rev-parse --short HEAD`;
if ($rev) {
chomp $rev;
}
else {
$rev = "exported";
}
return $rev;
}
sub build_date {
return POSIX::strftime("%m/%d/%Y %I:%M %p", localtime);
}
sub find_file {
my $file = shift;
for my $dir (qw(../.. .. .)) {
my $pfile = "$dir/$file";
return $pfile if -e $pfile;
}
return $file;
}
sub version_properties {
my $props = {};
my $file = $_[0] || find_file('version.properties');
open my $fh, $file or die "open $file: $!";
while (<$fh>) {
chomp;
my($key,$val) = split '=';
next unless $key and defined $val;
$props->{$key} = $val;
}
close $fh;
$props->{'scm.revision'} = scm_revision();
$props->{'build.date'} = build_date();
$props->{'version'} =
join '.', map $props->{"version.$_"}, qw(major minor maint);
$props->{'version.build'} = $ENV{BUILD_NUMBER} || '0';
$props->{'version.string'} =
join '.', $props->{'version'}, $props->{'version.build'};
return $props;
}
sub resource_file {
my(@args) = @_ ? @_ : @ARGV;
version_file(find_file("src/os/win32/sigar.rc.in"), "sigar.rc", @args);
}
sub version_file {
local $_;
my($source, $dest, %filters);
my(@args) = @_ ? @_ : @ARGV;
for (@args) {
if (/=/) {
my($key,$val) = split '=', $_, 2;
$filters{$key} = $val;
}
else {
if ($source) {
$dest = $_;
}
else {
$source = $_;
}
}
}
unless ($source) {
$dest = 'sigar_version.c';
$source = find_file("src/$dest.in");
}
my $props = version_properties();
while (my($key,$val) = each %$props) {
$key = uc $key;
$key =~ s/\./_/;
$filters{$key} = $val;
}
my $re = join '|', keys %filters;
open my $in, $source or die "open $source: $!";
my $out;
if ($dest) {
open $out, '>', $dest or die "open $dest: $!";
}
else {
$out = \*STDOUT;
}
while (<$in>) {
s/\@\@($re)\@\@/$filters{$1}/go;
print $out $_;
}
close $in;
close $out if $dest;
}
1;
__END__

View File

@ -1,8 +1,25 @@
#
# Copyright (c) 2007-2009 Hyperic, Inc.
# Copyright (c) 2009 SpringSource, Inc.
# Copyright (c) 2009-2010 VMware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#extension source generator for all bindings
package SigarWrapper;
use strict;
use Config;
use Cwd;
use Exporter;
use File::Path;
@ -12,57 +29,6 @@ use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(generate);
sub archname {
my $os = lc $^O;
my $vers = $Config{osvers};
my $arch = $Config{archname};
if ($os =~ /win32/) {
return 'x86-winnt';
}
elsif ($os =~ /linux/) {
if ($arch =~ /_64/) {
return 'amd64-linux';
}
else {
return 'x86-linux';
}
}
elsif ($os =~ /hpux/) {
if ($vers =~ /11\./) {
return 'pa-hpux-11';
}
}
elsif ($os =~ /aix/) {
return 'ppc-aix-5';
}
elsif ($os =~ /solaris/) {
if ($arch =~ /sun4/) {
return 'sparc-solaris';
}
elsif ($arch =~ /.86/) {
return 'x86-solaris';
}
}
elsif ($os =~ /darwin/) {
return 'universal-macosx';
}
elsif ($os =~ /freebsd/) {
if($arch =~ /.86/) {
if($vers =~ /6\../ ) {
return 'x86-freebsd-6';
}
}
elsif( $arch =~ /amd64/) {
if($vers =~ /6\../ ) {
return 'amd64-freebsd-6';
}
}
}
return '';
}
my %platforms = (
A => "AIX",
D => "Darwin",
@ -77,10 +43,11 @@ my %has_name_arg = map { $_, 1 } qw(FileSystemUsage DiskUsage
FileAttrs DirStat DirUsage
NetInterfaceConfig NetInterfaceStat);
my %proc_no_arg = map { $_, 1 } qw(stat);
my %get_not_impl = map { $_, 1 } qw(net_address net_route net_connection net_stat cpu_perc
who cpu_info file_system); #list funcs only
arp who cpu_info file_system); #list funcs only
sub supported_platforms {
my $p = shift;
@ -514,34 +481,44 @@ use vars qw(%classes %cmds);
{
name => 'vendor', type => 'String',
desc => 'CPU vendor id',
plat => 'AFLHSW'
plat => '*'
},
{
name => 'model', type => 'String',
desc => 'CPU model',
plat => 'AFLHSW'
plat => '*'
},
{
name => 'mhz', type => 'Int',
desc => 'CPU speed',
plat => 'AFHLSW'
desc => 'Current CPU speed',
plat => '*'
},
{
name => 'mhz_max', type => 'Int',
desc => 'Maximum CPU speed',
plat => 'DL'
},
{
name => 'mhz_min', type => 'Int',
desc => 'Maximum CPU speed',
plat => 'DL'
},
{
name => 'cache_size', type => 'Long',
desc => 'CPU cache size',
plat => 'AL'
plat => 'ADL'
},
{
name => 'total_cores', type => 'Int',
desc => 'Total CPU cores (logical)',
name => 'total_cores', type => 'Int',
desc => 'Total CPU cores (logical)',
},
{
name => 'total_sockets', type => 'Int',
desc => 'Total CPU sockets (physical)',
name => 'total_sockets', type => 'Int',
desc => 'Total CPU sockets (physical)',
},
{
name => 'cores_per_socket', type => 'Int',
desc => 'Number of CPU cores per CPU socket',
name => 'cores_per_socket', type => 'Int',
desc => 'Number of CPU cores per CPU socket',
},
],
Uptime => [
@ -551,6 +528,7 @@ use vars qw(%classes %cmds);
plat => '*'
},
],
ProcMem => [
{
name => 'size', type => 'Long',
@ -651,6 +629,51 @@ use vars qw(%classes %cmds);
plat => '*'
},
],
ProcDiskIO => [
{
name => 'bytes_read', type => 'Long',
desc => 'Bytes Read',
plat => 'LW'
},
{
name => 'bytes_written', type => 'Long',
desc => 'Bytes Written',
plat => 'LW'
},
{
name => 'bytes_total', type => 'Long',
desc => 'Bytes Total',
plat => 'LWAHS'
}
],
ProcCumulativeDiskIO => [
{
name => 'bytes_read', type => 'Long',
desc => 'Bytes Read from Start',
plat => 'LW'
},
{
name => 'bytes_written', type => 'Long',
desc => 'Bytes Written from Start',
plat => 'LW'
},
{
name => 'bytes_total', type => 'Long',
desc => 'Bytes Total from Start',
plat => 'LWAHS'
}
],
DumpPidCache => [
{
name => 'dummy', type => 'Long',
desc => 'Dummy',
plat => 'LWAHS'
}
],
ProcState => [
{
name => 'state', type => 'Char',
@ -987,6 +1010,11 @@ use vars qw(%classes %cmds);
desc => '',
plat => ''
},
{
name => 'default_gateway_interface', type => 'String',
desc => '',
plat => ''
},
{
name => 'host_name', type => 'String',
desc => '',
@ -1091,6 +1119,18 @@ use vars qw(%classes %cmds);
desc => '',
plat => '*'
},
{
name => 'address6', type => 'NetAddress',
desc => '',
},
{
name => 'prefix6_length', type => 'Int',
desc => '',
},
{
name => 'scope6', type => 'Int',
desc => '',
},
{
name => 'destination', type => 'NetAddress',
desc => '',
@ -1121,6 +1161,11 @@ use vars qw(%classes %cmds);
desc => '',
plat => 'DFL'
},
{
name => 'tx_queue_len', type => 'Int',
desc => '',
plat => 'L'
},
],
NetInterfaceStat => [
{
@ -1421,6 +1466,33 @@ use vars qw(%classes %cmds);
plat => '*'
},
],
Arp => [
{
name => 'ifname', type => 'String',
desc => '',
plat => '*'
},
{
name => 'hwaddr', type => 'NetAddress',
desc => '',
plat => '*'
},
{
name => 'type', type => 'String',
desc => '',
plat => '*'
},
{
name => 'address', type => 'NetAddress',
desc => '',
plat => '*'
},
{
name => 'flags', type => 'Long',
desc => '',
plat => '*'
},
],
Who => [
{
name => 'user', type => 'String',
@ -1625,6 +1697,13 @@ $comment
EOF
}
sub erl_warning_comment {
my $self = shift;
my $comment = $self->warning_comment;
$comment =~ s/^/% /mg;
"$comment\n";
}
sub generate {
my($lang, $dir) = @_ ? @_ : @ARGV;
@ -1689,7 +1768,9 @@ sub uptodate {
return 1;
}
my(%warning_comment) = map { $_ => \&c_warning_comment } qw(c h java);
my(%warning_comment) =
((map { $_ => \&c_warning_comment } qw(c h java)),
(map { $_ => \&erl_warning_comment } qw(erl hrl)));
sub create {
my($self, $file) = @_;
@ -2091,8 +2172,8 @@ EOF
my $member = $field->{member} || $name;
my $desc = $field->{desc} || $name;
(my $jname = $name) =~ s/_(\w)/\u$1/g;
my $getter = "get\u$jname";
$jname = jname($jname);
my $getter = "get\u$jname";
$jname = jname($jname);
my $sig = qq("$field_types{$type}");
my $set = "JENV->Set${type}Field";
my $get = "JENV->Get${type}Field";
@ -2350,7 +2431,7 @@ sub generate_class {
if ($func->{num_args} == 1) {
my $arg_type;
if ($func->{is_proc}) {
$arg_type = 'NUM2UINT';
$arg_type = 'OBJ2PID';
}
else {
$arg_type = 'StringValuePtr';
@ -2364,8 +2445,9 @@ static VALUE $ruby_class;
static VALUE rb_sigar_$cname($proto)
{
SIGAR_GET;
int status;
sigar_t *sigar = rb_sigar_get(obj);
$func->{sigar_type} *RETVAL = malloc(sizeof(*RETVAL));
if ((status = $func->{sigar_function}($args, RETVAL)) != SIGAR_OK) {
@ -2777,36 +2859,164 @@ sub finish {
$self->SUPER::finish;
}
#XXX not currently supporting netware
package SigarWrapper::Netware;
package SigarWrapper::Erlang;
use vars qw(@ISA);
@ISA = qw(SigarWrapper);
my %field_types = (
Long => "esigar_encode_ulonglong",
Double => "esigar_encode_double",
Int => "esigar_encode_long",
Char => "esigar_encode_char",
String => "esigar_encode_string",
NetAddress => "esigar_encode_netaddr",
);
my $c_file = 'priv/gen/sigar_drv_gen.c';
my $h_file = 'priv/gen/sigar.hrl';
my $g_file = 'priv/gen/sigar_gen.hrl';
sub sources {
return $c_file;
}
sub start {
my $self = shift;
$self->SUPER::start;
$self->{dfh} = $self->create('javasigar_generated.def');
$self->{cfh} = $self->create($c_file);
$self->{hfh} = $self->create($h_file);
$self->{gfh} = $self->create($g_file);
}
sub generate_class {
my($self, $func) = @_;
my $cfh = $self->{cfh};
my $cname = $func->{cname};
my $parse_args = "";
my $vars = "";
my $args = 'sigar';
if ($func->{num_args} == 1) {
if ($func->{is_proc}) {
$parse_args = 'pid = esigar_pid_get(sigar, bytes);';
$vars = "long $func->{arg};\n";
}
else {
$parse_args .= 'name = bytes;';
$vars = "char *$func->{arg};\n";
}
$args .= ", $func->{arg}";
}
my $encoder = "esigar_encode_$cname";
my $n = scalar @{ $func->{fields} };
print $cfh <<EOF;
static void $encoder(ei_x_buff *x,
$func->{sigar_type} *$cname)
{
ei_x_encode_list_header(x, $n);
EOF
for my $field (@{ $func->{fields} }) {
my $name = $field->{name};
my $type = $field_types{ $field->{type} };
print $cfh qq{ $type(x, "$name", $cname->$name);\n};
}
print $cfh " ei_x_encode_empty_list(x);\n}\n\n";
print $cfh <<EOF if $func->{has_get};
static int e$func->{sigar_function}(ErlDrvPort port, sigar_t *sigar, char *bytes)
{
int status;
ei_x_buff x;
$func->{sigar_type} $cname;
$vars
$parse_args
ESIGAR_NEW(&x);
if ((status = $func->{sigar_function}($args, &$cname)) == SIGAR_OK) {
ESIGAR_OK(&x);
$encoder(&x, &$cname);
ESIGAR_SEND(port, &x);
}
else {
ESIGAR_ERROR(&x, sigar, status);
}
return status;
}
EOF
}
my(@nongens) =
qw{net_interface_list net_route_list net_connection_list
file_system_list cpu_info_list arp_list who_list
loadavg};
sub finish {
my $self = shift;
my $fh = $self->{dfh};
for my $func (@{ $self->{nativefunc} }) {
#$fh->println($nativefunc) if $impl;
my $mappings = $self->get_mappings;
my $cfh = $self->{cfh};
my $hfh = $self->{hfh};
my $gfh = $self->{gfh};
my $ncmd = 1;
for my $ngen (@nongens) {
my $cmd = uc $ngen;
print $cfh "#define ESIGAR_$cmd $ncmd\n";
print $hfh "-define($cmd, $ncmd).\n";
$ncmd++;
}
my $jsigar = "../../src/jni/javasigar.c";
my(%alias) = (x => 'Sigar');
open JSIGAR, $jsigar or die "open $jsigar: $!";
while (<JSIGAR>) {
next unless /SIGAR_JNI([a-z]?)\(([A-Za-z_]+)\)/;
my $class = "";
if ($1) {
$class = $alias{$1} . "_";
for my $func (@$mappings) {
next unless $func->{has_get};
my $name = $func->{cname};
my $cmd = uc $name;
my $nargs = 1 + $func->{num_args};
print $cfh "#define ESIGAR_$cmd $ncmd\n";
print $hfh "-define($cmd, $ncmd).\n";
print $hfh "-export([$name/$nargs]).\n";
$ncmd++;
}
print $cfh <<EOF;
static int esigar_dispatch(ErlDrvPort port, sigar_t *sigar, int cmd, char *bytes) {
switch (cmd) {
EOF
for my $func (@$mappings) {
next unless $func->{has_get};
my $name = $func->{cname};
my $cmd = uc $name;
my $arg = "";
if ($func->{num_args}) {
$arg = ", Arg";
}
$fh->println("Java_org_hyperic_sigar_$class$2");
print $gfh <<EOF;
$name({sigar, S}$arg) ->
do_command(S, ?$cmd$arg).
EOF
print $cfh <<EOF
case ESIGAR_$cmd:
return e$func->{sigar_function}(port, sigar, bytes);
EOF
}
close JSIGAR;
print $cfh <<EOF;
default:
esigar_notimpl(port, sigar, cmd);
return SIGAR_ENOTIMPL;
}
}
EOF
$self->SUPER::finish;
}

View File

@ -1,3 +1,19 @@
/*
* Copyright (c) 2004 Hyperic, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using Hyperic.Sigar;

View File

@ -1,3 +1,19 @@
/*
* Copyright (c) 2004-2005 Hyperic, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using Hyperic.Sigar;

View File

@ -1,3 +1,19 @@
/*
* Copyright (c) 2004 Hyperic, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using Hyperic.Sigar;

View File

@ -1,3 +1,19 @@
/*
* Copyright (c) 2004-2005 Hyperic, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using Hyperic.Sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2004-2006 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;

12
bindings/erl/Makefile Normal file
View File

@ -0,0 +1,12 @@
all:
perl -Mlib=.. -MSigarWrapper -e generate Erlang .
cd src && make
cd c_src && make
shell:
make all
erl -pa ebin
clean:
cd src && make clean
cd c_src && make clean

View File

@ -0,0 +1,40 @@
## SIGAR driver for Erlang
If you're not already familar with sigar, have a look at the [SIGAR Wiki](http://sigar.hyperic.com).
Also helpful: **../../include/sigar.h**, **../*/examples** and
**../java/src/org/hyperic/sigar/cmd/** to get an idea of what you can do.
### Building
The other bindings/* inline the libsigar sources by default, haven't done that yet for erl.
So, you'll need a libsigar to link against, one of:
Ant build:
cd ../java ; ant
ln -s sigar-bin/lib/libsigar-amd64-linux.so sigar-lib/lib/libsigar.so
Or, download release binary created by the ant build:
curl -o priv/libsigar.so http://svn.hyperic.org/projects/sigar_bin/dist/SIGAR_1_6_2/lib/libsigar-amd64-linux.so
Or, top-level autotools build (WIP):
cd ../.. ; ./autogen.sh && ./configure && make install
Once you have a libsigar in place, just run **make** and have a look at the **examples/**.
Note that the majority of the driver code is generated by **../SigarWrapper.pm** and output to **priv/gen**.
### ToDo/Help Wanted
* Fill out the **examples/** - currently weaksauce in part due to me having just a few hours w/ Erlang
* Build system - doubt the current will work anywhere cept Linux
* EUnit
* Other stuff Erlangers know that I don't

View File

@ -0,0 +1,16 @@
GCC = gcc
OTP_ROOT = $(shell ./check_otp -root)
EI_ROOT = $(shell ./check_otp -ei)
EI_LIB = $(EI_ROOT)/lib
EI_INC = $(EI_ROOT)/include
SIGAR_LIB = ../../java/sigar-bin/lib
LDFLAGS = -shared -L${EI_LIB} -lei -lpthread -L${SIGAR_LIB} -L../priv -lsigar
SRCS = sigar_drv.c
OUTPUT = ../priv/sigar_drv.so
CFLAGS = -Wall -fPIC -I../../../include -I${OTP_ROOT}/usr/include -I${EI_INC} -o ${OUTPUT}
all:
${GCC} ${SRCS} ${LDFLAGS} ${CFLAGS}
clean:
rm -rf ${OUTPUT} ../priv/gen/*.c ../priv/gen/*.hrl

17
bindings/erl/c_src/check_otp Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
#copied from jungerl
if [ "$1" == "-root" -o "$1" == "" ]; then
erl -noinput -eval 'io:format("~s~n", [code:root_dir()]), halt(0).'
fi
if [ "$1" == "-ei" -o "$1" == "" ]; then
erl -noinput -eval \
'case code:lib_dir("erl_interface") of
{error, bad_name} ->
io:format("not found~n", []),
halt(1);
LibDir ->
io:format("~s~n", [LibDir]),
halt(0)
end.'
fi

View File

@ -0,0 +1,439 @@
/*
* Copyright (c) 2009 SpringSource, Inc.
* Copyright (c) 2010 VMware, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <erl_driver.h>
#include <ei.h>
#include <ctype.h>
#include <string.h>
#include "sigar.h"
#include "sigar_fileinfo.h"
#include "sigar_format.h"
#include "sigar_ptql.h"
typedef struct {
ErlDrvPort port;
sigar_t *sigar;
} sigar_drv_t;
static ErlDrvData start(ErlDrvPort port, char *cmd) {
sigar_drv_t *sd = (sigar_drv_t *)driver_alloc(sizeof(*sd));
int status;
status = sigar_open(&sd->sigar);
if (status != SIGAR_OK) {
sd->sigar = NULL;
driver_failure_posix(port, status);
}
sd->port = port;
return (ErlDrvData)sd;
}
static void stop(ErlDrvData handle) {
sigar_drv_t *driver_data = (sigar_drv_t *)handle;
if (driver_data->sigar) {
sigar_close(driver_data->sigar);
}
}
#ifdef SIGAR_64BIT
#define str2pid(value) strtoull(value, NULL, 10)
#else
#define str2pid(value) strtoul(value, NULL, 10)
#endif
static sigar_pid_t esigar_pid_get(sigar_t *sigar, char *pid)
{
if (isdigit(*pid)) {
return str2pid(pid);
}
else if ((*pid == '$') && (*(pid + 1) == '$')) {
return sigar_pid_get(sigar);
}
else {
/* XXX cache queries */
sigar_ptql_query_t *query;
sigar_ptql_error_t error;
int status =
sigar_ptql_query_create(&query, (char *)pid, &error);
if (status == SIGAR_OK) {
sigar_pid_t qpid;
status = sigar_ptql_query_find_process(sigar, query, &qpid);
sigar_ptql_query_destroy(query);
if (status == SIGAR_OK) {
return qpid;
}
}
}
return 0;
}
static void esigar_to_strlist(ei_x_buff *x,
char **data, unsigned long number)
{
unsigned long i;
ei_x_encode_list_header(x, number);
for (i=0; i<number; i++) {
ei_x_encode_string(x, data[i]);
}
ei_x_encode_empty_list(x);
}
typedef void (*esigar_encoder_func_t)(ei_x_buff *x, void *data);
static void esigar_to_list(ei_x_buff *x,
char *data, unsigned long number, int size,
esigar_encoder_func_t encoder)
{
unsigned long i;
ei_x_encode_list_header(x, number);
for (i=0; i<number; i++, data += size) {
encoder(x, data);
}
ei_x_encode_empty_list(x);
}
#define ESIGAR_NEW(x) \
ei_x_new_with_version(x)
#define ESIGAR_OK(x) \
ei_x_encode_tuple_header(x, 2); \
ei_x_encode_atom(x, "ok")
#define ESIGAR_ERROR(x, sigar, status) \
ei_x_encode_tuple_header(x, 2); \
ei_x_encode_atom(x, "error"); \
ei_x_encode_string(x, sigar_strerror(sigar, status))
#define ESIGAR_SEND(p, x) \
driver_output(port, (x)->buff, (x)->index); \
ei_x_free(x)
#define esigar_encode_long(x, k, v) \
ei_x_encode_tuple_header(x, 2); \
ei_x_encode_atom(x, k); \
ei_x_encode_long(x, v)
#define esigar_encode_ulonglong(x, k, v) \
ei_x_encode_tuple_header(x, 2); \
ei_x_encode_atom(x, k); \
ei_x_encode_ulonglong(x, v)
#define esigar_encode_char(x, k, v) \
ei_x_encode_tuple_header(x, 2); \
ei_x_encode_atom(x, k); \
ei_x_encode_char(x, v)
#define esigar_encode_string(x, k, v) \
ei_x_encode_tuple_header(x, 2); \
ei_x_encode_atom(x, k); \
ei_x_encode_string(x, v)
#define esigar_encode_double(x, k, v) \
ei_x_encode_tuple_header(x, 2); \
ei_x_encode_atom(x, k); \
ei_x_encode_double(x, v)
static void esigar_encode_net_address(ei_x_buff *x, const char *key,
sigar_net_address_t *address)
{
char buf[SIGAR_INET6_ADDRSTRLEN];
sigar_net_address_to_string(NULL, address, buf);
esigar_encode_string(x, key, buf);
}
#define esigar_encode_netaddr(x, k, v) \
esigar_encode_net_address(x, k, &v)
static void esigar_notimpl(ErlDrvPort port, sigar_t *sigar, int cmd)
{
ei_x_buff x;
ESIGAR_NEW(&x);
ESIGAR_ERROR(&x, sigar, SIGAR_ENOTIMPL);
ESIGAR_SEND(port, &x);
}
#include "../priv/gen/sigar_drv_gen.c"
static void esigar_loadavg_get(ErlDrvPort port, sigar_t *sigar)
{
int status;
ei_x_buff x;
sigar_loadavg_t loadavg;
ESIGAR_NEW(&x);
if ((status = sigar_loadavg_get(sigar, &loadavg)) == SIGAR_OK) {
ESIGAR_OK(&x);
ei_x_encode_list_header(&x, 3);
ei_x_encode_double(&x, loadavg.loadavg[0]);
ei_x_encode_double(&x, loadavg.loadavg[1]);
ei_x_encode_double(&x, loadavg.loadavg[2]);
ei_x_encode_empty_list(&x);
}
else {
ESIGAR_ERROR(&x, sigar, status);
}
ESIGAR_SEND(port, &x);
}
static void esigar_net_connection_list_get(ErlDrvPort port, sigar_t *sigar,
unsigned int flags)
{
int status;
ei_x_buff x;
sigar_net_connection_list_t list;
ei_x_new_with_version(&x);
if ((status = sigar_net_connection_list_get(sigar, &list, flags) == SIGAR_OK)) {
ESIGAR_OK(&x);
esigar_to_list(&x,
(char *)&list.data[0], list.number,
sizeof(*list.data),
(esigar_encoder_func_t)esigar_encode_net_connection);
sigar_net_connection_list_destroy(sigar, &list);
}
else {
ESIGAR_ERROR(&x, sigar, status);
}
ESIGAR_SEND(port, &x);
}
static void esigar_net_interface_list_get(ErlDrvPort port, sigar_t *sigar)
{
int status;
ei_x_buff x;
sigar_net_interface_list_t list;
ei_x_new_with_version(&x);
if ((status = sigar_net_interface_list_get(sigar, &list) == SIGAR_OK)) {
ESIGAR_OK(&x);
esigar_to_strlist(&x, list.data, list.number);
sigar_net_interface_list_destroy(sigar, &list);
}
else {
ESIGAR_ERROR(&x, sigar, status);
}
ESIGAR_SEND(port, &x);
}
static void esigar_file_system_list_get(ErlDrvPort port, sigar_t *sigar)
{
int status;
ei_x_buff x;
sigar_file_system_list_t list;
ei_x_new_with_version(&x);
if ((status = sigar_file_system_list_get(sigar, &list) == SIGAR_OK)) {
ESIGAR_OK(&x);
esigar_to_list(&x,
(char *)&list.data[0], list.number,
sizeof(*list.data),
(esigar_encoder_func_t)esigar_encode_file_system);
sigar_file_system_list_destroy(sigar, &list);
}
else {
ESIGAR_ERROR(&x, sigar, status);
}
ESIGAR_SEND(port, &x);
}
static void esigar_net_route_list_get(ErlDrvPort port, sigar_t *sigar)
{
int status;
ei_x_buff x;
sigar_net_route_list_t list;
ei_x_new_with_version(&x);
if ((status = sigar_net_route_list_get(sigar, &list) == SIGAR_OK)) {
ESIGAR_OK(&x);
esigar_to_list(&x,
(char *)&list.data[0], list.number,
sizeof(*list.data),
(esigar_encoder_func_t)esigar_encode_net_route);
sigar_net_route_list_destroy(sigar, &list);
}
else {
ESIGAR_ERROR(&x, sigar, status);
}
ESIGAR_SEND(port, &x);
}
static void esigar_cpu_info_list_get(ErlDrvPort port, sigar_t *sigar)
{
int status;
ei_x_buff x;
sigar_cpu_info_list_t list;
ei_x_new_with_version(&x);
if ((status = sigar_cpu_info_list_get(sigar, &list) == SIGAR_OK)) {
ESIGAR_OK(&x);
esigar_to_list(&x,
(char *)&list.data[0], list.number,
sizeof(*list.data),
(esigar_encoder_func_t)esigar_encode_cpu_info);
sigar_cpu_info_list_destroy(sigar, &list);
}
else {
ESIGAR_ERROR(&x, sigar, status);
}
ESIGAR_SEND(port, &x);
}
static void esigar_arp_list_get(ErlDrvPort port, sigar_t *sigar)
{
int status;
ei_x_buff x;
sigar_arp_list_t list;
ei_x_new_with_version(&x);
if ((status = sigar_arp_list_get(sigar, &list) == SIGAR_OK)) {
ESIGAR_OK(&x);
esigar_to_list(&x,
(char *)&list.data[0], list.number,
sizeof(*list.data),
(esigar_encoder_func_t)esigar_encode_arp);
sigar_arp_list_destroy(sigar, &list);
}
else {
ESIGAR_ERROR(&x, sigar, status);
}
ESIGAR_SEND(port, &x);
}
static void esigar_who_list_get(ErlDrvPort port, sigar_t *sigar)
{
int status;
ei_x_buff x;
sigar_who_list_t list;
ei_x_new_with_version(&x);
if ((status = sigar_who_list_get(sigar, &list) == SIGAR_OK)) {
ESIGAR_OK(&x);
esigar_to_list(&x,
(char *)&list.data[0], list.number,
sizeof(*list.data),
(esigar_encoder_func_t)esigar_encode_who);
sigar_who_list_destroy(sigar, &list);
}
else {
ESIGAR_ERROR(&x, sigar, status);
}
ESIGAR_SEND(port, &x);
}
static void outputv(ErlDrvData handle, ErlIOVec *ev) {
sigar_drv_t *sd = (sigar_drv_t *)handle;
sigar_t *sigar = sd->sigar;
ErlDrvPort port = sd->port;
ErlDrvBinary *data = ev->binv[1];
int cmd = data->orig_bytes[0];
switch(cmd) {
case ESIGAR_NET_CONNECTION_LIST:
esigar_net_connection_list_get(port, sigar,
data->orig_bytes[1]);
break;
case ESIGAR_NET_INTERFACE_LIST:
esigar_net_interface_list_get(port, sigar);
break;
case ESIGAR_NET_ROUTE_LIST:
esigar_net_route_list_get(port, sigar);
break;
case ESIGAR_FILE_SYSTEM_LIST:
esigar_file_system_list_get(port, sigar);
break;
case ESIGAR_CPU_INFO_LIST:
esigar_cpu_info_list_get(port, sigar);
break;
case ESIGAR_ARP_LIST:
esigar_arp_list_get(port, sigar);
break;
case ESIGAR_WHO_LIST:
esigar_who_list_get(port, sigar);
break;
case ESIGAR_LOADAVG:
esigar_loadavg_get(port, sigar);
break;
default:
esigar_dispatch(port, sigar, cmd, &data->orig_bytes[1]);
break;
}
}
static ErlDrvEntry sigar_driver_entry = {
NULL, /* init */
start, /* startup */
stop, /* shutdown */
NULL, /* output */
NULL, /* ready_input */
NULL, /* ready_output */
"sigar_drv", /* name of the driver */
NULL, /* finish */
NULL, /* handle */
NULL, /* control */
NULL, /* timeout */
outputv, /* outputv */
NULL, /* ready_async */
NULL, /* flush */
NULL, /* call */
NULL, /* event */
ERL_DRV_EXTENDED_MARKER, /* ERL_DRV_EXTENDED_MARKER */
ERL_DRV_EXTENDED_MAJOR_VERSION, /* ERL_DRV_EXTENDED_MAJOR_VERSION */
ERL_DRV_EXTENDED_MAJOR_VERSION, /* ERL_DRV_EXTENDED_MINOR_VERSION */
ERL_DRV_FLAG_USE_PORT_LOCKING /* ERL_DRV_FLAGs */
};
DRIVER_INIT(sigar_driver) {
return &sigar_driver_entry;
}

1
bindings/erl/ebin/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.beam

32
bindings/erl/examples/arp.erl Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env escript
%%! -pz ebin
%
% Copyright (c) 2010 VMware, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
%
-include(sigar).
main(_) ->
{ok, S} = sigar:start(),
{ok, List} = sigar:arp_list(S),
lists:map(
fun(Arp) ->
lists:map(
fun(K) ->
io:format("~s\t", [sigar:get_value(K, Arp)]) end,
[address, hwaddr, type, ifname]),
io:format("~n")
end, List),
sigar:stop(S).

29
bindings/erl/examples/df.erl Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env escript
%
% Copyright (c) 2009 SpringSource, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
%
-include(sigar).
main(_) ->
{ok, S} = sigar:start(),
{ok, FsList} = sigar:file_system_list(S),
lists:map(
fun(Fs) ->
io:format("~s ~n", [sigar:get_value(dir_name, Fs)]) end,
FsList),
sigar:stop(S).

40
bindings/erl/examples/free.erl Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env escript
%
% Copyright (c) 2009 SpringSource, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
%
-include(sigar).
main(_) ->
{ok, S} = sigar:start(),
{ok, Mem} = sigar:mem(S),
io:format("\tTotal\tUsed\tFree~n"),
io:format("Mem: "),
lists:map(
fun(K) ->
io:format("~w\t", [sigar:get_value(K, Mem)/1024]) end,
[total, used, free]),
io:format("~n"),
{ok, Swap} = sigar:swap(S),
io:format("Swap: "),
lists:map(
fun(K) ->
io:format("~w\t", [sigar:get_value(K, Swap)/1024]) end,
[total, used, free]),
io:format("~n"),
io:format("RAM: ~wMB~n", [sigar:get_value(ram, Mem)]),
sigar:stop(S).

View File

@ -0,0 +1,30 @@
#!/usr/bin/env escript
%
% Copyright (c) 2009 SpringSource, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
%
-include(sigar).
main(_) ->
{ok, S} = sigar:start(),
{ok, Names} = sigar:net_interface_list(S),
lists:map(
fun(K) ->
{ok, Ifconfig} = sigar:net_interface_config(S, K),
io:format("~s ~s~n", [K, sigar:get_value(address, Ifconfig)]) end,
Names),
sigar:stop(S).

31
bindings/erl/examples/ps.erl Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env escript
%
% Copyright (c) 2009 SpringSource, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
%
-include(sigar).
main(_) ->
{ok, S} = sigar:start(),
{ok, Mem} = sigar:proc_mem(S, "$$"),
io:format("Size\tResident~n"),
lists:map(
fun(K) ->
io:format("~w\t", [sigar:get_value(K, Mem)/1024]) end,
[size, resident]),
io:format("~n"),
sigar:stop(S).

View File

@ -0,0 +1,34 @@
#!/usr/bin/env escript
%
% Copyright (c) 2009 SpringSource, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
%
-include(sigar).
main(_) ->
{ok, S} = sigar:start(),
case sigar:loadavg(S) of
{ok, Avg} ->
lists:map(
fun(A) ->
io:format("~w% ", [A]) end,
Avg);
{error, Err} ->
Err
end,
io:format("~n"),
sigar:stop(S).

31
bindings/erl/examples/who.erl Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env escript
%
% Copyright (c) 2009 SpringSource, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
%
-include(sigar).
main(_) ->
{ok, S} = sigar:start(),
{ok, List} = sigar:who_list(S),
lists:map(
fun(Who) ->
lists:map(
fun(K) ->
io:format("~s\t", [sigar:get_value(K, Who)]) end,
[user, device, host]),
io:format("~n")
end, List),
sigar:stop(S).

1
bindings/erl/priv/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.so

2
bindings/erl/priv/gen/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.c
*.hrl

11
bindings/erl/src/Makefile Normal file
View File

@ -0,0 +1,11 @@
ERLC=erlc
EBIN=../ebin
INCLUDE=../include
EFLAGS=-I ${INCLUDE} -o ${EBIN}
SRCS=`ls *.erl`
all:
${ERLC} ${EFLAGS} ${SRCS}
clean:
rm -rf ${EBIN}/*.beam

108
bindings/erl/src/sigar.erl Normal file
View File

@ -0,0 +1,108 @@
%
% Copyright (c) 2009 SpringSource, Inc.
% Copyright (c) 2010 VMware, Inc.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
%
-module(sigar).
% generated by SigarWrapper.pm
-include("../priv/gen/sigar.hrl").
-export([start/0, stop/1, get_value/2]).
% handrolled wrappers
-export([loadavg/1,
net_connection_list/2,
net_interface_list/1,
net_route_list/1,
file_system_list/1,
cpu_info_list/1,
arp_list/1,
who_list/1]).
-define(NETCONN_CLIENT, 0x01).
-define(NETCONN_SERVER, 0x02).
-define(SIGAR_NETCONN_TCP, 0x10).
-define(SIGAR_NETCONN_UDP, 0x20).
-define(SIGAR_NETCONN_RAW, 0x40).
-define(SIGAR_NETCONN_UNIX, 0x80).
start() ->
case load_driver() of
ok ->
S = open_port({spawn, 'sigar_drv'}, [binary]),
{ok, {sigar, S}};
{error, Err} ->
Msg = erl_ddll:format_error(Err),
{error, Msg}
end.
% handrolled wrappers
loadavg({sigar, S}) ->
do_command(S, ?LOADAVG).
net_connection_list({sigar, S}, F) ->
do_command(S, ?NET_CONNECTION_LIST, F).
net_interface_list({sigar, S}) ->
do_command(S, ?NET_INTERFACE_LIST).
net_route_list({sigar, S}) ->
do_command(S, ?NET_ROUTE_LIST).
file_system_list({sigar, S}) ->
do_command(S, ?FILE_SYSTEM_LIST).
cpu_info_list({sigar, S}) ->
do_command(S, ?CPU_INFO_LIST).
arp_list({sigar, S}) ->
do_command(S, ?ARP_LIST).
who_list({sigar, S}) ->
do_command(S, ?WHO_LIST).
% generated by SigarWrapper.pm
-include("../priv/gen/sigar_gen.hrl").
% XXX must be a better way
get_value(Key, List) ->
case lists:keysearch(Key,1,List) of
false ->
1;
{ value, {Key, N} } ->
N
end.
stop({sigar, S}) ->
unlink(S),
port_close(S).
load_driver() ->
Dir = filename:join([filename:dirname(code:which(sigar)), "..", "priv"]),
erl_ddll:load(Dir, "sigar_drv").
do_command(S, C) ->
port_command(S, [C]),
receive
{S, {data, Bin}} -> binary_to_term(Bin)
end.
do_command(S, C, A) ->
port_command(S, [C, A]),
receive
{S, {data, Bin}} -> binary_to_term(Bin)
end.

View File

@ -3,11 +3,10 @@
<classpathentry kind="src" path="build/src"/>
<classpathentry kind="src" path="hyperic_jni/src"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="lib/junit.jar"/>
<classpathentry kind="var" path="ANT_HOME/lib/ant.jar"/>
<classpathentry kind="var" path="ANT_HOME/lib/junit.jar"/>
<classpathentry kind="lib" path="hyperic_jni/lib/cpptasks.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/log4j.jar"/>
<classpathentry kind="lib" path="lib/mx4j-jmx.jar"/>
<classpathentry kind="lib" path="lib/ant.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>

View File

@ -4,7 +4,7 @@
<project name="Sigar" default="build" basedir=".">
<property file="version.properties"/>
<property file="../../version.properties"/>
<property name="sigar.version"
value="${version.major}.${version.minor}.${version.maint}"/>
@ -14,6 +14,7 @@
<property name="jni.define.name" value="SIGAR"/>
<property name="sigar-bin" location="sigar-bin"/>
<property name="sigar-bin-dir" location="${sigar-bin}"/>
<property name="jni.git" location="../../.git"/>
<property name="jni.bin" location="${sigar-bin}"/>
<property name="jni.source.dir" location="../.."/>
<property name="jni.src.java" value="hyperic_jni/src"/>
@ -55,6 +56,7 @@
<path id="alljars">
<path refid="libjars"/>
<fileset dir="${sigar-bin}/lib" includes="${sigar.jar}"/>
<fileset dir="${ant.library.dir}" includes="junit*.jar"/>
</path>
<target name="javadoc_check">
@ -83,21 +85,26 @@
doctitle="Sigar">
<group title="Sigar" packages="org.hyperic.sigar" />
<classpath refid="libjars"/>
<classpath><path path="${env.ANT_HOME}/lib/ant.jar"/></classpath>
<classpath><path path="${ant.library.dir}/ant.jar"/></classpath>
<bottom>Copyright &#169; ${copyright.year} <![CDATA[<a target="_top" href="http://www.hyperic.com/">Hyperic</a>]]>. All Rights Reserved.</bottom>
</javadoc>
</target>
<target name="compile">
<mkdir dir="${build}/classes"/>
<available classname="junit.framework.TestCase" property="junit.present">
<classpath refid="alljars"/>
</available>
<javac destdir="${build}/classes"
source="1.4" target="1.4"
sourcepath=""
debug="true"
classpathref="libjars">
<src path="${src}"/>
<src path="${build}/src"/>
<src path="${jni.src.java}"/>
<include name="**/*.java"/>
<exclude name="**/test/*.java" unless="junit.present"/>
</javac>
</target>
@ -116,7 +123,7 @@
<replace file="${version.tofile}">
<replacefilter token="@@BUILD_DATE@@" value="${BUILD_DATE}"/>
<replacefilter token="@@VERSION_STRING@@" value="${sigar.version}.${version.build}"/>
<replacefilter token="@@SCM_REVISION@@" value="${sigar.scmrev}"/>
<replacefilter token="@@SCM_REVISION@@" value="${jni.scmrev}"/>
<replacefilter token="@@ARCHNAME@@" value="${jni.libarch}"/>
<replacefilter token="@@ARCHLIB@@" value="${jni.libname.full}"/>
<replacefilter token="@@BINNAME@@" value="${jni.project.archname}"/>
@ -128,63 +135,16 @@
</replace>
</target>
<target name="check-svn">
<condition property="svn.available">
<and>
<available file=".svn" type="dir"/>
<available file="svn" type="file">
<filepath>
<pathelement path="${env.PATH}"/>
</filepath>
</available>
</and>
</condition>
</target>
<target name="svn-revision" if="svn.available">
<exec executable="svnversion" dir="."
outputproperty="sigar.scmrev"
failifexecutionfails="false">
<arg value="."/>
</exec>
<echo message="SIGAR svn revision #${sigar.scmrev}"/>
</target>
<target name="check-git">
<condition property="git.available">
<and>
<available file="../../.git" type="dir"/>
<available file="git" type="file">
<filepath>
<pathelement path="${env.PATH}"/>
</filepath>
</available>
</and>
</condition>
</target>
<target name="git-revision" if="git.available">
<exec executable="git" dir="."
outputproperty="sigar.scmrev"
failifexecutionfails="false">
<arg value="rev-parse"/>
<arg value="--short"/>
<arg value="HEAD"/>
</exec>
<echo message="SIGAR git revision #${sigar.scmrev}"/>
</target>
<target name="sigar-version" depends="check-svn,svn-revision,check-git,git-revision">
<target name="sigar-version">
<tstamp>
<format property="BUILD_DATE" pattern="MM/dd/yyyy hh:mm aa"/>
</tstamp>
<!-- in the case of release source builds -->
<property name="sigar.scmrev" value="exported"/>
<echo message="SIGAR git revision ${jni.scmrev}"/>
<antcall target="version-file">
<param name="version.file"
value="src/org/hyperic/sigar/SigarVersion.java"/>
value="src/org/hyperic/sigar/Version.java"/>
</antcall>
<antcall target="version-file">
@ -196,15 +156,6 @@
value="${build}/src/sigar_version.c"/>
</antcall>
<antcall target="version-file">
<param name="version.file.srcdir"
value="../.."/>
<param name="version.file"
value="src/os/netware/sigar.def"/>
<param name="version.tofile"
value="${build}/src/sigar.def"/>
</antcall>
<antcall target="version-file">
<param name="version.file.srcdir"
value="../.."/>
@ -259,6 +210,7 @@
<include name="src/*.c"/>
<exclude name="src/sigar_main.c"/>
<include name="src/os/${jni.src}/*.c"/>
<include name="src/os/${jni.src}/*.cpp"/>
<include name="bindings/java/src/jni/*.c"/>
<include name="bindings/java/src/${win32.jni}/*.cpp"/>
<include name="bindings/java/src/${win32.jni}/*.c"/>
@ -290,12 +242,6 @@
<condition property="jni.libset.libs" value="odm,cfg,perfstat,pthreads">
<isset property="aix"/>
</condition>
<copy toDir="${sigar-bin}/lib">
<fileset dir="lib">
<include name="pdh.dll"/>
</fileset>
</copy>
</target>
<target name="copy-includes">
@ -400,9 +346,11 @@
<arg value="version"/>
</java>
<property name="junit.mx" value="-Dcom.sun.management.jmxremote"/>
<junit printsummary="yes" fork="yes"
haltonfailure="yes" showoutput="true">
<jvmarg line="${junit.args}"/>
<jvmarg line="${junit.args} ${junit.mx}"/>
<classpath refid="alljars"/>
<formatter type="xml"/>
@ -462,7 +410,6 @@
<include name="lib/*.lib"/>
</fileset>
<fileset dir=".">
<include name="lib/junit.jar"/>
<include name="lib/log4j.jar"/>
</fileset>
</copy>
@ -531,10 +478,10 @@
<target name="dist-common" depends="javadoc,dist-bindings">
<copy toDir="${dist}" overwrite="true">
<fileset dir="../..">
<include name="AUTHORS"/>
<include name="README"/>
<include name="COPYING"/>
<include name="LICENSES"/>
<include name="EXCEPTIONS"/>
<include name="LICENSE"/>
<include name="NOTICE"/>
<include name="ChangeLog"/>
</fileset>
</copy>
@ -552,6 +499,7 @@
<copy toDir="${dist.src}">
<fileset dir="../..">
<include name="version.properties"/>
<include name="include/*.h"/>
<include name="src/**/*.h"/>
<include name="src/**/*.c"/>
@ -560,10 +508,10 @@
<include name="bindings/java/**/*.java"/>
<include name="bindings/java/**/*.java.in"/>
<include name="bindings/java/**/*.c"/>
<include name="bindings/java/**/*.cpp"/>
<include name="bindings/java/**/*.h"/>
<include name="bindings/java/**/*.pl"/>
<include name="bindings/java/**/build.xml"/>
<include name="bindings/java/version.properties"/>
<include name="bindings/java/.classpath"/>
<include name="bindings/java/.project"/>
<include name="bindings/java/.sigar_shellrc"/>

View File

@ -1,3 +1,19 @@
/*
* Copyright (c) 2006 Hyperic, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.hyperic.sigar.*;
/*

View File

@ -1,3 +1,19 @@
/*
* Copyright (c) 2006 Hyperic, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.util.Arrays;
import java.util.List;
import org.hyperic.sigar.win32.Service;

View File

@ -1,19 +1,21 @@
<!--
Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
This file is part of SIGAR.
SIGAR is free software; you can redistribute it and/or modify
it under the terms version 2 of the GNU General Public License as
published by the Free Software Foundation. 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.
Copyright (c) 2009 Hyperic, Inc.
Copyright (c) 2009 SpringSource, Inc.
Copyright (c) 2009-2010 VMware, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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.
-->
<property environment="env"/>
@ -25,8 +27,6 @@ USA.
<property name="jni.src.java" value="src"/>
<property name="jni.libprefix" value="java"/>
<property name="jni.libversion" value=""/>
<property name="uni.sdk.version" value="4u"/>
<property name="osx.min" value="-mmacosx-version-min=10.3"/>
<property name="cpptasks.jar" location="lib/cpptasks.jar"/>
@ -56,15 +56,6 @@ USA.
<condition property="jni.javahome" value="${env.JAVA_HOME}">
<isset property="env.JAVA_HOME"/>
</condition>
<condition property="jni.javahome" value="${java.home}">
<not>
<isset property="jni.javahome"/>
</not>
</condition>
<echo>java.home=${jni.javahome}</echo>
<checksum file="${jni.javahome}/include/jni.h" property="jni.md5"/>
<condition property="linux">
<equals arg1="${os.name}" arg2="Linux"/>
@ -182,6 +173,10 @@ USA.
<libarch/>
<echo>java.home=${jni.javahome}</echo>
<checksum file="${jni.javahome}/include/jni.h" property="jni.md5"/>
<property name="jni.project.archname"
value="${project.name}-${jni.libarch}"/>
@ -195,11 +190,6 @@ USA.
<property name="jni.objdir" value="${build}/obj/${jni.libarch}"/>
<condition property="uni.sdk"
value="/Developer/SDKs/MacOSX10.${uni.sdk.version}.sdk">
<istrue value="${darwin}"/>
</condition>
<condition property="jni.cc" value="uni-cc">
<isset property="darwin"/>
</condition>
@ -282,6 +272,7 @@ USA.
<!-- HPUX -->
<compiler name="hp" if="hpux">
<compilerarg value="+Z"/>
<compilerarg value="+DD64" if="jni.arch64"/>
<defineset>
<define name="${jni.define.name}_HPUX"/>
@ -363,9 +354,7 @@ USA.
<compilerarg value="${uni.sdk}"/>
<compilerarg value="-arch"/>
<compilerarg value="${uni.arch}"/>
<compilerarg value="${osx.min}"/>
<sysincludepath location="/Developer/Headers/FlatCarbon"/>
<compilerarg value="-mmacosx-version-min=${osx.min}"/>
<defineset>
<define name="DARWIN"/>
@ -378,7 +367,7 @@ USA.
<linkerarg value="-Wl,-syslibroot,${uni.sdk}"/>
<linkerarg value="-arch"/>
<linkerarg value="${uni.arch}"/>
<linkerarg value="${osx.min}"/>
<linkerarg value="-mmacosx-version-min=${osx.min}"/>
<!-- for Gestalt() -->
<linkerarg value="-framework"/>

View File

@ -0,0 +1 @@
cpptasks.jar from http://github.com/dougm/ant-contrib-cpptasks

View File

@ -1,22 +0,0 @@
cpptasks.pat - provides support for HP cc and AIX xlc_r
the classes listed below are copy-n-pastes from existing cpptasks
classes, simply changed program names, flags, etc. the HP classes
were submitted as a patch to ant-contrib-developers on 10/09/2002,
to which there was no response, so have not bothered to submit the aix
patch.
SubsystemEnum patch is for the osf1 javac (aka tru64).
was throwing IllegalAccessError. why clone a final String[] anyhow??
CUtil patch is for jdk 1.3 (StringBuffer.indexOf is 1.4+)
GccLinker patch adds -arch to known flags for building universal binaries
added | derived from
--------------------------
HPCompiler | aCCCompiler
HPLinker | aCCLinker
XlcCompiler | VisualAgeCCompiler
XlcLinker | VisualAgeLinker
cpptasks.pat applies to:
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ant-contrib \
co -D"2006/04/28 15:00:00" cpptasks

View File

@ -1,696 +0,0 @@
Index: src/net/sf/antcontrib/cpptasks/CUtil.java
===================================================================
RCS file: /cvsroot/ant-contrib/cpptasks/src/net/sf/antcontrib/cpptasks/CUtil.java,v
retrieving revision 1.28
diff -u -r1.28 CUtil.java
--- src/net/sf/antcontrib/cpptasks/CUtil.java 17 Mar 2006 16:38:12 -0000 1.28
+++ src/net/sf/antcontrib/cpptasks/CUtil.java 29 Apr 2006 02:35:28 -0000
@@ -438,19 +438,19 @@
StringBuffer buf = new StringBuffer (attrValue);
int quotePos;
- for (quotePos = -1; (quotePos = buf.indexOf("\"", quotePos + 1)) >= 0;) {
+ for (quotePos = -1; (quotePos = buf.toString().indexOf("\"", quotePos + 1)) >= 0;) {
buf.deleteCharAt(quotePos);
buf.insert (quotePos, "&quot;");
quotePos += 5;
}
- for (quotePos = -1; (quotePos = buf.indexOf("<", quotePos + 1)) >= 0;) {
+ for (quotePos = -1; (quotePos = buf.toString().indexOf("<", quotePos + 1)) >= 0;) {
buf.deleteCharAt(quotePos);
buf.insert (quotePos, "&lt;");
quotePos += 3;
}
- for (quotePos = -1; (quotePos = buf.indexOf(">", quotePos + 1)) >= 0;) {
+ for (quotePos = -1; (quotePos = buf.toString().indexOf(">", quotePos + 1)) >= 0;) {
buf.deleteCharAt(quotePos);
buf.insert (quotePos, "&gt;");
quotePos += 3;
Index: src/net/sf/antcontrib/cpptasks/CompilerEnum.java
===================================================================
RCS file: /cvsroot/ant-contrib/cpptasks/src/net/sf/antcontrib/cpptasks/CompilerEnum.java,v
retrieving revision 1.18
diff -u -r1.18 CompilerEnum.java
--- src/net/sf/antcontrib/cpptasks/CompilerEnum.java 8 Jul 2004 22:30:53 -0000 1.18
+++ src/net/sf/antcontrib/cpptasks/CompilerEnum.java 29 Apr 2006 02:35:28 -0000
@@ -25,7 +25,9 @@
import net.sf.antcontrib.cpptasks.devstudio.DevStudioResourceCompiler;
import net.sf.antcontrib.cpptasks.gcc.GccCCompiler;
import net.sf.antcontrib.cpptasks.hp.aCCCompiler;
+import net.sf.antcontrib.cpptasks.hp.HPCompiler;
import net.sf.antcontrib.cpptasks.ibm.VisualAgeCCompiler;
+import net.sf.antcontrib.cpptasks.ibm.XlcCompiler;
import net.sf.antcontrib.cpptasks.intel.IntelLinux32CCompiler;
import net.sf.antcontrib.cpptasks.intel.IntelLinux64CCompiler;
import net.sf.antcontrib.cpptasks.intel.IntelWin32CCompiler;
@@ -205,6 +207,8 @@
new ProcessorEnumValue("armcpp", ADSCCompiler.getArmCpp()),
new ProcessorEnumValue("tcc", ADSCCompiler.getThumbCC()),
new ProcessorEnumValue("tcpp", ADSCCompiler.getThumbCpp()),
+ new ProcessorEnumValue("hp", HPCompiler.getInstance()),
+ new ProcessorEnumValue("xlc_r", XlcCompiler.getInstance()),
// GCC Cross Compilers
new ProcessorEnumValue(
"sparc-sun-solaris2-gcc",
Index: src/net/sf/antcontrib/cpptasks/LinkerEnum.java
===================================================================
RCS file: /cvsroot/ant-contrib/cpptasks/src/net/sf/antcontrib/cpptasks/LinkerEnum.java,v
retrieving revision 1.16
diff -u -r1.16 LinkerEnum.java
--- src/net/sf/antcontrib/cpptasks/LinkerEnum.java 8 Jul 2004 22:30:53 -0000 1.16
+++ src/net/sf/antcontrib/cpptasks/LinkerEnum.java 29 Apr 2006 02:35:28 -0000
@@ -25,7 +25,9 @@
import net.sf.antcontrib.cpptasks.gcc.GppLinker;
import net.sf.antcontrib.cpptasks.gcc.LdLinker;
import net.sf.antcontrib.cpptasks.hp.aCCLinker;
+import net.sf.antcontrib.cpptasks.hp.HPLinker;
import net.sf.antcontrib.cpptasks.ibm.VisualAgeLinker;
+import net.sf.antcontrib.cpptasks.ibm.XlcLinker;
import net.sf.antcontrib.cpptasks.intel.IntelLinux32Linker;
import net.sf.antcontrib.cpptasks.intel.IntelLinux64Linker;
import net.sf.antcontrib.cpptasks.intel.IntelWin32Linker;
@@ -72,6 +74,8 @@
new ProcessorEnumValue("armcpp", ADSLinker.getInstance()),
new ProcessorEnumValue("tcc", ADSLinker.getInstance()),
new ProcessorEnumValue("tcpp", ADSLinker.getInstance()),
+ new ProcessorEnumValue("hp", HPLinker.getInstance()),
+ new ProcessorEnumValue("xlc_r", XlcLinker.getInstance()),
// gcc cross compilers
new ProcessorEnumValue(
"sparc-sun-solaris2-gcc",
Index: src/net/sf/antcontrib/cpptasks/SubsystemEnum.java
===================================================================
RCS file: /cvsroot/ant-contrib/cpptasks/src/net/sf/antcontrib/cpptasks/SubsystemEnum.java,v
retrieving revision 1.7
diff -u -r1.7 SubsystemEnum.java
--- src/net/sf/antcontrib/cpptasks/SubsystemEnum.java 28 Feb 2004 20:04:02 -0000 1.7
+++ src/net/sf/antcontrib/cpptasks/SubsystemEnum.java 29 Apr 2006 02:35:28 -0000
@@ -29,6 +29,6 @@
setValue("gui");
}
public String[] getValues() {
- return (String[]) values.clone();
+ return values;
}
}
Index: src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java
===================================================================
RCS file:
/cvsroot/ant-contrib/cpptasks/src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java,v
retrieving revision 1.32
diff -u -r1.32 GccLinker.java
--- src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java 28 Feb 2004
20:01:15 -0000 1.32
+++ src/net/sf/antcontrib/cpptasks/gcc/GccLinker.java 29 Apr 2006
17:27:50 -0000
@@ -35,7 +35,7 @@
private static String[] linkerOptions = new String[]{"-bundle",
"-dynamiclib", "-nostartfiles", "-nostdlib", "-prebind",
"-s",
"-static", "-shared", "-symbolic", "-Xlinker",
- "--export-all-symbols", "-static-libgcc",};
+ "--export-all-symbols", "-static-libgcc", "-arch"};
private static final GccLinker dllLinker = new GccLinker("gcc",
objFiles,
discardFiles, "lib", ".so", false, new GccLinker("gcc",
objFiles,
discardFiles, "lib", ".so", true, null));
--- /dev/null 2006-04-28 19:36:02.000000000 -0700
+++ src/net/sf/antcontrib/cpptasks/hp/HPCompiler.java 2006-04-28 17:08:22.000000000 -0700
@@ -0,0 +1,161 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Ant-Contrib project. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package net.sf.antcontrib.cpptasks.hp;
+
+import java.io.File;
+import java.util.Vector;
+
+import net.sf.antcontrib.cpptasks.CUtil;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler;
+import org.apache.tools.ant.types.Environment;
+
+/**
+ * Adapter for the HP compiler
+ *
+ * @author Curt Arnold
+ */
+public final class HPCompiler extends GccCompatibleCCompiler {
+
+ private String identifier;
+ private File[] includePath;
+ private static final HPCompiler instance =
+ new HPCompiler("cc", false, null);
+
+ /**
+ * Private constructor. Use GccCCompiler.getInstance() to get
+ * singleton instance of this class.
+ */
+ private HPCompiler(
+ String command,
+ boolean newEnvironment,
+ Environment env) {
+ super(command, "-help", false, null, newEnvironment, env);
+ }
+
+ public int getMaximumCommandLength() {
+ return Integer.MAX_VALUE;
+ }
+
+ /**
+ * Gets singleton instance of this class
+ */
+ public static HPCompiler getInstance() {
+ return instance;
+ }
+
+ public File[] getEnvironmentIncludePath() {
+ if (includePath == null) {
+ File ccLoc = CUtil.getExecutableLocation("cc");
+ if (ccLoc != null) {
+ File compilerIncludeDir =
+ new File(new File(ccLoc, "../include").getAbsolutePath());
+ if (compilerIncludeDir.exists()) {
+ includePath = new File[2];
+ includePath[0] = compilerIncludeDir;
+ }
+ }
+ if (includePath == null) {
+ includePath = new File[1];
+ }
+ includePath[includePath.length - 1] = new File("/usr/include");
+ }
+ return includePath;
+ }
+
+ public void addImpliedArgs(
+ Vector args,
+ boolean debug,
+ boolean multithreaded,
+ boolean exceptions,
+ LinkType linkType) {
+ args.addElement("-c");
+ if (debug) {
+ args.addElement("-g");
+ }
+ /*
+ if (multithreaded) {
+ args.addElement("-mt");
+ }
+ */
+ if (linkType.isSharedLibrary()) {
+ args.addElement("+z");
+ }
+ }
+
+ public void addWarningSwitch(Vector args, int level) {
+ switch (level) {
+ case 0 :
+ args.addElement("-w");
+ break;
+
+ case 1 :
+ case 2 :
+ args.addElement("+w");
+ break;
+ /*
+ case 3:
+ case 4:
+ case 5:
+ args.addElement("+w2");
+ break;
+ */
+ }
+ }
+
+ public Linker getLinker(LinkType linkType) {
+ return HPLinker.getInstance().getLinker(linkType);
+ }
+}
--- /dev/null 2006-04-28 19:36:02.000000000 -0700
+++ src/net/sf/antcontrib/cpptasks/hp/HPLinker.java 2006-04-28 17:08:22.000000000 -0700
@@ -0,0 +1,153 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Ant-Contrib project. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package net.sf.antcontrib.cpptasks.hp;
+
+import java.io.File;
+import java.util.Vector;
+
+import net.sf.antcontrib.cpptasks.CUtil;
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
+
+/**
+ * Adapter for HP linker
+ *
+ * @author Curt Arnold
+ */
+public final class HPLinker extends AbstractLdLinker
+{
+ private static final String[] objFiles = new String[]
+ { ".o", ".a", ".lib", ".dll", ".so", ".sl" };
+ private static final String[] discardFiles = new String[0];
+
+ private static final HPLinker instance =
+ new HPLinker("ld", objFiles, discardFiles, "", "");
+ private static final HPLinker dllLinker =
+ new HPLinker("ld", objFiles, discardFiles, "lib", ".sl");
+ private static final HPLinker arLinker =
+ new HPLinker("ld", objFiles, discardFiles, "", ".a");
+
+ private File[] libDirs;
+
+ private HPLinker(String command, String[] extensions,
+ String[] ignoredExtensions, String outputPrefix,
+ String outputSuffix) {
+ super(command, "-help", extensions, ignoredExtensions,
+ outputPrefix, outputSuffix,false,null);
+ }
+
+ public static HPLinker getInstance() {
+ return instance;
+ }
+
+ /**
+ * Returns library path.
+ *
+ */
+ public File[] getLibraryPath() {
+ if(libDirs == null) {
+ File CCloc = CUtil.getExecutableLocation("ld");
+ if(CCloc != null) {
+ File compilerLib = new File(
+ new File(CCloc, "../lib").getAbsolutePath());
+ if (compilerLib.exists()) {
+ libDirs = new File[2];
+ libDirs[0] = compilerLib;
+ }
+ }
+ if (libDirs == null) {
+ libDirs = new File[1];
+ }
+ }
+ libDirs[libDirs.length-1] = new File("/usr/lib");
+ return libDirs;
+ }
+
+ public void addImpliedArgs(boolean debug, LinkType linkType, Vector args) {
+/* if(linkType.isStaticRuntime()) {
+ args.addElement("-static");
+ }
+*/
+ if(linkType.isSharedLibrary()) {
+ args.addElement("-b");
+ }
+/*
+ if (linkType.isStaticLibrary()) {
+ args.addElement("-Wl,-noshared");
+ }
+*/
+ }
+
+
+ public Linker getLinker(LinkType type) {
+ if(type.isStaticLibrary()) {
+ return arLinker;
+ }
+ if(type.isSharedLibrary()) {
+ return dllLinker;
+ }
+ return instance;
+ }
+
+ public void addIncremental(boolean incremental, Vector args) {
+ /*
+ if (incremental) {
+ args.addElement("-xidlon");
+ } else {
+ args.addElement("-xidloff");
+ }
+ */
+ }
+}
--- /dev/null 2006-04-28 19:36:02.000000000 -0700
+++ src/net/sf/antcontrib/cpptasks/ibm/XlcCompiler.java 2006-04-28 17:08:22.000000000 -0700
@@ -0,0 +1,138 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Ant-Contrib project. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Ant-Contrib project (http://sourceforge.net/projects/ant-contrib)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "Ant-Contrib"
+ * must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Ant-Contrib"
+ * nor may "Ant-Contrib" appear in their names without prior written
+ * permission of the Ant-Contrib project.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE ANT-CONTRIB PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ */
+package net.sf.antcontrib.cpptasks.ibm;
+
+import java.io.File;
+import java.util.Vector;
+
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler;
+import org.apache.tools.ant.types.Environment;
+
+
+/**
+ * Adapter for the IBM(r) Visual Age(tm) C++ compiler for AIX(tm)
+ *
+ * @author Curt Arnold
+ */
+public final class XlcCompiler extends GccCompatibleCCompiler {
+ private String identifier;
+ private File[] includePath;
+ private static final XlcCompiler instance =
+ new XlcCompiler("xlc_r", false, null);
+
+ /**
+ * Private constructor. Use getInstance() to get
+ * singleton instance of this class.
+ */
+ private XlcCompiler(String command, boolean newEnvironment, Environment env) {
+ super(command, "-help", false, null, newEnvironment, env);
+ }
+
+ public int getMaximumCommandLength() {
+ return Integer.MAX_VALUE;
+ }
+
+ /**
+ * Gets singleton instance of this class
+ */
+ public static XlcCompiler getInstance() {
+ return instance;
+ }
+
+ public void addImpliedArgs(
+ Vector args,
+ boolean debug,
+ boolean multithreaded,
+ boolean exceptions,
+ LinkType linkType) {
+ args.addElement("-c");
+ if (debug) {
+ args.addElement("-g");
+ }
+ if (linkType.isSharedLibrary()) {
+ args.addElement("-fpic");
+ args.addElement("-qmkshrobj");
+
+ }
+ }
+
+ public void addWarningSwitch(Vector args, int level) {
+ switch (level) {
+ case 0 :
+ args.addElement("-w");
+ break;
+
+ case 1 :
+ args.addElement("-qflag=s:s");
+ break;
+
+ case 2 :
+ args.addElement("-qflag=e:e");
+ break;
+
+ case 3 :
+ args.addElement("-qflag=w:w");
+ break;
+
+ case 4 :
+ args.addElement("-qflag=i:i");
+ break;
+
+ case 5 :
+ args.addElement("-qhalt=w:w");
+ break;
+ }
+ }
+
+ public Linker getLinker(LinkType linkType) {
+ return VisualAgeLinker.getInstance().getLinker(linkType);
+ }
+}
--- /dev/null 2006-04-28 19:36:02.000000000 -0700
+++ src/net/sf/antcontrib/cpptasks/ibm/XlcLinker.java 2006-04-28 17:08:22.000000000 -0700
@@ -0,0 +1,112 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Ant-Contrib project. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Ant-Contrib project (http://sourceforge.net/projects/ant-contrib)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "Ant-Contrib"
+ * must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Ant-Contrib"
+ * nor may "Ant-Contrib" appear in their names without prior written
+ * permission of the Ant-Contrib project.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE ANT-CONTRIB PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ */
+package net.sf.antcontrib.cpptasks.ibm;
+
+import java.util.Vector;
+
+import net.sf.antcontrib.cpptasks.compiler.LinkType;
+import net.sf.antcontrib.cpptasks.compiler.Linker;
+import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
+import net.sf.antcontrib.cpptasks.gcc.GccLibrarian;
+
+/**
+ * Adapter for IBM(r) Visual Age(tm) Linker for AIX(tm)
+ *
+ * @author Curt Arnold
+ */
+public final class XlcLinker extends AbstractLdLinker
+{
+ private static final String[] objFiles = new String[]
+ { ".o", ".a", ".lib",".dll", ".so", ".sl"};
+ private static final String[] discardFiles = new String[]
+ { };
+
+ private static final XlcLinker instance =
+ new XlcLinker("ld", objFiles, discardFiles, "", "");
+ private static final XlcLinker dllLinker =
+ new XlcLinker("ld", objFiles, discardFiles, "lib", ".so");
+
+ private XlcLinker(String command, String[] extensions,
+ String[] ignoredExtensions, String outputPrefix,
+ String outputSuffix) {
+ //
+ // just guessing that -? might display something useful
+ //
+ super(command, "-?", extensions, ignoredExtensions,
+ outputPrefix, outputSuffix,false,null);
+ }
+
+ public static XlcLinker getInstance() {
+ return instance;
+ }
+
+ public void addImpliedArgs(boolean debug, LinkType linkType, Vector args) {
+ if(debug) {
+ //args.addElement("-g");
+ }
+ if(linkType.isSharedLibrary()) {
+ args.addElement("-bdynamic");
+ args.addElement("-G");
+ args.addElement("-bnoentry");
+ args.addElement("-bexpall");
+ args.addElement("-lc_r");
+ }
+ }
+
+
+ public Linker getLinker(LinkType type) {
+ if(type.isStaticLibrary()) {
+ return GccLibrarian.getInstance();
+ }
+ if(type.isSharedLibrary()) {
+ return dllLinker;
+ }
+ return instance;
+ }
+}

View File

@ -1,24 +1,23 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2009 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.jni;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.StringTokenizer;
import java.net.URL;
import java.net.URLClassLoader;
@ -317,7 +316,16 @@ public class ArchLoader {
if ((file != null) &&
((file = file.getParentFile()) != null))
{
String dir = URLDecoder.decode(file.toString());
String dir;
try {
// Passing UTF-8 according to the recommendation in the URLDecoder.decode JavaDoc.
dir = URLDecoder.decode(file.toString(), "UTF-8");
} catch (UnsupportedEncodingException e) {
String msg = "Unsupported encoding in file name: " + file.toString();
ArchLoaderException archLoaderException = new ArchLoaderException(msg);
archLoaderException.initCause(e);
throw archLoaderException;
}
if (findNativeLibrary(dir, libName)) {
return dir;
}

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2009 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.jni;

View File

@ -1,19 +1,18 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2009 Hyperic, Inc.
* Copyright (c) 2009 SpringSource, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.jni;
@ -67,6 +66,9 @@ public class ArchName {
}
else {
arch = "pa";
if (is64()) {
arch += "64";
}
}
if (version.indexOf("11") > -1) {
return arch + "-hpux-11";

View File

@ -1,23 +1,30 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2009 Hyperic, Inc.
* Copyright (c) 2009 SpringSource, Inc.
* Copyright (c) 2009-2010 VMware, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.jni;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
import java.io.FileReader;
import java.io.Reader;
import java.util.Arrays;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
@ -25,6 +32,7 @@ public class ArchNameTask extends Task {
public void execute() throws BuildException {
String osArch = System.getProperty("os.arch");
String osVers = System.getProperty("os.version");
if (getProject().getProperty("jni.dmalloc") != null) {
ArchName.useDmalloc = true;
@ -78,5 +86,127 @@ public class ArchNameTask extends Task {
getProject().setProperty("jni.gccm", "-m31");
}
}
if (ArchLoader.IS_DARWIN) {
//default to most recent SDK
//MacOSX10.3.9.sdk, MacOSX10.4u.sdk, MacOSX10.5.sdk,etc.
String sdkRoot = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs";
if (new File(sdkRoot).exists() == false) {
sdkRoot = "/Developer/SDKs";
}
File[] sdks =
new File(sdkRoot).listFiles(new FileFilter() {
public boolean accept(File file) {
String name = file.getName();
return
name.startsWith("MacOSX10.") &&
name.endsWith(".sdk");
}
});
if (sdks != null) {
Arrays.sort(sdks);
String prop = "uni.sdk";
String sdk = getProject().getProperty(prop);
String defaultMin = "10.3";
if (sdk == null) {
int ix = sdks.length-1;
sdk = sdks[ix].getPath();
if ((sdk.indexOf("10.6") != -1) && (ix > 0)) {
sdk = sdks[ix-1].getPath(); //downgrade due to 64-bit ppc issues XXX
defaultMin = "10.5";
}
getProject().setProperty(prop, sdk);
}
String version = osVers.substring(0, 4);
int minorVers = Integer.parseInt(osVers.substring(3,4));
boolean usingLatestSDK = (sdk.indexOf(version) != -1);
System.out.println("Using SDK=" + sdk);
if ((minorVers >= 6) && ArchName.is64() && usingLatestSDK) {
//64-bit 10.6 sdk does not support ppc64
//switch from universal build to i386 only
getProject().setProperty("jni.cc", "jni-cc");
getProject().setProperty("uni.arch", "i386");
System.out.println("Note: SDK version does not support ppc64");
}
prop = "osx.min";
String min = getProject().getProperty(prop);
if (min == null) {
min = defaultMin;
getProject().setProperty(prop, min);
}
System.out.println("Using -mmacosx-version-min=" + min);
}
}
getProject().setProperty("jni.scmrev", getSourceRevision());
//jni.javahome required to find include/jni.h
String home = getProject().getProperty("jni.javahome");
if (home == null) {
home = System.getProperty("java.home");
}
File dir = new File(home);
if (!new File(dir, "include").exists()) {
dir = dir.getParentFile(); //was /jre
}
getProject().setProperty("jni.javahome", dir.getPath());
}
//XXX source rev stuff should be in another task
private String readLine(String filename) {
Reader reader = null;
try {
reader = new FileReader(filename);
return new BufferedReader(reader).readLine();
} catch (Exception e) {
} finally {
if (reader != null) {
try { reader.close(); } catch (Exception e) {}
}
}
return null;
}
private String getSourceRevision() {
final String exported = "exported";
String sha1 = getGitSourceRevision();
if (sha1 == null) {
return exported;
}
else {
return sha1;
}
}
//same as: git rev-parse --short HEAD
//same as: (cd .git && cat HEAD | awk '{print $2}' | xargs cat | cut -b 1-7)
private String getGitSourceRevision() {
String git = getProject().getProperty("jni.git");
if (git == null) {
git = ".git";
}
if (new File(git).exists()) {
String head = readLine(git + "/HEAD");
if (head != null) {
String sha1;
final String refp = "ref: ";
if (head.startsWith(refp)) {
//branch
String ref = head.substring(refp.length()).trim();
sha1 = readLine(git + "/" + ref);
}
else {
//git checkout -f origin/branch-name (no branch)
sha1 = head;
}
return sha1.substring(0, 7);
}
}
return null;
}
}

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2009 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.jni;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2009 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.jni;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,19 +1,19 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2004-2008 Hyperic, Inc.
* Copyright (c) 2009 SpringSource, Inc.
* Copyright (c) 2010 VMware, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <jni.h>
@ -249,7 +249,7 @@ int jsigar_list_init(JNIEnv *env, jsigar_list_t *obj)
obj->obj = JENV->NewObject(env, listclass, listid);
obj->id = addid;
return SIGAR_OK;
return JENV->ExceptionCheck(env) ? !SIGAR_OK : SIGAR_OK;
}
int jsigar_list_add(void *data, char *value, int len)
@ -260,7 +260,7 @@ int jsigar_list_add(void *data, char *value, int len)
JENV->CallBooleanMethod(env, obj->obj, obj->id,
JENV->NewStringUTF(env, value));
return SIGAR_OK;
return JENV->ExceptionCheck(env) ? !SIGAR_OK : SIGAR_OK;
}
JNIEXPORT jstring SIGAR_JNIx(formatSize)
@ -398,9 +398,6 @@ static jstring jnet_address_to_string(JNIEnv *env, sigar_t *sigar, sigar_net_add
#include "javasigar_generated.c"
#define SIGAR_ALLOC_OBJECT(name) \
JENV->AllocObject(env, SIGAR_FIND_CLASS(name))
enum {
FS_FIELD_DIRNAME,
FS_FIELD_DEVNAME,
@ -448,6 +445,7 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getFileSystemListNative)
JENV->GetFieldID(env, cls, "type", "I");
fsarray = JENV->NewObjectArray(env, fslist.number, cls, 0);
SIGAR_CHEX;
for (i=0; i<fslist.number; i++) {
sigar_file_system_t *fs = &(fslist.data)[i];
@ -472,6 +470,7 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getFileSystemListNative)
#endif
fsobj = JENV->AllocObject(env, obj_cls);
SIGAR_CHEX;
JENV->SetStringField(env, fsobj,
ids[FS_FIELD_DIRNAME],
@ -498,6 +497,7 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getFileSystemListNative)
fs->type);
JENV->SetObjectArrayElement(env, fsarray, i, fsobj);
SIGAR_CHEX;
}
sigar_file_system_list_destroy(sigar, &fslist);
@ -562,12 +562,15 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getCpuInfoList)
JAVA_SIGAR_INIT_FIELDS_CPUINFO(cls);
cpuarray = JENV->NewObjectArray(env, cpu_infos.number, cls, 0);
SIGAR_CHEX;
for (i=0; i<cpu_infos.number; i++) {
jobject info_obj = JENV->AllocObject(env, cls);
SIGAR_CHEX;
JAVA_SIGAR_SET_FIELDS_CPUINFO(cls, info_obj,
cpu_infos.data[i]);
JENV->SetObjectArrayElement(env, cpuarray, i, info_obj);
SIGAR_CHEX;
}
sigar_cpu_info_list_destroy(sigar, &cpu_infos);
@ -593,12 +596,15 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getCpuListNative)
JAVA_SIGAR_INIT_FIELDS_CPU(cls);
cpuarray = JENV->NewObjectArray(env, cpulist.number, cls, 0);
SIGAR_CHEX;
for (i=0; i<cpulist.number; i++) {
jobject info_obj = JENV->AllocObject(env, cls);
SIGAR_CHEX;
JAVA_SIGAR_SET_FIELDS_CPU(cls, info_obj,
cpulist.data[i]);
JENV->SetObjectArrayElement(env, cpuarray, i, info_obj);
SIGAR_CHEX;
}
sigar_cpu_list_destroy(sigar, &cpulist);
@ -635,6 +641,7 @@ JNIEXPORT jlongArray SIGAR_JNIx(getProcList)
}
procarray = JENV->NewLongArray(env, proclist.number);
SIGAR_CHEX;
if (sizeof(jlong) == sizeof(sigar_pid_t)) {
pids = (jlong *)proclist.data;
@ -676,10 +683,12 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getProcArgs)
}
argsarray = JENV->NewObjectArray(env, procargs.number, stringclass, 0);
SIGAR_CHEX;
for (i=0; i<procargs.number; i++) {
jstring s = JENV->NewStringUTF(env, procargs.data[i]);
JENV->SetObjectArrayElement(env, argsarray, i, s);
SIGAR_CHEX;
}
sigar_proc_args_destroy(sigar, &procargs);
@ -704,7 +713,7 @@ static int jni_env_getall(void *data,
JENV->NewStringUTF(env, key),
JENV->NewStringUTF(env, val));
return SIGAR_OK;
return JENV->ExceptionCheck(env) ? !SIGAR_OK : SIGAR_OK;
}
#define MAP_PUT_SIG \
@ -728,6 +737,7 @@ JNIEXPORT jobject SIGAR_JNI(ProcEnv_getAll)
dSIGAR(NULL);
hashmap = JENV->NewObject(env, mapclass, mapid);
SIGAR_CHEX;
put.env = env;
put.id = putid;
@ -809,7 +819,9 @@ JNIEXPORT jobject SIGAR_JNIx(getProcModulesNative)
dSIGAR(NULL);
jsigar_list_init(env, &obj);
if (jsigar_list_init(env, &obj) != SIGAR_OK) {
return NULL; /* Exception thrown */
}
procmods.module_getter = jsigar_list_add;
procmods.data = &obj;
@ -837,6 +849,7 @@ JNIEXPORT jdoubleArray SIGAR_JNIx(getLoadAverage)
}
avgarray = JENV->NewDoubleArray(env, 3);
SIGAR_CHEX;
JENV->SetDoubleArrayRegion(env, avgarray, 0,
3, loadavg.loadavg);
@ -862,11 +875,14 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getNetRouteList)
JAVA_SIGAR_INIT_FIELDS_NETROUTE(cls);
routearray = JENV->NewObjectArray(env, routelist.number, cls, 0);
SIGAR_CHEX;
for (i=0; i<routelist.number; i++) {
jobject obj = JENV->AllocObject(env, cls);
SIGAR_CHEX;
JAVA_SIGAR_SET_FIELDS_NETROUTE(cls, obj, routelist.data[i]);
JENV->SetObjectArrayElement(env, routearray, i, obj);
SIGAR_CHEX;
}
sigar_net_route_list_destroy(sigar, &routelist);
@ -882,6 +898,13 @@ JNIEXPORT jstring SIGAR_JNI(NetFlags_getIfFlagsString)
return JENV->NewStringUTF(env, buf);
}
JNIEXPORT jstring SIGAR_JNI(NetFlags_getScopeString)
(JNIEnv *env, jclass cls, jint scope)
{
const char *buf = sigar_net_scope_to_string(scope);
return JENV->NewStringUTF(env, buf);
}
JNIEXPORT jobjectArray SIGAR_JNIx(getNetConnectionList)
(JNIEnv *env, jobject sigar_obj, jint flags)
{
@ -902,11 +925,14 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getNetConnectionList)
JAVA_SIGAR_INIT_FIELDS_NETCONNECTION(cls);
connarray = JENV->NewObjectArray(env, connlist.number, cls, 0);
SIGAR_CHEX;
for (i=0; i<connlist.number; i++) {
jobject obj = JENV->AllocObject(env, cls);
SIGAR_CHEX;
JAVA_SIGAR_SET_FIELDS_NETCONNECTION(cls, obj, connlist.data[i]);
JENV->SetObjectArrayElement(env, connarray, i, obj);
SIGAR_CHEX;
}
sigar_net_connection_list_destroy(sigar, &connlist);
@ -983,6 +1009,10 @@ JNIEXPORT void SIGAR_JNI(NetStat_stat)
}
states = JENV->NewIntArray(env, SIGAR_TCP_UNKNOWN);
if (JENV->ExceptionCheck(env)) {
return;
}
JENV->SetIntArrayRegion(env, states, 0,
SIGAR_TCP_UNKNOWN,
tcp_states);
@ -1038,6 +1068,37 @@ JNIEXPORT jstring SIGAR_JNI(NetConnection_getStateString)
sigar_net_connection_state_get(state));
}
JNIEXPORT jobjectArray SIGAR_JNIx(getArpList)
(JNIEnv *env, jobject sigar_obj)
{
int status;
unsigned int i;
sigar_arp_list_t arplist;
jobjectArray arparray;
jclass cls = SIGAR_FIND_CLASS("Arp");
dSIGAR(NULL);
if ((status = sigar_arp_list_get(sigar, &arplist)) != SIGAR_OK) {
sigar_throw_error(env, jsigar, status);
return NULL;
}
JAVA_SIGAR_INIT_FIELDS_ARP(cls);
arparray = JENV->NewObjectArray(env, arplist.number, cls, 0);
for (i=0; i<arplist.number; i++) {
jobject info_obj = JENV->AllocObject(env, cls);
JAVA_SIGAR_SET_FIELDS_ARP(cls, info_obj,
arplist.data[i]);
JENV->SetObjectArrayElement(env, arparray, i, info_obj);
}
sigar_arp_list_destroy(sigar, &arplist);
return arparray;
}
JNIEXPORT jobjectArray SIGAR_JNIx(getWhoList)
(JNIEnv *env, jobject sigar_obj)
{
@ -1056,12 +1117,15 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getWhoList)
JAVA_SIGAR_INIT_FIELDS_WHO(cls);
whoarray = JENV->NewObjectArray(env, wholist.number, cls, 0);
SIGAR_CHEX;
for (i=0; i<wholist.number; i++) {
jobject info_obj = JENV->AllocObject(env, cls);
SIGAR_CHEX;
JAVA_SIGAR_SET_FIELDS_WHO(cls, info_obj,
wholist.data[i]);
JENV->SetObjectArrayElement(env, whoarray, i, info_obj);
SIGAR_CHEX;
}
sigar_who_list_destroy(sigar, &wholist);
@ -1158,10 +1222,12 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getNetInterfaceList)
}
ifarray = JENV->NewObjectArray(env, iflist.number, stringclass, 0);
SIGAR_CHEX;
for (i=0; i<iflist.number; i++) {
jstring s = JENV->NewStringUTF(env, iflist.data[i]);
JENV->SetObjectArrayElement(env, ifarray, i, s);
SIGAR_CHEX;
}
sigar_net_interface_list_destroy(sigar, &iflist);
@ -1355,6 +1421,7 @@ JNIEXPORT jlongArray SIGAR_JNI(ptql_SigarProcessQuery_find)
}
procarray = JENV->NewLongArray(env, proclist.number);
SIGAR_CHEX;
if (sizeof(jlong) == sizeof(sigar_pid_t)) {
pids = (jlong *)proclist.data;
@ -1466,7 +1533,7 @@ static int jsigar_getline_completer(char *buffer, int offset, int *pos)
JENV->CallObjectMethod(env, jsigar_completer.obj,
jsigar_completer.id, jbuffer);
if (JENV->ExceptionOccurred(env)) {
if (JENV->ExceptionCheck(env)) {
JENV->ExceptionDescribe(env);
return 0;
}
@ -1547,7 +1614,7 @@ static void jsigar_log_impl(sigar_t *sigar, void *data,
log_methods[level],
"(Ljava/lang/Object;)V");
if (JENV->ExceptionOccurred(env)) {
if (JENV->ExceptionCheck(env)) {
JENV->ExceptionDescribe(env);
return;
}

View File

@ -1,19 +1,18 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2004, 2006, 2008 Hyperic, Inc.
* Copyright (c) 2010 VMware, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <jni.h>
@ -33,6 +32,9 @@
#define SIGAR_CLASS_SIG(name) \
"L" SIGAR_PACKAGE name ";"
/* CHeck EXception */
#define SIGAR_CHEX if (JENV->ExceptionCheck(env)) return NULL
typedef struct {
JNIEnv *env;
jobject obj;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2007 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <jni.h>

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "vmcontrol_wrapper.h"

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2007 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef VMCONTROL_WRAPPER_H

View File

@ -1,19 +1,18 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2004-2007, 2009 Hyperic, Inc.
* Copyright (c) 2009-2010 VMware, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef WIN32
@ -69,7 +68,7 @@ static HANDLE win32_get_pointer(JNIEnv *env, jobject obj)
return h;
}
static int get_messagefile_dll(LPWSTR app, LPWSTR source, LPWSTR dllfile)
static int get_messagefile_dll(LPWSTR app, LPWSTR source, LPWSTR entry, LPWSTR dllfile)
{
HKEY hk;
WCHAR buf[MAX_MSG_LENGTH];
@ -87,7 +86,7 @@ static int get_messagefile_dll(LPWSTR app, LPWSTR source, LPWSTR dllfile)
return rc;
}
rc = RegQueryValueEx(hk, L"EventMessageFile", NULL, &type,
rc = RegQueryValueEx(hk, entry, NULL, &type,
(LPBYTE)buf, &data);
if (rc) {
RegCloseKey(hk);
@ -102,7 +101,9 @@ static int get_messagefile_dll(LPWSTR app, LPWSTR source, LPWSTR dllfile)
return ERROR_SUCCESS;
}
static int get_formatted_message(EVENTLOGRECORD *pevlr, LPWSTR dllfile,
static int get_formatted_message(EVENTLOGRECORD *pevlr,
DWORD id,
LPWSTR dllfile,
LPWSTR msg)
{
LPVOID msgbuf = NULL;
@ -121,10 +122,12 @@ static int get_formatted_message(EVENTLOGRECORD *pevlr, LPWSTR dllfile,
}
memset(insert_strs, '\0', sizeof(insert_strs));
ptr = (LPWSTR)((LPBYTE)pevlr + pevlr->StringOffset);
for (i = 0; i < pevlr->NumStrings && i < max; i++) {
insert_strs[i] = ptr;
ptr += wcslen(ptr) + 1;
if (pevlr) {
ptr = (LPWSTR)((LPBYTE)pevlr + pevlr->StringOffset);
for (i = 0; i < pevlr->NumStrings && i < max; i++) {
insert_strs[i] = ptr;
ptr += wcslen(ptr) + 1;
}
}
ptr = wcstok(msgdll, FILESEP);
@ -136,7 +139,7 @@ static int get_formatted_message(EVENTLOGRECORD *pevlr, LPWSTR dllfile,
if (hlib) {
FormatMessage(flags,
hlib,
pevlr->EventID,
id,
MAKELANGID(LANG_NEUTRAL, SUBLANG_ENGLISH_US),
(LPWSTR) &msgbuf,
sizeof(msgbuf), //min bytes w/ FORMAT_MESSAGE_ALLOCATE_BUFFER
@ -161,6 +164,29 @@ static int get_formatted_message(EVENTLOGRECORD *pevlr, LPWSTR dllfile,
}
}
static int get_formatted_event_message(EVENTLOGRECORD *pevlr, LPWSTR name, LPWSTR source, LPWSTR msg)
{
WCHAR dllfile[MAX_MSG_LENGTH];
if (get_messagefile_dll(name, source, L"EventMessageFile", dllfile) != ERROR_SUCCESS) {
return !ERROR_SUCCESS;
}
return get_formatted_message(pevlr, pevlr->EventID, dllfile, msg);
}
static int get_formatted_event_category(EVENTLOGRECORD *pevlr, LPWSTR name, LPWSTR source, LPWSTR msg)
{
WCHAR dllfile[MAX_MSG_LENGTH];
if (get_messagefile_dll(name, source, L"CategoryMessageFile", dllfile) != ERROR_SUCCESS) {
return !ERROR_SUCCESS;
}
return get_formatted_message(NULL, pevlr->EventCategory, dllfile, msg);
}
JNIEXPORT void SIGAR_JNI(win32_EventLog_openlog)
(JNIEnv *env, jobject obj, jstring lpSourceName)
{
@ -229,7 +255,6 @@ JNIEXPORT jobject SIGAR_JNI(win32_EventLog_readlog)
{
EVENTLOGRECORD *pevlr;
BYTE buffer[8192];
WCHAR dllfile[MAX_MSG_LENGTH];
WCHAR msg[MAX_MSG_LENGTH];
DWORD dwRead, dwNeeded;
LPWSTR source, machineName;
@ -239,6 +264,7 @@ JNIEXPORT jobject SIGAR_JNI(win32_EventLog_readlog)
jfieldID id;
jstring value;
LPWSTR name;
BOOL has_category = FALSE; /* 1.6.x compat */
h = win32_get_pointer(env, obj);
@ -267,6 +293,7 @@ JNIEXPORT jobject SIGAR_JNI(win32_EventLog_readlog)
}
obj = JENV->AllocObject(env, cls);
SIGAR_CHEX;
id = JENV->GetFieldID(env, cls, "recordNumber", "J");
JENV->SetLongField(env, obj, id, pevlr->RecordNumber);
@ -283,6 +310,18 @@ JNIEXPORT jobject SIGAR_JNI(win32_EventLog_readlog)
id = JENV->GetFieldID(env, cls, "eventType", "S");
JENV->SetShortField(env, obj, id, pevlr->EventType);
if (!JENV->ExceptionCheck(env)) { /* careful not to clear any existing exception */
id = JENV->GetFieldID(env, cls, "category", "S");
if (JENV->ExceptionCheck(env)) {
/* older version of sigar.jar being used with sigar.dll */
JENV->ExceptionClear(env);
}
else {
has_category = TRUE;
JENV->SetShortField(env, obj, id, pevlr->EventCategory);
}
}
/* Extract string data from the end of the structure. Lame. */
source = (LPWSTR)((LPBYTE)pevlr + sizeof(EVENTLOGRECORD));
@ -292,8 +331,7 @@ JNIEXPORT jobject SIGAR_JNI(win32_EventLog_readlog)
/* Get the formatted message */
if ((pevlr->NumStrings > 0) &&
(get_messagefile_dll(name, source, dllfile) == ERROR_SUCCESS) &&
(get_formatted_message(pevlr, dllfile, msg) == ERROR_SUCCESS))
(get_formatted_event_message(pevlr, name, source, msg) == ERROR_SUCCESS))
{
UNICODE_SetStringField("message", msg);
}
@ -301,11 +339,19 @@ JNIEXPORT jobject SIGAR_JNI(win32_EventLog_readlog)
LPWSTR tmp = (LPWSTR)((LPBYTE)pevlr + pevlr->StringOffset);
UNICODE_SetStringField("message", tmp);
}
/* Get the formatted category */
if (has_category &&
(get_formatted_event_category(pevlr, name, source, msg) == ERROR_SUCCESS))
{
UNICODE_SetStringField("categoryString", msg);
}
JENV->ReleaseStringChars(env, jname, name);
/* Increment up to the machine name. */
machineName = (LPWSTR)((LPBYTE)pevlr + sizeof(EVENTLOGRECORD) +
wcslen(source) + 1);
(wcslen(source) + 1) * sizeof(WCHAR));
UNICODE_SetStringField("computerName", machineName);
/* Get user id info */

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 2004-2006, 2008 Hyperic, Inc.
* Copyright (c) 2010 VMware, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(WIN32) && !defined(SIGAR_NO_ATL)
#define UNICODE
#define _UNICODE
@ -269,6 +286,9 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_MetaBase_MetaBaseGetMultiStringValue)
NewObjectArray(count,
env->FindClass("java/lang/String"),
env->NewString((const jchar *)"", 1));
if (env->ExceptionCheck()) {
return NULL;
}
// Walk the return instance list, creating an array
for (szThisInstance = (TCHAR *)MyRecord.pbMDData, i = 0;
@ -278,6 +298,9 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_MetaBase_MetaBaseGetMultiStringValue)
env->SetObjectArrayElement(ret,i,env->NewString(
(const jchar *)(LPCTSTR)szThisInstance,
lstrlen(szThisInstance)));
if (env->ExceptionCheck()) {
return NULL;
}
}
return ret;
}

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2007 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef WIN32

View File

@ -1,19 +1,18 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2004-2007 Hyperic, Inc.
* Copyright (c) 2010 VMware, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef WIN32
@ -222,6 +221,55 @@ JNIEXPORT jdouble SIGAR_JNI(win32_Pdh_pdhGetValue)
}
}
JNIEXPORT jstring SIGAR_JNI(win32_Pdh_pdhGetDescription)
(JNIEnv *env, jclass cur, jlong counter)
{
HCOUNTER h_counter = (HCOUNTER)counter;
PDH_COUNTER_INFO *info = NULL;
jstring retval = NULL;
DWORD size = 0;
PDH_STATUS status;
status = PdhGetCounterInfo(h_counter, TRUE, &size, NULL);
if (status != PDH_MORE_DATA) {
win32_throw_exception(env, get_error_message(status));
return NULL;
}
info = malloc(size);
status = PdhGetCounterInfo(h_counter, 1, &size, info);
if (status == ERROR_SUCCESS) {
if (info->szExplainText) {
retval = JENV->NewString(env, info->szExplainText,
lstrlen(info->szExplainText));
}
}
else {
win32_throw_exception(env, get_error_message(status));
}
free(info);
return retval;
}
JNIEXPORT jlong SIGAR_JNI(win32_Pdh_pdhGetCounterType)
(JNIEnv *env, jclass cur, jlong counter)
{
HCOUNTER h_counter = (HCOUNTER)counter;
PDH_COUNTER_INFO info;
DWORD size = sizeof(info);
PDH_STATUS status;
status = PdhGetCounterInfo(h_counter, FALSE, &size, &info);
if (status != ERROR_SUCCESS) {
win32_throw_exception(env, get_error_message(status));
return -1;
}
return info.dwType;
}
JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetInstances)
(JNIEnv *env, jclass cur, jstring cp)
{
@ -270,6 +318,10 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetInstances)
JENV->FindClass(env,
"java/lang/String"),
JENV->NewStringUTF(env, ""));
if (JENV->ExceptionCheck(env)) {
free(instance_list_buf);
return NULL;
}
/* Walk the return instance list, creating an array */
for (cur_object = instance_list_buf, i = 0;
@ -280,6 +332,10 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetInstances)
jstring s =
JENV->NewString(env, (const jchar *)cur_object, len);
JENV->SetObjectArrayElement(env, array, i, s);
if (JENV->ExceptionCheck(env)) {
free(instance_list_buf);
return NULL;
}
cur_object += len + 1;
}
} else {
@ -342,6 +398,10 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetKeys)
JENV->FindClass(env,
"java/lang/String"),
JENV->NewStringUTF(env, ""));
if (JENV->ExceptionCheck(env)) {
free(instance_list_buf);
return NULL;
}
/* Walk the return instance list, creating an array */
for (cur_object = instance_list_buf, i = 0;
@ -352,6 +412,10 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetKeys)
jstring s =
JENV->NewString(env, (const jchar *)cur_object, len);
JENV->SetObjectArrayElement(env, array, i, s);
if (JENV->ExceptionCheck(env)) {
free(instance_list_buf);
return NULL;
}
cur_object += len + 1;
}
} else {
@ -410,6 +474,10 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetObjects)
JENV->FindClass(env,
"java/lang/String"),
JENV->NewStringUTF(env, ""));
if (JENV->ExceptionCheck(env)) {
free(list_buf);
return NULL;
}
for (cur_object = list_buf, i = 0;
*cur_object != 0;
@ -419,6 +487,10 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetObjects)
jstring s =
JENV->NewString(env, (const jchar *)cur_object, len);
JENV->SetObjectArrayElement(env, array, i, s);
if (JENV->ExceptionCheck(env)) {
free(list_buf);
return NULL;
}
cur_object += len + 1;
}

23
bindings/java/src/jni/win32/registrykey.cpp Normal file → Executable file
View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 2004, 2007-2008 Hyperic, Inc.
* Copyright (c) 2009-2010 VMware, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef WIN32
#define UNICODE
#define _UNICODE
@ -115,6 +132,7 @@ JNIEXPORT jint SIGAR_JNI(win32_RegistryKey_RegLoadKey)
#endif
static DWORD RegOpenOpts[] = {
0,
KEY_WOW64_32KEY,
KEY_WOW64_64KEY
};
@ -330,7 +348,10 @@ JNIEXPORT void SIGAR_JNI(win32_RegistryKey_RegQueryMultiStringValue)
env->NewString((const jchar *)ptr, len);
env->CallBooleanMethod(obj, id, jval);
if (env->ExceptionCheck()) {
HeapFree(GetProcessHeap(), 0, value);
return;
}
ptr += len + 1;
}
}

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 2004-2005, 2008 Hyperic, Inc.
* Copyright (c) 2010 VMware, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef WIN32
#define UNICODE
#define _UNICODE
@ -289,6 +306,9 @@ static int to_array(JNIEnv *env, LPTSTR str, jobjectArray array)
jstring jstr =
env->NewString((const jchar *)ptr, slen);
env->SetObjectArrayElement(array, i, jstr);
if (env->ExceptionCheck()) {
return -1;
}
}
offset += slen + 1;
ptr = &str[offset];
@ -333,11 +353,19 @@ JNIEXPORT jboolean SIGAR_JNI(win32_Service_QueryServiceConfig)
int i;
jobjectArray jargv =
env->NewObjectArray(argc, stringclass, 0);
if (env->ExceptionCheck()) {
LocalFree(argv);
return JNI_FALSE;
}
for (i=0; i<argc; i++) {
jstring jstr =
env->NewString((const jchar *)argv[i], lstrlen(argv[i]));
env->SetObjectArrayElement(jargv, i, jstr);
if (env->ExceptionCheck()) {
LocalFree(argv);
return JNI_FALSE;
}
}
id = env->GetFieldID(cls, "argv", ASTRING_SIG);
@ -352,11 +380,22 @@ JNIEXPORT jboolean SIGAR_JNI(win32_Service_QueryServiceConfig)
if (config->lpDependencies) {
/* first pass just get num for NewObjectArray */
jobjectArray dependencies;
int num = to_array(env, config->lpDependencies, NULL);
jobjectArray dependencies =
env->NewObjectArray(num, stringclass, 0);
if (num < 0) {
return JNI_FALSE; /* Exception thrown */
}
dependencies = env->NewObjectArray(num, stringclass, 0);
if (env->ExceptionCheck()) {
return JNI_FALSE;
}
to_array(env, config->lpDependencies, dependencies);
if (num < 0) {
return JNI_FALSE; /* Exception thrown */
}
id = env->GetFieldID(cls, "dependencies", ASTRING_SIG);

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2004-2006, 2008 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef WIN32

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2004-2006 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WIN32_BINDINGS_H

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2008 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2007 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2007 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2007 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;
@ -294,74 +292,58 @@ public class FileInfo extends FileAttrs implements java.io.Serializable {
}
public String diff(FileInfo info) {
ArrayList changes = new ArrayList();
ArrayList changes = new ArrayList();
if (this.getMtime() != info.getMtime()) {
changes.add(new Diff("Mtime",
formatDate(info.getMtime()),
formatDate(this.getMtime())));
if (this.getMtime() != info.getMtime()) {
changes.add(new Diff("Mtime", formatDate(info.getMtime()),
formatDate(this.getMtime())));
} else if (this.getCtime() != info.getCtime()) {
changes.add(new Diff("Ctime", formatDate(info.getCtime()),
formatDate(this.getCtime())));
}
if (this.getPermissions() != info.getPermissions()) {
changes.add(new Diff("Perms", info.getPermissionsString(), this
.getPermissionsString()));
}
if (this.getType() != info.getType()) {
changes.add(new Diff("Type", info.getTypeString(), this
.getTypeString()));
}
if (this.getUid() != info.getUid()) {
changes.add(new Diff("Uid", info.getUid(), this.getUid()));
}
if (this.getGid() != info.getGid()) {
changes.add(new Diff("Gid", info.getGid(), this.getGid()));
}
if (this.getSize() != info.getSize()) {
changes.add(new Diff("Size", info.getSize(), this.getSize()));
}
if (!OperatingSystem.IS_WIN32) {
if (this.getInode() != info.getInode()) {
changes.add(new Diff("Inode", info.getInode(), this.getInode()));
}
if (this.getDevice() != info.getDevice()) {
changes.add(new Diff("Device", info.getDevice(), this
.getDevice()));
}
if (this.getNlink() != info.getNlink()) {
changes.add(new Diff("Nlink", info.getNlink(), this.getNlink()));
}
}
else if (this.getCtime() != info.getCtime()) {
changes.add(new Diff("Ctime",
formatDate(info.getCtime()),
formatDate(this.getCtime())));
}
else {
//no point in checking the rest if all times are the same.
//or should we include atime in the diff?
/* if changes were not detected then return empty String */
if (changes.isEmpty()){
return "";
}
if (this.getPermissions() != info.getPermissions()) {
changes.add(new Diff("Perms",
info.getPermissionsString(),
this.getPermissionsString()));
}
if (this.getType() != info.getType()) {
changes.add(new Diff("Type",
info.getTypeString(),
this.getTypeString()));
}
if (this.getUid() != info.getUid()) {
changes.add(new Diff("Uid",
info.getUid(),
this.getUid()));
}
if (this.getGid() != info.getGid()) {
changes.add(new Diff("Gid",
info.getGid(),
this.getGid()));
}
if (this.getSize() != info.getSize()) {
changes.add(new Diff("Size",
info.getSize(),
this.getSize()));
}
if (!OperatingSystem.IS_WIN32) {
if (this.getInode() != info.getInode()) {
changes.add(new Diff("Inode",
info.getInode(),
this.getInode()));
}
if (this.getDevice() != info.getDevice()) {
changes.add(new Diff("Device",
info.getDevice(),
this.getDevice()));
}
if (this.getNlink() != info.getNlink()) {
changes.add(new Diff("Nlink",
info.getNlink(),
this.getNlink()));
}
}
StringBuffer sb = format(changes);
if (this.dirStatEnabled) {
sb.append(diff(info.stat));
@ -391,7 +373,9 @@ public class FileInfo extends FileAttrs implements java.io.Serializable {
stat();
return this.mtime != oldInfo.mtime;
boolean isModified = isModified(this.oldInfo);
return isModified;
}
public boolean changed()
@ -457,4 +441,49 @@ public class FileInfo extends FileAttrs implements java.io.Serializable {
return fetchInfo(sigar, name, false);
}
private boolean isModified(FileInfo info){
/* Check modified time */
if (this.getMtime() != info.getMtime()) {
return true;
} else if (this.getCtime() != info.getCtime()) {
return true;
}
if (this.getPermissions() != info.getPermissions()) {
return true;
}
if (this.getType() != info.getType()) {
return true;
}
if (this.getUid() != info.getUid()) {
return true;
}
if (this.getGid() != info.getGid()) {
return true;
}
if (this.getSize() != info.getSize()) {
return true;
}
if (!OperatingSystem.IS_WIN32) {
if (this.getInode() != info.getInode()) {
return true;
}
if (this.getDevice() != info.getDevice()) {
return true;
}
if (this.getNlink() != info.getNlink()) {
return true;
}
}
return false;
}
}

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2007, 2009 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;
@ -25,6 +23,8 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.apache.log4j.Logger;
public abstract class FileWatcher {
private Sigar sigar;
@ -33,6 +33,9 @@ public abstract class FileWatcher {
private Set files =
Collections.synchronizedSet(new HashSet());
private static final Logger log =
SigarLog.getLogger(FileWatcher.class.getName());
public abstract void onChange(FileInfo info);
public void onNotFound(FileInfo info) {
@ -68,14 +71,22 @@ public abstract class FileWatcher {
public void add(File[] files)
throws SigarException {
for (int i=0; i<files.length; i++) {
add(files[i]);
try {
add(files[i]);
} catch (SigarFileNotFoundException e) {
log.error("Cannot add file: " + files[i].getAbsolutePath(), e);
}
}
}
public void add(String[] files)
throws SigarException {
for (int i=0; i<files.length; i++) {
add(files[i]);
try {
add(files[i]);
} catch (SigarFileNotFoundException e) {
log.error("Cannot add file: " + files[i], e);
}
}
}

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2007 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,18 @@
/*
* Copyright (C) [2004-2009], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2009 SpringSource, Inc.
* Copyright (c) 2010 VMware, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;
@ -36,7 +35,7 @@ public class Humidor {
private Object LOCK = new Object();
private InvocationHandler _handler;
private SigarProxy _sigar;
private Sigar _impl;
private Sigar _impl, _inst;
private Humidor() {}
@ -69,7 +68,7 @@ public class Humidor {
synchronized(LOCK) {
if (_sigar == null) {
if (_impl == null) {
_impl = new Sigar();
_inst = _impl = new Sigar();
}
_handler = new MyHandler(_impl);
_sigar = (SigarProxy)
@ -84,4 +83,13 @@ public class Humidor {
public static Humidor getInstance() {
return INSTANCE;
}
//close the Sigar instance if getSigar() created it
public void close() {
if (_inst != null) {
_inst.close();
_impl = _inst = null;
}
_sigar = null;
}
}

View File

@ -0,0 +1,52 @@
/*
* Copyright (c) 2009 Hyperic, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;
import java.util.HashMap;
import java.util.Map;
/**
* Object wrapper of double[] Sigar.getLoadAverage() for use in bean patterns (JMX).
*/
public class LoadAverage {
private double[] average;
public LoadAverage(double[] average) {
this.average = average;
}
public double getOneMinute() {
return this.average[0];
}
public double getFiveMinute() {
return this.average[1];
}
public double getFifteenMinute() {
return this.average[2];
}
public Map toMap() {
Map map = new HashMap();
map.put("OneMinute", new Double(getOneMinute()));
map.put("FiveMinute", new Double(getFiveMinute()));
map.put("FifteenMinute", new Double(getFifteenMinute()));
return map;
}
}

View File

@ -1,26 +1,21 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2008 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;
import java.util.HashMap;
import java.util.Map;
import org.hyperic.sigar.ptql.ProcessFinder;
/**
@ -30,64 +25,33 @@ public class MultiProcCpu extends ProcCpu {
private long pid;
private int nproc = 0;
private static Map ptable = new HashMap();
static synchronized MultiProcCpu get(Sigar sigar, String query)
throws SigarException {
throws SigarException {
MultiProcCpu cpu;
cpu = (MultiProcCpu)ptable.get(query);
if (cpu == null) {
cpu = new MultiProcCpu();
cpu.pid = query.hashCode(); //for equals()
ptable.put(query, cpu);
}
long timeNow = System.currentTimeMillis();
double diff = timeNow - cpu.lastTime;
if (diff == 0) {
return cpu; //we were just called within < 1 second ago.
}
cpu.lastTime = timeNow;
long otime = cpu.total;
MultiProcCpu cpu = new MultiProcCpu();
cpu.pid = query.hashCode(); //for equals()
cpu.total = 0;
cpu.user = 0;
cpu.sys = 0;
cpu.nproc = 0;
cpu.percent = 0.0D;
long[] pids = ProcessFinder.find(sigar, query);
cpu.nproc = pids.length;
for (int i=0; i<pids.length; i++) {
ProcTime time;
try {
time = sigar.getProcTime(pids[i]);
ProcCpu procCpu = sigar.getProcCpu(pids[i]);
cpu.total += procCpu.getTotal();
cpu.user += procCpu.getUser();
cpu.sys += procCpu.getSys();
cpu.percent += procCpu.getPercent();
} catch (SigarException e) {
//process may have gone away or EPERM
continue;
}
cpu.total += time.total;
cpu.user += time.user;
cpu.sys += time.sys;
}
if (otime == 0) {
//XXX could/should pause first time called.
return cpu;
}
cpu.percent = ((cpu.total - otime) / diff);
if (cpu.percent < 0.0) {
//counter wrapped
cpu.percent = (0.0 - cpu.percent);
}
if (cpu.percent >= 1.0) {
cpu.percent = 0.99;
}
return cpu;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2008 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,19 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2007 Hyperic, Inc.
* Copyright (c) 2009 SpringSource, Inc.
* Copyright (c) 2009 VMware, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;
@ -97,6 +97,16 @@ public class NetFlags {
public final static int IFF_SLAVE = 0x1000;
/**
* Master of a load balancer
*/
public static final int IFF_MASTER = 0x2000;
/**
* Dialup device with changing addresses
*/
public static final int IFF_DYNAMIC = 0x4000;
public static final int RTF_UP = 0x1;
public static final int RTF_GATEWAY = 0x2;
@ -157,6 +167,13 @@ public class NetFlags {
*/
public static native String getIfFlagsString(long flags);
/**
* @param network interface ipv6 address scope.
* @return String representation of ipv6 address scope.
* @see org.hyperic.sigar.NetInterfaceConfig#getScope6
*/
public static native String getScopeString(int scope);
public static boolean isAnyAddress(String address) {
return
(address == null) ||

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2007 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2007 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2008 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006, 2008 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2007 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;
@ -33,7 +31,7 @@ public class ProcUtil {
for (int i=0; i<len; i++) {
char c = name.charAt(i);
if (!((c == '.') || Character.isLetter(c))) {
if (!((c == '.') || Character.isJavaIdentifierPart(c))) {
return false;
}
}

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2007 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,18 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2009 Hyperic, Inc.
* Copyright (c) 2010 VMware, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;
@ -43,12 +42,14 @@ public class Sigar implements SigarProxy {
private static String loadError = null;
public static final long FIELD_NOTIMPL = -1;
public static final int PID_PROC_CPU_CACHE = 1;
public static final int PID_PROC_IO_CACHE = 2;
/**
* The Sigar java version.
*/
public static final String VERSION_STRING =
SigarVersion.VERSION_STRING;
Version.VERSION_STRING;
/**
* The Sigar native version.
@ -59,7 +60,7 @@ public class Sigar implements SigarProxy {
* The scm (svn) revision from which sigar.jar was built.
*/
public static final String SCM_REVISION =
SigarVersion.SCM_REVISION;
Version.SCM_REVISION;
/**
* The scm (svn) revision from which the sigar native binary was built.
@ -70,7 +71,7 @@ public class Sigar implements SigarProxy {
* The date on which sigar.jar was built.
*/
public static final String BUILD_DATE =
SigarVersion.BUILD_DATE;
Version.BUILD_DATE;
/**
* The date on which the sigar native binary was built.
@ -156,15 +157,19 @@ public class Sigar implements SigarProxy {
}
private static void loadLibrary() throws SigarException {
try {
if (SigarLoader.IS_WIN32 &&
System.getProperty("os.version").equals("4.0"))
{
if (SigarLoader.IS_WIN32 &&
System.getProperty("os.version").equals("4.0"))
{
try {
//NT 4.0 only
String lib =
loader.findJarPath("pdh.dll") +
File.separator + "pdh.dll";
loader.systemLoad(lib);
}
} catch (Exception e) {}
}
try {
loader.load();
} catch (ArchNotSupportedException e) {
throw new SigarException(e.getMessage());
@ -375,7 +380,7 @@ public class Sigar implements SigarProxy {
CpuPerc[] perc =
new CpuPerc[curLen < oldLen ? curLen : oldLen];
for (int i=0; i<curLen; i++) {
for (int i=0; i<perc.length; i++) {
perc[i] =
CpuPerc.fetch(this, oldCpuList[i],
this.lastCpuList[i]);
@ -635,6 +640,57 @@ public class Sigar implements SigarProxy {
Integer.parseInt(port));
}
/**
* Get process disk IO info.
* @param pid THe process id.
* @exception SigarException on failure.
*/
public ProcDiskIO getProcDiskIO(long pid) throws SigarException {
try {
return ProcDiskIO.fetch(this, pid);
} catch (UnsatisfiedLinkError linkErrorException) {
// We want to handle exceptions gracefully even if the linked
// shared library is older and isn't compiled with the ProcDiskIO APIs.
// The downside of this is that we throw SigarNotImplemented exception
// also when the shared library can't be loaded.
SigarException sigarException = new SigarNotImplementedException();
sigarException.initCause(linkErrorException);
throw sigarException;
}
}
public ProcDiskIO getProcDiskIO(String pid) throws SigarException {
return getProcDiskIO(convertPid(pid));
}
/**
* Get process cumulative disk IO info.
* @param pid THe process id.
* @exception SigarException on failure.
*/
public ProcCumulativeDiskIO getProcCumulativeDiskIO(long pid) throws SigarException {
try {
return ProcCumulativeDiskIO.fetch(this, pid);
} catch (UnsatisfiedLinkError linkErrorException) {
// We want to handle exceptions gracefully even if the linked
// shared library is older and isn't compiled with the ProcDiskIO APIs.
// The downside of this is that we throw SigarNotImplemented exception
// also when the shared library can't be loaded.
SigarException sigarException = new SigarNotImplementedException();
sigarException.initCause(linkErrorException);
throw sigarException;
}
}
public ProcCumulativeDiskIO getProcCumulativeDiskIO(String pid) throws SigarException {
return getProcCumulativeDiskIO(convertPid(pid));
}
public DumpPidCache dumpPidCache() throws SigarException {
return DumpPidCache.fetch(this);
}
/**
* Get the cumulative cpu time for the calling thread.
*/
@ -804,6 +860,9 @@ public class Sigar implements SigarProxy {
return netstat;
}
public native Arp[] getArpList()
throws SigarException;
public native Who[] getWhoList()
throws SigarException;
@ -955,6 +1014,10 @@ public class Sigar implements SigarProxy {
*/
public native String getFQDN() throws SigarException;
public SigarVersion getSigarVersion() {
return new SigarVersion();
}
/**
* Enabling logging in the native Sigar code.
* This method will hook log4j into the Sigar

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2007 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006, 2008 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;
@ -96,7 +94,7 @@ public class SigarInvoker {
this.sigarProxy = proxy;
}
protected void setType(String val) {
public void setType(String val) {
String alias = (String)compatTypes.get(val);
if (alias != null) {
val = alias;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006-2008 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;

View File

@ -1,19 +1,17 @@
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
* Copyright (c) 2006 Hyperic, Inc.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperic.sigar;
@ -31,6 +29,8 @@ public class SigarLog {
private static final int LOG_INFO = 3;
private static final int LOG_DEBUG = 4;
private static final boolean enableLogFallbackConf = ! Boolean.getBoolean("sigar.noLog4jDefaultConfig");
private static native void setLogger(Sigar sigar, Logger log);
public static native void setLevel(Sigar sigar, int level);
@ -48,7 +48,7 @@ public class SigarLog {
public static Logger getLogger(String name) {
Logger log = Logger.getLogger(name);
if (!isLogConfigured()) {
if (enableLogFallbackConf && !isLogConfigured()) {
BasicConfigurator.configure();
}
return log;

Some files were not shown because too many files have changed in this diff Show More