From 2fdb26a3bd96e8722567778aab3656a1c8ee6e04 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Tue, 10 Jul 2018 22:14:59 -0400 Subject: [PATCH] asmon: Add version 0.71 to repository. From http://ftp.riken.jp/X11/AfterStep/stable/rpms/misc-tarballs/asmon-0.71.tar.bz2 --- asmon/COPYING | 339 ++++++++++++++ asmon/Changelog | 104 +++++ asmon/INSTALL | 14 + asmon/asmon.icon.xpm | 62 +++ asmon/asmon/Makefile | 27 ++ asmon/asmon/asmon | Bin 0 -> 36149 bytes asmon/asmon/asmon-mask.xbm | 38 ++ asmon/asmon/asmon-master.xpm | 205 ++++++++ asmon/asmon/asmon.c | 873 +++++++++++++++++++++++++++++++++++ asmon/asmon/asmon.o | Bin 0 -> 23632 bytes asmon/asmon/solaris26.c | 262 +++++++++++ asmon/wmgeneral/list.c | 169 +++++++ asmon/wmgeneral/list.h | 59 +++ asmon/wmgeneral/list.o | Bin 0 -> 1484 bytes asmon/wmgeneral/misc.c | 164 +++++++ asmon/wmgeneral/misc.h | 9 + asmon/wmgeneral/misc.o | Bin 0 -> 2148 bytes asmon/wmgeneral/wmgeneral.c | 366 +++++++++++++++ asmon/wmgeneral/wmgeneral.h | 50 ++ asmon/wmgeneral/wmgeneral.o | Bin 0 -> 8032 bytes 20 files changed, 2741 insertions(+) create mode 100644 asmon/COPYING create mode 100644 asmon/Changelog create mode 100644 asmon/INSTALL create mode 100644 asmon/asmon.icon.xpm create mode 100644 asmon/asmon/Makefile create mode 100755 asmon/asmon/asmon create mode 100644 asmon/asmon/asmon-mask.xbm create mode 100644 asmon/asmon/asmon-master.xpm create mode 100644 asmon/asmon/asmon.c create mode 100644 asmon/asmon/asmon.o create mode 100644 asmon/asmon/solaris26.c create mode 100644 asmon/wmgeneral/list.c create mode 100644 asmon/wmgeneral/list.h create mode 100644 asmon/wmgeneral/list.o create mode 100644 asmon/wmgeneral/misc.c create mode 100644 asmon/wmgeneral/misc.h create mode 100644 asmon/wmgeneral/misc.o create mode 100644 asmon/wmgeneral/wmgeneral.c create mode 100644 asmon/wmgeneral/wmgeneral.h create mode 100644 asmon/wmgeneral/wmgeneral.o diff --git a/asmon/COPYING b/asmon/COPYING new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/asmon/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, 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 Library 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 + + Appendix: 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. + + + Copyright (C) 19yy + + 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., 675 Mass Ave, Cambridge, MA 02139, 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) 19yy 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. + + , 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 Library General +Public License instead of this License. diff --git a/asmon/Changelog b/asmon/Changelog new file mode 100644 index 0000000..c039edb --- /dev/null +++ b/asmon/Changelog @@ -0,0 +1,104 @@ +asmon-0.71 + - Patch from Eric Evans to fix problems + with the Uptime not rolling over after more than 10 days. + +asmon-0.7 + - Fixed a graphics bug when X mem is over 100 mb + - Fixed a bug in regards to throttling cpus +- Eric Evans + - added support for Linux Kernel 2.6 +- apollock@debian.org + - fixed problem with more powerful cpus + - fixed problem with very large memory systems + +asmon-0.60 + - fixed glitch when only shared mem shown +- Eric Davis + - ported to Solaris + - added code to refresh the area of the memory and swap bars + - fixed a few math bugs + +asmon-0.51 +- added support for more than 9 days uptime +- added support for load average higher than 9.99 +- fixed the mem bar for >99 megs of ram +- added "Kitchen Sink" for WavePoet +- fixed a couple graphics glitches + +asmon-0.50 +- fixed yet another bug in the X mem bar, it should behave now +- integrated patch from Dmytro Sudak , allowing + execution of a program when you click on asmon, with "-e " + +asmon-0.49 +- fixed bug in X mem usage bar + +asmon-0.48 +- tweaked a few things + +asmon-0.47 +- more CPU optimization +- cleaned up the code alot + +asmon-0.46 +- it now checks both /tmp/.X0-lock and /var/run/server.0.pid for X's pid + +asmon-0.45 +- cleaned up the code a bunch +- some optimization + +asmon-0.44 +- added -m option to show only Shared mem like other mem meters + +asmon-0.43 +- increased the time interval between mem updates to lower cpu usage +- fixed the >100 megs bug +- added "-u" option to force uptime display +- fixed a few other minor things that I don't remember + + +asmon-0.42 +- fixed some math errors +- put a limiter on the X mem bar +- fixed problem of crashing when no Swap exists + +asmon-0.4 +- made X mem meter only appear if X pid can be found + otherwise diverting to uptime + +asmon-0.3 +- put in X mem meter + +asmon-0.2 +- stomped a few bugs +- first official release + +asmon-0.15 +- tweaked the graphs +- changed the name +- fixed -h docs + +asmem-0.1e +- put brackets on the graphs + +asmem-0.1d +- fixed overzealous bra graphs + +asmem-0.1c +- moved the cpu meter over one pixel + +asmem-0.1b +- re-integrated CPU monitor +- removed ladavg bar + +asmem-0.1a +- added page/swap LED's + +asmem-0.1 +- changed from wmcpu +- Removed CPU Usage Meter +- Added Swap Usage Meter +- Added Number of megs next to mem meters +- Added Load avg number +- Changed mem splits to tick marks rather than colors +- Put in better colors taken from wmsysmon diff --git a/asmon/INSTALL b/asmon/INSTALL new file mode 100644 index 0000000..5bcaef2 --- /dev/null +++ b/asmon/INSTALL @@ -0,0 +1,14 @@ +Installation instructions for asmon + +Installation +-------------------------------------------------------------- +1) % tar -zxvf asmon-0.7.tar.gz +2) % cd amon-0.7/asmon +3) % make +4) % make install +5) % asmon & (or asmon -h for help) + +Solaris +-------------------------------------------------------------- +Uncomment the appropriate lines in the Makefile before +compiling. diff --git a/asmon/asmon.icon.xpm b/asmon/asmon.icon.xpm new file mode 100644 index 0000000..13f77a8 --- /dev/null +++ b/asmon/asmon.icon.xpm @@ -0,0 +1,62 @@ +/* XPM */ +static char * xemacs_xpm[] = { +/* XEmacs pixmap + * width height ncolors chars_per_pixel */ +"50 50 5 1", +/**/ +" s None c None", +". m black c darkslategrey", +"X m white c orange", +"o m black c slate blue", +"O m white c white", +/* pixels */ +" ", +" ", +" ...... ... ", +" .. ... ", +" ............. ", +" .XXXXXXXXXX... ", +" .XX............ ", +" .X. ... ", +" ..... ... ", +" ... ", +" o ... ", +" o ... ", +" ... ", +" o o o ... ", +" oo oo ... ", +" ooo ... ", +" .......................................... ", +" o ......................................... ", +" o ....................................... ", +" o ..................................... ", +" o ..................................... ", +" ..................................... ", +" ..................................... ", +" o ..................................... ", +" oo ......OOO...OOOO..................... ", +" o .....OO.OO.O......................... ", +" .....O...O.O.....OO.OO..OO...OOO..... ", +" .....OOOOO..OOO..O.O.O.O..O..O..O.... ", +" .....O...O.....O.O.O.O.O..O..O..O.... ", +" o .....O...O.....O.O...O.O..O..O..O.... ", +" oo .....O...O.OOOO..O...O..OO...O..O.... ", +" o ..................................... ", +" ..................................... ", +" ..................................... ", +" ..................................... ", +" ..................................... ", +" o ................................... ", +" o ................................. ", +" oo ..X.. ", +" .X. .... ", +" .X. .XXXX. ", +" .X. .XX..XX. ", +" .X. .X. .X. ", +" o .XX..XX. .X. ", +" o .XXXX. .X. ", +" o o .... .X. ", +" .X. ", +" ", +" ", +" "}; diff --git a/asmon/asmon/Makefile b/asmon/asmon/Makefile new file mode 100644 index 0000000..d669e15 --- /dev/null +++ b/asmon/asmon/Makefile @@ -0,0 +1,27 @@ + +# uncomment the following lines if your using Solaris +#SOLARIS = -D__solaris__ +#SOLARIS_LIBS = -lsocket -lkstat +#SOLARIS_OBJS = solaris26.o + +LIBDIR = -L/usr/X11R6/lib +LIBS = -lXpm -lXext -lX11 $(SOLARIS_LIBS) +OBJS = asmon.o $(SOLARIS_OBJS) \ + ../wmgeneral/wmgeneral.o \ + ../wmgeneral/misc.o \ + ../wmgeneral/list.o + +.c.o: + gcc -c -Wall $(SOLARIS) $< -o $*.o + +asmon: $(OBJS) + gcc -o asmon $(OBJS) $(LIBDIR) $(LIBS) + +clean:: + for i in $(OBJS) ; do \ + rm $$i;\ + done + rm asmon + +install:: + cp -f asmon /usr/local/bin diff --git a/asmon/asmon/asmon b/asmon/asmon/asmon new file mode 100755 index 0000000000000000000000000000000000000000..03fd7e259dda1ea5c53ef787f1ee28426d3cd2b1 GIT binary patch literal 36149 zcmeHw4S1Brwf`j9zyiTU8x>nDiv$P-LIOz$el=ekzy^#GG*;=lNj4vnWY^sdBo;In z*0NpGQY)3-zqV5Bw|c#|t*x!JLD67KdueOEkl%%XHS*0jazE9ii`EU>Tbx6K)sEI0D zWvQ8J0=yWO-vu7PQQ(ABfDMoW$b^v0EjByheV_>pqilj)h^qhx-AWM{UuEcU@p~O% zfEAOJnwF*{U4|!v?HKrvA&d|OO`u*(gOH6xvXM5y0h(ZiUH7|SJ;+loEB>OE=GsLq z^$S~?+uA#F0^Xd(IxdnH-IuRkD{-j@&%>`U;=!I}U1ejy!C2%hWoDY}^fO={!pa3urFcZLQ86ZcnQ*SH_>zZgGXK>TU zgiQg>@;DD*2TTTJ0*U~a0C+70TnLy3Ko!QW%YdOe)hs}k@n!k(qV4edAYg%DN)^JL z0eC;)3IM8BT>!`iSQqPoHpx1n43>peKiiZeN&T*P3jL@PWqkj)_iZY3{%YvakNmc` z=#9wqL$}vVf2!y8^9FzUM`kJEdW{L(yW#TsGl24}cK$l}NHZR92Pd*BI+TTX${{nyIL7Ux%@bgu=T8D54!ZkfjeQONA z4}8<^)$uP-Q`Bvsvk@N-(ns?}|6Sv2WzU_jT&~7eZ<{L+bo+xYmvUXR!F9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e=(*is+Q>|#jWdRJZ3dRK$Hxn(pg zAE~tm6PW8=7{ic5-BkH11f_(EY;yZND85>})1XDDnku$s-TCRJgska~*$*?~s}CtH zTBxcip-!4PzUY*6d9fCPwzYm#IoN{LB{ie2X+Udb1GbozRh2ps>?&2VQD4=dOV;&L z5)AsAYq1YI05kIkd~t??Ur=HIXiF&MhEsfMS!mMK*FaKRV)R8o+SAb-JSFpNl+1iH%pHx@G$^anYA!4) i%t3eP^3}P5P3>*#b868qRe9R#p{;6lBZ3Ss>i+?Er<0ce literal 0 HcmV?d00001 diff --git a/asmon/asmon/asmon-mask.xbm b/asmon/asmon/asmon-mask.xbm new file mode 100644 index 0000000..62c6a72 --- /dev/null +++ b/asmon/asmon/asmon-mask.xbm @@ -0,0 +1,38 @@ +#define asmon_mask_width 64 +#define asmon_mask_height 64 +static char asmon_mask_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff, + 0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff, + 0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff, + 0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff, + 0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0, + 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f, + 0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0xff,0xff,0xff,0xff,0xff, + 0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff, + 0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff, + 0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff, + 0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff, + 0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0, + 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff, + 0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff, + 0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff, + 0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff, + 0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff, + 0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0, + 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff, + 0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff, + 0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff, + 0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff, + 0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff, + 0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff, + 0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0, + 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00}; diff --git a/asmon/asmon/asmon-master.xpm b/asmon/asmon/asmon-master.xpm new file mode 100644 index 0000000..a5fcfd0 --- /dev/null +++ b/asmon/asmon/asmon-master.xpm @@ -0,0 +1,205 @@ +/* XPM */ +static char * asmon_master_xpm[] = { +"75 126 76 1", +" c None", +". c #000000", +"+ c #202020", +"@ c #C7C7C7", +"# c #20B2AE", +"$ c #004941", +"% c #188A86", +"& c #107D79", +"* c #24DA0D", +"= c #28D60D", +"- c #2DD10D", +"; c #32CC0C", +"> c #36C80C", +", c #3BC30C", +"' c #3FBF0B", +") c #44BA0B", +"! c #48B60B", +"~ c #4DB10B", +"{ c #51AD0A", +"] c #56A80A", +"^ c #5BA30A", +"/ c #5F9F09", +"( c #649A09", +"_ c #689609", +": c #6D9109", +"< c #718D08", +"[ c #768808", +"} c #7A8408", +"| c #7F7F07", +"1 c #847A07", +"2 c #887607", +"3 c #8D7107", +"4 c #916D06", +"5 c #966806", +"6 c #9A6406", +"7 c #9F5F05", +"8 c #A35B05", +"9 c #A85605", +"0 c #AD5105", +"a c #B14D04", +"b c #B64804", +"c c #BA4404", +"d c #BF3F03", +"e c #C33B03", +"f c #C83603", +"g c #CC3203", +"h c #D12D02", +"i c #D62802", +"j c #DA2402", +"k c #DF1F01", +"l c #E31B01", +"m c #E81601", +"n c #EC1201", +"o c #F10D00", +"p c #F50900", +"q c #FA0400", +"r c #30CB00", +"s c #38BE00", +"t c #41B600", +"u c #49AA00", +"v c #59A200", +"w c #619600", +"x c #698E00", +"y c #718200", +"z c #867900", +"A c #8E6D00", +"B c #966500", +"C c #9E5900", +"D c #AE5100", +"E c #B64500", +"F c #BE3C00", +"G c #C73000", +"H c #BF2020", +"I c #B60418", +"J c #283C38", +"K c #F7F3FF", +" ", +" ", +" ", +" ", +" ........................................................ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", +" ", +" ", +" ........................................................ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", +" ", +" ", +" ........................................................ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++@ ", +" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", +" ", +" ", +" ........................................................ ", +" .+++++++++++@.+++++++++++++++++++++++++++++++++++++++++@ ", +" .+++++++++++@.+++++++++++++++++++++++++++++++++++++++++@ ", +" .+++++++++++@.+++++++++++++++++++++++++++++++++++++++++@ ", +" .+++++++++++@.+++++++++++++++++++++++++++++++++++++++++@ ", +" .+++++++++++@.+++++++++++++++++++++++++++++++++++++++++@ ", +" .+++++++++++@.+++++++++++++++++++++++++++++++++++++++++@ ", +" .+++++++++++@.+++++++++++++++++++++++++++++++++++++++++@ ", +" .+++++++++++@.+++++++++++++++++++++++++++++++++++++++++@ ", +" .+++++++++++@.+++++++++++++++++++++++++++++++++++++++++@ ", +" .+++++++++++@.+++++++++++++++++++++++++++++++++++++++++@ ", +" .+++++++++++@.+++++++++++++++++++++++++++++++++++++++++@ ", +" .+++++++++++@.+++++++++++++++++++++++++++++++++++++++++@ ", +" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ", +" ", +" ", +" ", +" ", +" ", +" ", +" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +" ++###+++$$$%+%###%+%###%+#$$$#+%###%+%###%+%###%+%###%+%###%++++++ ", +" +#+++#+$+++#+$+++#+$+++#+#+++#+#+++$+#+++$+$+++#+#+++#+#+++#+#++++ ", +" +#+++#+$+++#+$+++#+$+++#+#+++#+#+++$+#+++$+$+++#+#+++#+#+++#+#++++ ", +" +%$$$%++$$$%+%###%++###%+%###%+####%+%###%++$$$%+%###%+&###%++++++ ", +" +#+++#+$+++#+#+++$+$+++#+$+++#+$+++#+#+++#+$+++#+#+++#+$+++#+#++++ ", +" +#+++#+$+++#+#+++$+$+++#+$+++#+$+++#+#+++#+$+++#+#+++#+$+++#+#++++ ", +" ++###+++$$$#+%###%+%###%++$$$%+%###%+%###%++$$$#+%###%+%###%+++#++ ", +" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +" *=-;>,')!~{]^/(_:<[}|1234567890abcdefghijklmnopq ", +" *=-;>,')!~{]^/(_:<[}|1234567890abcdefghijklmnopq ", +" *=-;>,')!~{]^/(_:<[}|1234567890abcdefghijklmnopq ", +" *=-;>,')!~{]^/(_:<[}|1234567890abcdefghijklmnopq ", +" *=-;>,')!~{]^/(_:<[}|1234567890abcdefghijklmnopq ", +" *=-;>,')!~{]^/(_:<[}|1234567890abcdefghijklmnopq ", +" *=-;>,')!~{]^/(_:<[}|1234567890abcdefghijklmnopq ", +" *=-;>,')!~{]^/(_:<[}|1234567890abcdefghijklmnopq ", +" *=-;>,')!~{]^/(_:<[}|1234567890abcdefghijklmnopq ", +" rsstuuvvwwxxyzzAABBCCDEEFFGHHHHHHHHHHHHHHHHHHHHHHHHHH ", +" rsstuuvvwwxxyzzAABBCCDEEFFGHHHHHHHHHHHHHHHHHHHHHHHHHH ", +" rsstuuvvwwxxyzzAABBCCDEEFFGHHHHHHHHHHHHHHHHHHHHHHHHHH ", +" rsstuuvvwwxxyzzAABBCCDEEFFGHHHHHHHHHHHHHHHHHHHHHHHHHH ", +" rsstuuvvwwxxyzzAABBCCDEEFFGHHHHHHHHHHHHHHHHHHHHHHHHHH ", +" rsstuuvvwwxxyzzAABBCCDEEFFGHHHHHHHHHHHHHHHHHHHHHHHHHH ", +" rsstuuvvwwxxyzzAABBCCDEEFFGHHHHHHHHHHHHHHHHHHHHHHHHHH ", +" rsstuuvvwwxxyzzAABBCCDEEFFGHHHHHHHHHHHHHHHHHHHHHHHHHH ", +" rsstuuvvwwxxyzzAABBCCDEEFFGHHHHHHHHHHHHHHHHHHHHHHHHHH ", +" rsstuuvvwwxxyzzAABBCCDEEFFGHHHHHHHHHHHHHHHHHHHHHHHHHH ", +" rsstuuvvwwxxyzzAABBCCDEEFFGHHHHHHHHHHHHHHHHHHHHHHHHHH ", +" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++,' ", +" +$###$+%###+++###%+%###++%###%+%###%+%###%+%$$$%++$$$%++$$$%+,' ", +" +#+++#+#+++#+#+++$+#+++#+#+++$+#+++$+#+++$+#+++#+$+++#+$+++#+,' ", +" +#+++#+#+++#+#+++$+#+++#+#+++$+#+++$+#+++$+#+++#+$+++#+$+++#+,' ", +" +%###%+%###++%$$$++%$$$%+%###++%###++%$%#%+%###%++$$$%++$$$%+,' ", +" +#+++#+#+++#+#+++$+#+++#+#+++$+#+++$+#+++#+#+++#+$+++#+$+++#+,' ", +" +#+++#+#+++#+#+++$+#+++#+#+++$+#+++$+#+++#+#+++#+$+++#+$+++#+,' ", +" +%$$$%+%###+++###%+%###++%###%+%$$$++%###%+%$$$%++$$$%+%###%+ ", +" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +" +II+ +JJ+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +" IKII JJJJ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +" IIII JJJJ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +" +II+ +JJ+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +" ....................................................... ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", +" .++++++++++++++++++++++++++++++++++++++++++++++++++++++ "}; diff --git a/asmon/asmon/asmon.c b/asmon/asmon/asmon.c new file mode 100644 index 0000000..3460b1b --- /dev/null +++ b/asmon/asmon/asmon.c @@ -0,0 +1,873 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include "../wmgeneral/wmgeneral.h" +#include "../wmgeneral/misc.h" + +#include "asmon-master.xpm" +#include "asmon-mask.xbm" + +#ifdef __solaris__ +#include +#endif + +#define EXEC_ON_CLICK 1 +#define ASMON_VERSION "0.71" +#define CHAR_WIDTH 5 +#define CHAR_HEIGHT 7 + +#define BCHAR_WIDTH 6 +#define BCHAR_HEIGHT 9 + +#define BOFFX (9) +#define BOFFY (111) +#define BREDX (3) +#define BREDY (111) +#define BGREENX (87) +#define BGREENY (66) + +#define LITEW (4) +#define LITEH (4) + +#define B_OFF (0) +#define B_RED (1) +#define B_GREEN (2) + + +/* Evil globals I haven't removed yet */ +long last_pageins=0, last_pageouts=0; +long last_swapins=0, last_swapouts=0; +//double old; +static int has_kern26 = 0; + +#ifdef EXEC_ON_CLICK +char Command[256]=""; +#endif + +/* functions */ +void DrawUptime(void); +void usage(void); +void printversion(void); +void asmon_routine(int Xpid, int allmem); +void DrawLite(int state, int dx, int dy); +void DrawCPU(void); +void DrawLoad(void); +#ifdef __solaris__ +float DrawMemSwap(void); +extern int getLoad(float *); +extern int getSwap(unsigned long *, unsigned long *); +extern int getMem(unsigned long *, unsigned long *); +extern int getCPU(unsigned long *, unsigned long *, + unsigned long *, unsigned long *, + unsigned long *, unsigned long *, + unsigned long *, unsigned long *); +#else +void DrawXmem(int Xpid, float total); +float DrawMemSwap(float total, int allmem); +#endif + +int main(int argc, char *argv[]) +{ + FILE *fp; + int i; + int allmem=1; + int Xpid=1; + char *ProgName; + struct utsname name; + int kernMajor, kernMinor, kernRev; + + ProgName = argv[0]; + + if (strlen(ProgName) >= 5) + ProgName += (strlen(ProgName) - 5); + + for (i=1; i\n"); + fprintf(stderr, "\t-h\tthis screen\n"); + fprintf(stderr, "\t-v\tprint the version number\n"); +#ifndef __solaris__ + fprintf(stderr, "\t-u\tforce asmon to show uptime, rather than X mem use\n"); +#endif +#ifdef EXEC_ON_CLICK + fprintf(stderr, "\t-e cmd\texecute 'cmd' on mouse click\n"); +#endif + fprintf(stderr, "\n"); +} + +/**************************************************************************/ + +void printversion(void) +{ + fprintf(stderr, "asmon %s\n", ASMON_VERSION); +} + +/**************************************************************************/ + +void asmon_routine(int Xpid, int allmem) +{ + int xpm_X=0, xpm_Y=0, count=0; + XEvent Event; + float total=0.0; + + while(1) + { + DrawCPU(); + DrawLoad(); + + /* Only run every 15 iterations */ + if ( count == 0 || count == 15) +#ifdef __solaris__ + total=DrawMemSwap(); +#else + total=DrawMemSwap(total, allmem); +#endif + +#ifdef __solaris__ + DrawUptime(); +#else + /* X mem or Uptime? */ + if (Xpid == 0) + { + DrawUptime(); + } else { + if (count == 5) + DrawXmem(Xpid, total); + } +#endif + + /* Redraw Windows */ + RedrawWindowXY(xpm_X, xpm_Y); + while (XPending(display)) + { + XNextEvent(display, &Event); + switch (Event.type) + { +#ifdef EXEC_ON_CLICK + case ButtonPress: +#if 0 + fprintf(stderr,"system(%s)\n",Command); +#endif + if (Command[ 0 ]) system(Command); + break; +#endif + case Expose: + RedrawWindowXY(xpm_X, xpm_Y); + break; + case DestroyNotify: + XCloseDisplay(display); + exit(0); + break; + } + } + count++; + if (count > 30) + count = 0; + usleep(150000); + } +} + + +/**************************************************************************/ + +#ifdef __solaris__ + +/* CPU Usage Meter */ +void DrawCPU + ( + void + ) + { + unsigned long cpuIdle, cpuUser, cpuKern, cpuWait; + unsigned long pageIn, pageOut, swapIn, swapOut; + + /* remember the statistics read last time */ + static float cpustat[4] = {0.0, 0.0, 0.0, 0.0}; + float fields[4] = {0.0, 0.0, 0.0, 0.0}; + float cputotal = 0.0; + + getCPU(&cpuIdle, &cpuUser, &cpuKern, &cpuWait, + &pageIn, &pageOut, &swapIn, &swapOut); + + // Calculate CPU stuff + fields[0] = ((float)cpuIdle - cpustat[0]); + cpustat[0] = (float)cpuIdle; + cputotal += fields[0]; + + fields[1] = ((float)cpuUser - cpustat[1]); + cpustat[1] = (float)cpuUser; + cputotal += fields[1]; + + fields[2] = ((float)cpuKern - cpustat[2]); + cpustat[2] = (float)cpuKern; + cputotal += fields[2]; + + fields[3] = ((float)cpuWait - cpustat[3]); + cpustat[3] = (float)cpuWait; + cputotal += fields[3]; + + // CPU Bar + if(cputotal > 0) + { + cputotal = ((cputotal - (fields[0] + fields[2])) * 1.55); + if (cputotal > 26) cputotal = 26; + copyXPMArea(3, 84, cputotal, 9, 5, 5); + copyXPMArea(15, 105, (27 - cputotal), 9, (5 + cputotal), 5); + copyXPMArea(16, 46, 2, 14, 32, 2); + } + + // Page In/Out + if (pageIn > last_pageins) DrawLite(B_RED, 5, 48); + else DrawLite(B_OFF, 5, 48); + + if (pageOut > last_pageouts) DrawLite(B_RED, 10, 48); + else DrawLite(B_OFF, 10, 48); + + last_pageins = pageIn; + last_pageouts = pageOut; + + // Swap In/Out + if (swapIn > last_swapins) DrawLite(B_RED, 5, 53); + else DrawLite(B_OFF, 5, 53); + + if (swapOut > last_swapouts) DrawLite(B_RED, 10, 53); + else DrawLite(B_OFF, 10, 53); + + last_swapins = swapIn; + last_swapouts = swapOut; + } + +#else + +/* CPU Usage Meter */ +void DrawCPU(void) +{ + FILE *fp; + static double cpustat[7]; /* remember the statistics read last time */ + //double fields[7], info[7], cputotal=0.0,idlee=0.0; + double fields[7], info[7], cputotal=0.0; + long pageins=0, pageouts=0, swapins=0, swapouts=0 ; + char buf[128]; + int i; + + if( (fp = fopen("/proc/stat", "r")) != NULL) + { + if( has_kern26 > 0 ) + { + // CPU data + fscanf(fp, "cpu %lf %lf %lf %lf %lf %lf %lf", info, info+1, + info+2, info+3, info+4, info+5, info+6); + + fclose(fp); + + if( (fp = fopen("/proc/vmstat", "r")) != NULL) + { + // gather data for LED's + while( fgets(buf, 127, fp) ) + { + if (strstr(buf, "pgpgin")) + sscanf(buf, "pgpgin %ld", &pageins); + + if (strstr(buf, "pgpgout")) + sscanf(buf, "pgpgout %ld", &pageouts); + + if (strstr(buf, "pswpin")) + sscanf(buf, "pswpin %ld", &swapins); + + if (strstr(buf, "pswpout")) + sscanf(buf, "pswpout %ld", &swapouts); + } + fclose(fp); + } + } else { + // CPU data + fscanf(fp, "cpu %lf %lf %lf %lf", info, info+1, info+2, + info+3); + + // gather data for LED's + while( fgets(buf, 127, fp) ) + { + if (strstr(buf, "page")) + sscanf(buf, "page %ld %ld", &pageins, &pageouts); + + if (strstr(buf, "swap")) + sscanf(buf, "swap %ld %ld", &swapins, &swapouts); + } + fclose(fp); + } + + // Calculate CPU stuff + if( has_kern26 > 0 ) + { + for(i = 0; i < 7; i++) + { + fields[i] = info[i] - cpustat[i]; + cputotal += fields[i]; + cpustat[i] = info[i]; + } + } else { + for(i = 0; i < 4; i++) + { + fields[i] = info[i] - cpustat[i]; + cputotal += fields[i]; + cpustat[i] = info[i]; + } + } + //idlee=info[3]-old; + + //old=info[3]; + + // CPU Bar + + //cputotal = 100 * l1 ; + //cputotal=(100-(idlee*100/16))*26/100; + if(cputotal > 0) + { + cputotal = (cputotal-(fields[3]+fields[4]))*1.55; + if ( cputotal > 26 ) cputotal = 26; + copyXPMArea(3,84,cputotal,9,5,5); + copyXPMArea(15,105,(27-cputotal),9,(5+cputotal),5); + copyXPMArea(16,46,2,14,32,2); + } + + // Page In/Out + if (pageins > last_pageins) + { + DrawLite(B_RED, 5, 48); + } else { + DrawLite(B_OFF, 5, 48); + } + + if (pageouts > last_pageouts) + { + DrawLite(B_RED, 10, 48); + } else { + DrawLite(B_OFF, 10, 48); + } + last_pageins = pageins; + last_pageouts = pageouts; + + // Swap In/Out + if (swapins > last_swapins) + { + DrawLite(B_RED, 5, 53); + } else { + DrawLite(B_OFF, 5, 53); + } + + if (swapouts > last_swapouts) + { + DrawLite(B_RED, 10, 53); + } else { + DrawLite(B_OFF, 10, 53); + } + last_swapins = swapins; + last_swapouts = swapouts; + } +} + +#endif + +/**************************************************************************/ + +/* Load Average */ +void DrawLoad(void) +{ + int tempy, tempa, i; + static float oldv = -1.0; + float ftmp; + +#ifdef __solaris__ + if (getLoad(&ftmp) != -1) + { +#else + FILE *fp; + if( (fp = fopen("/proc/loadavg", "r")) != NULL) + { + fscanf(fp, "%f", &ftmp); + fclose(fp); +#endif + if(oldv != ftmp) + { + oldv = ftmp; + i=ftmp*26; + tempa=(ftmp+0.005)*100; + tempy=tempa%10; + copyXPMArea(3+(tempy*6),66,6,9,50,5); + tempy=tempa/10; + tempy=tempy%10; + copyXPMArea(3+(tempy*6),66,6,9,44,5); + copyXPMArea(65,66,3,9,41,5); + tempy=tempa/100; + if ( tempy > 9 ) + { + tempy=(tempy-10); + copyXPMArea(3+(tempy*6),95,6,9,34,5); + } else { + copyXPMArea(3+(tempy*6),66,6,9,34,5); + } + } + } +} + +/**************************************************************************/ + +#ifdef __solaris__ + +/* Mem/Swap Meter */ +float DrawMemSwap + ( + void + ) + { + unsigned long memMax, memFree, swapMax, swapFree; + unsigned long MEMmem, MEMswap; + float memUsed, swapUsed; + int tempy, tempa; + + getMem(&memMax, &memFree); + memUsed = (float)(memMax - memFree); + + getSwap(&swapMax, &swapFree); + swapUsed = (float)(swapMax - swapFree); + + /* MEM Meter */ + if (memMax == 0) + MEMmem = 0; + else + { + if (((float)memMax / 1048576) >= 1) + MEMmem = ((memUsed * 31) / (float)memMax); + else + MEMmem = ((memUsed * 36) / (float)memMax); + } + + // refresh + copyXPMArea(4, 115, 55, 11, 4, 18); + + // Bar + copyXPMArea(3, 75, MEMmem, 9, 5, 19); + copyXPMArea(15, 105, (36 - MEMmem), 9, (5 + MEMmem), 19); + // Numbers + tempa = (memUsed / 1048576); + tempy = (tempa % 10); + copyXPMArea((3 + (tempy * 6)), 66, 6, 9, 50, 19); + tempy = ((tempa / 10) % 10); + copyXPMArea((3 + (tempy * 6)), 66, 6, 9, 44, 19); + tempy = ((tempa / 100) % 10); + if (tempy != 0) + { + copyXPMArea((3 + (tempy * 6)), 66, 6, 9, 38, 19); + copyXPMArea(16, 46, 2, 14, 35, 16); + } + else + { + copyXPMArea(16, 46, 2, 14, 41, 16); + } + + // refresh + copyXPMArea(4, 115, 55, 11, 4, 32); + + /* SWAP Meter */ + if (swapMax == 0) + MEMswap = 0; + else + { + if (((float)swapMax / 1048576) >= 1) + MEMswap = ((swapUsed * 31) / (float)swapMax); + else + MEMswap = ((swapUsed * 36) / (float)swapMax); + } + // Bar + copyXPMArea(3, 75, MEMswap, 9, 5, 33); + copyXPMArea(15, 105, (36 - MEMswap), 9, (5 + MEMswap), 33); + // Numbers + tempa = (swapUsed / 1048576); + tempy = (tempa % 10); + copyXPMArea((3 + (tempy * 6)), 66, 6, 9, 50, 33); + tempy = ((tempa / 10) % 10); + copyXPMArea((3 + (tempy * 6)), 66, 6, 9, 44, 33); + tempy = ((tempa / 100) % 10); + if (tempy != 0) + { + copyXPMArea((3 + (tempy * 6)), 66, 6, 9, 38, 33); + copyXPMArea(16, 46, 2, 14, 42, 16); + } + else + { + copyXPMArea(16, 46, 2, 14, 41, 30); + } + + return (float)memMax; + } + +#else + +/* Mem/Swap Meter */ +float DrawMemSwap(float total, int allmem) +{ + FILE *fp; + if( (fp = fopen("/proc/meminfo", "r")) != NULL) + { + static float stotal=0.0, sshared=0.0, sbuffers=0.0, scached=0.0; + char junk[128]; + float used, freeM, shared, buffers, cached, swaptotal, + swapused, swapfreeM; + unsigned long MEMshar,MEMbuff,MEMcach, MEMswap; + int tempy, tempa; + + if( has_kern26 > 0 ) + { + float scratch; + + while(!feof(fp)) + { + fgets(junk, 120, fp); + if (strstr(junk, "MemTotal")) + { + sscanf(junk, "MemTotal: %f kB", &scratch); + total = scratch * 1024; + } + if (strstr(junk, "MemFree")) + { + sscanf(junk, "MemFree: %f kB", &scratch); + freeM = scratch * 1024; + used = total - freeM; + } + if (strstr(junk, "Buffers")) + { + sscanf(junk, "Buffers: %f kB", &scratch); + buffers = scratch * 1024; + } + if (strstr(junk, "Cached")) + { + sscanf(junk, "Cached: %f kB", &scratch); + cached = scratch * 1024; + } + if (strstr(junk, "SwapTotal")) + { + sscanf(junk, "SwapTotal: %f kB", &scratch); + swaptotal = scratch * 1024; + } + if (strstr(junk, "SwapFree")) + { + sscanf(junk, "SwapFree: %f kB", &scratch); + swapfreeM = scratch * 1024; + swapused = swaptotal - swapfreeM; + } + } + } else { + fgets(junk, 80, fp); + fscanf(fp, "Mem: %f %f %f %f %f %f\nSwap: %f %f %f", &total, + &used, &freeM, &shared, &buffers, &cached, + &swaptotal, &swapused, &swapfreeM); + } + fclose(fp); + + /* All mem areas */ + if(stotal != total || sshared != shared || sbuffers != buffers || scached != cached) + { + stotal = total; sshared = shared; sbuffers = buffers; scached = cached; + if ( (total/101048576) >= 1) + { + MEMshar=((used-buffers-cached)/total)*27; + MEMbuff=(buffers/total)*27; + MEMcach=(cached/total)*27; + } else { + MEMshar=((used-buffers-cached)/total)*33; + MEMbuff=(buffers/total)*33; + MEMcach=(cached/total)*33; + } + // refresh + copyXPMArea(4, 115, 55, 11, 4, 18); + // Bar + if ( (total/101048576) >= 1) + { + copyXPMArea(3,75,((used/total)*28),9,5,19); + } else { + copyXPMArea(3,75,((used/total)*34),9,5,19); + } + // Separators + copyXPMArea(15,105,1,9,5+MEMshar,19); + copyXPMArea(15,105,1,9,7+MEMshar+MEMbuff,19); + copyXPMArea(15,105,(36-(used/total)*34),9,(5+(used/total)*34),19); + // Numbers + tempa=used/1048576; + tempy=tempa%10; + copyXPMArea(3+(tempy*6),66,6,9,50,19); + tempy=(tempa/10)%10; + copyXPMArea(3+(tempy*6),66,6,9,44,19); + tempy=(tempa/100)%10; + if ( (total/101048576) >= 1) { + copyXPMArea(3+(tempy*6),66,6,9,38,19); + copyXPMArea(16,46,2,14,35,16); + } else { + copyXPMArea(16,46,2,14,41,16); + } + } + /* SWAP Meter */ + if ( swaptotal == 0 ) MEMswap = 0; + else { + if ( (total/101048576) >= 1) + MEMswap=(swapused*31)/swaptotal; + else MEMswap=(swapused*36)/swaptotal; + } + // refresh + copyXPMArea(4, 115, 55, 11, 4, 32); + // Bar + copyXPMArea(3,75,MEMswap,9,5,33); + copyXPMArea(15,105,(36-(MEMswap)),9,5+MEMswap,33); + // Numbers + tempa=swapused/1048576; + tempy=tempa%10; + copyXPMArea(3+(tempy*6),66,6,9,50,33); + tempy=(tempa/10)%10; + copyXPMArea(3+(tempy*6),66,6,9,44,33); + tempy=tempa/100; + if ( tempy != 0 ) { + copyXPMArea(3+(tempy*6),66,6,9,38,33); + copyXPMArea(16,46,2,14,35,30); + } else { + copyXPMArea(16,46,2,14,41,30); + } + } + return(total); +} + +#endif + +/**************************************************************************/ + +#ifndef __solaris__ + +/* X Mem Usage */ +void DrawXmem(int Xpid, float total) +{ + FILE *fp; + char buf[128], XFileName[256]; + float ratio; + long old_Xsize=-1, Xsize=0; + + sprintf(XFileName, "/proc/%d/status", Xpid); + + if ((fp = fopen(XFileName, "r")) != NULL) + { + while( fgets(buf, 127, fp) ) + { + if (strstr(buf, "VmSize")) + sscanf(buf, "VmSize: %ld", &Xsize); + } + if(old_Xsize!=Xsize) + { + int tempy, tempa, tempb; + old_Xsize=Xsize; + ratio=Xsize/(total/1024); + if ( Xsize > (total/1024) ) Xsize=total/1024; + Xsize=Xsize/1024; + tempy=Xsize%10; + copyXPMArea(3+(tempy*6),66,6,9,50,48); + tempa=Xsize/10; + tempy=tempa%10; + tempb=Xsize/100; + if ( Xsize > 100 ) + { + copyXPMArea(3,84,((ratio)*17),11,18,47); + copyXPMArea(15,105,(23-((ratio)*17)),11,(18+(ratio*22)),47); + copyXPMArea(3+(tempy*6),66,6,9,44,48); + copyXPMArea(3+(tempb*6),66,6,9,38,48); + copyXPMArea(16,46,2,14,36,46); + } else { + copyXPMArea(3,84,((ratio)*22),11,18,47); + copyXPMArea(15,105,(23-((ratio)*22)),11,(18+(ratio*22)),47); + copyXPMArea(3+(tempy*6),66,6,9,44,48); + copyXPMArea(16,46,2,14,41,46); + } + } + fclose(fp); + } +} + +#endif + +/**************************************************************************/ + +/* Uptime */ +void DrawUptime(void) +{ + int upt, days=0,hours=0,mins=0, old_mins=-1,old_hours=-1; + +#ifdef __solaris__ + struct utmp * pUtmp; + struct utmp idUtmp; + idUtmp.ut_type = BOOT_TIME; + setutent(); + pUtmp = getutid(&idUtmp); + upt = (time(0) - pUtmp->ut_time); +#else + FILE *fp; + if( (fp = fopen("/proc/uptime", "r")) != NULL) + fscanf(fp, "%d",&upt); + fclose(fp); +#endif + mins=(upt/60)%60; + hours=(upt/3600)%24; + days=(upt/86400); + if(old_hours!=hours) + old_hours=hours; + if(old_mins!=mins) + { + int tempy; + old_mins=mins; + if ( days > 9 ) + { + copyXPMArea(20,105,36,9,18,48); + tempy=hours%10; + copyXPMArea(3+(tempy*6),66,6,9,50,48); + tempy=hours/10; + copyXPMArea(3+(tempy*6),66,6,9,44,48); + copyXPMArea(63,66,3,9,41,48); + tempy=days%10; + copyXPMArea(3+(tempy*6),66,6,9,34,48); + tempy=(days/10)%10; + copyXPMArea(3+(tempy*6),66,6,9,28,48); + tempy=days/100; + copyXPMArea(3+(tempy*6),66,6,9,22,48); + } else { + tempy=mins%10; + copyXPMArea(3+(tempy*6),66,6,9,50,48); + tempy=mins/10; + copyXPMArea(3+(tempy*6),66,6,9,44,48); + copyXPMArea(63,66,3,9,41,48); + tempy=hours%10; + copyXPMArea(3+(tempy*6),66,6,9,34,48); + tempy=hours/10; + copyXPMArea(3+(tempy*6),66,6,9,28,48); + copyXPMArea(63,66,3,9,25,48); + tempy=days%10; + copyXPMArea(3+(tempy*6),66,6,9,18,48); + + } + } +} + +/**************************************************************************/ + +/* Drawing LED's */ +void DrawLite(int state, int dx, int dy) +{ + switch(state) + { + case B_RED: + copyXPMArea(BREDX, BREDY, LITEW, LITEH, dx, dy); + break; + case B_GREEN: + copyXPMArea(BGREENX, BGREENY, LITEW, LITEH, dx, dy); + break; + default: + case B_OFF: + copyXPMArea(BOFFX, BOFFY, LITEW, LITEH, dx, dy); + break; + } + +} + +/* EOF */ diff --git a/asmon/asmon/asmon.o b/asmon/asmon/asmon.o new file mode 100644 index 0000000000000000000000000000000000000000..4fb939b06de8aba79d228619ca8a43f2a8e16fab GIT binary patch literal 23632 zcmeHP4|r77mA?rYP10yk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ZlsED!-j^H_1`|=ZHuAUmza+^D^friAO*G zJM+IM9{pT|n2?<-8O=b_Tgm)t;-S~de1tJda_D`Y`L7TUy>Bu90^_SBhu*(3{}%Dk zqnJ{?moa_-NP5-GHxduM4>RA+=p%U*{#6_1KTSOJ4l+MXd=17UA=-aC`jqN%1F1j! zgy@e5$q}bG<3o(!VSJ786yq4}kzz>vr9jGmiupURx03u7Mu9z+cspYoA?DBLfmH4*#5;ue zCi8>DqwarVeuVfcA^wZ`67)6o_cB5o&fP$=b1&nAj3MmVRPR;TlPG@|koY+BpJx0K z<7&{-JzK7l|02644Zi8Y4m=dAKbR<|Sh5mWZyF zh@m2J6=NNvlW{d;Gh+*5D`Okudd7{69>y-l9>xG;n6Zy>C*vN*eT@4V4=~=xct7I< zj1MwC#P}%V&{GoE5R%{an1&N#t%hH;W{ic#dNcoi_x zzdT0qD`A|=NdHn9$rms#WYieVjOC2W7%hzS97*LJjH?*y7@dr(8Jihf7+V?J7}qmy zWb`n0G4?P97{iQxj5`_kFz#dA&v=0GKF0eQA7Fft@gc@X86Ri-I^$D}PcuHt_#ER9 z<6*`Z8DC*M%J@^pV~occPcfcm9AO-1oM1e|ILSE0DCThgGZr$IFwSM1$GCuzp3|v6 NHAea;_J}WM{BPvpS^59~ literal 0 HcmV?d00001 diff --git a/asmon/asmon/solaris26.c b/asmon/asmon/solaris26.c new file mode 100644 index 0000000..00d43cc --- /dev/null +++ b/asmon/asmon/solaris26.c @@ -0,0 +1,262 @@ +/* + * Routines for Solaris. + * + * Note that this might not work on differnet versions of Solaris. The + * reason being is that the kstat variables can change from version to + * version. Read the kvm and kstat man pages to see what Sun says + * about it. Also there is no 'real' way to find out the implemented + * kernel variables! There is an undocumented feature to netstat which + * walks the kstat chain. The output sort of makes sense for kernel + * hackers. Anyways use 'netstat -k'. + * + * The code is GPL'ed. See the asmon COPYING file that comes with the + * distribution. The only thing I add is that if you use this code + * and we meet sometime, then you can buy me a beer. Happy monitoring. + * + * Eric Davis + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +typedef struct swapent SWAP_ENT_T; +typedef struct swaptable SWAP_TABLE_T; +typedef unsigned long ULONG; + + +static int err + ( + char * msg + ) + { + perror(msg); + return -1; + } + + +int getLoad + ( + float * load + ) + { + kstat_t * ks; + kstat_ctl_t * kc; + kstat_named_t * kn; + + if ((kc = kstat_open()) == NULL) + return err("kstat_open"); + + if ((ks = kstat_lookup(kc, "unix", 0, "system_misc")) == NULL) + return err("kstat_lookup"); + + if (kstat_read(kc, ks, NULL) == -1) + return err("kstat_read"); + + if ((kn = kstat_data_lookup(ks, "avenrun_1min")) == NULL) + return err("kstat_data_lookup"); + + if (kstat_close(kc) == -1) + return err("kstat_close"); + + *load = ((float)kn->value.ul / FSCALE); + /* printf("load: %2.2f\n\n", *load); */ + return 0; + } + + +int getSwap + ( + ULONG * swapMax, + ULONG * swapFree + ) + { + static char buf[256]; + int i; + int totalSwapEntries; + SWAP_TABLE_T * swapTable; + SWAP_ENT_T * swapEntries; + + TRY_AGAIN: + + totalSwapEntries = swapctl(SC_GETNSWP, 0); + swapTable = (SWAP_TABLE_T *)malloc(sizeof(int) + + (totalSwapEntries * + sizeof(SWAP_ENT_T))); + + swapTable->swt_n = totalSwapEntries; + for (swapEntries = &(swapTable->swt_ent[0]), + i = 0; i < totalSwapEntries; i++, swapEntries++) + { + swapEntries->ste_path = buf; + } + + if (swapctl(SC_LIST, swapTable) == -1) + { + /* Retry if our swap table was too small else bail */ + free(swapTable); + perror("swapctl"); + if (errno == ENOMEM) goto TRY_AGAIN; + else return -1; + } + + for (swapEntries = &(swapTable->swt_ent[0]), *swapMax = *swapFree = 0, + i = 0; i < totalSwapEntries; i++, swapEntries++) + { + if (!(swapEntries->ste_flags & ST_INDEL) && + !(swapEntries->ste_flags & ST_DOINGDEL)) + { + *swapMax += swapEntries->ste_pages; + *swapFree += swapEntries->ste_free; + } + } + + *swapMax *= sysconf(_SC_PAGESIZE); + *swapFree *= sysconf(_SC_PAGESIZE); + /* + printf("swap max: %ld\nswap free: %ld\nswap used: %ld\n\n", + *swapMax, *swapFree, (*swapMax - *swapFree)); + */ + free(swapTable); + return 0; + } + + +int getMem + ( + ULONG * memMax, + ULONG * memFree + ) + { + kstat_t * ks; + kstat_ctl_t * kc; + kstat_named_t * kn; + + if ((kc = kstat_open()) == NULL) + return err("kstat_open"); + + if ((ks = kstat_lookup(kc, "unix", 0, "system_pages")) == NULL) + return err("kstat_lookup"); + + if (kstat_read(kc, ks, NULL) == -1) + return err("kstat_read"); + + if ((kn = kstat_data_lookup(ks, "physmem")) == NULL) + return err("kstat_data_lookup"); + + *memMax = (kn->value.ul * sysconf(_SC_PAGESIZE)); + + if ((kn = kstat_data_lookup(ks, "freemem")) == NULL) + return err("kstat_data_lookup"); + + *memFree = (kn->value.ul * sysconf(_SC_PAGESIZE)); + + if (kstat_close(kc) == -1) + return err("kstat_close"); + + /* + printf("mem max: %ld\nmem free: %ld\nmem used: %ld\n\n", + *memMax, *memFree, (*memMax - *memFree)); + */ + return 0; + } + + +int getCPU + ( + ULONG * cpuIdle, + ULONG * cpuUser, + ULONG * cpuKern, + ULONG * cpuWait, + ULONG * pageIn, + ULONG * pageOut, + ULONG * swapIn, + ULONG * swapOut + ) + { + cpu_stat_t * cpu_stat; + + ULONG numCPUs; + int i; + kstat_t * ks; + kstat_ctl_t * kc; + kstat_named_t * kn; + + if ((kc = kstat_open()) == NULL) + return err("kstat_open"); + + if ((ks = kstat_lookup(kc, "unix", 0, "system_misc")) == NULL) + return err("kstat_lookup"); + + if (kstat_read(kc, ks, NULL) == -1) + return err("kstat_read"); + + if ((kn = kstat_data_lookup(ks, "ncpus")) == NULL) + return err("kstat_data_lookup"); + + numCPUs = kn->value.ul; + + cpu_stat = (cpu_stat_t *)malloc(numCPUs * sizeof(cpu_stat_t)); + + for (i = 0, ks = kc->kc_chain; ks != NULL; ks = ks->ks_next) + { + if (strncmp(ks->ks_name, "cpu_stat", 8) == 0) + { + if (kstat_read(kc, ks, &cpu_stat[i++]) == -1) + { + free(cpu_stat); + return err("kstat_read"); + } + if (i > numCPUs) + { + fprintf(stderr, + "getCPU: invalid number of cpus in kstat chain\n"); + free(cpu_stat); + return -1; + } + } + } + if (i != numCPUs) + { + fprintf(stderr, + "getCPU: invalid number of cpus in kstat chain\n"); + free(cpu_stat); + return -1; + } + + for (*cpuIdle = *cpuUser = *cpuKern = *cpuWait = 0, + *pageIn = *pageOut = *swapIn = *swapOut = 0, + i = 0; i < numCPUs; ++i) + { + *cpuIdle += cpu_stat[i].cpu_sysinfo.cpu[CPU_IDLE]; + *cpuUser += cpu_stat[i].cpu_sysinfo.cpu[CPU_USER]; + *cpuKern += cpu_stat[i].cpu_sysinfo.cpu[CPU_KERNEL]; + *cpuWait += cpu_stat[i].cpu_sysinfo.cpu[CPU_WAIT]; + *pageIn += cpu_stat[i].cpu_vminfo.pgpgin; + *pageOut += cpu_stat[i].cpu_vminfo.pgpgout; + *swapIn += cpu_stat[i].cpu_vminfo.pgswapin; + *swapOut += cpu_stat[i].cpu_vminfo.pgswapout; + } + + if (kstat_close(kc) == -1) + { + free(cpu_stat); + return err("kstat_close"); + } + + /* + printf("num cpus: %ld\ncpu idle: %ld\ncpu user: %ld\ncpu kern: %ld\ncpu wait: %ld\npage in: %ld\npage out: %ld\nswap in: %ld\nswap out: %ld\n\n", + numCPUs, *cpuIdle, *cpuUser, *cpuKern, *cpuWait, + *pageIn, *pageOut, *swapIn, *swapOut); + */ + free(cpu_stat); + return 0; + } + diff --git a/asmon/wmgeneral/list.c b/asmon/wmgeneral/list.c new file mode 100644 index 0000000..f804b2c --- /dev/null +++ b/asmon/wmgeneral/list.c @@ -0,0 +1,169 @@ +/* Generic single linked list to keep various information + Copyright (C) 1993, 1994 Free Software Foundation, Inc. + + +Author: Kresten Krab Thorup + +Many modifications by Alfredo K. Kojima + + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you link this library with files compiled with + GCC to produce an executable, this does not cause the resulting executable + to be covered by the GNU General Public License. This exception does not + however invalidate any other reasons why the executable file might be + covered by the GNU General Public License. */ + +#include "list.h" +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#include + +/* Return a cons cell produced from (head . tail) */ + +INLINE LinkedList* +list_cons(void* head, LinkedList* tail) +{ + LinkedList* cell; + + cell = (LinkedList*)malloc(sizeof(LinkedList)); + cell->head = head; + cell->tail = tail; + return cell; +} + +/* Return the length of a list, list_length(NULL) returns zero */ + +INLINE int +list_length(LinkedList* list) +{ + int i = 0; + while(list) + { + i += 1; + list = list->tail; + } + return i; +} + +/* Return the Nth element of LIST, where N count from zero. If N + larger than the list length, NULL is returned */ + +INLINE void* +list_nth(int index, LinkedList* list) +{ + while(index-- != 0) + { + if(list->tail) + list = list->tail; + else + return 0; + } + return list->head; +} + +/* Remove the element at the head by replacing it by its successor */ + +INLINE void +list_remove_head(LinkedList** list) +{ + if (!*list) return; + if ((*list)->tail) + { + LinkedList* tail = (*list)->tail; /* fetch next */ + *(*list) = *tail; /* copy next to list head */ + free(tail); /* free next */ + } + else /* only one element in list */ + { + free(*list); + (*list) = 0; + } +} + + +/* Remove the element with `car' set to ELEMENT */ +/* +INLINE void +list_remove_elem(LinkedList** list, void* elem) +{ + while (*list) + { + if ((*list)->head == elem) + list_remove_head(list); + *list = (*list ? (*list)->tail : NULL); + } +}*/ + +INLINE LinkedList * +list_remove_elem(LinkedList* list, void* elem) +{ + LinkedList *tmp; + + if (list) { + if (list->head == elem) { + tmp = list->tail; + free(list); + return tmp; + } + list->tail = list_remove_elem(list->tail, elem); + return list; + } + return NULL; +} + + +/* Return element that has ELEM as car */ + +INLINE LinkedList* +list_find(LinkedList* list, void* elem) +{ + while(list) + { + if (list->head == elem) + return list; + list = list->tail; + } + return NULL; +} + +/* Free list (backwards recursive) */ + +INLINE void +list_free(LinkedList* list) +{ + if(list) + { + list_free(list->tail); + free(list); + } +} + +/* Map FUNCTION over all elements in LIST */ + +INLINE void +list_mapcar(LinkedList* list, void(*function)(void*)) +{ + while(list) + { + (*function)(list->head); + list = list->tail; + } +} diff --git a/asmon/wmgeneral/list.h b/asmon/wmgeneral/list.h new file mode 100644 index 0000000..af0f22c --- /dev/null +++ b/asmon/wmgeneral/list.h @@ -0,0 +1,59 @@ +/* Generic single linked list to keep various information + Copyright (C) 1993, 1994 Free Software Foundation, Inc. + +Author: Kresten Krab Thorup + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you link this library with files compiled with + GCC to produce an executable, this does not cause the resulting executable + to be covered by the GNU General Public License. This exception does not + however invalidate any other reasons why the executable file might be + covered by the GNU General Public License. */ + +#ifndef __LIST_H_ +#define __LIST_H_ + +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +# define INLINE inline +#else +# define INLINE +#endif + +typedef struct LinkedList { + void *head; + struct LinkedList *tail; +} LinkedList; + +INLINE LinkedList* list_cons(void* head, LinkedList* tail); + +INLINE int list_length(LinkedList* list); + +INLINE void* list_nth(int index, LinkedList* list); + +INLINE void list_remove_head(LinkedList** list); + +INLINE LinkedList *list_remove_elem(LinkedList* list, void* elem); + +INLINE void list_mapcar(LinkedList* list, void(*function)(void*)); + +INLINE LinkedList*list_find(LinkedList* list, void* elem); + +INLINE void list_free(LinkedList* list); + +#endif diff --git a/asmon/wmgeneral/list.o b/asmon/wmgeneral/list.o new file mode 100644 index 0000000000000000000000000000000000000000..d60925044be6c2bb02c66f66543b7709362c2079 GIT binary patch literal 1484 zcma)6&ubG=5T0$fcB@;hL8PTcd#IXLyVg>{ABbZ6EMn0rUXU-Bg?erMsvV@&0 z(ot1rj4!25>Oh~a+SqC(w|T(Co|5x74@;$?APsq5eSkcV8r_hZi^7d3*yA(EBkLMm zPPCe*IENm>O_rwYz-5nlfd2#W=WPbT(VR~}GJLAny<_qg_If@mV zor@(~m?rXSkHg4c2S!zeTgIyfB`*pdMdWSxkx$-wtwvt45{5w;v2rB}Jam|?MSk%< zH~qhL6f%C3d$gS2;-{WRYU}toa7gW8L7UYeP-z_vN +#include +#include "list.h" +#include "misc.h" + +/* + *---------------------------------------------------------------------- + * parse_command-- + * Divides a command line into a argv/argc pair. + *---------------------------------------------------------------------- + */ +#define PRC_ALPHA 0 +#define PRC_BLANK 1 +#define PRC_ESCAPE 2 +#define PRC_DQUOTE 3 +#define PRC_EOS 4 +#define PRC_SQUOTE 5 + +typedef struct { + short nstate; + short output; +} DFA; + + +static DFA mtable[9][6] = { + {{3,1},{0,0},{4,0},{1,0},{8,0},{6,0}}, + {{1,1},{1,1},{2,0},{3,0},{5,0},{1,1}}, + {{1,1},{1,1},{1,1},{1,1},{5,0},{1,1}}, + {{3,1},{5,0},{4,0},{1,0},{5,0},{6,0}}, + {{3,1},{3,1},{3,1},{3,1},{5,0},{3,1}}, + {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */ + {{6,1},{6,1},{7,0},{6,1},{5,0},{3,0}}, + {{6,1},{6,1},{6,1},{6,1},{5,0},{6,1}}, + {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */ +}; + +char* +next_token(char *word, char **next) +{ + char *ptr; + char *ret, *t; + int state, ctype; + + t = ret = malloc(strlen(word)+1); + ptr = word; + + state = 0; + *t = 0; + while (1) { + if (*ptr==0) + ctype = PRC_EOS; + else if (*ptr=='\\') + ctype = PRC_ESCAPE; + else if (*ptr=='"') + ctype = PRC_DQUOTE; + else if (*ptr=='\'') + ctype = PRC_SQUOTE; + else if (*ptr==' ' || *ptr=='\t') + ctype = PRC_BLANK; + else + ctype = PRC_ALPHA; + + if (mtable[state][ctype].output) { + *t = *ptr; t++; + *t = 0; + } + state = mtable[state][ctype].nstate; + ptr++; + if (mtable[state][0].output<0) { + break; + } + } + + if (*ret==0) + t = NULL; + else + t = strdup(ret); + + free(ret); + + if (ctype==PRC_EOS) + *next = NULL; + else + *next = ptr; + + return t; +} + + +extern void +parse_command(char *command, char ***argv, int *argc) +{ + LinkedList *list = NULL; + char *token, *line; + int count, i; + + line = command; + do { + token = next_token(line, &line); + if (token) { + list = list_cons(token, list); + } + } while (token!=NULL && line!=NULL); + + count = list_length(list); + *argv = malloc(sizeof(char*)*count); + i = count; + while (list!=NULL) { + (*argv)[--i] = list->head; + list_remove_head(&list); + } + *argc = count; +} + +extern pid_t +execCommand(char *command) +{ + pid_t pid; + char **argv; + int argc; + + parse_command(command, &argv, &argc); + + if (argv==NULL) { + return 0; + } + + if ((pid=fork())==0) { + char **args; + int i; + + args = malloc(sizeof(char*)*(argc+1)); + if (!args) + exit(10); + for (i=0; i + +extern void parse_command(char *, char ***, int *); + +extern pid_t execCommand(char *); +#endif /* __MISC_H */ diff --git a/asmon/wmgeneral/misc.o b/asmon/wmgeneral/misc.o new file mode 100644 index 0000000000000000000000000000000000000000..8277983a729194cc451226c43ea11049f19a926a GIT binary patch literal 2148 zcmZ`)-)mcC7=BNZt!Y=+S`|bGrW#qNG)xKT)Qhq9b0|(w3%ZG9)U8n#dP1-;(xVP9|hbGS0orb|>ws_>cc$Ico0*S_kgd-e2E1xBk9k zw+y>sII(1F;MqH_>Nu*407tc&sz+~Eb${WzHTAuG)~Jp*Ri9h6ulm#*S3D|0>g|Af z)}x}NUJ0nv9(9aVGN2OHL?DfOMxLfUhV(#jGd=fG-??Kn3_iD}ZpOB`$Le;&dcq5v zMqxLmZPhh`3jZg9nZ9&X&sHr18U1uS2hpjUp9aZl$L`PK=s5TAcwI)dPqG!m#-Jrb z&ED$AswZ4E*`%Yi<8EdW6*&>qVgH<7y1I+L+nu?l@-lhNWMk`@j`Kk>c9^thZ}o(y z={k$an5%k+rmkliL)3Pox=W8?DScP>AVfGF)*zdC0pdI`s2p$-eJ$0DfJuocVioKu5Oe)IE2Ro`zm zPve!15}n8Wu?=s)CaQf`?cd(zMxmu|3ul*;7RPhklMU#Ga2`0Z98sS+`qn)2P}X@U zGY|RjL!LS>9>fRMaoG5b!9w)?eOcQyPkdM&xwx?KT4L_vyO}eIbn2zl%Za(naYr!2E(Nopl)WhJ#-sYohUDiq8jxMImNQ`lj? zVr6q14;Uwc?f&H z=)Dtx{34M4+V4rdQDE2VS?J8K7yVw)3Q*h5g=Cs9=mb=-wBMtU^`7ME_ZEd8$%c%~p z=}Ds7lWDP;5cQciG9R;rt_S~gAD%$6(W67NQ~xFY%W ziUp-u@uj?3{K#7K<+52QT{D-~%?&~E +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "wmgeneral.h" + + /*****************/ + /* X11 Variables */ +/*****************/ + +Window Root; +int screen; +int x_fd; +int d_depth; +XSizeHints mysizehints; +XWMHints mywmhints; +Pixel back_pix, fore_pix; +char *Geometry = ""; +Window iconwin, win; +GC NormalGC; +XpmIcon wmgen; +Pixmap pixmask; + + /*****************/ + /* Mouse Regions */ +/*****************/ + +typedef struct { + int enable; + int top; + int bottom; + int left; + int right; +} MOUSE_REGION; + +#define MAX_MOUSE_REGION (8) +MOUSE_REGION mouse_region[MAX_MOUSE_REGION]; + + /***********************/ + /* Function Prototypes */ +/***********************/ + +static void GetXPM(XpmIcon *, char **); +static Pixel GetColor(char *); +void RedrawWindow(void); +void AddMouseRegion(int, int, int, int, int); +int CheckMouseRegion(int, int); + +/*******************************************************************************\ +|* read_rc_file *| +\*******************************************************************************/ + +void parse_rcfile(const char *filename, rckeys *keys) { + + char *p; + char temp[128]; + char *tokens = " :\t\n"; + FILE *fp; + int i,key; + + fp = fopen(filename, "r"); + if (fp) { + while (fgets(temp, 128, fp)) { + key = 0; + while (key >= 0 && keys[key].label) { + if ((p = strstr(temp, keys[key].label))) { + p += strlen(keys[key].label); + p += strspn(p, tokens); + if ((i = strcspn(p, "#\n"))) p[i] = 0; + free(*keys[key].var); + *keys[key].var = strdup(p); + key = -1; + } else key++; + } + } + fclose(fp); + } +} + + +/*******************************************************************************\ +|* GetXPM *| +\*******************************************************************************/ + +static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) { + + XWindowAttributes attributes; + int err; + + /* For the colormap */ + XGetWindowAttributes(display, Root, &attributes); + + wmgen->attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions); + + err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap), + &(wmgen->mask), &(wmgen->attributes)); + + if (err != XpmSuccess) { + fprintf(stderr, "Not enough free colorcells.\n"); + exit(1); + } +} + +/*******************************************************************************\ +|* GetColor *| +\*******************************************************************************/ + +static Pixel GetColor(char *name) { + + XColor color; + XWindowAttributes attributes; + + XGetWindowAttributes(display, Root, &attributes); + + color.pixel = 0; + if (!XParseColor(display, attributes.colormap, name, &color)) { + fprintf(stderr, "wm.app: can't parse %s.\n", name); + } else if (!XAllocColor(display, attributes.colormap, &color)) { + fprintf(stderr, "wm.app: can't allocate %s.\n", name); + } + return color.pixel; +} + +/*******************************************************************************\ +|* flush_expose *| +\*******************************************************************************/ + +static int flush_expose(Window w) { + + XEvent dummy; + int i=0; + + while (XCheckTypedWindowEvent(display, w, Expose, &dummy)) + i++; + + return i; +} + +/*******************************************************************************\ +|* RedrawWindow *| +\*******************************************************************************/ + +void RedrawWindow(void) { + + flush_expose(iconwin); + XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, + 0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0); + flush_expose(win); + XCopyArea(display, wmgen.pixmap, win, NormalGC, + 0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0); +} + +/*******************************************************************************\ +|* RedrawWindowXY *| +\*******************************************************************************/ + +void RedrawWindowXY(int x, int y) { + + flush_expose(iconwin); + XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, + x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0); + flush_expose(win); + XCopyArea(display, wmgen.pixmap, win, NormalGC, + x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0); +} + +/*******************************************************************************\ +|* AddMouseRegion *| +\*******************************************************************************/ + +void AddMouseRegion(int index, int left, int top, int right, int bottom) { + + if (index < MAX_MOUSE_REGION) { + mouse_region[index].enable = 1; + mouse_region[index].top = top; + mouse_region[index].left = left; + mouse_region[index].bottom = bottom; + mouse_region[index].right = right; + } +} + +/*******************************************************************************\ +|* CheckMouseRegion *| +\*******************************************************************************/ + +int CheckMouseRegion(int x, int y) { + + int i; + int found; + + found = 0; + + for (i=0; i= mouse_region[i].left && + y <= mouse_region[i].bottom && + y >= mouse_region[i].top) + found = 1; + } + if (!found) return -1; + return (i-1); +} + +/*******************************************************************************\ +|* copyXPMArea *| +\*******************************************************************************/ + +void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) { + + XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy); + +} + +/*******************************************************************************\ +|* copyXBMArea *| +\*******************************************************************************/ + +void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) { + + XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy); +} + + +/*******************************************************************************\ +|* setMaskXY *| +\*******************************************************************************/ + +void setMaskXY(int x, int y) { + + XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet); + XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet); +} + +/*******************************************************************************\ +|* openXwindow *| +\*******************************************************************************/ +void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height) { + + unsigned int borderwidth = 1; + XClassHint classHint; + char *display_name = NULL; + char *wname = argv[0]; + XTextProperty name; + + XGCValues gcv; + unsigned long gcm; + + + int dummy=0; + int i; + + for (i=1; argv[i]; i++) { + if (!strcmp(argv[i], "-display")) + display_name = argv[i+1]; + } + + if (!(display = XOpenDisplay(display_name))) { + fprintf(stderr, "%s: can't open display %s\n", + wname, XDisplayName(display_name)); + exit(1); + } + screen = DefaultScreen(display); + Root = RootWindow(display, screen); + d_depth = DefaultDepth(display, screen); + x_fd = XConnectionNumber(display); + + /* Convert XPM to XImage */ + GetXPM(&wmgen, pixmap_bytes); + + /* Create a window to hold the stuff */ + mysizehints.flags = USSize | USPosition; + mysizehints.x = 0; + mysizehints.y = 0; + + back_pix = GetColor("white"); + fore_pix = GetColor("black"); + + XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, + &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); + + mysizehints.width = 64; + mysizehints.height = 64; + + win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y, + mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); + + iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y, + mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); + + /* Activate hints */ + XSetWMNormalHints(display, win, &mysizehints); + classHint.res_name = wname; + classHint.res_class = wname; + XSetClassHint(display, win, &classHint); + + XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask); + XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask); + + if (XStringListToTextProperty(&wname, 1, &name) == 0) { + fprintf(stderr, "%s: can't allocate window name\n", wname); + exit(1); + } + + XSetWMName(display, win, &name); + + /* Create GC for drawing */ + + gcm = GCForeground | GCBackground | GCGraphicsExposures; + gcv.foreground = fore_pix; + gcv.background = back_pix; + gcv.graphics_exposures = 0; + NormalGC = XCreateGC(display, Root, gcm, &gcv); + + /* ONLYSHAPE ON */ + + pixmask = XCreateBitmapFromData(display, win, pixmask_bits, pixmask_width, pixmask_height); + + XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet); + XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet); + + /* ONLYSHAPE OFF */ + + mywmhints.initial_state = WithdrawnState; + mywmhints.icon_window = iconwin; + mywmhints.icon_x = mysizehints.x; + mywmhints.icon_y = mysizehints.y; + mywmhints.window_group = win; + mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint; + + XSetWMHints(display, win, &mywmhints); + + XSetCommand(display, win, argv, argc); + XMapWindow(display, win); + +} diff --git a/asmon/wmgeneral/wmgeneral.h b/asmon/wmgeneral/wmgeneral.h new file mode 100644 index 0000000..55b37dd --- /dev/null +++ b/asmon/wmgeneral/wmgeneral.h @@ -0,0 +1,50 @@ +#ifndef WMGENERAL_H_INCLUDED +#define WMGENERAL_H_INCLUDED + + /***********/ + /* Defines */ +/***********/ + +#define MAX_MOUSE_REGION (8) + + /************/ + /* Typedefs */ +/************/ + +typedef struct _rckeys rckeys; + +struct _rckeys { + const char *label; + char **var; +}; + +typedef struct { + Pixmap pixmap; + Pixmap mask; + XpmAttributes attributes; +} XpmIcon; + + /*******************/ + /* Global variable */ +/*******************/ + +Display *display; + + /***********************/ + /* Function Prototypes */ +/***********************/ + +void AddMouseRegion(int index, int left, int top, int right, int bottom); +int CheckMouseRegion(int x, int y); + +void openXwindow(int argc, char *argv[], char **, char *, int, int); +void RedrawWindow(void); +void RedrawWindowXY(int x, int y); + +void copyXPMArea(int, int, int, int, int, int); +void copyXBMArea(int, int, int, int, int, int); +void setMaskXY(int, int); + +void parse_rcfile(const char *, rckeys *); + +#endif diff --git a/asmon/wmgeneral/wmgeneral.o b/asmon/wmgeneral/wmgeneral.o new file mode 100644 index 0000000000000000000000000000000000000000..821defa6adaa7684e88b0ec5feb486c05bcff26d GIT binary patch literal 8032 zcmcIpdvH|M89%!T5NMR3p~g0p9ZfV?NsFMol@KmqC71ysTSek#_a@o0FL!T*v@isg ztzNHDrnMu|c5I}r{iEYJrCJ|N4MmBa>o!|F;=lj0%K3R5ZYgYPvKH)q*Q6k2e5S>$P%{&QpqFhWCE#?Os*Y7F}KxAoU zW^Tji=%}TYo4IBb^u9{SO>Jn-Kt30NfZp;eYDy>4T-utYHG?D2n7K}Tv;F*vse87= z@?--(`CN(;JSQtaElCd@FDa1$EMdZ1Z_c2HqNh8gCw}4S4H=3~T(zD7MaVVyK26^v zRzJ&U9yee7*Q?na8tu15$69CtmzO4>jHjzwSA0WZm20W%k2Th zY_OJtxoxvdc~{{c2tOs~yfy?QVYR&J zG;0XCAf+;I>v98KGnF%2$xP}{*Q~U2KDE^2WnAZ=`i%3cH@K=>+R#hvX*+Fa9gSce zY5SPssnV>r&u6>n)qcb**(c>t+1Zvli6GRQmbTAo8PVrXcMYg?zY!x@xZ3VkjJ$=J z(#L+ardRPR$JRYi)>4Ss>op1kL`1K~@Kr(10Mu7VIffJCSY{d+%O!Td6l2Z&{9|R0 zTz%VSd&YVi`Y0y+XK1KBM=R}~mb3N~o4Mfgj^t`&c1PKyojb9@%vTQ`_xt$C_i!M% z9>&DIl{pG6t-{=0`th1_bGMvIMOVc-RpxHF>7B2sGytzc;d*ZQzpDy^o9^Vfkrm$lQDR*fZ4 zV`)`@09HaZHnJ+uB-wAx#;C) zZ0BBKPjI=jNR4ZI|BTh0-rZFwz;j+Z;gc}PFbIxQQ9GX3-XYCvr>Q*EhHk@*E|J>Y zY7AIDw*ueWX_H%q(qxoItS70m`l+&dDL(u2sSh2V`n>`3wYo#*i&K9$fGu%a(OGtY zXRtPyMVO+{!o=))z|sbtaXJ9k_8361z@@NS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