Compare commits
241
Commits
sigar-1.6.0
...
sigar-1.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
494ed4ed3e | ||
|
|
f12b8e32d3 | ||
|
|
9c931654d7 | ||
|
|
797d8a9edf | ||
|
|
449de48cea | ||
|
|
a04f46a647 | ||
|
|
d83284613b | ||
|
|
012dcef75d | ||
|
|
f21897f93b | ||
|
|
710a3f791b | ||
|
|
510a4b5c89 | ||
|
|
0a3f546638 | ||
|
|
a693ebce90 | ||
|
|
2d2c4c996d | ||
|
|
639169e9cc | ||
|
|
8a4c9f6eb0 | ||
|
|
87f0aa7f6f | ||
|
|
692f5a43ea | ||
|
|
b8c6325123 | ||
|
|
d1a4f8e55e | ||
|
|
ef5317a2da | ||
|
|
e43244a6e9 | ||
|
|
4e0b8c02d0 | ||
|
|
4b67f577f4 | ||
|
|
61837690b9 | ||
|
|
2378412774 | ||
|
|
3774ce96fa | ||
|
|
1a9dfe999e | ||
|
|
99c4228cad | ||
|
|
c9d4bf9758 | ||
|
|
73f9b8cf84 | ||
|
|
1c9b45eab1 | ||
|
|
bb122cc1e4 | ||
|
|
54ef26bab6 | ||
|
|
b40013def1 | ||
|
|
30e8d0e2c1 | ||
|
|
b3078dca91 | ||
|
|
a5dacd4d03 | ||
|
|
8cd05ddc64 | ||
|
|
647f3d32c3 | ||
|
|
4b9e309c8b | ||
|
|
0bee437f85 | ||
|
|
6259451277 | ||
|
|
bbc21090a1 | ||
|
|
c9ef9f4bb6 | ||
|
|
aa2cbaa89b | ||
|
|
277b80791c | ||
|
|
56e03d7243 | ||
|
|
5d79c359d4 | ||
|
|
f272cb2b5d | ||
|
|
788c125c68 | ||
|
|
5324c6f235 | ||
|
|
745508e3c0 | ||
|
|
5f77c77158 | ||
|
|
c46af75d74 | ||
|
|
6c1f0a9871 | ||
|
|
55002f1930 | ||
|
|
4227bf6ab9 | ||
|
|
9ce6361973 | ||
|
|
9fb759fb17 | ||
|
|
9dbbcce60a | ||
|
|
b94783b9ad | ||
|
|
cd422901c9 | ||
|
|
7f4a3a3fd4 | ||
|
|
127099cd34 | ||
|
|
d3acf798d5 | ||
|
|
1ba3abd3ab | ||
|
|
6a0cd93cf5 | ||
|
|
21a09f23d4 | ||
|
|
b1da05dbe0 | ||
|
|
e4fda73a29 | ||
|
|
f27542af5b | ||
|
|
29c96e2343 | ||
|
|
2dc981dfa8 | ||
|
|
7905904cb6 | ||
|
|
b2d33467b8 | ||
|
|
fd9acb0004 | ||
|
|
e20e2eaa54 | ||
|
|
a210aa7e23 | ||
|
|
feabd736de | ||
|
|
eac18a6b4e | ||
|
|
d47fd1e3e7 | ||
|
|
392f6325e0 | ||
|
|
3e98f20197 | ||
|
|
46897838f6 | ||
|
|
035a097325 | ||
|
|
e86a150a8d | ||
|
|
32512cde90 | ||
|
|
9cc30ca006 | ||
|
|
3e4a408f74 | ||
|
|
b1352e2f76 | ||
|
|
ce7be03af5 | ||
|
|
a4915e8ed6 | ||
|
|
089ba0d93c | ||
|
|
a96bd1bc04 | ||
|
|
32040563ce | ||
|
|
6eef4f7cdc | ||
|
|
6b9ac77afa | ||
|
|
0d3d5e45da | ||
|
|
55167b6ebe | ||
|
|
f16b3e3daa | ||
|
|
d3e019dd98 | ||
|
|
7a30f1e4a2 | ||
|
|
f5766d5593 | ||
|
|
ac44312b5e | ||
|
|
cb1f3dafe7 | ||
|
|
315c8474d9 | ||
|
|
6500952e5b | ||
|
|
fdc0cf5c1f | ||
|
|
c6b35167c8 | ||
|
|
c88b49abe2 | ||
|
|
0b335d9025 | ||
|
|
a08120c323 | ||
|
|
e3b378ecd1 | ||
|
|
e3068f466a | ||
|
|
079dd9b09f | ||
|
|
9149e907ef | ||
|
|
b05f332705 | ||
|
|
c310dffb84 | ||
|
|
57b8fff72f | ||
|
|
8c1608bb76 | ||
|
|
2550c6373a | ||
|
|
7d236ebc39 | ||
|
|
e5c1e8ac07 | ||
|
|
8dd2a25568 | ||
|
|
5fb1bcdb15 | ||
|
|
00a4ebf85e | ||
|
|
4a926f42d5 | ||
|
|
a355ba22c9 | ||
|
|
60182c3f82 | ||
|
|
1a00826ebb | ||
|
|
07f9d49931 | ||
|
|
ab8759261e | ||
|
|
ceab542f7b | ||
|
|
90c2b19127 | ||
|
|
9e699babc5 | ||
|
|
4bd3ef75a9 | ||
|
|
8cef393365 | ||
|
|
a3851c6b9a | ||
|
|
1039b12396 | ||
|
|
5145e6b8c8 | ||
|
|
d4ac7f1ecf | ||
|
|
80016c67c7 | ||
|
|
de915ae0d1 | ||
|
|
4d0046fa25 | ||
|
|
4bffa314d2 | ||
|
|
9326fe4a99 | ||
|
|
b8d4a04dfe | ||
|
|
c8609e9e4a | ||
|
|
7d483e3982 | ||
|
|
ce39c1ad1e | ||
|
|
22e9e06b9d | ||
|
|
3f3a070045 | ||
|
|
e9e3dce323 | ||
|
|
d048e0ccdc | ||
|
|
89b0b68ece | ||
|
|
07941d4304 | ||
|
|
8866170e52 | ||
|
|
bc492c8945 | ||
|
|
0e0d7ea1f7 | ||
|
|
46427ad949 | ||
|
|
2b0c7f8205 | ||
|
|
a788e2b6e2 | ||
|
|
d29ef6d6ac | ||
|
|
2b00bad1c1 | ||
|
|
d3d35e937f | ||
|
|
621f9ccb61 | ||
|
|
3366588f85 | ||
|
|
4f223cc4d6 | ||
|
|
af75428ab6 | ||
|
|
bb5fec3790 | ||
|
|
b3abdd5a53 | ||
|
|
eeadfd104b | ||
|
|
bace63f710 | ||
|
|
91ba1a2c3d | ||
|
|
596bc2a522 | ||
|
|
a04e2db66f | ||
|
|
fb9a5f3357 | ||
|
|
64a6f41925 | ||
|
|
26872fdda0 | ||
|
|
cb8eb6b183 | ||
|
|
5ac96fb803 | ||
|
|
f1e3a4c37c | ||
|
|
3ab4e297a9 | ||
|
|
9fec04ad66 | ||
|
|
289f024956 | ||
|
|
5e4d11f6ce | ||
|
|
4c5873885e | ||
|
|
8c8d4cf814 | ||
|
|
039080f722 | ||
|
|
68cf08cf4d | ||
|
|
6d6b5577b1 | ||
|
|
880a24ad30 | ||
|
|
ae289d3d41 | ||
|
|
b64ebca57e | ||
|
|
bc3e8ed6d4 | ||
|
|
7ef48da327 | ||
|
|
7a5288278c | ||
|
|
2e3c302f4f | ||
|
|
93afe26132 | ||
|
|
22dec9316c | ||
|
|
9774d05e20 | ||
|
|
bca7314718 | ||
|
|
bf342bc9cf | ||
|
|
3a9d6b7024 | ||
|
|
95dcc68c57 | ||
|
|
5d50f402bb | ||
|
|
5df4c608b4 | ||
|
|
143e8fb6bd | ||
|
|
e787667e91 | ||
|
|
1cd800ff6e | ||
|
|
08cfdfef6e | ||
|
|
a7495637a9 | ||
|
|
bd2178d0cf | ||
|
|
6db07f1cba | ||
|
|
ede7b6c9de | ||
|
|
bf61ce78a9 | ||
|
|
0175e969e1 | ||
|
|
be5f4930a7 | ||
|
|
4c441a3ee2 | ||
|
|
06f4770bf0 | ||
|
|
1ccf48ca19 | ||
|
|
4867aeb235 | ||
|
|
d19ab5ae30 | ||
|
|
8e9ab74eee | ||
|
|
c2114a71e1 | ||
|
|
ec7d726a9d | ||
|
|
26f2977533 | ||
|
|
b3b194e97b | ||
|
|
f2c9cc9d61 | ||
|
|
b1890e438d | ||
|
|
4424c48981 | ||
|
|
a6b5f3f30b | ||
|
|
61327b9034 | ||
|
|
7ac30e778a | ||
|
|
9b4dd7b263 | ||
|
|
29d57da8a9 | ||
|
|
898e933070 | ||
|
|
19a76d5fa1 | ||
|
|
4f4805ffd1 | ||
|
|
5c905c8e64 |
No files matched your search
@@ -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>
|
||||||
@@ -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.
|
|
||||||
@@ -1,3 +1,368 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
2009-07-08 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* (SIGAR-130) Use pstat(PSTAT_GETCOMMANDLINE,...) on HP-UX < 11iv2
|
||||||
|
|
||||||
|
* (SIGAR-130) Use pstat_getcommandline on HP-UX 11iv2+
|
||||||
|
|
||||||
|
* (SIGAR-131) switch to pst_fileinfo2 on all HPUX flavors
|
||||||
|
|
||||||
|
2009-07-08 Jon Travis <jtravis@p00p.org>
|
||||||
|
|
||||||
|
* (SIGAR-150) Wrapper class to synchronize Sigar method invocation
|
||||||
|
|
||||||
|
2009-07-07 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* add getNetServicesName to SigarProxy interface
|
||||||
|
|
||||||
|
2009-07-02 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* (SIGAR-145) default to 'Irix mode' for proc_cpu.percent
|
||||||
|
|
||||||
|
* (SIGAR-144) Solaris net_interface_stat should use 64-bit kstats
|
||||||
|
|
||||||
|
2009-07-01 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* (SIGAR-148) statfs usage compiled with LFS flags
|
||||||
|
|
||||||
|
2009-06-30 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* (SIGAR-152) Add support for 31-bit s390 builds
|
||||||
|
|
||||||
|
2009-06-17 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* darwin sigar_dlinfo_modules impl
|
||||||
|
|
||||||
|
2009-06-06 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* (SIGAR-151) Add Modules support to PTQL
|
||||||
|
|
||||||
|
2009-06-01 Kay Röpke <kroepke@classdump.local>
|
||||||
|
|
||||||
|
* (SIGAR-149) fix Darwin side of SIGAR-47: integer multlipcation overflow on
|
||||||
|
32bit builds with more than 4GB available memory
|
||||||
|
|
||||||
|
2009-05-24 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* (SIGAR-142) loosen net_interface_list filters on MacOSX
|
||||||
|
|
||||||
|
2009-05-15 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* (SIGAR-150) make SigarProxyCached.invoke synchronized
|
||||||
|
|
||||||
|
2009-05-13 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* fix so SigarPermissionDeniedException is throw on open /dev/kmem EACCES
|
||||||
|
|
||||||
|
* add 64-bit compile/link flags for AIX
|
||||||
|
|
||||||
|
* require libperfstat on aix
|
||||||
|
|
||||||
|
2009-04-25 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* getrusage on NetBSD may not return monotonically increasing
|
||||||
|
values for CPU time.
|
||||||
|
|
||||||
|
* (SIGAR-39) Use kern.cp_times in cpu_list on FreeBSD 7.x+
|
||||||
|
|
||||||
|
2009-03-27 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* (SIGAR-141) sigar.jar location is not required to find native library
|
||||||
|
|
||||||
|
2009-03-25 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* (SIGAR-140) interface aliases are valid in sigar_net_interface_config_primary_get
|
||||||
|
|
||||||
|
2008-02-13 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* 1.6.2 release
|
||||||
|
|
||||||
|
2009-02-12 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* (SIGAR-134) use UNICODE in EventLog wrapper
|
||||||
|
|
||||||
|
2009-02-10 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* (SIGAR-73) check for 'ocfs' in addition to 'ocfs2'
|
||||||
|
|
||||||
|
2009-02-08 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* (SIGAR-138) Recognize zfs as local filesystem type
|
||||||
|
|
||||||
|
2009-02-06 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* fix osx version on 64-bit platforms
|
||||||
|
|
||||||
|
* [SIGAR-133] use InputStream.skip (bytes) instead of Reader.skip (chars) in onChange
|
||||||
|
|
||||||
|
* [SIGAR-132] Fix possible memory leak in sigar_rpc_ping
|
||||||
|
|
||||||
|
* [SIGAR-129] fix possible integer overflow in time_now_millis
|
||||||
|
|
||||||
|
* [SIGAR-129] add another sanity check
|
||||||
|
|
||||||
|
* [SIGAR-129] prevent possible wrapping
|
||||||
|
|
||||||
|
* [SIGAR-129] prevent possible integer overflow
|
||||||
|
|
||||||
|
* [SIGAR-127] use KERN_ARGMAX for KERN_PROCARGS2 buffer size
|
||||||
|
|
||||||
|
* [SIGAR-126] /dev/kmem not usable in aix 6
|
||||||
|
|
||||||
|
* rid "warning: cast from pointer to integer of different size" on 64-bit builds
|
||||||
|
|
||||||
|
* [SIGAR-125] bring back /private/var/vm swap impl for osx 10.3
|
||||||
|
|
||||||
|
* [SIGAR-123] do not include global shared text+data region size
|
||||||
|
|
||||||
|
* [SIGAR-122] ARG_MAX undefined on glibc 2.8
|
||||||
|
|
||||||
|
2008-09-13 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* include ptql and log in dist headers
|
||||||
|
|
||||||
|
* dont include ant and mx4j jars in dist
|
||||||
|
|
||||||
|
* add cpu_perc typemap to bindings/perl
|
||||||
|
|
||||||
|
2008-09-11 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* [SIGAR-120] Support WoW registry reflection
|
||||||
|
|
||||||
|
2008-09-08 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
|
* [SIGAR-119] Use 64-bit performance counter for uptime
|
||||||
|
|
||||||
2008-09-06 Doug MacEachern <dougm@hyperic.com>
|
2008-09-06 Doug MacEachern <dougm@hyperic.com>
|
||||||
|
|
||||||
* 1.6 released, change summary:
|
* 1.6 released, change summary:
|
||||||
|
|||||||
-104
@@ -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
|
|
||||||
@@ -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.
|
||||||
@@ -1,43 +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:
|
|
||||||
|
|
||||||
- BCEL -
|
|
||||||
Information: http://jakarta.apache.org/bcel/index.html
|
|
||||||
License: http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
- 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
|
|
||||||
@@ -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.
|
||||||
+76
-38
@@ -1,3 +1,20 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2007-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.
|
||||||
|
#
|
||||||
|
|
||||||
#extension source generator for all bindings
|
#extension source generator for all bindings
|
||||||
package SigarWrapper;
|
package SigarWrapper;
|
||||||
|
|
||||||
@@ -77,6 +94,7 @@ my %has_name_arg = map { $_, 1 } qw(FileSystemUsage DiskUsage
|
|||||||
FileAttrs DirStat DirUsage
|
FileAttrs DirStat DirUsage
|
||||||
NetInterfaceConfig NetInterfaceStat);
|
NetInterfaceConfig NetInterfaceStat);
|
||||||
|
|
||||||
|
|
||||||
my %proc_no_arg = map { $_, 1 } qw(stat);
|
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
|
my %get_not_impl = map { $_, 1 } qw(net_address net_route net_connection net_stat cpu_perc
|
||||||
@@ -551,6 +569,7 @@ use vars qw(%classes %cmds);
|
|||||||
plat => '*'
|
plat => '*'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
ProcMem => [
|
ProcMem => [
|
||||||
{
|
{
|
||||||
name => 'size', type => 'Long',
|
name => 'size', type => 'Long',
|
||||||
@@ -651,6 +670,59 @@ use vars qw(%classes %cmds);
|
|||||||
plat => '*'
|
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'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
DumpPidCache => [
|
||||||
|
{
|
||||||
|
name => 'dummy', type => 'Long',
|
||||||
|
desc => 'Dummy',
|
||||||
|
plat => 'LWAHS'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
ProcState => [
|
ProcState => [
|
||||||
{
|
{
|
||||||
name => 'state', type => 'Char',
|
name => 'state', type => 'Char',
|
||||||
@@ -824,22 +896,22 @@ use vars qw(%classes %cmds);
|
|||||||
FileSystemUsage => [
|
FileSystemUsage => [
|
||||||
{
|
{
|
||||||
name => 'total', type => 'Long',
|
name => 'total', type => 'Long',
|
||||||
desc => 'Total bytes of filesystem',
|
desc => 'Total Kbytes of filesystem',
|
||||||
plat => '*'
|
plat => '*'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name => 'free', type => 'Long',
|
name => 'free', type => 'Long',
|
||||||
desc => 'Total free bytes on filesystem',
|
desc => 'Total free Kbytes on filesystem',
|
||||||
plat => '*'
|
plat => '*'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name => 'used', type => 'Long',
|
name => 'used', type => 'Long',
|
||||||
desc => 'Total used bytes on filesystem',
|
desc => 'Total used Kbytes on filesystem',
|
||||||
plat => '*'
|
plat => '*'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name => 'avail', type => 'Long',
|
name => 'avail', type => 'Long',
|
||||||
desc => 'Total free bytes on filesystem available to caller',
|
desc => 'Total free Kbytes on filesystem available to caller',
|
||||||
plat => '*'
|
plat => '*'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -2777,39 +2849,5 @@ sub finish {
|
|||||||
$self->SUPER::finish;
|
$self->SUPER::finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
#XXX not currently supporting netware
|
|
||||||
package SigarWrapper::Netware;
|
|
||||||
|
|
||||||
use vars qw(@ISA);
|
|
||||||
@ISA = qw(SigarWrapper);
|
|
||||||
|
|
||||||
sub start {
|
|
||||||
my $self = shift;
|
|
||||||
$self->SUPER::start;
|
|
||||||
$self->{dfh} = $self->create('javasigar_generated.def');
|
|
||||||
}
|
|
||||||
|
|
||||||
sub finish {
|
|
||||||
my $self = shift;
|
|
||||||
my $fh = $self->{dfh};
|
|
||||||
for my $func (@{ $self->{nativefunc} }) {
|
|
||||||
#$fh->println($nativefunc) if $impl;
|
|
||||||
}
|
|
||||||
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} . "_";
|
|
||||||
}
|
|
||||||
$fh->println("Java_org_hyperic_sigar_$class$2");
|
|
||||||
}
|
|
||||||
close JSIGAR;
|
|
||||||
|
|
||||||
$self->SUPER::finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
__END__
|
__END__
|
||||||
@@ -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 System;
|
||||||
using Hyperic.Sigar;
|
using Hyperic.Sigar;
|
||||||
|
|
||||||
|
|||||||
@@ -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 System;
|
||||||
using Hyperic.Sigar;
|
using Hyperic.Sigar;
|
||||||
|
|
||||||
|
|||||||
@@ -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 System;
|
||||||
using Hyperic.Sigar;
|
using Hyperic.Sigar;
|
||||||
|
|
||||||
|
|||||||
@@ -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 System;
|
||||||
using Hyperic.Sigar;
|
using Hyperic.Sigar;
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2004-2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@@ -3,11 +3,10 @@
|
|||||||
<classpathentry kind="src" path="build/src"/>
|
<classpathentry kind="src" path="build/src"/>
|
||||||
<classpathentry kind="src" path="hyperic_jni/src"/>
|
<classpathentry kind="src" path="hyperic_jni/src"/>
|
||||||
<classpathentry kind="src" path="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="lib" path="hyperic_jni/lib/cpptasks.jar"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="lib" path="lib/log4j.jar"/>
|
<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"/>
|
<classpathentry kind="output" path="build/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
build
|
||||||
|
sigar-bin
|
||||||
+25
-61
@@ -14,6 +14,7 @@
|
|||||||
<property name="jni.define.name" value="SIGAR"/>
|
<property name="jni.define.name" value="SIGAR"/>
|
||||||
<property name="sigar-bin" location="sigar-bin"/>
|
<property name="sigar-bin" location="sigar-bin"/>
|
||||||
<property name="sigar-bin-dir" 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.bin" location="${sigar-bin}"/>
|
||||||
<property name="jni.source.dir" location="../.."/>
|
<property name="jni.source.dir" location="../.."/>
|
||||||
<property name="jni.src.java" value="hyperic_jni/src"/>
|
<property name="jni.src.java" value="hyperic_jni/src"/>
|
||||||
@@ -55,6 +56,7 @@
|
|||||||
<path id="alljars">
|
<path id="alljars">
|
||||||
<path refid="libjars"/>
|
<path refid="libjars"/>
|
||||||
<fileset dir="${sigar-bin}/lib" includes="${sigar.jar}"/>
|
<fileset dir="${sigar-bin}/lib" includes="${sigar.jar}"/>
|
||||||
|
<fileset dir="${ant.library.dir}" includes="junit*.jar"/>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<target name="javadoc_check">
|
<target name="javadoc_check">
|
||||||
@@ -83,21 +85,26 @@
|
|||||||
doctitle="Sigar">
|
doctitle="Sigar">
|
||||||
<group title="Sigar" packages="org.hyperic.sigar" />
|
<group title="Sigar" packages="org.hyperic.sigar" />
|
||||||
<classpath refid="libjars"/>
|
<classpath refid="libjars"/>
|
||||||
<classpath><path path="${env.ANT_HOME}/lib/ant.jar"/></classpath>
|
<classpath><path path="${ant.library.dir}/ant.jar"/></classpath>
|
||||||
<bottom>Copyright © ${copyright.year} <![CDATA[<a target="_top" href="http://www.hyperic.com/">Hyperic</a>]]>. All Rights Reserved.</bottom>
|
<bottom>Copyright © ${copyright.year} <![CDATA[<a target="_top" href="http://www.hyperic.com/">Hyperic</a>]]>. All Rights Reserved.</bottom>
|
||||||
</javadoc>
|
</javadoc>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="compile">
|
<target name="compile">
|
||||||
<mkdir dir="${build}/classes"/>
|
<mkdir dir="${build}/classes"/>
|
||||||
|
<available classname="junit.framework.TestCase" property="junit.present">
|
||||||
|
<classpath refid="alljars"/>
|
||||||
|
</available>
|
||||||
<javac destdir="${build}/classes"
|
<javac destdir="${build}/classes"
|
||||||
source="1.4" target="1.4"
|
source="1.4" target="1.4"
|
||||||
|
sourcepath=""
|
||||||
debug="true"
|
debug="true"
|
||||||
classpathref="libjars">
|
classpathref="libjars">
|
||||||
<src path="${src}"/>
|
<src path="${src}"/>
|
||||||
<src path="${build}/src"/>
|
<src path="${build}/src"/>
|
||||||
<src path="${jni.src.java}"/>
|
<src path="${jni.src.java}"/>
|
||||||
<include name="**/*.java"/>
|
<include name="**/*.java"/>
|
||||||
|
<exclude name="**/test/*.java" unless="junit.present"/>
|
||||||
</javac>
|
</javac>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
@@ -116,7 +123,7 @@
|
|||||||
<replace file="${version.tofile}">
|
<replace file="${version.tofile}">
|
||||||
<replacefilter token="@@BUILD_DATE@@" value="${BUILD_DATE}"/>
|
<replacefilter token="@@BUILD_DATE@@" value="${BUILD_DATE}"/>
|
||||||
<replacefilter token="@@VERSION_STRING@@" value="${sigar.version}.${version.build}"/>
|
<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="@@ARCHNAME@@" value="${jni.libarch}"/>
|
||||||
<replacefilter token="@@ARCHLIB@@" value="${jni.libname.full}"/>
|
<replacefilter token="@@ARCHLIB@@" value="${jni.libname.full}"/>
|
||||||
<replacefilter token="@@BINNAME@@" value="${jni.project.archname}"/>
|
<replacefilter token="@@BINNAME@@" value="${jni.project.archname}"/>
|
||||||
@@ -128,35 +135,12 @@
|
|||||||
</replace>
|
</replace>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="check-svn">
|
<target name="sigar-version">
|
||||||
<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="scm-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="sigar-version" depends="check-svn,scm-revision">
|
|
||||||
<tstamp>
|
<tstamp>
|
||||||
<format property="BUILD_DATE" pattern="MM/dd/yyyy hh:mm aa"/>
|
<format property="BUILD_DATE" pattern="MM/dd/yyyy hh:mm aa"/>
|
||||||
</tstamp>
|
</tstamp>
|
||||||
|
|
||||||
<!-- in the case of release source builds -->
|
<echo message="SIGAR git revision ${jni.scmrev}"/>
|
||||||
<property name="sigar.scmrev" value="exported"/>
|
|
||||||
|
|
||||||
<antcall target="version-file">
|
<antcall target="version-file">
|
||||||
<param name="version.file"
|
<param name="version.file"
|
||||||
@@ -169,16 +153,7 @@
|
|||||||
<param name="version.file"
|
<param name="version.file"
|
||||||
value="src/sigar_version.c"/>
|
value="src/sigar_version.c"/>
|
||||||
<param name="version.tofile"
|
<param name="version.tofile"
|
||||||
value="${build}/src/sigar_version_${jni.libarch}.c"/>
|
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>
|
||||||
|
|
||||||
<antcall target="version-file">
|
<antcall target="version-file">
|
||||||
@@ -235,11 +210,12 @@
|
|||||||
<include name="src/*.c"/>
|
<include name="src/*.c"/>
|
||||||
<exclude name="src/sigar_main.c"/>
|
<exclude name="src/sigar_main.c"/>
|
||||||
<include name="src/os/${jni.src}/*.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/jni/*.c"/>
|
||||||
<include name="bindings/java/src/${win32.jni}/*.cpp"/>
|
<include name="bindings/java/src/${win32.jni}/*.cpp"/>
|
||||||
<include name="bindings/java/src/${win32.jni}/*.c"/>
|
<include name="bindings/java/src/${win32.jni}/*.c"/>
|
||||||
<include name="bindings/java/src/${vmware.jni}/*.c"/>
|
<include name="bindings/java/src/${vmware.jni}/*.c"/>
|
||||||
<include name="bindings/java/build/src/sigar_version_${jni.libarch}.c"/>
|
<include name="bindings/java/build/src/sigar_version.c"/>
|
||||||
</patternset>
|
</patternset>
|
||||||
|
|
||||||
<path id="jni.include.dirs">
|
<path id="jni.include.dirs">
|
||||||
@@ -263,15 +239,9 @@
|
|||||||
<isset property="aix"/>
|
<isset property="aix"/>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<condition property="jni.libset.libs" value="odm,cfg">
|
<condition property="jni.libset.libs" value="odm,cfg,perfstat,pthreads">
|
||||||
<isset property="aix"/>
|
<isset property="aix"/>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<copy toDir="${sigar-bin}/lib">
|
|
||||||
<fileset dir="lib">
|
|
||||||
<include name="pdh.dll"/>
|
|
||||||
</fileset>
|
|
||||||
</copy>
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="copy-includes">
|
<target name="copy-includes">
|
||||||
@@ -281,6 +251,8 @@
|
|||||||
<include name="sigar.h"/>
|
<include name="sigar.h"/>
|
||||||
<include name="sigar_fileinfo.h"/>
|
<include name="sigar_fileinfo.h"/>
|
||||||
<include name="sigar_format.h"/>
|
<include name="sigar_format.h"/>
|
||||||
|
<include name="sigar_ptql.h"/>
|
||||||
|
<include name="sigar_log.h"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
@@ -328,15 +300,6 @@
|
|||||||
depends="jni-init,prepare-src,jni-compile,jni-lib-copy,copy-includes"
|
depends="jni-init,prepare-src,jni-compile,jni-lib-copy,copy-includes"
|
||||||
if="jni.libarch"/>
|
if="jni.libarch"/>
|
||||||
|
|
||||||
<target name="build-perfstat" depends="jni-init" if="aix">
|
|
||||||
<ant dir="../../src/os/aix/perfstat"/>
|
|
||||||
<copy toDir="${sigar-bin}/lib" overwrite="true">
|
|
||||||
<fileset dir="${build}">
|
|
||||||
<include name="libsigar_aixperfstat.so"/>
|
|
||||||
</fileset>
|
|
||||||
</copy>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="pack">
|
<target name="pack">
|
||||||
<jar jarfile="${sigar-bin}/lib/${sigar.jar}"
|
<jar jarfile="${sigar-bin}/lib/${sigar.jar}"
|
||||||
basedir="${build}/classes">
|
basedir="${build}/classes">
|
||||||
@@ -348,7 +311,7 @@
|
|||||||
</jar>
|
</jar>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="build" depends="build-jni,build-perfstat,compile,pack"/>
|
<target name="build" depends="build-jni,compile,pack"/>
|
||||||
|
|
||||||
<target name="clean">
|
<target name="clean">
|
||||||
<delete dir="${build}"/>
|
<delete dir="${build}"/>
|
||||||
@@ -445,7 +408,7 @@
|
|||||||
<include name="lib/*.lib"/>
|
<include name="lib/*.lib"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
<fileset dir=".">
|
<fileset dir=".">
|
||||||
<include name="lib/*.jar"/>
|
<include name="lib/log4j.jar"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
@@ -513,10 +476,10 @@
|
|||||||
<target name="dist-common" depends="javadoc,dist-bindings">
|
<target name="dist-common" depends="javadoc,dist-bindings">
|
||||||
<copy toDir="${dist}" overwrite="true">
|
<copy toDir="${dist}" overwrite="true">
|
||||||
<fileset dir="../..">
|
<fileset dir="../..">
|
||||||
|
<include name="AUTHORS"/>
|
||||||
<include name="README"/>
|
<include name="README"/>
|
||||||
<include name="COPYING"/>
|
<include name="LICENSE"/>
|
||||||
<include name="LICENSES"/>
|
<include name="NOTICE"/>
|
||||||
<include name="EXCEPTIONS"/>
|
|
||||||
<include name="ChangeLog"/>
|
<include name="ChangeLog"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
@@ -542,6 +505,7 @@
|
|||||||
<include name="bindings/java/**/*.java"/>
|
<include name="bindings/java/**/*.java"/>
|
||||||
<include name="bindings/java/**/*.java.in"/>
|
<include name="bindings/java/**/*.java.in"/>
|
||||||
<include name="bindings/java/**/*.c"/>
|
<include name="bindings/java/**/*.c"/>
|
||||||
|
<include name="bindings/java/**/*.cpp"/>
|
||||||
<include name="bindings/java/**/*.h"/>
|
<include name="bindings/java/**/*.h"/>
|
||||||
<include name="bindings/java/**/*.pl"/>
|
<include name="bindings/java/**/*.pl"/>
|
||||||
<include name="bindings/java/**/build.xml"/>
|
<include name="bindings/java/**/build.xml"/>
|
||||||
@@ -549,8 +513,8 @@
|
|||||||
<include name="bindings/java/.classpath"/>
|
<include name="bindings/java/.classpath"/>
|
||||||
<include name="bindings/java/.project"/>
|
<include name="bindings/java/.project"/>
|
||||||
<include name="bindings/java/.sigar_shellrc"/>
|
<include name="bindings/java/.sigar_shellrc"/>
|
||||||
<include name="bindings/java/lib/*.jar"/>
|
<include name="bindings/java/lib/log4j.jar"/>
|
||||||
<include name="bindings/java/lib/*.dll"/>
|
<include name="bindings/java/lib/junit.jar"/>
|
||||||
<exclude name="**/.svn/**"/>
|
<exclude name="**/.svn/**"/>
|
||||||
<exclude name="bindings/java/build/**"/>
|
<exclude name="bindings/java/build/**"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
|
|||||||
@@ -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.*;
|
import org.hyperic.sigar.*;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -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.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.hyperic.sigar.win32.Service;
|
import org.hyperic.sigar.win32.Service;
|
||||||
|
|||||||
@@ -0,0 +1,515 @@
|
|||||||
|
<!--
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
<property environment="env"/>
|
||||||
|
|
||||||
|
<property name="build" location="build"/>
|
||||||
|
<property name="jni.bin" location="${build}"/>
|
||||||
|
<property name="jni.define.name" value="JNI"/>
|
||||||
|
<property name="jni.source.dir" value="src"/>
|
||||||
|
<property name="jni.src.java" value="src"/>
|
||||||
|
<property name="jni.libprefix" value="java"/>
|
||||||
|
<property name="jni.libversion" value=""/>
|
||||||
|
|
||||||
|
<property name="cpptasks.jar" location="lib/cpptasks.jar"/>
|
||||||
|
|
||||||
|
<taskdef name="cc" classname="net.sf.antcontrib.cpptasks.CCTask">
|
||||||
|
<classpath location="${cpptasks.jar}"/>
|
||||||
|
</taskdef>
|
||||||
|
|
||||||
|
<target name="jni-init">
|
||||||
|
<mkdir dir="${build}/classes"/>
|
||||||
|
|
||||||
|
<available property="libproc.h" file="/usr/include/libproc.h"/>
|
||||||
|
|
||||||
|
<condition property="jni.debug" value="true">
|
||||||
|
<isset property="jni.dmalloc"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.optim" value="true">
|
||||||
|
<not>
|
||||||
|
<istrue value="${jni.debug}"/>
|
||||||
|
</not>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="static.gcc">
|
||||||
|
<os arch="i386"/><!-- only for x86 solaris -->
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.javahome" value="${env.JAVA_HOME}">
|
||||||
|
<isset property="env.JAVA_HOME"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="linux">
|
||||||
|
<equals arg1="${os.name}" arg2="Linux"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="solaris">
|
||||||
|
<equals arg1="${os.name}" arg2="SunOS"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="win32">
|
||||||
|
<os family="windows"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="hpux">
|
||||||
|
<equals arg1="${os.name}" arg2="HP-UX"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="aix">
|
||||||
|
<equals arg1="${os.name}" arg2="AIX"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="darwin">
|
||||||
|
<equals arg1="${os.name}" arg2="Mac OS X"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="freebsd">
|
||||||
|
<equals arg1="${os.name}" arg2="FreeBSD"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="openbsd">
|
||||||
|
<equals arg1="${os.name}" arg2="OpenBSD"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="netbsd">
|
||||||
|
<equals arg1="${os.name}" arg2="NetBSD"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="osf1">
|
||||||
|
<equals arg1="${os.name}" arg2="OSF1"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.os" value="linux">
|
||||||
|
<isset property="linux"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.os" value="win32">
|
||||||
|
<isset property="win32"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.os" value="solaris">
|
||||||
|
<isset property="solaris"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.os" value="aix">
|
||||||
|
<isset property="aix"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.os" value="hpux">
|
||||||
|
<isset property="hpux"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.os" value="darwin">
|
||||||
|
<isset property="darwin"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.os" value="freebsd">
|
||||||
|
<isset property="freebsd"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.os" value="openbsd">
|
||||||
|
<isset property="openbsd"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.os" value="netbsd">
|
||||||
|
<isset property="netbsd"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<!-- darwin and freebsd use the same source files -->
|
||||||
|
<condition property="jni.src" value="darwin">
|
||||||
|
<isset property="freebsd"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="jni.src" value="darwin">
|
||||||
|
<isset property="openbsd"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="jni.src" value="darwin">
|
||||||
|
<isset property="netbsd"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.os" value="osf1">
|
||||||
|
<isset property="osf1"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.jdk.os" value="${jni.os}">
|
||||||
|
<and>
|
||||||
|
<isfalse value="${hpux}"/>
|
||||||
|
<isfalse value="${osf1}"/>
|
||||||
|
</and>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.jdk.os" value="hp-ux">
|
||||||
|
<istrue value="${hpux}"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.jdk.os" value="alpha">
|
||||||
|
<istrue value="${osf1}"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<condition property="jni.src" value="${jni.os}">
|
||||||
|
<isfalse value="${jni.src}"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<echo message="jni.src=${jni.src}, jni.jdk.os=${jni.jdk.os}, ${sun.arch.data.model}-bit"/>
|
||||||
|
|
||||||
|
<javac srcdir="${jni.src.java}" destdir="${build}/classes" debug="true"
|
||||||
|
source="1.4" target="1.4"
|
||||||
|
includes="org/hyperic/jni/*.java"/>
|
||||||
|
|
||||||
|
<taskdef name="libarch" classname="org.hyperic.jni.ArchNameTask">
|
||||||
|
<classpath location="${build}/classes"/>
|
||||||
|
</taskdef>
|
||||||
|
<taskdef name="copydep" classname="org.hyperic.jni.CopyDependsTask">
|
||||||
|
<classpath location="${build}/classes"/>
|
||||||
|
</taskdef>
|
||||||
|
|
||||||
|
<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}"/>
|
||||||
|
|
||||||
|
<condition property="jni.libname"
|
||||||
|
value="${jni.libprefix}${jni.project.archname}${jni.libversion}">
|
||||||
|
<isfalse value="${jni.libname}"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<property name="jni.libname.full"
|
||||||
|
value="${jni.libpre}${jni.libname}${jni.libext}"/>
|
||||||
|
|
||||||
|
<property name="jni.objdir" value="${build}/obj/${jni.libarch}"/>
|
||||||
|
|
||||||
|
<condition property="jni.cc" value="uni-cc">
|
||||||
|
<isset property="darwin"/>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<property name="jni.cc" value="jni-cc"/>
|
||||||
|
|
||||||
|
<condition property="cc.runtime" value="static">
|
||||||
|
<isset property="win32"/>
|
||||||
|
</condition>
|
||||||
|
<condition property="cc.runtime" value="dynamic">
|
||||||
|
<not>
|
||||||
|
<isset property="win32"/>
|
||||||
|
</not>
|
||||||
|
</condition>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="jni-lib-copy" if="jni.libarch">
|
||||||
|
<mkdir dir="${jni.bin}/lib"/>
|
||||||
|
|
||||||
|
<copy toDir="${jni.bin}/lib" overwrite="true">
|
||||||
|
<fileset dir="${jni.objdir}/lib"/>
|
||||||
|
</copy>
|
||||||
|
|
||||||
|
<chmod perm="a+x">
|
||||||
|
<fileset dir="${jni.bin}/lib">
|
||||||
|
<include name="*.sl"/>
|
||||||
|
</fileset>
|
||||||
|
</chmod>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="jni-compile" if="jni.libarch">
|
||||||
|
<antcall target="${jni.cc}" inheritRefs="true"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- run jni-cc twice {ppc,i386}, then feed both to lipo to build a universal binary -->
|
||||||
|
<target name="uni-cc" if="jni.libarch">
|
||||||
|
<property name="shlib" value="${jni.objdir}/lib/lib${jni.libname}.dylib"/>
|
||||||
|
|
||||||
|
<!-- ppc -->
|
||||||
|
<echo message="build 'ppc' arch"/>
|
||||||
|
<antcall target="jni-cc" inheritRefs="true">
|
||||||
|
<param name="uni.arch" value="ppc"/>
|
||||||
|
</antcall>
|
||||||
|
|
||||||
|
<copy file="${shlib}" tofile="${shlib}.ppc"/>
|
||||||
|
|
||||||
|
<!-- i386 -->
|
||||||
|
<echo message="build 'i386' arch"/>
|
||||||
|
<delete>
|
||||||
|
<fileset dir="${jni.objdir}" includes="*.o"/>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<antcall target="jni-cc" inheritRefs="true">
|
||||||
|
<param name="uni.arch" value="i386"/>
|
||||||
|
</antcall>
|
||||||
|
|
||||||
|
<copy file="${shlib}" tofile="${shlib}.i386"/>
|
||||||
|
|
||||||
|
<echo message="lipo 'ppc'+'i386'"/>
|
||||||
|
<exec executable="lipo">
|
||||||
|
<arg line="-create ${shlib}.ppc ${shlib}.i386 -output ${jni.objdir}/lib/lib${jni.libname}.dylib"/>
|
||||||
|
</exec>
|
||||||
|
|
||||||
|
<delete>
|
||||||
|
<fileset dir="${jni.objdir}/lib" includes="*.ppc,*.i386"/>
|
||||||
|
</delete>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="jni-cc" if="jni.libarch">
|
||||||
|
<mkdir dir="${jni.objdir}/lib"/>
|
||||||
|
|
||||||
|
<echo message="jni libname=${jni.libname}"/>
|
||||||
|
|
||||||
|
<cc outtype="shared"
|
||||||
|
outfile="${jni.objdir}/lib/${jni.libname}"
|
||||||
|
objdir="${jni.objdir}"
|
||||||
|
runtime="${cc.runtime}"
|
||||||
|
relentless="false">
|
||||||
|
|
||||||
|
<!-- HPUX -->
|
||||||
|
<compiler name="hp" if="hpux">
|
||||||
|
<compilerarg value="+Z"/>
|
||||||
|
<compilerarg value="+DD64" if="jni.arch64"/>
|
||||||
|
|
||||||
|
<defineset>
|
||||||
|
<define name="${jni.define.name}_HPUX"/>
|
||||||
|
<define name="_HPUX_SOURCE"/>
|
||||||
|
<define name="_REENTRANT"/>
|
||||||
|
</defineset>
|
||||||
|
</compiler>
|
||||||
|
|
||||||
|
<linker name="hp" if="hpux">
|
||||||
|
<libset if="jni.libset.libs"
|
||||||
|
dir="${jni.libset.dir}"
|
||||||
|
libs="${jni.libset.libs}"/>
|
||||||
|
|
||||||
|
<syslibset libs="nsl"/>
|
||||||
|
<syslibset libs="nm"/>
|
||||||
|
</linker>
|
||||||
|
|
||||||
|
<!-- Solaris -->
|
||||||
|
<compiler name="gcc" if="solaris">
|
||||||
|
<compilerarg value="-O2" if="jni.optim"/>
|
||||||
|
<compilerarg value="-g" if="jni.debug"/>
|
||||||
|
<compilerarg value="-Wall"/>
|
||||||
|
<compilerarg value="-Werror" if="jni.werror"/>
|
||||||
|
<compilerarg value="-m64" if="jni.arch64"/>
|
||||||
|
<defineset>
|
||||||
|
<define name="${jni.define.name}_SOLARIS"/>
|
||||||
|
<define name="_REENTRANT"/>
|
||||||
|
<define name="_POSIX_PTHREAD_SEMANTICS"/>
|
||||||
|
<define name="DMALLOC" if="jni.dmalloc"/>
|
||||||
|
</defineset>
|
||||||
|
</compiler>
|
||||||
|
|
||||||
|
<linker name="gcc" if="solaris">
|
||||||
|
<!-- required for modern gcc to avoid libgcc_s.so dependency -->
|
||||||
|
<!-- this arg is ignored by older gcc -->
|
||||||
|
<linkerarg value="-static-libgcc"/>
|
||||||
|
<linkerarg value="-m64" if="jni.arch64"/>
|
||||||
|
|
||||||
|
<libset if="jni.libset.libs"
|
||||||
|
dir="${jni.libset.dir}"
|
||||||
|
libs="${jni.libset.libs}"/>
|
||||||
|
<libset if="jni.dmalloc"
|
||||||
|
dir="${jni.dmalloc}/lib"
|
||||||
|
libs="dmallocth"/>
|
||||||
|
</linker>
|
||||||
|
|
||||||
|
<!-- Linux -->
|
||||||
|
<compiler name="gcc" debug="${jni.debug}" if="linux">
|
||||||
|
<compilerarg value="-O2" if="jni.optim"/>
|
||||||
|
<compilerarg value="-g" if="jni.debug"/>
|
||||||
|
<compilerarg value="-Wall"/>
|
||||||
|
<compilerarg value="-Werror" if="jni.werror"/>
|
||||||
|
<compilerarg value="${jni.gccm}" if="jni.gccm"/>
|
||||||
|
<defineset>
|
||||||
|
<define name="${jni.define.name}_LINUX"/>
|
||||||
|
<define name="_REENTRANT"/>
|
||||||
|
<define name="DMALLOC" if="jni.dmalloc"/>
|
||||||
|
</defineset>
|
||||||
|
</compiler>
|
||||||
|
|
||||||
|
<linker name="gcc" if="linux">
|
||||||
|
<libset if="jni.libset.libs"
|
||||||
|
dir="${jni.libset.dir}"
|
||||||
|
libs="${jni.libset.libs}"/>
|
||||||
|
<libset if="jni.dmalloc"
|
||||||
|
dir="${jni.dmalloc}/lib"
|
||||||
|
libs="dmallocth"/>
|
||||||
|
<linkerarg value="${jni.gccm}" if="jni.gccm"/>
|
||||||
|
</linker>
|
||||||
|
|
||||||
|
<!-- Darwin -->
|
||||||
|
<compiler name="gcc" if="darwin">
|
||||||
|
<compilerarg value="-Wall"/>
|
||||||
|
<compilerarg value="-Werror" if="jni.werror"/>
|
||||||
|
<compilerarg value="-m64" if="jni.arch64"/>
|
||||||
|
<compilerarg value="-O2" if="jni.optim"/>
|
||||||
|
<compilerarg value="-g" if="jni.debug"/>
|
||||||
|
<compilerarg value="-isysroot"/>
|
||||||
|
<compilerarg value="${uni.sdk}"/>
|
||||||
|
<compilerarg value="-arch"/>
|
||||||
|
<compilerarg value="${uni.arch}"/>
|
||||||
|
<compilerarg value="-mmacosx-version-min=${osx.min}"/>
|
||||||
|
|
||||||
|
<sysincludepath location="/Developer/Headers/FlatCarbon"/>
|
||||||
|
|
||||||
|
<defineset>
|
||||||
|
<define name="DARWIN"/>
|
||||||
|
<define name="DARWIN_HAS_LIBPROC_H" if="libproc.h"/>
|
||||||
|
</defineset>
|
||||||
|
</compiler>
|
||||||
|
|
||||||
|
<linker name="gcc" if="darwin">
|
||||||
|
<linkerarg value="-m64" if="jni.arch64"/>
|
||||||
|
<linkerarg value="-Wl,-syslibroot,${uni.sdk}"/>
|
||||||
|
<linkerarg value="-arch"/>
|
||||||
|
<linkerarg value="${uni.arch}"/>
|
||||||
|
<linkerarg value="-mmacosx-version-min=${osx.min}"/>
|
||||||
|
|
||||||
|
<!-- for Gestalt() -->
|
||||||
|
<linkerarg value="-framework"/>
|
||||||
|
<linkerarg value="CoreServices"/>
|
||||||
|
|
||||||
|
<linkerarg value="-sectcreate,__TEXT,__info_plist,${jni.info.plist}" if="jni.info.plist"/>
|
||||||
|
|
||||||
|
<libset if="jni.libset.libs"
|
||||||
|
dir="${jni.libset.dir}"
|
||||||
|
libs="${jni.libset.libs}"/>
|
||||||
|
|
||||||
|
<syslibset libs="IOKit"/>
|
||||||
|
</linker>
|
||||||
|
|
||||||
|
<!-- Freebsd -->
|
||||||
|
<compiler name="gcc" if="freebsd">
|
||||||
|
<compilerarg value="-O2" if="jni.optim"/>
|
||||||
|
<compilerarg value="-g" if="jni.debug"/>
|
||||||
|
<compilerarg value="-Wall"/>
|
||||||
|
<compilerarg value="-Werror" if="jni.werror"/>
|
||||||
|
<defineset>
|
||||||
|
<define name="${jni.define.name}_FREEBSD"/>
|
||||||
|
</defineset>
|
||||||
|
</compiler>
|
||||||
|
|
||||||
|
<linker name="gcc" if="freebsd">
|
||||||
|
<libset if="jni.libset.libs"
|
||||||
|
dir="${jni.libset.dir}"
|
||||||
|
libs="${jni.libset.libs}"/>
|
||||||
|
<syslibset libs="kvm"/>
|
||||||
|
</linker>
|
||||||
|
|
||||||
|
<!-- OpenBSD -->
|
||||||
|
<compiler name="gcc" if="openbsd">
|
||||||
|
<compilerarg value="-O2" if="jni.optim"/>
|
||||||
|
<compilerarg value="-g" if="jni.debug"/>
|
||||||
|
<compilerarg value="-Wall"/>
|
||||||
|
<!-- <compilerarg value="-Werror" if="jni.werror"/> -->
|
||||||
|
<defineset>
|
||||||
|
<define name="${jni.define.name}_OPENBSD"/>
|
||||||
|
</defineset>
|
||||||
|
</compiler>
|
||||||
|
|
||||||
|
<linker name="gcc" if="openbsd">
|
||||||
|
<libset if="jni.libset.libs"
|
||||||
|
dir="${jni.libset.dir}"
|
||||||
|
libs="${jni.libset.libs}"/>
|
||||||
|
<syslibset libs="kvm"/>
|
||||||
|
</linker>
|
||||||
|
|
||||||
|
<!-- NetBSD -->
|
||||||
|
<compiler name="gcc" if="netbsd">
|
||||||
|
<compilerarg value="-O2" if="jni.optim"/>
|
||||||
|
<compilerarg value="-g" if="jni.debug"/>
|
||||||
|
<compilerarg value="-Wall"/>
|
||||||
|
<!-- <compilerarg value="-Werror" if="jni.werror"/> -->
|
||||||
|
<defineset>
|
||||||
|
<define name="${jni.define.name}_NETBSD"/>
|
||||||
|
</defineset>
|
||||||
|
</compiler>
|
||||||
|
|
||||||
|
<linker name="gcc" if="netbsd">
|
||||||
|
<libset if="jni.libset.libs"
|
||||||
|
dir="${jni.libset.dir}"
|
||||||
|
libs="${jni.libset.libs}"/>
|
||||||
|
<syslibset libs="kvm"/>
|
||||||
|
</linker>
|
||||||
|
|
||||||
|
<!-- AIX -->
|
||||||
|
<compiler name="xlc_r" if="aix">
|
||||||
|
<compilerarg value="-q64" if="jni.arch64"/>
|
||||||
|
<defineset>
|
||||||
|
<define name="${jni.define.name}_AIX"/>
|
||||||
|
<define name="_ALL_SOURCE"/>
|
||||||
|
<define name="_ANSI_C_SOURCE"/>
|
||||||
|
<define name="_POSIX_SOURCE"/>
|
||||||
|
</defineset>
|
||||||
|
</compiler>
|
||||||
|
|
||||||
|
<linker name="xlc_r" if="aix">
|
||||||
|
<linkerarg value="-b64" if="jni.arch64"/>
|
||||||
|
<libset if="jni.libset.libs"
|
||||||
|
dir="${jni.libset.dir}"
|
||||||
|
libs="${jni.libset.libs}"/>
|
||||||
|
</linker>
|
||||||
|
|
||||||
|
<!-- WIN32 -->
|
||||||
|
<linker name="msvc" debug="${jni.debug}" if="win32">
|
||||||
|
<libset if="jni.libset.libs"
|
||||||
|
dir="${jni.libset.dir}"
|
||||||
|
libs="${jni.libset.libs}"/>
|
||||||
|
|
||||||
|
<linkerarg value="/MACHINE:X64" if="jni.arch64"/>
|
||||||
|
<linkerarg value="${jni.info.res}" if="jni.info.res"/>
|
||||||
|
<syslibset libs="kernel32,user32,advapi32,ws2_32,netapi32,shell32,pdh,version"/>
|
||||||
|
</linker>
|
||||||
|
|
||||||
|
<compiler name="msvc" debug="${jni.debug}" if="win32">
|
||||||
|
<defineset>
|
||||||
|
<define name="WIN32"/>
|
||||||
|
<define name="_CRT_SECURE_NO_DEPRECATE"/>
|
||||||
|
<!-- XXX 2008 MSC express/SDK does not include atl headers -->
|
||||||
|
<define name="SIGAR_NO_ATL" if="jni.noatl"/>
|
||||||
|
</defineset>
|
||||||
|
</compiler>
|
||||||
|
|
||||||
|
<!-- OSF1 -->
|
||||||
|
<compiler name="gcc" if="osf1">
|
||||||
|
<compilerarg value="-Wall"/>
|
||||||
|
<compilerarg value="-pthread"/>
|
||||||
|
<defineset>
|
||||||
|
<define name="${jni.define.name}_OSF1"/>
|
||||||
|
</defineset>
|
||||||
|
</compiler>
|
||||||
|
|
||||||
|
<linker name="gcc" if="osf1">
|
||||||
|
<libset if="jni.libset.libs"
|
||||||
|
dir="${jni.libset.dir}"
|
||||||
|
libs="${jni.libset.libs}"/>
|
||||||
|
|
||||||
|
<syslibset libs="mach"/>
|
||||||
|
</linker>
|
||||||
|
|
||||||
|
<!-- C sources -->
|
||||||
|
<fileset dir="${jni.source.dir}">
|
||||||
|
<patternset refid="jni.source.files"/>
|
||||||
|
</fileset>
|
||||||
|
|
||||||
|
<includepath>
|
||||||
|
<path refid="jni.include.dirs"/>
|
||||||
|
</includepath>
|
||||||
|
|
||||||
|
<sysincludepath location="${jni.javahome}/include"/>
|
||||||
|
<sysincludepath location="${jni.javahome}/include/${jni.jdk.os}"/>
|
||||||
|
<sysincludepath location="${jni.dmalloc}/include"
|
||||||
|
if="jni.dmalloc"/>
|
||||||
|
</cc>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="jni-clean">
|
||||||
|
<delete dir="${jni.objdir}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
cpptasks.jar from http://github.com/dougm/ant-contrib-cpptasks
|
||||||
Binary file not shown.
@@ -0,0 +1,460 @@
|
|||||||
|
/*
|
||||||
|
* 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.jni;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLClassLoader;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
|
||||||
|
public class ArchLoader {
|
||||||
|
private Object loadLock = new Object();
|
||||||
|
|
||||||
|
private boolean loaded = false;
|
||||||
|
|
||||||
|
private final static String osName = System.getProperty("os.name");
|
||||||
|
|
||||||
|
public final static boolean IS_WIN32 = osName.startsWith("Windows");
|
||||||
|
public final static boolean IS_AIX = osName.equals("AIX");
|
||||||
|
public final static boolean IS_HPUX = osName.equals("HP-UX");
|
||||||
|
public final static boolean IS_SOLARIS = osName.equals("SunOS");
|
||||||
|
public final static boolean IS_LINUX = osName.equals("Linux");
|
||||||
|
public final static boolean IS_DARWIN = osName.equals("Mac OS X") || osName.equals("Darwin");
|
||||||
|
public final static boolean IS_OSF1 = osName.equals("OSF1");
|
||||||
|
public final static boolean IS_FREEBSD = osName.equals("FreeBSD");
|
||||||
|
public final static boolean IS_NETWARE = osName.equals("NetWare");
|
||||||
|
|
||||||
|
private String packageName;
|
||||||
|
private String name;
|
||||||
|
private String resourcePath;
|
||||||
|
private Class loaderClass;
|
||||||
|
private String jarName;
|
||||||
|
private String libName = null;
|
||||||
|
private File nativeLibrary;
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
public ArchLoader() { }
|
||||||
|
|
||||||
|
public ArchLoader(Class loaderClass) {
|
||||||
|
setLoaderClass(loaderClass); //e.g. Sigar.class
|
||||||
|
|
||||||
|
//argh. possible for loaderClass.getPackage()
|
||||||
|
//to return null depending on ClassLoader
|
||||||
|
String pname = loaderClass.getName();
|
||||||
|
int ix = pname.lastIndexOf(".");
|
||||||
|
pname = pname.substring(0, ix);
|
||||||
|
setPackageName(pname); //e.g. org.hyperic.sigar
|
||||||
|
|
||||||
|
ix = pname.lastIndexOf(".");
|
||||||
|
setName(pname.substring(ix+1)); //e.g. sigar
|
||||||
|
|
||||||
|
setJarName(getName() + ".jar");
|
||||||
|
|
||||||
|
setResourcePath(toResName(pname)); //e.g. org.hyperic/sigar
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class getLoaderClass() {
|
||||||
|
return this.loaderClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLoaderClass(Class value) {
|
||||||
|
this.loaderClass = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClassLoader getClassLoader() {
|
||||||
|
return getLoaderClass().getClassLoader();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String value) {
|
||||||
|
this.name = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPackageName() {
|
||||||
|
return this.packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPackageName(String value) {
|
||||||
|
this.packageName = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResourcePath() {
|
||||||
|
return this.resourcePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResourcePath(String value) {
|
||||||
|
this.resourcePath = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJarName() {
|
||||||
|
return this.jarName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJarName(String value) {
|
||||||
|
this.jarName = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLibName() {
|
||||||
|
return this.libName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLibName(String value) {
|
||||||
|
this.libName = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArchLibName()
|
||||||
|
throws ArchNotSupportedException {
|
||||||
|
|
||||||
|
return getName() + "-" + ArchName.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefaultLibName()
|
||||||
|
throws ArchNotSupportedException {
|
||||||
|
|
||||||
|
return
|
||||||
|
System.getProperty(getPackageName() + ".libname",
|
||||||
|
//e.g. javasigar-x86-linux
|
||||||
|
"java" + getArchLibName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getNativeLibrary() {
|
||||||
|
return this.nativeLibrary;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String toResName(String name) {
|
||||||
|
StringBuffer sb = new StringBuffer(name);
|
||||||
|
for (int i=0; i < sb.length(); i++) {
|
||||||
|
if (sb.charAt(i) == '.') {
|
||||||
|
sb.setCharAt(i, '/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getLibraryPrefix() {
|
||||||
|
if (IS_WIN32 || IS_NETWARE) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "lib";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getLibraryExtension() {
|
||||||
|
if (IS_WIN32) {
|
||||||
|
return ".dll";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IS_NETWARE) {
|
||||||
|
return ".nlm";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IS_DARWIN) {
|
||||||
|
return ".dylib";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IS_HPUX) {
|
||||||
|
return ".sl";
|
||||||
|
}
|
||||||
|
|
||||||
|
return ".so";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLibraryName()
|
||||||
|
throws ArchNotSupportedException {
|
||||||
|
String libName;
|
||||||
|
|
||||||
|
if ((libName = getLibName()) == null) {
|
||||||
|
libName = getDefaultLibName();
|
||||||
|
setLibName(libName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String prefix = getLibraryPrefix();
|
||||||
|
String ext = getLibraryExtension();
|
||||||
|
|
||||||
|
return prefix + libName + ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersionedLibraryName() {
|
||||||
|
|
||||||
|
if (this.version == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
getLibraryName();
|
||||||
|
} catch (ArchNotSupportedException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String prefix = getLibraryPrefix();
|
||||||
|
String ext = getLibraryExtension();
|
||||||
|
|
||||||
|
return prefix + this.libName + '-' + this.version + ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isJarURL(URL url) {
|
||||||
|
if (url == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String name = url.getFile();
|
||||||
|
|
||||||
|
String jarName = getJarName();
|
||||||
|
if (name.indexOf(jarName) != -1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ix = jarName.indexOf(".jar");
|
||||||
|
if (ix != -1) {
|
||||||
|
//check for a versioned name-x.x.jar
|
||||||
|
jarName = jarName.substring(0, ix) + "-";
|
||||||
|
|
||||||
|
//lastIndex else could match "sigar-bin/"
|
||||||
|
ix = name.lastIndexOf(jarName);
|
||||||
|
if (ix != -1) {
|
||||||
|
jarName = name.substring(ix);
|
||||||
|
ix = jarName.indexOf(".jar");
|
||||||
|
if (ix == -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.version =
|
||||||
|
jarName.substring(jarName.indexOf('-')+1, ix);
|
||||||
|
jarName = jarName.substring(0, ix+4);
|
||||||
|
setJarName(jarName); //for future reference
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String findJarPath(String libName)
|
||||||
|
throws ArchLoaderException {
|
||||||
|
return findJarPath(libName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String findJarPath(String libName, boolean isRequired)
|
||||||
|
throws ArchLoaderException {
|
||||||
|
/*
|
||||||
|
* native libraries should be installed along side
|
||||||
|
* ${this.name}.jar, try to find where ${this.name}.jar
|
||||||
|
* is on disk and use that path.
|
||||||
|
*/
|
||||||
|
if (getJarName() == null) {
|
||||||
|
throw new ArchLoaderException("jarName is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
String path = getResourcePath();
|
||||||
|
ClassLoader loader = getClassLoader();
|
||||||
|
URL url = loader.getResource(path);
|
||||||
|
|
||||||
|
if (!isJarURL(url)) {
|
||||||
|
url = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((url == null) && (loader instanceof URLClassLoader)) {
|
||||||
|
URL[] urls = ((URLClassLoader)loader).getURLs();
|
||||||
|
|
||||||
|
for (int i=0; i<urls.length; i++) {
|
||||||
|
if (isJarURL(urls[i])) {
|
||||||
|
url = urls[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (url == null) {
|
||||||
|
if (isRequired) {
|
||||||
|
throw new ArchLoaderException("Unable to find " +
|
||||||
|
getJarName());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
path = url.getFile();
|
||||||
|
|
||||||
|
if (path.startsWith("file:")) {
|
||||||
|
path = path.substring(5);
|
||||||
|
}
|
||||||
|
File file = new File(path);
|
||||||
|
String jarName = getJarName();
|
||||||
|
|
||||||
|
while ((file != null) &&
|
||||||
|
!file.getName().startsWith(jarName))
|
||||||
|
{
|
||||||
|
file = file.getParentFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (libName == null) {
|
||||||
|
//return path containing ${this.name}.jar
|
||||||
|
//which may or may not be -x.x.x.x versioned
|
||||||
|
libName = jarName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((file != null) &&
|
||||||
|
((file = file.getParentFile()) != null))
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//java.lang.ClassLoader does not delegate native linking
|
||||||
|
//to the parent ClassLoader.
|
||||||
|
//overriding these methods provides a workaround.
|
||||||
|
protected void systemLoadLibrary(String name) {
|
||||||
|
System.loadLibrary(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void systemLoad(String name) {
|
||||||
|
System.load(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean containsNativeLibrary(File dir, String name) {
|
||||||
|
if (name == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
File file = new File(dir, name);
|
||||||
|
if (file.exists()) {
|
||||||
|
this.nativeLibrary = file;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean findNativeLibrary(String dir, String name) {
|
||||||
|
//must be an absolute path; this allows relative to $PWD
|
||||||
|
File path = new File(dir).getAbsoluteFile();
|
||||||
|
if (containsNativeLibrary(path, name)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (containsNativeLibrary(path, getVersionedLibraryName())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//try w/o arch name (e.g. "libsigar.so")
|
||||||
|
return containsNativeLibrary(path,
|
||||||
|
getLibraryPrefix() +
|
||||||
|
getName() +
|
||||||
|
getLibraryExtension());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean findInJavaLibraryPath(String libName) {
|
||||||
|
String path = System.getProperty("java.library.path", "");
|
||||||
|
StringTokenizer tok =
|
||||||
|
new StringTokenizer(path, File.pathSeparator);
|
||||||
|
while (tok.hasMoreTokens()) {
|
||||||
|
path = tok.nextToken();
|
||||||
|
if (findNativeLibrary(path, libName)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void loadLibrary(String path)
|
||||||
|
throws ArchNotSupportedException,
|
||||||
|
ArchLoaderException {
|
||||||
|
|
||||||
|
try {
|
||||||
|
String libName = getLibraryName();
|
||||||
|
|
||||||
|
if (path == null) {
|
||||||
|
//e.g. org.hyperic.sigar.path
|
||||||
|
path = System.getProperty(getPackageName() + ".path");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path != null) {
|
||||||
|
if (path.equals("-")) {
|
||||||
|
return; //assume library is already loaded
|
||||||
|
}
|
||||||
|
findJarPath(null, false); //check for versioned .jar
|
||||||
|
findNativeLibrary(path, libName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (findJarPath(libName, false) == null) {
|
||||||
|
findInJavaLibraryPath(libName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//nativeLibrary set when findJarPath() calls findNativeLibrary()
|
||||||
|
if (this.nativeLibrary != null) {
|
||||||
|
systemLoad(this.nativeLibrary.toString());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//LD_LIBRARY_PATH must be set for linux and solaris
|
||||||
|
//SHLIB_PATH must be set for hpux
|
||||||
|
//PATH must be set for windows
|
||||||
|
systemLoadLibrary(libName);
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
String reason = e.getMessage();
|
||||||
|
if (reason == null) {
|
||||||
|
reason = e.getClass().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
String msg =
|
||||||
|
"Failed to load " + libName +
|
||||||
|
": " + reason;
|
||||||
|
|
||||||
|
throw new ArchLoaderException(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load()
|
||||||
|
throws ArchNotSupportedException,
|
||||||
|
ArchLoaderException {
|
||||||
|
load(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load(String path)
|
||||||
|
throws ArchNotSupportedException,
|
||||||
|
ArchLoaderException {
|
||||||
|
/*
|
||||||
|
* System.loadLibrary() is only supposed to load the library
|
||||||
|
* once per-classloader. but we make extra sure that is the case.
|
||||||
|
*/
|
||||||
|
synchronized (this.loadLock) {
|
||||||
|
if (this.loaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loadLibrary(path);
|
||||||
|
this.loaded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* 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.jni;
|
||||||
|
|
||||||
|
public class ArchLoaderException extends Exception {
|
||||||
|
|
||||||
|
public ArchLoaderException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArchLoaderException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 Hyperic, Inc.
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.hyperic.jni;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper class for naming the jni library with
|
||||||
|
* platform/arch name for which it is binary compatible.
|
||||||
|
*/
|
||||||
|
public class ArchName {
|
||||||
|
|
||||||
|
static boolean useDmalloc =
|
||||||
|
System.getProperty("jni.dmalloc") != null;
|
||||||
|
|
||||||
|
public static String getName() throws ArchNotSupportedException {
|
||||||
|
String name = getArchName();
|
||||||
|
if (useDmalloc) {
|
||||||
|
name += "-dmalloc";
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean is64() {
|
||||||
|
return "64".equals(System.getProperty("sun.arch.data.model"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getArchName() throws ArchNotSupportedException {
|
||||||
|
String name = System.getProperty("os.name");
|
||||||
|
String arch = System.getProperty("os.arch");
|
||||||
|
String version = System.getProperty("os.version");
|
||||||
|
String majorVersion = version.substring(0, 1); //4.x, 5.x, etc.
|
||||||
|
|
||||||
|
if (arch.endsWith("86")) {
|
||||||
|
arch = "x86";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name.equals("Linux")) {
|
||||||
|
return arch + "-linux";
|
||||||
|
}
|
||||||
|
else if (name.indexOf("Windows") > -1) {
|
||||||
|
return arch + "-winnt";
|
||||||
|
}
|
||||||
|
else if (name.equals("SunOS")) {
|
||||||
|
if (arch.startsWith("sparcv") && is64()) {
|
||||||
|
arch = "sparc64";
|
||||||
|
}
|
||||||
|
return arch + "-solaris";
|
||||||
|
}
|
||||||
|
else if (name.equals("HP-UX")) {
|
||||||
|
if (arch.startsWith("IA64")) {
|
||||||
|
arch = "ia64";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
arch = "pa";
|
||||||
|
if (is64()) {
|
||||||
|
arch += "64";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (version.indexOf("11") > -1) {
|
||||||
|
return arch + "-hpux-11";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (name.equals("AIX")) {
|
||||||
|
if (majorVersion.equals("6")) {
|
||||||
|
//v5 binary is compatible with v6
|
||||||
|
majorVersion = "5";
|
||||||
|
}
|
||||||
|
//arch == "ppc" on 32-bit, "ppc64" on 64-bit
|
||||||
|
return arch + "-aix-" + majorVersion;
|
||||||
|
}
|
||||||
|
else if (name.equals("Mac OS X") || name.equals("Darwin")) {
|
||||||
|
if (is64()) {
|
||||||
|
return "universal64-macosx";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "universal-macosx";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (name.equals("FreeBSD")) {
|
||||||
|
//none of the 4,5,6 major versions are binary compatible
|
||||||
|
return arch + "-freebsd-" + majorVersion;
|
||||||
|
}
|
||||||
|
else if (name.equals("OpenBSD")) {
|
||||||
|
return arch + "-openbsd-" + majorVersion;
|
||||||
|
}
|
||||||
|
else if (name.equals("NetBSD")) {
|
||||||
|
return arch + "-netbsd-" + majorVersion;
|
||||||
|
}
|
||||||
|
else if (name.equals("OSF1")) {
|
||||||
|
return "alpha-osf1-" + majorVersion;
|
||||||
|
}
|
||||||
|
else if (name.equals("NetWare")) {
|
||||||
|
return "x86-netware-" + majorVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
String desc = arch + "-" + name + "-" + version;
|
||||||
|
|
||||||
|
throw new ArchNotSupportedException("platform (" + desc + ") not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArchName () { }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,207 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
String archName;
|
||||||
|
|
||||||
|
try {
|
||||||
|
archName = ArchName.getName();
|
||||||
|
} catch (ArchNotSupportedException e) {
|
||||||
|
//ok: can still compile *.java
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(archName);
|
||||||
|
getProject().setProperty("jni.libarch", archName);
|
||||||
|
getProject().setProperty("jni.libpre",
|
||||||
|
ArchLoader.getLibraryPrefix());
|
||||||
|
getProject().setProperty("jni.libext",
|
||||||
|
ArchLoader.getLibraryExtension());
|
||||||
|
|
||||||
|
String compiler;
|
||||||
|
if (ArchLoader.IS_WIN32) {
|
||||||
|
compiler = "msvc";
|
||||||
|
}
|
||||||
|
else if (ArchLoader.IS_HPUX) {
|
||||||
|
compiler = "hp";
|
||||||
|
}
|
||||||
|
else if (ArchLoader.IS_AIX) {
|
||||||
|
compiler = "xlc_r";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
compiler = "gcc";
|
||||||
|
getProject().setProperty("jni.compiler.isgcc", "true");
|
||||||
|
}
|
||||||
|
|
||||||
|
getProject().setProperty("jni.compiler", compiler);
|
||||||
|
|
||||||
|
if (ArchName.is64()) {
|
||||||
|
getProject().setProperty("jni.arch64", "true");
|
||||||
|
if (ArchLoader.IS_LINUX) {
|
||||||
|
if (!osArch.equals("ia64")) {
|
||||||
|
getProject().setProperty("jni.gccm", "-m64");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (ArchLoader.IS_LINUX && osArch.equals("s390")) {
|
||||||
|
//gcc defaults to m64 on s390x platforms
|
||||||
|
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.
|
||||||
|
File[] sdks =
|
||||||
|
new File("/Developer/SDKs").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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* 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.jni;
|
||||||
|
|
||||||
|
public class ArchNotSupportedException extends Exception {
|
||||||
|
|
||||||
|
public ArchNotSupportedException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArchNotSupportedException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* 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.jni;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.apache.tools.ant.BuildException;
|
||||||
|
import org.apache.tools.ant.taskdefs.Copy;
|
||||||
|
|
||||||
|
public class CopyDependsTask extends Copy {
|
||||||
|
|
||||||
|
private File depends;
|
||||||
|
|
||||||
|
protected void validateAttributes()
|
||||||
|
throws BuildException {
|
||||||
|
|
||||||
|
super.validateAttributes();
|
||||||
|
if (this.depends == null) {
|
||||||
|
throw new BuildException("missing depends attribute");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void execute()
|
||||||
|
throws BuildException {
|
||||||
|
|
||||||
|
if (this.destFile.exists()) {
|
||||||
|
String state;
|
||||||
|
if (this.depends.lastModified() >
|
||||||
|
this.destFile.lastModified())
|
||||||
|
{
|
||||||
|
this.setOverwrite(true);
|
||||||
|
state = "out of date";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
state = "up to date";
|
||||||
|
}
|
||||||
|
|
||||||
|
log(this.destFile +
|
||||||
|
" " + state + " with " +
|
||||||
|
this.depends);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getDepends() {
|
||||||
|
return this.depends;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepends(String depends) {
|
||||||
|
this.depends = new File(depends);
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2004-2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
* Copyright (c) 2010 VMware, Inc.
|
||||||
*
|
*
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* you may not use this file except in compliance with the License.
|
||||||
* published by the Free Software Foundation. This program is distributed
|
* You may obtain a copy of the License at
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
*
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
*
|
||||||
* details.
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
*
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* You should have received a copy of the GNU General Public License
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* along with this program; if not, write to the Free Software
|
* See the License for the specific language governing permissions and
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* limitations under the License.
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
@@ -249,7 +248,7 @@ int jsigar_list_init(JNIEnv *env, jsigar_list_t *obj)
|
|||||||
obj->obj = JENV->NewObject(env, listclass, listid);
|
obj->obj = JENV->NewObject(env, listclass, listid);
|
||||||
obj->id = addid;
|
obj->id = addid;
|
||||||
|
|
||||||
return SIGAR_OK;
|
return JENV->ExceptionCheck(env) ? !SIGAR_OK : SIGAR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int jsigar_list_add(void *data, char *value, int len)
|
int jsigar_list_add(void *data, char *value, int len)
|
||||||
@@ -260,7 +259,7 @@ int jsigar_list_add(void *data, char *value, int len)
|
|||||||
JENV->CallBooleanMethod(env, obj->obj, obj->id,
|
JENV->CallBooleanMethod(env, obj->obj, obj->id,
|
||||||
JENV->NewStringUTF(env, value));
|
JENV->NewStringUTF(env, value));
|
||||||
|
|
||||||
return SIGAR_OK;
|
return JENV->ExceptionCheck(env) ? !SIGAR_OK : SIGAR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring SIGAR_JNIx(formatSize)
|
JNIEXPORT jstring SIGAR_JNIx(formatSize)
|
||||||
@@ -398,9 +397,6 @@ static jstring jnet_address_to_string(JNIEnv *env, sigar_t *sigar, sigar_net_add
|
|||||||
|
|
||||||
#include "javasigar_generated.c"
|
#include "javasigar_generated.c"
|
||||||
|
|
||||||
#define SIGAR_ALLOC_OBJECT(name) \
|
|
||||||
JENV->AllocObject(env, SIGAR_FIND_CLASS(name))
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
FS_FIELD_DIRNAME,
|
FS_FIELD_DIRNAME,
|
||||||
FS_FIELD_DEVNAME,
|
FS_FIELD_DEVNAME,
|
||||||
@@ -448,6 +444,7 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getFileSystemListNative)
|
|||||||
JENV->GetFieldID(env, cls, "type", "I");
|
JENV->GetFieldID(env, cls, "type", "I");
|
||||||
|
|
||||||
fsarray = JENV->NewObjectArray(env, fslist.number, cls, 0);
|
fsarray = JENV->NewObjectArray(env, fslist.number, cls, 0);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
for (i=0; i<fslist.number; i++) {
|
for (i=0; i<fslist.number; i++) {
|
||||||
sigar_file_system_t *fs = &(fslist.data)[i];
|
sigar_file_system_t *fs = &(fslist.data)[i];
|
||||||
@@ -472,6 +469,7 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getFileSystemListNative)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
fsobj = JENV->AllocObject(env, obj_cls);
|
fsobj = JENV->AllocObject(env, obj_cls);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
JENV->SetStringField(env, fsobj,
|
JENV->SetStringField(env, fsobj,
|
||||||
ids[FS_FIELD_DIRNAME],
|
ids[FS_FIELD_DIRNAME],
|
||||||
@@ -498,6 +496,7 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getFileSystemListNative)
|
|||||||
fs->type);
|
fs->type);
|
||||||
|
|
||||||
JENV->SetObjectArrayElement(env, fsarray, i, fsobj);
|
JENV->SetObjectArrayElement(env, fsarray, i, fsobj);
|
||||||
|
SIGAR_CHEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigar_file_system_list_destroy(sigar, &fslist);
|
sigar_file_system_list_destroy(sigar, &fslist);
|
||||||
@@ -562,12 +561,15 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getCpuInfoList)
|
|||||||
JAVA_SIGAR_INIT_FIELDS_CPUINFO(cls);
|
JAVA_SIGAR_INIT_FIELDS_CPUINFO(cls);
|
||||||
|
|
||||||
cpuarray = JENV->NewObjectArray(env, cpu_infos.number, cls, 0);
|
cpuarray = JENV->NewObjectArray(env, cpu_infos.number, cls, 0);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
for (i=0; i<cpu_infos.number; i++) {
|
for (i=0; i<cpu_infos.number; i++) {
|
||||||
jobject info_obj = JENV->AllocObject(env, cls);
|
jobject info_obj = JENV->AllocObject(env, cls);
|
||||||
|
SIGAR_CHEX;
|
||||||
JAVA_SIGAR_SET_FIELDS_CPUINFO(cls, info_obj,
|
JAVA_SIGAR_SET_FIELDS_CPUINFO(cls, info_obj,
|
||||||
cpu_infos.data[i]);
|
cpu_infos.data[i]);
|
||||||
JENV->SetObjectArrayElement(env, cpuarray, i, info_obj);
|
JENV->SetObjectArrayElement(env, cpuarray, i, info_obj);
|
||||||
|
SIGAR_CHEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigar_cpu_info_list_destroy(sigar, &cpu_infos);
|
sigar_cpu_info_list_destroy(sigar, &cpu_infos);
|
||||||
@@ -593,12 +595,15 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getCpuListNative)
|
|||||||
JAVA_SIGAR_INIT_FIELDS_CPU(cls);
|
JAVA_SIGAR_INIT_FIELDS_CPU(cls);
|
||||||
|
|
||||||
cpuarray = JENV->NewObjectArray(env, cpulist.number, cls, 0);
|
cpuarray = JENV->NewObjectArray(env, cpulist.number, cls, 0);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
for (i=0; i<cpulist.number; i++) {
|
for (i=0; i<cpulist.number; i++) {
|
||||||
jobject info_obj = JENV->AllocObject(env, cls);
|
jobject info_obj = JENV->AllocObject(env, cls);
|
||||||
|
SIGAR_CHEX;
|
||||||
JAVA_SIGAR_SET_FIELDS_CPU(cls, info_obj,
|
JAVA_SIGAR_SET_FIELDS_CPU(cls, info_obj,
|
||||||
cpulist.data[i]);
|
cpulist.data[i]);
|
||||||
JENV->SetObjectArrayElement(env, cpuarray, i, info_obj);
|
JENV->SetObjectArrayElement(env, cpuarray, i, info_obj);
|
||||||
|
SIGAR_CHEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigar_cpu_list_destroy(sigar, &cpulist);
|
sigar_cpu_list_destroy(sigar, &cpulist);
|
||||||
@@ -635,6 +640,7 @@ JNIEXPORT jlongArray SIGAR_JNIx(getProcList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
procarray = JENV->NewLongArray(env, proclist.number);
|
procarray = JENV->NewLongArray(env, proclist.number);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
if (sizeof(jlong) == sizeof(sigar_pid_t)) {
|
if (sizeof(jlong) == sizeof(sigar_pid_t)) {
|
||||||
pids = (jlong *)proclist.data;
|
pids = (jlong *)proclist.data;
|
||||||
@@ -659,6 +665,17 @@ JNIEXPORT jlongArray SIGAR_JNIx(getProcList)
|
|||||||
|
|
||||||
return procarray;
|
return procarray;
|
||||||
}
|
}
|
||||||
|
jstring getProcArgStr(char *arg, JNIEnv *env) {
|
||||||
|
jstring s;
|
||||||
|
#ifdef WIN32
|
||||||
|
WCHAR warg[3000];
|
||||||
|
SIGAR_A2W(arg, warg, sizeof(warg));
|
||||||
|
s = JENV->NewString(env, (const jchar *)warg, wcslen(warg));
|
||||||
|
#else
|
||||||
|
s = JENV->NewStringUTF(env, arg);
|
||||||
|
#endif
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jobjectArray SIGAR_JNIx(getProcArgs)
|
JNIEXPORT jobjectArray SIGAR_JNIx(getProcArgs)
|
||||||
(JNIEnv *env, jobject sigar_obj, jlong pid)
|
(JNIEnv *env, jobject sigar_obj, jlong pid)
|
||||||
@@ -676,10 +693,13 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getProcArgs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
argsarray = JENV->NewObjectArray(env, procargs.number, stringclass, 0);
|
argsarray = JENV->NewObjectArray(env, procargs.number, stringclass, 0);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
for (i=0; i<procargs.number; i++) {
|
for (i=0; i<procargs.number; i++) {
|
||||||
jstring s = JENV->NewStringUTF(env, procargs.data[i]);
|
|
||||||
|
jstring s = getProcArgStr(procargs.data[i], env);
|
||||||
JENV->SetObjectArrayElement(env, argsarray, i, s);
|
JENV->SetObjectArrayElement(env, argsarray, i, s);
|
||||||
|
SIGAR_CHEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigar_proc_args_destroy(sigar, &procargs);
|
sigar_proc_args_destroy(sigar, &procargs);
|
||||||
@@ -704,7 +724,7 @@ static int jni_env_getall(void *data,
|
|||||||
JENV->NewStringUTF(env, key),
|
JENV->NewStringUTF(env, key),
|
||||||
JENV->NewStringUTF(env, val));
|
JENV->NewStringUTF(env, val));
|
||||||
|
|
||||||
return SIGAR_OK;
|
return JENV->ExceptionCheck(env) ? !SIGAR_OK : SIGAR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAP_PUT_SIG \
|
#define MAP_PUT_SIG \
|
||||||
@@ -728,6 +748,7 @@ JNIEXPORT jobject SIGAR_JNI(ProcEnv_getAll)
|
|||||||
dSIGAR(NULL);
|
dSIGAR(NULL);
|
||||||
|
|
||||||
hashmap = JENV->NewObject(env, mapclass, mapid);
|
hashmap = JENV->NewObject(env, mapclass, mapid);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
put.env = env;
|
put.env = env;
|
||||||
put.id = putid;
|
put.id = putid;
|
||||||
@@ -809,7 +830,9 @@ JNIEXPORT jobject SIGAR_JNIx(getProcModulesNative)
|
|||||||
|
|
||||||
dSIGAR(NULL);
|
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.module_getter = jsigar_list_add;
|
||||||
procmods.data = &obj;
|
procmods.data = &obj;
|
||||||
@@ -837,6 +860,7 @@ JNIEXPORT jdoubleArray SIGAR_JNIx(getLoadAverage)
|
|||||||
}
|
}
|
||||||
|
|
||||||
avgarray = JENV->NewDoubleArray(env, 3);
|
avgarray = JENV->NewDoubleArray(env, 3);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
JENV->SetDoubleArrayRegion(env, avgarray, 0,
|
JENV->SetDoubleArrayRegion(env, avgarray, 0,
|
||||||
3, loadavg.loadavg);
|
3, loadavg.loadavg);
|
||||||
@@ -862,11 +886,14 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getNetRouteList)
|
|||||||
JAVA_SIGAR_INIT_FIELDS_NETROUTE(cls);
|
JAVA_SIGAR_INIT_FIELDS_NETROUTE(cls);
|
||||||
|
|
||||||
routearray = JENV->NewObjectArray(env, routelist.number, cls, 0);
|
routearray = JENV->NewObjectArray(env, routelist.number, cls, 0);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
for (i=0; i<routelist.number; i++) {
|
for (i=0; i<routelist.number; i++) {
|
||||||
jobject obj = JENV->AllocObject(env, cls);
|
jobject obj = JENV->AllocObject(env, cls);
|
||||||
|
SIGAR_CHEX;
|
||||||
JAVA_SIGAR_SET_FIELDS_NETROUTE(cls, obj, routelist.data[i]);
|
JAVA_SIGAR_SET_FIELDS_NETROUTE(cls, obj, routelist.data[i]);
|
||||||
JENV->SetObjectArrayElement(env, routearray, i, obj);
|
JENV->SetObjectArrayElement(env, routearray, i, obj);
|
||||||
|
SIGAR_CHEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigar_net_route_list_destroy(sigar, &routelist);
|
sigar_net_route_list_destroy(sigar, &routelist);
|
||||||
@@ -902,11 +929,14 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getNetConnectionList)
|
|||||||
JAVA_SIGAR_INIT_FIELDS_NETCONNECTION(cls);
|
JAVA_SIGAR_INIT_FIELDS_NETCONNECTION(cls);
|
||||||
|
|
||||||
connarray = JENV->NewObjectArray(env, connlist.number, cls, 0);
|
connarray = JENV->NewObjectArray(env, connlist.number, cls, 0);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
for (i=0; i<connlist.number; i++) {
|
for (i=0; i<connlist.number; i++) {
|
||||||
jobject obj = JENV->AllocObject(env, cls);
|
jobject obj = JENV->AllocObject(env, cls);
|
||||||
|
SIGAR_CHEX;
|
||||||
JAVA_SIGAR_SET_FIELDS_NETCONNECTION(cls, obj, connlist.data[i]);
|
JAVA_SIGAR_SET_FIELDS_NETCONNECTION(cls, obj, connlist.data[i]);
|
||||||
JENV->SetObjectArrayElement(env, connarray, i, obj);
|
JENV->SetObjectArrayElement(env, connarray, i, obj);
|
||||||
|
SIGAR_CHEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigar_net_connection_list_destroy(sigar, &connlist);
|
sigar_net_connection_list_destroy(sigar, &connlist);
|
||||||
@@ -983,6 +1013,10 @@ JNIEXPORT void SIGAR_JNI(NetStat_stat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
states = JENV->NewIntArray(env, SIGAR_TCP_UNKNOWN);
|
states = JENV->NewIntArray(env, SIGAR_TCP_UNKNOWN);
|
||||||
|
if (JENV->ExceptionCheck(env)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
JENV->SetIntArrayRegion(env, states, 0,
|
JENV->SetIntArrayRegion(env, states, 0,
|
||||||
SIGAR_TCP_UNKNOWN,
|
SIGAR_TCP_UNKNOWN,
|
||||||
tcp_states);
|
tcp_states);
|
||||||
@@ -1056,12 +1090,15 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getWhoList)
|
|||||||
JAVA_SIGAR_INIT_FIELDS_WHO(cls);
|
JAVA_SIGAR_INIT_FIELDS_WHO(cls);
|
||||||
|
|
||||||
whoarray = JENV->NewObjectArray(env, wholist.number, cls, 0);
|
whoarray = JENV->NewObjectArray(env, wholist.number, cls, 0);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
for (i=0; i<wholist.number; i++) {
|
for (i=0; i<wholist.number; i++) {
|
||||||
jobject info_obj = JENV->AllocObject(env, cls);
|
jobject info_obj = JENV->AllocObject(env, cls);
|
||||||
|
SIGAR_CHEX;
|
||||||
JAVA_SIGAR_SET_FIELDS_WHO(cls, info_obj,
|
JAVA_SIGAR_SET_FIELDS_WHO(cls, info_obj,
|
||||||
wholist.data[i]);
|
wholist.data[i]);
|
||||||
JENV->SetObjectArrayElement(env, whoarray, i, info_obj);
|
JENV->SetObjectArrayElement(env, whoarray, i, info_obj);
|
||||||
|
SIGAR_CHEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigar_who_list_destroy(sigar, &wholist);
|
sigar_who_list_destroy(sigar, &wholist);
|
||||||
@@ -1158,10 +1195,12 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getNetInterfaceList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ifarray = JENV->NewObjectArray(env, iflist.number, stringclass, 0);
|
ifarray = JENV->NewObjectArray(env, iflist.number, stringclass, 0);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
for (i=0; i<iflist.number; i++) {
|
for (i=0; i<iflist.number; i++) {
|
||||||
jstring s = JENV->NewStringUTF(env, iflist.data[i]);
|
jstring s = JENV->NewStringUTF(env, iflist.data[i]);
|
||||||
JENV->SetObjectArrayElement(env, ifarray, i, s);
|
JENV->SetObjectArrayElement(env, ifarray, i, s);
|
||||||
|
SIGAR_CHEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigar_net_interface_list_destroy(sigar, &iflist);
|
sigar_net_interface_list_destroy(sigar, &iflist);
|
||||||
@@ -1269,18 +1308,28 @@ JNIEXPORT jboolean SIGAR_JNI(ptql_SigarProcessQuery_match)
|
|||||||
JNIEXPORT void SIGAR_JNI(ptql_SigarProcessQuery_create)
|
JNIEXPORT void SIGAR_JNI(ptql_SigarProcessQuery_create)
|
||||||
(JNIEnv *env, jobject obj, jstring jptql)
|
(JNIEnv *env, jobject obj, jstring jptql)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
jboolean is_copy;
|
jboolean is_copy;
|
||||||
const char *ptql;
|
|
||||||
sigar_ptql_query_t *query;
|
sigar_ptql_query_t *query;
|
||||||
sigar_ptql_error_t error;
|
sigar_ptql_error_t error;
|
||||||
|
#ifdef WIN32
|
||||||
ptql = JENV->GetStringUTFChars(env, jptql, &is_copy);
|
LPCTSTR ptql;
|
||||||
|
char ptql_ch[3000];
|
||||||
|
ptql = (LPCTSTR)JENV->GetStringChars(env, jptql, &is_copy);
|
||||||
|
|
||||||
|
SIGAR_W2A((LPCWSTR)ptql, ptql_ch, sizeof(ptql_ch));
|
||||||
|
status = sigar_ptql_query_create(&query, ptql_ch, &error);
|
||||||
|
if (is_copy) {
|
||||||
|
JENV->ReleaseStringChars(env, jptql, (const jchar *)ptql);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
const char *ptql;
|
||||||
|
ptql = JENV->GetStringUTFChars(env, jptql, &is_copy);
|
||||||
status = sigar_ptql_query_create(&query, (char *)ptql, &error);
|
status = sigar_ptql_query_create(&query, (char *)ptql, &error);
|
||||||
if (is_copy) {
|
if (is_copy) {
|
||||||
JENV->ReleaseStringUTFChars(env, jptql, ptql);
|
JENV->ReleaseStringUTFChars(env, jptql, ptql);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (status != SIGAR_OK) {
|
if (status != SIGAR_OK) {
|
||||||
sigar_throw_ptql_malformed(env, error.message);
|
sigar_throw_ptql_malformed(env, error.message);
|
||||||
}
|
}
|
||||||
@@ -1355,6 +1404,7 @@ JNIEXPORT jlongArray SIGAR_JNI(ptql_SigarProcessQuery_find)
|
|||||||
}
|
}
|
||||||
|
|
||||||
procarray = JENV->NewLongArray(env, proclist.number);
|
procarray = JENV->NewLongArray(env, proclist.number);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
if (sizeof(jlong) == sizeof(sigar_pid_t)) {
|
if (sizeof(jlong) == sizeof(sigar_pid_t)) {
|
||||||
pids = (jlong *)proclist.data;
|
pids = (jlong *)proclist.data;
|
||||||
@@ -1466,7 +1516,7 @@ static int jsigar_getline_completer(char *buffer, int offset, int *pos)
|
|||||||
JENV->CallObjectMethod(env, jsigar_completer.obj,
|
JENV->CallObjectMethod(env, jsigar_completer.obj,
|
||||||
jsigar_completer.id, jbuffer);
|
jsigar_completer.id, jbuffer);
|
||||||
|
|
||||||
if (JENV->ExceptionOccurred(env)) {
|
if (JENV->ExceptionCheck(env)) {
|
||||||
JENV->ExceptionDescribe(env);
|
JENV->ExceptionDescribe(env);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1547,7 +1597,7 @@ static void jsigar_log_impl(sigar_t *sigar, void *data,
|
|||||||
log_methods[level],
|
log_methods[level],
|
||||||
"(Ljava/lang/Object;)V");
|
"(Ljava/lang/Object;)V");
|
||||||
|
|
||||||
if (JENV->ExceptionOccurred(env)) {
|
if (JENV->ExceptionCheck(env)) {
|
||||||
JENV->ExceptionDescribe(env);
|
JENV->ExceptionDescribe(env);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2004, 2006, 2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
* Copyright (c) 2010 VMware, Inc.
|
||||||
*
|
*
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* you may not use this file except in compliance with the License.
|
||||||
* published by the Free Software Foundation. This program is distributed
|
* You may obtain a copy of the License at
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
*
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
*
|
||||||
* details.
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
*
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* You should have received a copy of the GNU General Public License
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* along with this program; if not, write to the Free Software
|
* See the License for the specific language governing permissions and
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* limitations under the License.
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
@@ -33,6 +32,9 @@
|
|||||||
#define SIGAR_CLASS_SIG(name) \
|
#define SIGAR_CLASS_SIG(name) \
|
||||||
"L" SIGAR_PACKAGE name ";"
|
"L" SIGAR_PACKAGE name ";"
|
||||||
|
|
||||||
|
/* CHeck EXception */
|
||||||
|
#define SIGAR_CHEX if (JENV->ExceptionCheck(env)) return NULL
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
JNIEnv *env;
|
JNIEnv *env;
|
||||||
jobject obj;
|
jobject obj;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vmcontrol_wrapper.h"
|
#include "vmcontrol_wrapper.h"
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef VMCONTROL_WRAPPER_H
|
#ifndef VMCONTROL_WRAPPER_H
|
||||||
|
|||||||
@@ -1,29 +1,40 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2004-2007, 2009 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
* Copyright (c) 2009-2010 VMware, Inc.
|
||||||
*
|
*
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* you may not use this file except in compliance with the License.
|
||||||
* published by the Free Software Foundation. This program is distributed
|
* You may obtain a copy of the License at
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
*
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
*
|
||||||
* details.
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
*
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* You should have received a copy of the GNU General Public License
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* along with this program; if not, write to the Free Software
|
* See the License for the specific language governing permissions and
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* limitations under the License.
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
#define UNICODE
|
||||||
|
#define _UNICODE
|
||||||
|
|
||||||
#include "javasigar.h"
|
#include "javasigar.h"
|
||||||
#include "win32bindings.h"
|
#include "win32bindings.h"
|
||||||
|
|
||||||
#define MAX_MSG_LENGTH 8192
|
#define MAX_MSG_LENGTH 8192
|
||||||
#define MAX_ERROR_LENGTH 1024
|
#define MAX_ERROR_LENGTH 1024
|
||||||
|
|
||||||
#define REG_MSGFILE_ROOT "SYSTEM\\CurrentControlSet\\Services\\EventLog\\"
|
#define REG_MSGFILE_ROOT L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\"
|
||||||
|
#define FILESEP L";"
|
||||||
|
#define STRING_SIG "Ljava/lang/String;"
|
||||||
|
|
||||||
|
#define UNICODE_SetStringField(field, str) \
|
||||||
|
id = JENV->GetFieldID(env, cls, field, STRING_SIG); \
|
||||||
|
value = JENV->NewString(env, (const jchar *)str, wcslen(str)); \
|
||||||
|
JENV->SetObjectField(env, obj, id, value)
|
||||||
|
|
||||||
|
#define ARRLEN(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||||
|
|
||||||
static void win32_set_pointer(JNIEnv *env, jobject obj, const void *ptr)
|
static void win32_set_pointer(JNIEnv *env, jobject obj, const void *ptr)
|
||||||
{
|
{
|
||||||
@@ -57,27 +68,32 @@ static HANDLE win32_get_pointer(JNIEnv *env, jobject obj)
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_messagefile_dll(const char *app, char *source, char *dllfile)
|
static int get_messagefile_dll(LPWSTR app, LPWSTR source, LPWSTR entry, LPWSTR dllfile)
|
||||||
{
|
{
|
||||||
HKEY hk;
|
HKEY hk;
|
||||||
char buf[MAX_MSG_LENGTH];
|
WCHAR buf[MAX_MSG_LENGTH];
|
||||||
DWORD type, data = sizeof(buf);
|
DWORD type, data = sizeof(buf);
|
||||||
LONG rc;
|
LONG rc;
|
||||||
|
|
||||||
sprintf(buf, "%s%s\\%s", REG_MSGFILE_ROOT, app, source);
|
wcscpy(buf, REG_MSGFILE_ROOT);
|
||||||
rc = RegOpenKey(HKEY_LOCAL_MACHINE, buf, &hk);
|
wcscat(buf, app);
|
||||||
|
wcscat(buf, L"\\");
|
||||||
|
wcscat(buf, source);
|
||||||
|
|
||||||
|
rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, buf,
|
||||||
|
0, KEY_READ, &hk);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegQueryValueEx(hk, "EventMessageFile", NULL, &type,
|
rc = RegQueryValueEx(hk, entry, NULL, &type,
|
||||||
(UCHAR *)buf, &data);
|
(LPBYTE)buf, &data);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
RegCloseKey(hk);
|
RegCloseKey(hk);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(dllfile, buf, MAX_MSG_LENGTH);
|
wcsncpy(dllfile, buf, MAX_MSG_LENGTH);
|
||||||
dllfile[MAX_MSG_LENGTH-1] = '\0';
|
dllfile[MAX_MSG_LENGTH-1] = '\0';
|
||||||
|
|
||||||
RegCloseKey(hk);
|
RegCloseKey(hk);
|
||||||
@@ -85,13 +101,15 @@ static int get_messagefile_dll(const char *app, char *source, char *dllfile)
|
|||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_formatted_message(EVENTLOGRECORD *pevlr, char *dllfile,
|
static int get_formatted_message(EVENTLOGRECORD *pevlr,
|
||||||
char *msg)
|
DWORD id,
|
||||||
|
LPWSTR dllfile,
|
||||||
|
LPWSTR msg)
|
||||||
{
|
{
|
||||||
LPVOID msgbuf = NULL;
|
LPVOID msgbuf = NULL;
|
||||||
char msgdll[MAX_MSG_LENGTH];
|
WCHAR msgdll[MAX_MSG_LENGTH];
|
||||||
char *insert_strs[56], *ptr;
|
LPWSTR insert_strs[56], ptr;
|
||||||
int i, max = sizeof(insert_strs) / sizeof(char *);
|
int i, max = ARRLEN(insert_strs);
|
||||||
const DWORD flags =
|
const DWORD flags =
|
||||||
FORMAT_MESSAGE_FROM_HMODULE |
|
FORMAT_MESSAGE_FROM_HMODULE |
|
||||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||||
@@ -99,47 +117,44 @@ static int get_formatted_message(EVENTLOGRECORD *pevlr, char *dllfile,
|
|||||||
FORMAT_MESSAGE_ARGUMENT_ARRAY |
|
FORMAT_MESSAGE_ARGUMENT_ARRAY |
|
||||||
FORMAT_MESSAGE_MAX_WIDTH_MASK;
|
FORMAT_MESSAGE_MAX_WIDTH_MASK;
|
||||||
|
|
||||||
if (!ExpandEnvironmentStrings(dllfile, msgdll, sizeof(msgdll))) {
|
if (!ExpandEnvironmentStrings(dllfile, msgdll, ARRLEN(msgdll))) {
|
||||||
return GetLastError();
|
return GetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(insert_strs, '\0', sizeof(insert_strs));
|
memset(insert_strs, '\0', sizeof(insert_strs));
|
||||||
ptr = (char *)((LPBYTE)pevlr + pevlr->StringOffset);
|
if (pevlr) {
|
||||||
for (i = 0; i < pevlr->NumStrings && i < max; i++) {
|
ptr = (LPWSTR)((LPBYTE)pevlr + pevlr->StringOffset);
|
||||||
insert_strs[i] = ptr;
|
for (i = 0; i < pevlr->NumStrings && i < max; i++) {
|
||||||
ptr += strlen(ptr) + 1;
|
insert_strs[i] = ptr;
|
||||||
|
ptr += wcslen(ptr) + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = msgdll;
|
ptr = wcstok(msgdll, FILESEP);
|
||||||
while (ptr) {
|
while (ptr) {
|
||||||
HINSTANCE hlib;
|
HINSTANCE hlib;
|
||||||
char *delim = strchr(ptr, ';');
|
|
||||||
|
|
||||||
if (delim) {
|
|
||||||
*delim++ = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
hlib = LoadLibraryEx(ptr, NULL,
|
hlib = LoadLibraryEx(ptr, NULL,
|
||||||
LOAD_LIBRARY_AS_DATAFILE);
|
LOAD_LIBRARY_AS_DATAFILE);
|
||||||
if (hlib) {
|
if (hlib) {
|
||||||
FormatMessage(flags,
|
FormatMessage(flags,
|
||||||
hlib,
|
hlib,
|
||||||
pevlr->EventID,
|
id,
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_ENGLISH_US),
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_ENGLISH_US),
|
||||||
(LPTSTR) &msgbuf,
|
(LPWSTR) &msgbuf,
|
||||||
sizeof(msgbuf),
|
sizeof(msgbuf), //min bytes w/ FORMAT_MESSAGE_ALLOCATE_BUFFER
|
||||||
insert_strs);
|
(va_list *)insert_strs);
|
||||||
FreeLibrary(hlib);
|
FreeLibrary(hlib);
|
||||||
|
|
||||||
if (msgbuf) {
|
if (msgbuf) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ptr = delim;
|
ptr = wcstok(NULL, FILESEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msgbuf) {
|
if (msgbuf) {
|
||||||
strncpy(msg, msgbuf, MAX_MSG_LENGTH);
|
wcsncpy(msg, msgbuf, MAX_MSG_LENGTH);
|
||||||
msg[MAX_MSG_LENGTH-1] = '\0';
|
msg[MAX_MSG_LENGTH-1] = '\0';
|
||||||
LocalFree(msgbuf);
|
LocalFree(msgbuf);
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
@@ -149,13 +164,36 @@ static int get_formatted_message(EVENTLOGRECORD *pevlr, char *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)
|
JNIEXPORT void SIGAR_JNI(win32_EventLog_openlog)
|
||||||
(JNIEnv *env, jobject obj, jstring lpSourceName)
|
(JNIEnv *env, jobject obj, jstring lpSourceName)
|
||||||
{
|
{
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
const char *name;
|
LPWSTR name;
|
||||||
|
|
||||||
name = JENV->GetStringUTFChars(env, lpSourceName, 0);
|
name = (LPWSTR)JENV->GetStringChars(env, lpSourceName, NULL);
|
||||||
|
|
||||||
h = OpenEventLog(NULL, name);
|
h = OpenEventLog(NULL, name);
|
||||||
if (h == NULL) {
|
if (h == NULL) {
|
||||||
@@ -163,12 +201,12 @@ JNIEXPORT void SIGAR_JNI(win32_EventLog_openlog)
|
|||||||
DWORD lastError = GetLastError();
|
DWORD lastError = GetLastError();
|
||||||
|
|
||||||
sprintf(buf, "Unable to open event log: %d", lastError);
|
sprintf(buf, "Unable to open event log: %d", lastError);
|
||||||
JENV->ReleaseStringUTFChars(env, lpSourceName, name);
|
JENV->ReleaseStringChars(env, lpSourceName, name);
|
||||||
win32_throw_exception(env, buf);
|
win32_throw_exception(env, buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
JENV->ReleaseStringUTFChars(env, lpSourceName, name);
|
JENV->ReleaseStringChars(env, lpSourceName, name);
|
||||||
|
|
||||||
/* Save the handle for later use */
|
/* Save the handle for later use */
|
||||||
win32_set_pointer(env, obj, h);
|
win32_set_pointer(env, obj, h);
|
||||||
@@ -217,16 +255,16 @@ JNIEXPORT jobject SIGAR_JNI(win32_EventLog_readlog)
|
|||||||
{
|
{
|
||||||
EVENTLOGRECORD *pevlr;
|
EVENTLOGRECORD *pevlr;
|
||||||
BYTE buffer[8192];
|
BYTE buffer[8192];
|
||||||
char dllfile[MAX_MSG_LENGTH];
|
WCHAR msg[MAX_MSG_LENGTH];
|
||||||
char msg[MAX_MSG_LENGTH];
|
|
||||||
DWORD dwRead, dwNeeded;
|
DWORD dwRead, dwNeeded;
|
||||||
LPSTR source, machineName;
|
LPWSTR source, machineName;
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
BOOL rv;
|
BOOL rv;
|
||||||
jclass cls = WIN32_FIND_CLASS("EventLogRecord");
|
jclass cls = WIN32_FIND_CLASS("EventLogRecord");
|
||||||
jobject eventObj; /* Actual instance of the EventLogRecord */
|
|
||||||
jfieldID id;
|
jfieldID id;
|
||||||
const char *name;
|
jstring value;
|
||||||
|
LPWSTR name;
|
||||||
|
BOOL has_category = FALSE; /* 1.6.x compat */
|
||||||
|
|
||||||
h = win32_get_pointer(env, obj);
|
h = win32_get_pointer(env, obj);
|
||||||
|
|
||||||
@@ -254,59 +292,74 @@ JNIEXPORT jobject SIGAR_JNI(win32_EventLog_readlog)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
eventObj = JENV->AllocObject(env, cls);
|
obj = JENV->AllocObject(env, cls);
|
||||||
|
SIGAR_CHEX;
|
||||||
|
|
||||||
id = JENV->GetFieldID(env, cls, "recordNumber", "J");
|
id = JENV->GetFieldID(env, cls, "recordNumber", "J");
|
||||||
JENV->SetLongField(env, eventObj, id, pevlr->RecordNumber);
|
JENV->SetLongField(env, obj, id, pevlr->RecordNumber);
|
||||||
|
|
||||||
id = JENV->GetFieldID(env, cls, "timeGenerated", "J");
|
id = JENV->GetFieldID(env, cls, "timeGenerated", "J");
|
||||||
JENV->SetLongField(env, eventObj, id, pevlr->TimeGenerated);
|
JENV->SetLongField(env, obj, id, pevlr->TimeGenerated);
|
||||||
|
|
||||||
id = JENV->GetFieldID(env, cls, "timeWritten", "J");
|
id = JENV->GetFieldID(env, cls, "timeWritten", "J");
|
||||||
JENV->SetLongField(env, eventObj, id, pevlr->TimeWritten);
|
JENV->SetLongField(env, obj, id, pevlr->TimeWritten);
|
||||||
|
|
||||||
id = JENV->GetFieldID(env, cls, "eventId", "J");
|
id = JENV->GetFieldID(env, cls, "eventId", "J");
|
||||||
JENV->SetLongField(env, eventObj, id, pevlr->EventID);
|
JENV->SetLongField(env, obj, id, pevlr->EventID);
|
||||||
|
|
||||||
id = JENV->GetFieldID(env, cls, "eventType", "S");
|
id = JENV->GetFieldID(env, cls, "eventType", "S");
|
||||||
JENV->SetShortField(env, eventObj, id, pevlr->EventType);
|
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. */
|
/* Extract string data from the end of the structure. Lame. */
|
||||||
|
|
||||||
id = JENV->GetFieldID(env, cls, "source", "Ljava/lang/String;");
|
source = (LPWSTR)((LPBYTE)pevlr + sizeof(EVENTLOGRECORD));
|
||||||
source = (LPSTR)((LPBYTE)pevlr + sizeof(EVENTLOGRECORD));
|
UNICODE_SetStringField("source", source);
|
||||||
SetStringField(env, eventObj, id, source);
|
|
||||||
|
|
||||||
name = JENV->GetStringUTFChars(env, jname, 0);
|
name = (LPWSTR)JENV->GetStringChars(env, jname, NULL);
|
||||||
|
|
||||||
/* Get the formatted message */
|
/* Get the formatted message */
|
||||||
if ((pevlr->NumStrings > 0) &&
|
if ((pevlr->NumStrings > 0) &&
|
||||||
(get_messagefile_dll(name, source, dllfile) == ERROR_SUCCESS) &&
|
(get_formatted_event_message(pevlr, name, source, msg) == ERROR_SUCCESS))
|
||||||
(get_formatted_message(pevlr, dllfile, msg) == ERROR_SUCCESS))
|
|
||||||
{
|
{
|
||||||
id = JENV->GetFieldID(env, cls, "message",
|
UNICODE_SetStringField("message", msg);
|
||||||
"Ljava/lang/String;");
|
|
||||||
SetStringField(env, eventObj, id, msg);
|
|
||||||
}
|
}
|
||||||
else if (pevlr->NumStrings > 0) {
|
else if (pevlr->NumStrings > 0) {
|
||||||
char *tmp = (LPSTR)((LPBYTE)pevlr + pevlr->StringOffset);
|
LPWSTR tmp = (LPWSTR)((LPBYTE)pevlr + pevlr->StringOffset);
|
||||||
id = JENV->GetFieldID(env, cls, "message", "Ljava/lang/String;");
|
UNICODE_SetStringField("message", tmp);
|
||||||
SetStringField(env, eventObj, id, tmp);
|
|
||||||
}
|
}
|
||||||
JENV->ReleaseStringUTFChars(env, jname, name);
|
|
||||||
|
/* 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. */
|
/* Increment up to the machine name. */
|
||||||
id = JENV->GetFieldID(env, cls, "computerName", "Ljava/lang/String;");
|
machineName = (LPWSTR)((LPBYTE)pevlr + sizeof(EVENTLOGRECORD) +
|
||||||
machineName = (LPSTR)((LPBYTE)pevlr + sizeof(EVENTLOGRECORD) +
|
(wcslen(source) + 1) * sizeof(WCHAR));
|
||||||
strlen(source) + 1);
|
UNICODE_SetStringField("computerName", machineName);
|
||||||
SetStringField(env, eventObj, id, machineName);
|
|
||||||
|
|
||||||
/* Get user id info */
|
/* Get user id info */
|
||||||
if (pevlr->UserSidLength > 0) {
|
if (pevlr->UserSidLength > 0) {
|
||||||
char name[256];
|
WCHAR name[256];
|
||||||
char domain[256];
|
WCHAR domain[256];
|
||||||
DWORD namelen = sizeof(name);
|
DWORD namelen = ARRLEN(name);
|
||||||
DWORD domainlen = sizeof(domain);
|
DWORD domainlen = ARRLEN(domain);
|
||||||
DWORD len;
|
DWORD len;
|
||||||
SID_NAME_USE snu;
|
SID_NAME_USE snu;
|
||||||
PSID sid;
|
PSID sid;
|
||||||
@@ -314,12 +367,11 @@ JNIEXPORT jobject SIGAR_JNI(win32_EventLog_readlog)
|
|||||||
sid = (PSID)((LPBYTE)pevlr + pevlr->UserSidOffset);
|
sid = (PSID)((LPBYTE)pevlr + pevlr->UserSidOffset);
|
||||||
if (LookupAccountSid(NULL, sid, name, &namelen, domain,
|
if (LookupAccountSid(NULL, sid, name, &namelen, domain,
|
||||||
&domainlen, &snu)) {
|
&domainlen, &snu)) {
|
||||||
id = JENV->GetFieldID(env, cls, "user", "Ljava/lang/String;");
|
UNICODE_SetStringField("user", name);
|
||||||
SetStringField(env, eventObj, id, name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return eventObj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void SIGAR_JNI(win32_EventLog_waitForChange)
|
JNIEXPORT void SIGAR_JNI(win32_EventLog_waitForChange)
|
||||||
|
|||||||
@@ -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)
|
#if defined(WIN32) && !defined(SIGAR_NO_ATL)
|
||||||
#define UNICODE
|
#define UNICODE
|
||||||
#define _UNICODE
|
#define _UNICODE
|
||||||
@@ -269,7 +286,10 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_MetaBase_MetaBaseGetMultiStringValue)
|
|||||||
NewObjectArray(count,
|
NewObjectArray(count,
|
||||||
env->FindClass("java/lang/String"),
|
env->FindClass("java/lang/String"),
|
||||||
env->NewString((const jchar *)"", 1));
|
env->NewString((const jchar *)"", 1));
|
||||||
|
if (env->ExceptionCheck()) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Walk the return instance list, creating an array
|
// Walk the return instance list, creating an array
|
||||||
for (szThisInstance = (TCHAR *)MyRecord.pbMDData, i = 0;
|
for (szThisInstance = (TCHAR *)MyRecord.pbMDData, i = 0;
|
||||||
*szThisInstance != 0;
|
*szThisInstance != 0;
|
||||||
@@ -278,6 +298,9 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_MetaBase_MetaBaseGetMultiStringValue)
|
|||||||
env->SetObjectArrayElement(ret,i,env->NewString(
|
env->SetObjectArrayElement(ret,i,env->NewString(
|
||||||
(const jchar *)(LPCTSTR)szThisInstance,
|
(const jchar *)(LPCTSTR)szThisInstance,
|
||||||
lstrlen(szThisInstance)));
|
lstrlen(szThisInstance)));
|
||||||
|
if (env->ExceptionCheck()) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2004-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
* Copyright (c) 2010 VMware, Inc.
|
||||||
*
|
*
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* you may not use this file except in compliance with the License.
|
||||||
* published by the Free Software Foundation. This program is distributed
|
* You may obtain a copy of the License at
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
*
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
*
|
||||||
* details.
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
*
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* You should have received a copy of the GNU General Public License
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* along with this program; if not, write to the Free Software
|
* See the License for the specific language governing permissions and
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* limitations under the License.
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -173,6 +172,34 @@ JNIEXPORT void SIGAR_JNI(win32_Pdh_pdhRemoveCounter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void SIGAR_JNI(win32_Pdh_pdhCollectQueryDataOverSecond)
|
||||||
|
(JNIEnv *env, jclass cur, jlong query)
|
||||||
|
{
|
||||||
|
HQUERY h_query = (HQUERY)query;
|
||||||
|
PdhCollectQueryData(h_query);
|
||||||
|
Sleep(1000);
|
||||||
|
PdhCollectQueryData(h_query);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
JNIEXPORT jdouble SIGAR_JNI(win32_Pdh_pdhGetFormattedValue)
|
||||||
|
(JNIEnv *env, jclass cur, jlong counter)
|
||||||
|
{
|
||||||
|
HCOUNTER h_counter = (HCOUNTER)counter;
|
||||||
|
PDH_STATUS status;
|
||||||
|
PDH_FMT_COUNTERVALUE fmt_value;
|
||||||
|
status = PdhGetFormattedCounterValue(h_counter,
|
||||||
|
PDH_FMT_DOUBLE,
|
||||||
|
(LPDWORD)NULL,
|
||||||
|
&fmt_value);
|
||||||
|
if (status != ERROR_SUCCESS) {
|
||||||
|
win32_throw_exception(env, get_error_message(status));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt_value.doubleValue;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jdouble SIGAR_JNI(win32_Pdh_pdhGetValue)
|
JNIEXPORT jdouble SIGAR_JNI(win32_Pdh_pdhGetValue)
|
||||||
(JNIEnv *env, jclass cur, jlong query, jlong counter, jboolean fmt)
|
(JNIEnv *env, jclass cur, jlong query, jlong counter, jboolean fmt)
|
||||||
{
|
{
|
||||||
@@ -222,6 +249,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)
|
JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetInstances)
|
||||||
(JNIEnv *env, jclass cur, jstring cp)
|
(JNIEnv *env, jclass cur, jstring cp)
|
||||||
{
|
{
|
||||||
@@ -270,6 +346,10 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetInstances)
|
|||||||
JENV->FindClass(env,
|
JENV->FindClass(env,
|
||||||
"java/lang/String"),
|
"java/lang/String"),
|
||||||
JENV->NewStringUTF(env, ""));
|
JENV->NewStringUTF(env, ""));
|
||||||
|
if (JENV->ExceptionCheck(env)) {
|
||||||
|
free(instance_list_buf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Walk the return instance list, creating an array */
|
/* Walk the return instance list, creating an array */
|
||||||
for (cur_object = instance_list_buf, i = 0;
|
for (cur_object = instance_list_buf, i = 0;
|
||||||
@@ -280,6 +360,10 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetInstances)
|
|||||||
jstring s =
|
jstring s =
|
||||||
JENV->NewString(env, (const jchar *)cur_object, len);
|
JENV->NewString(env, (const jchar *)cur_object, len);
|
||||||
JENV->SetObjectArrayElement(env, array, i, s);
|
JENV->SetObjectArrayElement(env, array, i, s);
|
||||||
|
if (JENV->ExceptionCheck(env)) {
|
||||||
|
free(instance_list_buf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
cur_object += len + 1;
|
cur_object += len + 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -297,6 +381,7 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetInstances)
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetKeys)
|
JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetKeys)
|
||||||
(JNIEnv *env, jclass cur, jstring cp)
|
(JNIEnv *env, jclass cur, jstring cp)
|
||||||
{
|
{
|
||||||
@@ -342,6 +427,10 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetKeys)
|
|||||||
JENV->FindClass(env,
|
JENV->FindClass(env,
|
||||||
"java/lang/String"),
|
"java/lang/String"),
|
||||||
JENV->NewStringUTF(env, ""));
|
JENV->NewStringUTF(env, ""));
|
||||||
|
if (JENV->ExceptionCheck(env)) {
|
||||||
|
free(instance_list_buf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Walk the return instance list, creating an array */
|
/* Walk the return instance list, creating an array */
|
||||||
for (cur_object = instance_list_buf, i = 0;
|
for (cur_object = instance_list_buf, i = 0;
|
||||||
@@ -352,6 +441,10 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetKeys)
|
|||||||
jstring s =
|
jstring s =
|
||||||
JENV->NewString(env, (const jchar *)cur_object, len);
|
JENV->NewString(env, (const jchar *)cur_object, len);
|
||||||
JENV->SetObjectArrayElement(env, array, i, s);
|
JENV->SetObjectArrayElement(env, array, i, s);
|
||||||
|
if (JENV->ExceptionCheck(env)) {
|
||||||
|
free(instance_list_buf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
cur_object += len + 1;
|
cur_object += len + 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -410,6 +503,10 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetObjects)
|
|||||||
JENV->FindClass(env,
|
JENV->FindClass(env,
|
||||||
"java/lang/String"),
|
"java/lang/String"),
|
||||||
JENV->NewStringUTF(env, ""));
|
JENV->NewStringUTF(env, ""));
|
||||||
|
if (JENV->ExceptionCheck(env)) {
|
||||||
|
free(list_buf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for (cur_object = list_buf, i = 0;
|
for (cur_object = list_buf, i = 0;
|
||||||
*cur_object != 0;
|
*cur_object != 0;
|
||||||
@@ -419,6 +516,10 @@ JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetObjects)
|
|||||||
jstring s =
|
jstring s =
|
||||||
JENV->NewString(env, (const jchar *)cur_object, len);
|
JENV->NewString(env, (const jchar *)cur_object, len);
|
||||||
JENV->SetObjectArrayElement(env, array, i, s);
|
JENV->SetObjectArrayElement(env, array, i, s);
|
||||||
|
if (JENV->ExceptionCheck(env)) {
|
||||||
|
free(list_buf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
cur_object += len + 1;
|
cur_object += len + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
+48
-2
@@ -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
|
#ifdef WIN32
|
||||||
#define UNICODE
|
#define UNICODE
|
||||||
#define _UNICODE
|
#define _UNICODE
|
||||||
@@ -106,6 +123,20 @@ JNIEXPORT jint SIGAR_JNI(win32_RegistryKey_RegLoadKey)
|
|||||||
return lResult;
|
return lResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* http://msdn.microsoft.com/en-us/library/aa384129(VS.85).aspx */
|
||||||
|
#ifndef KEY_WOW64_64KEY
|
||||||
|
#define KEY_WOW64_64KEY 0x0100
|
||||||
|
#endif
|
||||||
|
#ifndef KEY_WOW64_32KEY
|
||||||
|
#define KEY_WOW64_32KEY 0x0200
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static DWORD RegOpenOpts[] = {
|
||||||
|
0,
|
||||||
|
KEY_WOW64_32KEY,
|
||||||
|
KEY_WOW64_64KEY
|
||||||
|
};
|
||||||
|
|
||||||
JNIEXPORT jlong SIGAR_JNI(win32_RegistryKey_RegOpenKey)
|
JNIEXPORT jlong SIGAR_JNI(win32_RegistryKey_RegOpenKey)
|
||||||
(JNIEnv *env, jclass, jlong hkey, jstring subkey)
|
(JNIEnv *env, jclass, jlong hkey, jstring subkey)
|
||||||
{
|
{
|
||||||
@@ -113,6 +144,7 @@ JNIEXPORT jlong SIGAR_JNI(win32_RegistryKey_RegOpenKey)
|
|||||||
jsize len = env->GetStringLength(subkey);
|
jsize len = env->GetStringLength(subkey);
|
||||||
LPTSTR lpSubkey = (LPTSTR)env->GetStringChars(subkey, NULL);
|
LPTSTR lpSubkey = (LPTSTR)env->GetStringChars(subkey, NULL);
|
||||||
LPTSTR copy;
|
LPTSTR copy;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* required under IBM/WebSphere 4.0 for certain keys */
|
/* required under IBM/WebSphere 4.0 for certain keys */
|
||||||
if (lpSubkey[len] != '\0') {
|
if (lpSubkey[len] != '\0') {
|
||||||
@@ -122,7 +154,18 @@ JNIEXPORT jlong SIGAR_JNI(win32_RegistryKey_RegOpenKey)
|
|||||||
else {
|
else {
|
||||||
copy = lpSubkey;
|
copy = lpSubkey;
|
||||||
}
|
}
|
||||||
RegOpenKey((HKEY)hkey, copy, &hkeyResult);
|
|
||||||
|
/* try both flags so 32-bit apps can access registry entries
|
||||||
|
of 64-bit apps and vice-versa */
|
||||||
|
for (i=0; i<sizeof(RegOpenOpts)/sizeof(RegOpenOpts[0]); i++) {
|
||||||
|
DWORD status =
|
||||||
|
RegOpenKeyEx((HKEY)hkey, copy,
|
||||||
|
0, KEY_READ|RegOpenOpts[i],
|
||||||
|
&hkeyResult);
|
||||||
|
if (status == ERROR_SUCCESS) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
env->ReleaseStringChars(subkey, (const jchar *)lpSubkey);
|
env->ReleaseStringChars(subkey, (const jchar *)lpSubkey);
|
||||||
if (copy != lpSubkey) {
|
if (copy != lpSubkey) {
|
||||||
@@ -305,7 +348,10 @@ JNIEXPORT void SIGAR_JNI(win32_RegistryKey_RegQueryMultiStringValue)
|
|||||||
env->NewString((const jchar *)ptr, len);
|
env->NewString((const jchar *)ptr, len);
|
||||||
|
|
||||||
env->CallBooleanMethod(obj, id, jval);
|
env->CallBooleanMethod(obj, id, jval);
|
||||||
|
if (env->ExceptionCheck()) {
|
||||||
|
HeapFree(GetProcessHeap(), 0, value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
ptr += len + 1;
|
ptr += len + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
#ifdef WIN32
|
||||||
#define UNICODE
|
#define UNICODE
|
||||||
#define _UNICODE
|
#define _UNICODE
|
||||||
@@ -289,6 +306,9 @@ static int to_array(JNIEnv *env, LPTSTR str, jobjectArray array)
|
|||||||
jstring jstr =
|
jstring jstr =
|
||||||
env->NewString((const jchar *)ptr, slen);
|
env->NewString((const jchar *)ptr, slen);
|
||||||
env->SetObjectArrayElement(array, i, jstr);
|
env->SetObjectArrayElement(array, i, jstr);
|
||||||
|
if (env->ExceptionCheck()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
offset += slen + 1;
|
offset += slen + 1;
|
||||||
ptr = &str[offset];
|
ptr = &str[offset];
|
||||||
@@ -333,11 +353,19 @@ JNIEXPORT jboolean SIGAR_JNI(win32_Service_QueryServiceConfig)
|
|||||||
int i;
|
int i;
|
||||||
jobjectArray jargv =
|
jobjectArray jargv =
|
||||||
env->NewObjectArray(argc, stringclass, 0);
|
env->NewObjectArray(argc, stringclass, 0);
|
||||||
|
if (env->ExceptionCheck()) {
|
||||||
|
LocalFree(argv);
|
||||||
|
return JNI_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
for (i=0; i<argc; i++) {
|
for (i=0; i<argc; i++) {
|
||||||
jstring jstr =
|
jstring jstr =
|
||||||
env->NewString((const jchar *)argv[i], lstrlen(argv[i]));
|
env->NewString((const jchar *)argv[i], lstrlen(argv[i]));
|
||||||
env->SetObjectArrayElement(jargv, i, jstr);
|
env->SetObjectArrayElement(jargv, i, jstr);
|
||||||
|
if (env->ExceptionCheck()) {
|
||||||
|
LocalFree(argv);
|
||||||
|
return JNI_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
id = env->GetFieldID(cls, "argv", ASTRING_SIG);
|
id = env->GetFieldID(cls, "argv", ASTRING_SIG);
|
||||||
@@ -352,11 +380,22 @@ JNIEXPORT jboolean SIGAR_JNI(win32_Service_QueryServiceConfig)
|
|||||||
|
|
||||||
if (config->lpDependencies) {
|
if (config->lpDependencies) {
|
||||||
/* first pass just get num for NewObjectArray */
|
/* first pass just get num for NewObjectArray */
|
||||||
|
jobjectArray dependencies;
|
||||||
int num = to_array(env, config->lpDependencies, NULL);
|
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);
|
to_array(env, config->lpDependencies, dependencies);
|
||||||
|
if (num < 0) {
|
||||||
|
return JNI_FALSE; /* Exception thrown */
|
||||||
|
}
|
||||||
|
|
||||||
id = env->GetFieldID(cls, "dependencies", ASTRING_SIG);
|
id = env->GetFieldID(cls, "dependencies", ASTRING_SIG);
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2004-2006, 2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2004-2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef WIN32_BINDINGS_H
|
#ifndef WIN32_BINDINGS_H
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
@@ -294,74 +292,58 @@ public class FileInfo extends FileAttrs implements java.io.Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String diff(FileInfo info) {
|
public String diff(FileInfo info) {
|
||||||
ArrayList changes = new ArrayList();
|
ArrayList changes = new ArrayList();
|
||||||
|
|
||||||
if (this.getMtime() != info.getMtime()) {
|
if (this.getMtime() != info.getMtime()) {
|
||||||
changes.add(new Diff("Mtime",
|
changes.add(new Diff("Mtime", formatDate(info.getMtime()),
|
||||||
formatDate(info.getMtime()),
|
formatDate(this.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",
|
/* if changes were not detected then return empty String */
|
||||||
formatDate(info.getCtime()),
|
if (changes.isEmpty()){
|
||||||
formatDate(this.getCtime())));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//no point in checking the rest if all times are the same.
|
|
||||||
//or should we include atime in the diff?
|
|
||||||
return "";
|
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);
|
StringBuffer sb = format(changes);
|
||||||
if (this.dirStatEnabled) {
|
if (this.dirStatEnabled) {
|
||||||
sb.append(diff(info.stat));
|
sb.append(diff(info.stat));
|
||||||
@@ -391,7 +373,9 @@ public class FileInfo extends FileAttrs implements java.io.Serializable {
|
|||||||
|
|
||||||
stat();
|
stat();
|
||||||
|
|
||||||
return this.mtime != oldInfo.mtime;
|
boolean isModified = isModified(this.oldInfo);
|
||||||
|
|
||||||
|
return isModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean changed()
|
public boolean changed()
|
||||||
@@ -457,4 +441,49 @@ public class FileInfo extends FileAttrs implements java.io.Serializable {
|
|||||||
|
|
||||||
return fetchInfo(sigar, name, false);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007, 2009 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
|
||||||
@@ -54,24 +54,24 @@ public abstract class FileTail extends FileWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onChange(FileInfo info) {
|
public void onChange(FileInfo info) {
|
||||||
|
InputStream in = null;
|
||||||
Reader reader = null;
|
Reader reader = null;
|
||||||
String name = info.getName();
|
String name = info.getName();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (this.useSudo) {
|
if (this.useSudo) {
|
||||||
reader =
|
in = new SudoFileInputStream(name);
|
||||||
new InputStreamReader(new SudoFileInputStream(name));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
reader = new FileReader(name);
|
in = new FileInputStream(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
long offset = getOffset(info);
|
long offset = getOffset(info);
|
||||||
|
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
reader.skip(offset);
|
in.skip(offset); //use InputStream to skip bytes
|
||||||
}
|
}
|
||||||
|
reader = new InputStreamReader(in);
|
||||||
tail(info, reader);
|
tail(info, reader);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
error(name, e);
|
error(name, e);
|
||||||
@@ -79,6 +79,9 @@ public abstract class FileTail extends FileWatcher {
|
|||||||
if (reader != null) {
|
if (reader != null) {
|
||||||
try { reader.close(); } catch (IOException e) { }
|
try { reader.close(); } catch (IOException e) { }
|
||||||
}
|
}
|
||||||
|
if (in != null) {
|
||||||
|
try { in.close(); } catch (IOException e) { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
@@ -25,6 +23,8 @@ import java.util.HashSet;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
public abstract class FileWatcher {
|
public abstract class FileWatcher {
|
||||||
|
|
||||||
private Sigar sigar;
|
private Sigar sigar;
|
||||||
@@ -33,6 +33,9 @@ public abstract class FileWatcher {
|
|||||||
private Set files =
|
private Set files =
|
||||||
Collections.synchronizedSet(new HashSet());
|
Collections.synchronizedSet(new HashSet());
|
||||||
|
|
||||||
|
private static final Logger log =
|
||||||
|
SigarLog.getLogger(FileWatcher.class.getName());
|
||||||
|
|
||||||
public abstract void onChange(FileInfo info);
|
public abstract void onChange(FileInfo info);
|
||||||
|
|
||||||
public void onNotFound(FileInfo info) {
|
public void onNotFound(FileInfo info) {
|
||||||
@@ -68,14 +71,22 @@ public abstract class FileWatcher {
|
|||||||
public void add(File[] files)
|
public void add(File[] files)
|
||||||
throws SigarException {
|
throws SigarException {
|
||||||
for (int i=0; i<files.length; i++) {
|
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)
|
public void add(String[] files)
|
||||||
throws SigarException {
|
throws SigarException {
|
||||||
for (int i=0; i<files.length; i++) {
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.hyperic.sigar;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationHandler;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Proxy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Humidor provides access to a single Sigar instance. Sigar has a
|
||||||
|
* high-cost setup/teardown and has a high amount of caching, used to determine
|
||||||
|
* things like the % of CPU used in-between calls.
|
||||||
|
*
|
||||||
|
* The Humidor also synchronizes access to all Sigar methods, so all
|
||||||
|
* calls will be serialized.
|
||||||
|
*/
|
||||||
|
public class Humidor {
|
||||||
|
private static final Humidor INSTANCE = new Humidor();
|
||||||
|
private Object LOCK = new Object();
|
||||||
|
private InvocationHandler _handler;
|
||||||
|
private SigarProxy _sigar;
|
||||||
|
private Sigar _impl, _inst;
|
||||||
|
|
||||||
|
private Humidor() {}
|
||||||
|
|
||||||
|
public Humidor(Sigar sigar) {
|
||||||
|
_impl = sigar;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class MyHandler implements InvocationHandler {
|
||||||
|
private SigarProxy _sigar;
|
||||||
|
private Object _lock = new Object();
|
||||||
|
|
||||||
|
public MyHandler(SigarProxy sigar) {
|
||||||
|
_sigar = sigar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object invoke(Object proxy, Method meth, Object[] args)
|
||||||
|
throws Throwable
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
synchronized (_lock) {
|
||||||
|
return meth.invoke(_sigar, args);
|
||||||
|
}
|
||||||
|
} catch(InvocationTargetException e) {
|
||||||
|
throw e.getTargetException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SigarProxy getSigar() {
|
||||||
|
synchronized(LOCK) {
|
||||||
|
if (_sigar == null) {
|
||||||
|
if (_impl == null) {
|
||||||
|
_inst = _impl = new Sigar();
|
||||||
|
}
|
||||||
|
_handler = new MyHandler(_impl);
|
||||||
|
_sigar = (SigarProxy)
|
||||||
|
Proxy.newProxyInstance(Humidor.class.getClassLoader(),
|
||||||
|
new Class[] { SigarProxy.class },
|
||||||
|
_handler);
|
||||||
|
}
|
||||||
|
return _sigar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006, 2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
@@ -33,7 +31,7 @@ public class ProcUtil {
|
|||||||
|
|
||||||
for (int i=0; i<len; i++) {
|
for (int i=0; i<len; i++) {
|
||||||
char c = name.charAt(i);
|
char c = name.charAt(i);
|
||||||
if (!((c == '.') || Character.isLetter(c))) {
|
if (!((c == '.') || Character.isJavaIdentifierPart(c))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
@@ -43,6 +41,8 @@ public class Sigar implements SigarProxy {
|
|||||||
private static String loadError = null;
|
private static String loadError = null;
|
||||||
|
|
||||||
public static final long FIELD_NOTIMPL = -1;
|
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.
|
* The Sigar java version.
|
||||||
@@ -375,7 +375,7 @@ public class Sigar implements SigarProxy {
|
|||||||
CpuPerc[] perc =
|
CpuPerc[] perc =
|
||||||
new CpuPerc[curLen < oldLen ? curLen : oldLen];
|
new CpuPerc[curLen < oldLen ? curLen : oldLen];
|
||||||
|
|
||||||
for (int i=0; i<curLen; i++) {
|
for (int i=0; i<perc.length; i++) {
|
||||||
perc[i] =
|
perc[i] =
|
||||||
CpuPerc.fetch(this, oldCpuList[i],
|
CpuPerc.fetch(this, oldCpuList[i],
|
||||||
this.lastCpuList[i]);
|
this.lastCpuList[i]);
|
||||||
@@ -437,7 +437,7 @@ public class Sigar implements SigarProxy {
|
|||||||
return this.processFinder.findSingleProcess(pid);
|
return this.processFinder.findSingleProcess(pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get process memory info.
|
* Get process memory info.
|
||||||
* @param pid The process id.
|
* @param pid The process id.
|
||||||
@@ -635,6 +635,57 @@ public class Sigar implements SigarProxy {
|
|||||||
Integer.parseInt(port));
|
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.
|
* Get the cumulative cpu time for the calling thread.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006, 2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
@@ -31,6 +29,8 @@ public class SigarLog {
|
|||||||
private static final int LOG_INFO = 3;
|
private static final int LOG_INFO = 3;
|
||||||
private static final int LOG_DEBUG = 4;
|
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);
|
private static native void setLogger(Sigar sigar, Logger log);
|
||||||
|
|
||||||
public static native void setLevel(Sigar sigar, int level);
|
public static native void setLevel(Sigar sigar, int level);
|
||||||
@@ -48,7 +48,7 @@ public class SigarLog {
|
|||||||
|
|
||||||
public static Logger getLogger(String name) {
|
public static Logger getLogger(String name) {
|
||||||
Logger log = Logger.getLogger(name);
|
Logger log = Logger.getLogger(name);
|
||||||
if (!isLogConfigured()) {
|
if (enableLogFallbackConf && !isLogConfigured()) {
|
||||||
BasicConfigurator.configure();
|
BasicConfigurator.configure();
|
||||||
}
|
}
|
||||||
return log;
|
return log;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
* Copyright (c) 2009 SpringSource, Inc.
|
||||||
*
|
*
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* you may not use this file except in compliance with the License.
|
||||||
* published by the Free Software Foundation. This program is distributed
|
* You may obtain a copy of the License at
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
*
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
*
|
||||||
* details.
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
*
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* You should have received a copy of the GNU General Public License
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* along with this program; if not, write to the Free Software
|
* See the License for the specific language governing permissions and
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* limitations under the License.
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
@@ -107,6 +106,16 @@ public interface SigarProxy {
|
|||||||
|
|
||||||
public long getProcPort(String protocol, String port) throws SigarException;
|
public long getProcPort(String protocol, String port) throws SigarException;
|
||||||
|
|
||||||
|
public ProcDiskIO getProcDiskIO(long pid) throws SigarException;
|
||||||
|
|
||||||
|
public ProcDiskIO getProcDiskIO(String pid) throws SigarException;
|
||||||
|
|
||||||
|
public ProcCumulativeDiskIO getProcCumulativeDiskIO(long pid) throws SigarException;
|
||||||
|
|
||||||
|
public ProcCumulativeDiskIO getProcCumulativeDiskIO(String pid) throws SigarException;
|
||||||
|
|
||||||
|
public DumpPidCache dumpPidCache() throws SigarException;
|
||||||
|
|
||||||
public FileSystem[] getFileSystemList() throws SigarException;
|
public FileSystem[] getFileSystemList() throws SigarException;
|
||||||
|
|
||||||
public FileSystemMap getFileSystemMap() throws SigarException;
|
public FileSystemMap getFileSystemMap() throws SigarException;
|
||||||
@@ -158,6 +167,8 @@ public interface SigarProxy {
|
|||||||
|
|
||||||
public NetStat getNetStat() throws SigarException;
|
public NetStat getNetStat() throws SigarException;
|
||||||
|
|
||||||
|
public String getNetServicesName(int protocol, long port);
|
||||||
|
|
||||||
public Who[] getWhoList() throws SigarException;
|
public Who[] getWhoList() throws SigarException;
|
||||||
|
|
||||||
public Tcp getTcp() throws SigarException;
|
public Tcp getTcp() throws SigarException;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2009 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
@@ -123,7 +121,7 @@ public class SigarProxyCache
|
|||||||
* The java.lang.reflect.InvocationHandler used by the Proxy.
|
* The java.lang.reflect.InvocationHandler used by the Proxy.
|
||||||
* This method handles caching of all Sigar type objects.
|
* This method handles caching of all Sigar type objects.
|
||||||
*/
|
*/
|
||||||
public Object invoke(Object proxy, Method method, Object[] args)
|
public synchronized Object invoke(Object proxy, Method method, Object[] args)
|
||||||
throws SigarException, SigarNotImplementedException {
|
throws SigarException, SigarNotImplementedException {
|
||||||
|
|
||||||
SigarCacheObject cacheVal = null;
|
SigarCacheObject cacheVal = null;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar;
|
package org.hyperic.sigar;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
* Copyright (c) 2010 VMware, Inc.
|
||||||
*
|
*
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* you may not use this file except in compliance with the License.
|
||||||
* published by the Free Software Foundation. This program is distributed
|
* You may obtain a copy of the License at
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
*
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
*
|
||||||
* details.
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
*
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* You should have received a copy of the GNU General Public License
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* along with this program; if not, write to the Free Software
|
* See the License for the specific language governing permissions and
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* limitations under the License.
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
@@ -48,8 +47,19 @@ public class Df extends SigarCommandBase {
|
|||||||
"Mounted on",
|
"Mounted on",
|
||||||
"Type"
|
"Type"
|
||||||
};
|
};
|
||||||
|
//df -i
|
||||||
|
private static final String[] IHEADER = new String[] {
|
||||||
|
"Filesystem",
|
||||||
|
"Inodes",
|
||||||
|
"IUsed",
|
||||||
|
"IFree",
|
||||||
|
"IUse%",
|
||||||
|
"Mounted on",
|
||||||
|
"Type"
|
||||||
|
};
|
||||||
|
|
||||||
private GetlineCompleter completer;
|
private GetlineCompleter completer;
|
||||||
|
private boolean opt_i;
|
||||||
|
|
||||||
public Df(Shell shell) {
|
public Df(Shell shell) {
|
||||||
super(shell);
|
super(shell);
|
||||||
@@ -67,7 +77,7 @@ public class Df extends SigarCommandBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean validateArgs(String[] args) {
|
protected boolean validateArgs(String[] args) {
|
||||||
return args.length <= 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSyntaxArgs() {
|
public String getSyntaxArgs() {
|
||||||
@@ -79,31 +89,42 @@ public class Df extends SigarCommandBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void printHeader() {
|
public void printHeader() {
|
||||||
printf(HEADER);
|
printf(this.opt_i ? IHEADER : HEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void output(String[] args) throws SigarException {
|
public void output(String[] args) throws SigarException {
|
||||||
if (args.length == 1) {
|
this.opt_i = false;
|
||||||
|
ArrayList sys = new ArrayList();
|
||||||
|
|
||||||
|
if (args.length > 0) {
|
||||||
FileSystemMap mounts = this.proxy.getFileSystemMap();
|
FileSystemMap mounts = this.proxy.getFileSystemMap();
|
||||||
String name = FileCompleter.expand(args[0]);
|
for (int i=0; i<args.length; i++) {
|
||||||
FileSystem fs = mounts.getMountPoint(name);
|
String arg = args[i];
|
||||||
|
if (arg.equals("-i")) {
|
||||||
|
this.opt_i = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String name = FileCompleter.expand(arg);
|
||||||
|
FileSystem fs = mounts.getMountPoint(name);
|
||||||
|
|
||||||
if (fs != null) {
|
if (fs == null) {
|
||||||
printHeader();
|
throw new SigarException(arg +
|
||||||
output(fs);
|
" No such file or directory");
|
||||||
return;
|
}
|
||||||
|
sys.add(fs);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new SigarException(args[0] +
|
|
||||||
" No such file or directory");
|
|
||||||
}
|
}
|
||||||
else {
|
if (sys.size() == 0) {
|
||||||
FileSystem[] fslist = this.proxy.getFileSystemList();
|
FileSystem[] fslist = this.proxy.getFileSystemList();
|
||||||
printHeader();
|
|
||||||
for (int i=0; i<fslist.length; i++) {
|
for (int i=0; i<fslist.length; i++) {
|
||||||
output(fslist[i]);
|
sys.add(fslist[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printHeader();
|
||||||
|
for (int i=0; i<sys.size(); i++) {
|
||||||
|
output((FileSystem)sys.get(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void output(FileSystem fs) throws SigarException {
|
public void output(FileSystem fs) throws SigarException {
|
||||||
@@ -119,12 +140,26 @@ public class Df extends SigarCommandBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
usage = this.sigar.getFileSystemUsage(fs.getDirName());
|
usage = this.sigar.getFileSystemUsage(fs.getDirName());
|
||||||
|
if (this.opt_i) {
|
||||||
|
used = usage.getFiles() - usage.getFreeFiles();
|
||||||
|
avail = usage.getFreeFiles();
|
||||||
|
total = usage.getFiles();
|
||||||
|
if (total == 0) {
|
||||||
|
pct = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
long u100 = used * 100;
|
||||||
|
pct = u100 / total +
|
||||||
|
((u100 % total != 0) ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
used = usage.getTotal() - usage.getFree();
|
||||||
|
avail = usage.getAvail();
|
||||||
|
total = usage.getTotal();
|
||||||
|
|
||||||
used = usage.getTotal() - usage.getFree();
|
pct = (long)(usage.getUsePercent() * 100);
|
||||||
avail = usage.getAvail();
|
}
|
||||||
total = usage.getTotal();
|
|
||||||
|
|
||||||
pct = (long)(usage.getUsePercent() * 100);
|
|
||||||
} catch (SigarException e) {
|
} catch (SigarException e) {
|
||||||
//e.g. on win32 D:\ fails with "Device not ready"
|
//e.g. on win32 D:\ fails with "Device not ready"
|
||||||
//if there is no cd in the drive.
|
//if there is no cd in the drive.
|
||||||
@@ -152,8 +187,8 @@ public class Df extends SigarCommandBase {
|
|||||||
printf(items);
|
printf(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String formatSize(long size) {
|
private String formatSize(long size) {
|
||||||
return Sigar.formatSize(size * 1024);
|
return this.opt_i ? String.valueOf(size) : Sigar.formatSize(size * 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,81 +1,79 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2007, 2009 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
*/
|
||||||
* USA.
|
|
||||||
*/
|
package org.hyperic.sigar.cmd;
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
import org.hyperic.sigar.win32.EventLog;
|
||||||
|
import org.hyperic.sigar.win32.EventLogNotification;
|
||||||
import org.hyperic.sigar.win32.EventLog;
|
import org.hyperic.sigar.win32.EventLogRecord;
|
||||||
import org.hyperic.sigar.win32.EventLogNotification;
|
import org.hyperic.sigar.win32.EventLogThread;
|
||||||
import org.hyperic.sigar.win32.EventLogRecord;
|
import org.hyperic.sigar.win32.Win32Exception;
|
||||||
import org.hyperic.sigar.win32.EventLogThread;
|
|
||||||
import org.hyperic.sigar.win32.Win32Exception;
|
public class EventLogTail {
|
||||||
|
|
||||||
public class EventLogTail {
|
private static void tail(String name, Tail tail) throws Win32Exception {
|
||||||
|
EventLog log = new EventLog();
|
||||||
private static void tail(String name, Tail tail) throws Win32Exception {
|
log.open(name);
|
||||||
EventLog log = new EventLog();
|
int max = log.getNumberOfRecords();
|
||||||
log.open(name);
|
if (tail.number < max) {
|
||||||
int max = log.getNumberOfRecords();
|
max = tail.number;
|
||||||
if (tail.number < max) {
|
}
|
||||||
max = tail.number;
|
int last = log.getNewestRecord()+1;
|
||||||
}
|
int first = last - max;
|
||||||
int last = log.getNewestRecord()+1;
|
|
||||||
int first = last - max;
|
for (int i=first; i<last; i++) {
|
||||||
|
EventLogRecord record = log.read(i);
|
||||||
for (int i=first; i<last; i++) {
|
System.out.println(record);
|
||||||
EventLogRecord record = log.read(i);
|
}
|
||||||
System.out.println(record);
|
log.close();
|
||||||
}
|
}
|
||||||
log.close();
|
|
||||||
}
|
private static class TailNotification implements EventLogNotification {
|
||||||
|
public void handleNotification(EventLogRecord event) {
|
||||||
private static class TailNotification implements EventLogNotification {
|
System.out.println(event);
|
||||||
public void handleNotification(EventLogRecord event) {
|
}
|
||||||
System.out.println(event);
|
|
||||||
}
|
public boolean matches(EventLogRecord event) {
|
||||||
|
return true;
|
||||||
public boolean matches(EventLogRecord event) {
|
}
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
}
|
public static void main(String[] args) throws Exception {
|
||||||
|
Tail tail = new Tail();
|
||||||
public static void main(String[] args) throws Exception {
|
tail.parseArgs(args);
|
||||||
Tail tail = new Tail();
|
|
||||||
tail.parseArgs(args);
|
if (tail.files.size() == 0) {
|
||||||
|
tail.files.add(EventLog.SYSTEM);
|
||||||
if (tail.files.size() == 0) {
|
}
|
||||||
tail.files.add(EventLog.SYSTEM);
|
|
||||||
}
|
for (int i=0; i<tail.files.size(); i++) {
|
||||||
|
String name = (String)tail.files.get(i);
|
||||||
for (int i=0; i<tail.files.size(); i++) {
|
tail(name, tail);
|
||||||
String name = (String)tail.files.get(i);
|
|
||||||
tail(name, tail);
|
if (tail.follow) {
|
||||||
|
TailNotification notifier = new TailNotification();
|
||||||
if (tail.follow) {
|
EventLogThread thread =
|
||||||
TailNotification notifier = new TailNotification();
|
EventLogThread.getInstance(name);
|
||||||
EventLogThread thread =
|
thread.add(notifier);
|
||||||
EventLogThread.getInstance(name);
|
thread.doStart();
|
||||||
thread.add(notifier);
|
}
|
||||||
thread.doStart();
|
}
|
||||||
}
|
|
||||||
}
|
if (tail.follow) {
|
||||||
|
System.in.read();
|
||||||
if (tail.follow) {
|
}
|
||||||
System.in.read();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,100 +1,98 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2008-2009 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
*/
|
||||||
* USA.
|
|
||||||
*/
|
package org.hyperic.sigar.cmd;
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
import java.io.File;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.io.File;
|
import java.util.Map;
|
||||||
import java.util.Iterator;
|
import org.hyperic.sigar.SigarException;
|
||||||
import java.util.Map;
|
import org.hyperic.sigar.ProcExe;
|
||||||
import org.hyperic.sigar.SigarException;
|
import org.hyperic.sigar.win32.Win32;
|
||||||
import org.hyperic.sigar.ProcExe;
|
import org.hyperic.sigar.win32.FileVersion;
|
||||||
import org.hyperic.sigar.win32.Win32;
|
|
||||||
import org.hyperic.sigar.win32.FileVersion;
|
/**
|
||||||
|
* Display process file information.
|
||||||
/**
|
*/
|
||||||
* Display process file information.
|
public class FileVersionInfo extends SigarCommandBase {
|
||||||
*/
|
|
||||||
public class FileVersionInfo extends SigarCommandBase {
|
public FileVersionInfo(Shell shell) {
|
||||||
|
super(shell);
|
||||||
public FileVersionInfo(Shell shell) {
|
}
|
||||||
super(shell);
|
|
||||||
}
|
public FileVersionInfo() {
|
||||||
|
super();
|
||||||
public FileVersionInfo() {
|
}
|
||||||
super();
|
|
||||||
}
|
protected boolean validateArgs(String[] args) {
|
||||||
|
return args.length >= 1;
|
||||||
protected boolean validateArgs(String[] args) {
|
}
|
||||||
return args.length >= 1;
|
|
||||||
}
|
public String getUsageShort() {
|
||||||
|
return "Display file version info";
|
||||||
public String getUsageShort() {
|
}
|
||||||
return "Display file version info";
|
|
||||||
}
|
public void output(String[] args) throws SigarException {
|
||||||
|
for (int i=0; i<args.length; i++) {
|
||||||
public void output(String[] args) throws SigarException {
|
String exe = args[i];
|
||||||
for (int i=0; i<args.length; i++) {
|
if (new File(exe).exists()) {
|
||||||
String exe = args[i];
|
output(exe);
|
||||||
if (new File(exe).exists()) {
|
}
|
||||||
output(exe);
|
else {
|
||||||
}
|
long[] pids = this.shell.findPids(exe);
|
||||||
else {
|
for (int j=0; j<pids.length; j++) {
|
||||||
long[] pids = this.shell.findPids(exe);
|
try {
|
||||||
for (int j=0; j<pids.length; j++) {
|
output(sigar.getProcExe(pids[j]).getName());
|
||||||
try {
|
} catch (SigarException e) {
|
||||||
output(sigar.getProcExe(pids[j]).getName());
|
println(exe + ": " + e.getMessage());
|
||||||
} catch (SigarException e) {
|
}
|
||||||
println(exe + ": " + e.getMessage());
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
private void output(String key, String val) {
|
||||||
|
final int max = 20;
|
||||||
private void output(String key, String val) {
|
int len = max - key.length();
|
||||||
final int max = 20;
|
StringBuffer sb = new StringBuffer();
|
||||||
int len = max - key.length();
|
sb.append(" ").append(key);
|
||||||
StringBuffer sb = new StringBuffer();
|
while (len-- > 0) {
|
||||||
sb.append(" ").append(key);
|
sb.append('.');
|
||||||
while (len-- > 0) {
|
}
|
||||||
sb.append('.');
|
sb.append(val);
|
||||||
}
|
println(sb.toString());
|
||||||
sb.append(val);
|
}
|
||||||
println(sb.toString());
|
|
||||||
}
|
public void output(String exe) throws SigarException {
|
||||||
|
FileVersion info = Win32.getFileVersion(exe);
|
||||||
public void output(String exe) throws SigarException {
|
if (info == null) {
|
||||||
FileVersion info = Win32.getFileVersion(exe);
|
return;
|
||||||
if (info == null) {
|
}
|
||||||
return;
|
println("Version info for file '" + exe + "':");
|
||||||
}
|
output("FileVersion", info.getFileVersion());
|
||||||
println("Version info for file '" + exe + "':");
|
output("ProductVersion", info.getProductVersion());
|
||||||
output("FileVersion", info.getFileVersion());
|
for (Iterator it = info.getInfo().entrySet().iterator();
|
||||||
output("ProductVersion", info.getProductVersion());
|
it.hasNext();)
|
||||||
for (Iterator it = info.getInfo().entrySet().iterator();
|
{
|
||||||
it.hasNext();)
|
Map.Entry entry = (Map.Entry)it.next();
|
||||||
{
|
output((String)entry.getKey(), (String)entry.getValue());
|
||||||
Map.Entry entry = (Map.Entry)it.next();
|
}
|
||||||
output((String)entry.getKey(), (String)entry.getValue());
|
}
|
||||||
}
|
|
||||||
}
|
public static void main(String[] args) throws Exception {
|
||||||
|
new FileVersionInfo().processCommand(args);
|
||||||
public static void main(String[] args) throws Exception {
|
}
|
||||||
new FileVersionInfo().processCommand(args);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2007 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.cmd;
|
||||||
|
|
||||||
|
import org.hyperic.sigar.SigarException;
|
||||||
|
import org.hyperic.sigar.SigarPermissionDeniedException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display all pid cache information.
|
||||||
|
*/
|
||||||
|
public class PidCacheInfo extends SigarCommandBase {
|
||||||
|
|
||||||
|
|
||||||
|
public PidCacheInfo(Shell shell) {
|
||||||
|
super(shell);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PidCacheInfo() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean validateArgs(String[] args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsageShort() {
|
||||||
|
return "Display cache info for CPU cache and for IO cache";
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPidCompleter() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void output(String[] args) throws SigarException {
|
||||||
|
sigar.dumpPidCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2008 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
@@ -102,6 +100,14 @@ public class ProcInfo extends SigarCommandBase {
|
|||||||
try {
|
try {
|
||||||
println("credname=" + sigar.getProcCredName(pid));
|
println("credname=" + sigar.getProcCredName(pid));
|
||||||
} catch (SigarException e) {}
|
} catch (SigarException e) {}
|
||||||
|
try {
|
||||||
|
println("diskio=" + sigar.getProcDiskIO(pid));
|
||||||
|
} catch (SigarException e) {}
|
||||||
|
|
||||||
|
try {
|
||||||
|
println("cumulative diskio=" + sigar.getProcCumulativeDiskIO(pid));
|
||||||
|
} catch (SigarException e) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
*
|
||||||
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* you may not use this file except in compliance with the License.
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* You may obtain a copy of the License at
|
||||||
* published by the Free Software Foundation. This program is distributed
|
*
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
*
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* details.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
*
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* You should have received a copy of the GNU General Public License
|
* See the License for the specific language governing permissions and
|
||||||
* along with this program; if not, write to the Free Software
|
* limitations under the License.
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
|
* Copyright (c) 2006-2007 Hyperic, Inc.
|
||||||
* This file is part of SIGAR.
|
* Copyright (c) 2010 VMware, Inc.
|
||||||
*
|
*
|
||||||
* SIGAR is free software; you can redistribute it and/or modify
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* it under the terms version 2 of the GNU General Public License as
|
* you may not use this file except in compliance with the License.
|
||||||
* published by the Free Software Foundation. This program is distributed
|
* You may obtain a copy of the License at
|
||||||
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
*
|
||||||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* PARTICULAR PURPOSE. See the GNU General Public License for more
|
*
|
||||||
* details.
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
*
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* You should have received a copy of the GNU General Public License
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* along with this program; if not, write to the Free Software
|
* See the License for the specific language governing permissions and
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* limitations under the License.
|
||||||
* USA.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hyperic.sigar.cmd;
|
package org.hyperic.sigar.cmd;
|
||||||
@@ -31,6 +30,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.hyperic.sigar.Sigar;
|
||||||
import org.hyperic.sigar.SigarLoader;
|
import org.hyperic.sigar.SigarLoader;
|
||||||
|
|
||||||
public class Runner {
|
public class Runner {
|
||||||
@@ -136,6 +136,21 @@ public class Runner {
|
|||||||
return !missingJars();
|
return !missingJars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getenv(String key) {
|
||||||
|
try {
|
||||||
|
return System.getenv("ANT_HOME"); //check for junit.jar
|
||||||
|
} catch (Error e) {
|
||||||
|
/*1.4*/
|
||||||
|
Sigar sigar = new Sigar();
|
||||||
|
try {
|
||||||
|
return sigar.getProcEnv("$$", "ANT_HOME");
|
||||||
|
} catch (Exception se) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
finally { sigar.close(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
args = new String[] { "Shell" };
|
args = new String[] { "Shell" };
|
||||||
@@ -182,6 +197,13 @@ public class Runner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (missingJars()) {
|
||||||
|
String home = getenv("ANT_HOME"); //check for junit.jar
|
||||||
|
if (home != null) {
|
||||||
|
addJarDir(home + "/lib");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Class cmd = null;
|
Class cmd = null;
|
||||||
|
|||||||
Loaded 100 of 344 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user