Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:11.4
xosview
xosview-1.8.3.dif
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xosview-1.8.3.dif of Package xosview
Index: .pkgextract =================================================================== --- /dev/null +++ .pkgextract @@ -0,0 +1,10 @@ +patch -p0 -s --suffix=".serial" < ../xosview-1.8.2-serial.patch +patch -p0 -s --suffix=".procsys" < ../xosview-1.8.1-procsys.patch +patch -p0 -s --suffix=".maxlimit" < ../xosview-1.8.2-maxlimit.patch +patch -p0 -s --suffix=".irda" < ../xosview-1.8.0-irda.patch +patch -p0 -s --suffix=".double" < ../xosview-1.8.3-double.patch +patch -p0 -s --suffix=".ulong" < ../xosview-1.8.3-longint.patch +patch -p0 -s --suffix=".float" < ../xosview-1.8.2-float-conv.patch +patch -p0 -s --suffix=".conf" < ../xosview-1.8.2-configure.patch +patch -p0 -s --suffix=".appdef" < ../xosview-1.8.3-appdef.dif +#patch -p0 -s --suffix=".diskstat" < ../xosview-1.8.3-diskstat.dif Index: README.linux =================================================================== --- README.linux.orig +++ README.linux @@ -26,7 +26,7 @@ To install xosview: to /usr/bin/X11/xosview and will be suid root. If you do not want to run xosview suid root (this will just disable the serial meters) you can change the permissions to whatever you like. The X defaults for - xosview (Xdefaults) are copied to /usr/lib/X11/app-defaults/XOsview. + xosview (Xdefaults) are copied to /usr/share/X11/app-defaults/XOsview. To run xosview : Index: README.security =================================================================== --- /dev/null +++ README.security @@ -0,0 +1,35 @@ + +Xosview, serial meters, and suid bit +==================================== + + The program xosview is able to display the serial interfaces of your + system. Unfortunately this requires root permissions. Therefore this + feature is *disabled* by default in + + /usr/share/X11/app-defaults/XOsview + + and the program /usr/X11R6/bin/xosview does *not* run suid root due to + lack of security of xosview. It *is* exploitable at some parts of its code. + + If you want to use the serial meters you have to change `xosview*serial<X>' + in /usr/share/X11/app-defaults/XOsview *and* add a line + + /usr/X11R6/bin/xosview.bin root.root 4755 + + to /etc/permissions.local. If you are using PERMISSION_SECURITY="easy local" + in /etc/rc.config and you don't want xosview to be suid root you should add + the line + + /usr/X11R6/bin/xosview.bin root.root 0755 + + to /etc/permissions.local. In both cases, after the next run of SuSEconfig + the permissions are set according to your choice. + + In normal cases the serial meters are not very useful. Therefore + the secure defaults should be used. + + + Have a lot of fun... + + Your SuSE Team + Index: Xdefaults.in =================================================================== --- Xdefaults.in.orig +++ Xdefaults.in @@ -16,130 +16,131 @@ ! General Resources -!xosview*title: -!xosview*geometry: +5+5 -!xosview*display: -xosview*captions: True -xosview*labels: True -xosview*transparent: False -xosview*meterLabelColor: wheat -xosview*usedlabels: True -xosview*usedLabelColor: wheat -xosview*borderwidth: 0 -xosview*font: 7x13bold -xosview*background: navy -xosview*foreground: wheat -xosview*enableStipple: False ! Change to true to try beta stipple support. -xosview*samplesPerSec: 10 ! not yet supported -xosview*graphNumCols: 128 ! number of samples shown in a graph +!*title: +!*geometry: +5+5 +!*geometry: 184x158 +!*display: +*captions: True +*labels: True +*transparent: False +*meterLabelColor: black +*usedlabels: True +*usedLabelColor: black +*borderwidth: 1 +*font: 6x10 +*background: grey77 +*foreground: black +*enableStipple: False ! Change to true to try beta stipple support. +*samplesPerSec: 10 ! not yet supported +*graphNumCols: 128 ! number of samples shown in a graph ! Load Meter Resources ! We don't need to enable the Decay option, as it is already time-averaged. -xosview*load: True -xosview*loadCritColor: red -xosview*loadWarnColor: orange -xosview*loadProcColor: seagreen -xosview*loadIdleColor: aquamarine -xosview*loadPriority: 20 -xosview*loadCritThreshold: 5 -xosview*loadWarnThreshold: 2 -xosview*loadDecay: False -xosview*loadGraph: False -xosview*loadUsedFormat: float -xosview*loadCpuSpeed: True +*load: True +*loadCritColor: red +*loadWarnColor: orange +*loadProcColor: blue +*loadIdleColor: green2 +*loadPriority: 20 +*loadCritThreshold: 5 +*loadWarnThreshold: 2 +*loadDecay: False +*loadGraph: False +*loadUsedFormat: float +*loadCpuSpeed: True ! Gfx Meter Resources ( Irix ) -xosview*gfx: True -xosview*gfxCritColor: red -xosview*gfxWarnColor: orange -xosview*gfxSwapColor: seagreen -xosview*gfxIdleColor: aquamarine -xosview*gfxPriority: 1 ! dont change, until you know what you do -xosview*gfxCritThreshold: 120 ! swapbuffers/s per pipe -xosview*gfxWarnThreshold: 60 ! swapbuffers/s per pipe -xosview*gfxDecay: False -xosview*gfxGraph: False -xosview*gfxUsedFormat: autoscale +*gfx: True +*gfxCritColor: red +*gfxWarnColor: orange +*gfxSwapColor: seagreen +*gfxIdleColor: aquamarine +*gfxPriority: 1 ! dont change, until you know what you do +*gfxCritThreshold: 120 ! swapbuffers/s per pipe +*gfxWarnThreshold: 60 ! swapbuffers/s per pipe +*gfxDecay: False +*gfxGraph: False +*gfxUsedFormat: autoscale ! CPU Meter Resources -xosview*cpu: True -xosview*cpuUserColor: seagreen -xosview*cpuNiceColor: yellow -xosview*cpuSystemColor: orange -xosview*cpuInterruptColor: red -xosview*cpuSoftIntColor: red -xosview*cpuWaitColor: lightblue -xosview*cpuFreeColor: aquamarine -xosview*cpuPriority: 1 -xosview*cpuDecay: True -xosview*cpuGraph: True -xosview*cpuUsedFormat: percent -xosview*cpuFormat: auto ! single, all, auto or both +*cpu: True +*cpuUserColor: blue +*cpuNiceColor: yellow +*cpuSystemColor: red +*cpuInterruptColor: SkyBlue +*cpuSoftIntColor: DarkOrange +*cpuWaitColor: white +*cpuFreeColor: green2 +*cpuPriority: 1 +*cpuDecay: True +*cpuGraph: False +*cpuUsedFormat: percent +*cpuFormat: auto ! single, all, auto or both ! Memory Meter Resources ! Not all of these are used by a specific platform. -xosview*mem: True -xosview*memKernelColor: yellow -xosview*memUsedColor: seagreen -xosview*memSharedColor: SkyBlue -xosview*memBufferColor: orange -xosview*memCacheColor: red -xosview*memFreeColor: aquamarine -xosview*memTextColor: blue -xosview*memOtherColor: orange -xosview*memActiveColor: blue -xosview*memInactiveColor: lightblue -xosview*memPriority: 10 -xosview*memDecay: False -xosview*memGraph: False -xosview*memUsedFormat: autoscale +*mem: True +*memKernelColor: SkyBlue +*memUsedColor: blue +*memSharedColor: yellow +*memBufferColor: DarkOrange +*memCacheColor: red +*memFreeColor: green2 +!*memTextColor: blue +!*memOtherColor: orange +!*memActiveColor: blue +!*memInactiveColor: lightblue +*memPriority: 10 +*memDecay: False +*memGraph: False +*memUsedFormat: autoscale ! Swap Meter Resources -xosview*swap: True -xosview*swapUsedColor: seagreen -xosview*swapFreeColor: aquamarine -xosview*swapReservedColor: yellow -xosview*swapPriority: 10 -xosview*swapDecay: False -xosview*swapGraph: False -xosview*swapUsedFormat: autoscale +*swap: True +*swapUsedColor: blue +*swapFreeColor: green2 +*swapReservedColor: yellow +*swapPriority: 10 +*swapDecay: False +*swapGraph: False +*swapUsedFormat: autoscale ! Page Meter Resources -xosview*page: True -xosview*pageBandwidth: 120 -xosview*pageInColor: SkyBlue -xosview*pageOutColor: SlateBlue1 -xosview*pageIdleColor: aquamarine -xosview*pagePriority: 5 -xosview*pageDecay: False -xosview*pageGraph: False -xosview*pageUsedFormat: autoscale +*page: True +*pageBandwidth: 120 +*pageInColor: blue +*pageOutColor: red +*pageIdleColor: green2 +*pagePriority: 5 +*pageDecay: False +*pageGraph: False +*pageUsedFormat: autoscale ! Network Meter Resources -xosview*net: @NetMeter_Default_Setting@ -xosview*netBandwidth: 7500 ! for 64kbps ISDN -!xosview*netBandwidth: 5000 ! for up to 57.6kbps modems -!xosview*netBandwidth: 2000 ! for 28.8kbps modems (no compression) +*net: @NetMeter_Default_Setting@ +!*netBandwidth: 7500 ! for 64kbps ISDN +!*netBandwidth: 5000 ! for up to 57.6kbps modems +!*netBandwidth: 2000 ! for 28.8kbps modems (no compression) ! ! or 14.4kbps modems (with compression) -!xosview*netBandwidth: 1000000 ! for 10Mbit/s Ethernet (could be 1250000) -!xosview*netBandwidth: 10000000 ! for 100Mbit/s Ethernet (could be 12500000) -xosview*netInColor: SkyBlue -xosview*netOutColor: SlateBlue1 -xosview*netBackground: aquamarine -xosview*netPriority: 2 -xosview*netDecay: True -xosview*netGraph: True -xosview*netUsedFormat: autoscale -xosview*netIface: False +*netBandwidth: 1000000 ! for 10Mbit/s Ethernet (could be 1250000) +!*netBandwidth: 10000000 ! for 100Mbit/s Ethernet (could be 12500000) +*netInColor: blue +*netOutColor: red +*netBackground: green2 +*netPriority: 2 +*netDecay: True +*netGraph: False +*netUsedFormat: autoscale +*netIface: False ! Linux-only resources: @@ -149,116 +150,116 @@ xosview*netIface: False ! (autodetection may fail sometimes, if the port is ! locked by ppp/slip for example) -!xosview*serial0: 0x3f8 -!xosview*serial1: 0x2f8 -!xosview*serial2: 0x3e8 -!xosview*serial3: 0x2e8 -xosview*serial0: False -xosview*serial1: False -xosview*serial2: False -xosview*serial3: False -xosview*serial4: False -xosview*serial5: False -xosview*serial6: False -xosview*serial7: False -xosview*serial8: False -xosview*serial9: False -xosview*serialOnColor: red -xosview*serialOffColor: aquamarine -xosview*serialPriority: 1 +!*serial0: 0x3f8 +!*serial1: 0x2f8 +!*serial2: 0x3e8 +!*serial3: 0x2e8 +*serial0: False +*serial1: False +*serial2: False +*serial3: False +*serial4: False +*serial5: False +*serial6: False +*serial7: False +*serial8: False +*serial9: False +*serialOnColor: red +*serialOffColor: blue +*serialPriority: 1 ! Interrupt Meter Resources -xosview*interrupts: True -xosview*intOnColor: red -xosview*intOffColor: aquamarine -xosview*intPriority: 1 +*interrupts: True +*intOnColor: red +*intOffColor: blue +*intPriority: 1 ! Interrupt Rate Meter Resources -xosview*irqrate: True -xosview*irqrateUsedColor: red -xosview*irqrateIdleColor: black -xosview*irqratePriority: 1 -xosview*irqrateUsedFormat: autoscale -xosview*irqrateDecay: True -xosview*irqrateGraph: False +*irqrate: True +*irqrateUsedColor: red +*irqrateIdleColor: black +*irqratePriority: 1 +*irqrateUsedFormat: autoscale +*irqrateDecay: True +*irqrateGraph: False ! Battery Meter Resources -xosview*battery: False -xosview*batteryLeftColor: orange -xosview*batteryUsedColor: aquamarine -xosview*batteryPriority: 50 -xosview*batteryUsedFormat: percent -xosview*batteryChargeColor: green -xosview*batteryFullColor: magenta -xosview*batteryLowColor: red -xosview*batteryCritColor: red -xosview*batteryNoneColor: grey +*battery: False +*batteryLeftColor: blue +*batteryUsedColor: red +*batteryPriority: 50 +*batteryUsedFormat: percent +*batteryChargeColor: green2 +*batteryFullColor: magenta +*batteryLowColor: red +*batteryCritColor: red +*batteryNoneColor: grey ! Disk Meter Resources -xosview*disk: True -xosview*diskUsedColor: seagreen -xosview*diskIdleColor: aquamarine -xosview*diskWriteColor: SlateBlue1 -xosview*diskReadColor: SkyBlue -xosview*diskBandwidth: 10000000 ! 10MB/s should be reasonable today for +*disk: True +*diskUsedColor: red +*diskIdleColor: green2 +*diskWriteColor: red +*diskReadColor: blue +*diskBandwidth: 10000000 ! 10MB/s should be reasonable today for ! both IDE and SCSI -xosview*diskPriority: 10 -xosview*diskDecay: True -xosview*diskUsedFormat: autoscale -xosview*diskGraph: True - - -xosview*RAID: False -xosview*RAIDdevicecount: 1 -xosview*RAIDdiskOnlineColor: green -xosview*RAIDdiskFailureColor: red -xosview*RAIDresyncdoneColor: yellow -xosview*RAIDresynctodoColor: red -xosview*RAIDresynccompleteColor: green -xosview*RAIDPriority: 20 -xosview*RAIDUsedFormat: percent - -xosview*horizontalMargin: 5 -xosview*verticalMargin: 5 -xosview*verticalSpacing: 5 +*diskPriority: 10 +*diskDecay: True +*diskUsedFormat: autoscale +*diskGraph: True + + +*RAID: False +*RAIDdevicecount: 1 +*RAIDdiskOnlineColor: green2 +*RAIDdiskFailureColor: red +*RAIDresyncdoneColor: yellow +*RAIDresynctodoColor: red +*RAIDresynccompleteColor: green2 +*RAIDPriority: 20 +*RAIDUsedFormat: percent + +*horizontalMargin: 5 +*verticalMargin: 5 +*verticalSpacing: 5 ! Lms Temp -xosview*lmstemp: False -xosview*lmstempActColor: blue -xosview*lmstempHighColor: red -xosview*lmstempIdleColor: aquamarine -! xosview*lmstempHighest: 100 +*lmstemp: False +*lmstempActColor: blue +*lmstempHighColor: red +*lmstempIdleColor: green2 +! *lmstempHighest: 100 ! default 100 -xosview*lmstemp1: temp -xosview*lmstemp2: remote_temp +*lmstemp1: temp +*lmstemp2: remote_temp ! for more sensors just add entries here ! note, there is currently no way to configure sensors with same ! name in different subdirs ! xosview*lmstempLabel1: TMP ! labels for avove sensors (default = TMP) -xosview*lmstempLabel2: RTMP -xosview*lmstempPriority: 20 -xosview*lmstempUsedFormat: autoscale - -xosview*NFSDStats: False -xosview*NFSDStatCallsColor: green -xosview*NFSDStatBadCallsColor: red -xosview*NFSDStatUDPColor: yellow -xosview*NFSDStatTCPColor: orange -xosview*NFSDStatIdleColor: aquamarine -xosview*NFSDStatDecay: True -xosview*NFSDStatGraph: False -xosview*NFSDStatUsedFormat: percent - -xosview*NFSStats: False -xosview*NFSStatReTransColor: red -xosview*NFSStatAuthRefrshColor: yellow -xosview*NFSStatCallsColor: SkyBlue -xosview*NFSStatIdleColor: aquamarine -xosview*NFSStatDecay: True -xosview*NFSStatGraph: False -xosview*NFSStatUsedFormat: percent +*lmstempLabel2: RTMP +*lmstempPriority: 20 +*lmstempUsedFormat: autoscale + +*NFSDStats: False +*NFSDStatCallsColor: green2 +*NFSDStatBadCallsColor: red +*NFSDStatUDPColor: yellow +*NFSDStatTCPColor: orange +*NFSDStatIdleColor: blue +*NFSDStatDecay: True +*NFSDStatGraph: False +*NFSDStatUsedFormat: percent + +*NFSStats: False +*NFSStatReTransColor: blue +*NFSStatAuthRefrshColor: seagreen +*NFSStatCallsColor: green2 +*NFSStatIdleColor: blue +*NFSStatDecay: True +*NFSStatGraph: False +*NFSStatUsedFormat: percent Index: Xrm.h =================================================================== --- Xrm.h.orig +++ Xrm.h @@ -34,7 +34,7 @@ public: private: XrmDatabase _db; XrmClass _class, _instance; - char* _display_name; // Used solely for getting the display's resources. + const char* _display_name; // Used solely for getting the display's resources. //void getArgs(int argc, char **argv); static Bool enumCB(XrmDatabase *, XrmBindingList bindings, Index: bitmeter.cc =================================================================== --- bitmeter.cc.orig +++ bitmeter.cc @@ -94,9 +94,9 @@ void BitMeter::draw( void ){ int offset; if ( dousedlegends_ ) - offset = parent_->textWidth( "XXXXXXXXX" ); + offset = parent_->textWidth( "XXXXXXXXXXX" ); else - offset = parent_->textWidth( "XXXXX" ); + offset = parent_->textWidth( "XXXXXM" ); parent_->drawString( x_ - offset + 1, y_ + height_, title_ ); parent_->setForeground( onColor_ ); Index: defresources.awk =================================================================== --- defresources.awk.orig +++ defresources.awk @@ -28,7 +28,7 @@ BEGIN { # general.h file. Let's let this .cc file do that, since it doesn't # have an associated header file. print "CVSID_DOT_H(GENERAL_H_CVSID);\n"; - printf "char *defaultXResourceString = \""; + printf "const char *defaultXResourceString = \""; } # Index: fieldmeter.cc =================================================================== --- fieldmeter.cc.orig +++ fieldmeter.cc @@ -196,9 +196,9 @@ FieldMeter<F>::draw( void ){ int offset; if ( dousedlegends_ ) - offset = parent_->textWidth( "XXXXXXXXX" ); + offset = parent_->textWidth( "XXXXXXXXXXX" ); else - offset = parent_->textWidth( "XXXXX" ); + offset = parent_->textWidth( "XXXXXM" ); parent_->drawString( x_ - offset + 1, y_ + height_, title_ ); if(docaptions_) @@ -244,7 +244,7 @@ FieldMeter<F>::drawused( int manditory ) parent_->setStippleN(0); /* Use all-bits stipple. */ static const int onechar = parent_->textWidth( "X" ); - static int xoffset = parent_->textWidth( "XXXXX" ); + static int xoffset = parent_->textWidth( "XXXXXM" ); char buf[10]; @@ -275,7 +275,7 @@ FieldMeter<F>::drawused( int manditory ) {scale='M'; scaled_used = used_/1024/1024;} else if (used_ >= 999.5) {scale='K'; scaled_used = used_/1024;} - else {scale=' '; scaled_used = used_;} + else {scale='\0'; scaled_used = used_;} /* For now, we can only print 3 characters, plus the optional * suffix, without overprinting the legends. Thus, we can * print 965, or we can print 34, but we can't print 34.7 (the Index: general.h =================================================================== --- general.h.orig +++ general.h @@ -66,13 +66,13 @@ enum bool { FALSE = 0, false = 0, TRUE = * identifier for the char*'s, hence the definition of * CVSID_DOT_H2 etc., which are occasionally needed. */ #define CVSID(s) \ - static char* cvsid __attribute__ ((unused)) = (s) + static const char cvsid[] __attribute__ ((unused)) = (s) #define CVSID_DOT_H(s) \ - static char* cvsid_dot_h __attribute__ ((unused)) = (s) + static const char cvsid_dot_h[] __attribute__ ((unused)) = (s) #define CVSID_DOT_H2(s) \ - static char* cvsid_dot_h2 __attribute__ ((unused)) = (s) + static const char cvsid_dot_h2[] __attribute__ ((unused)) = (s) #define CVSID_DOT_H3(s) \ - static char* cvsid_dot_h3 __attribute__ ((unused)) = (s) + static const char cvsid_dot_h3[] __attribute__ ((unused)) = (s) #else /* Don't put the CVS Id strings in the .o files -- the compiler will probably print tons of warning about Index: llist.cc =================================================================== --- llist.cc.orig +++ llist.cc @@ -242,24 +242,32 @@ void *LList::findc( int which ){ } void LList::save( int size, FILE *fp ){ + size_t r; int i; void *buf; - fwrite( &n_, sizeof( int ), 1, fp ); /* save n */ + r = fwrite( &n_, sizeof( int ), 1, fp ); /* save n */ + if (r != sizeof ( int )) + return ; setc( 1 ); for ( i = 1 ; i <= n_ ; i ++ ) { buf = findc(); - fwrite ( buf, size, 1, fp ); + r = fwrite ( buf, size, 1, fp ); + if (r != size) + break; incc(); } } int LList::restore( int size, FILE *fp ){ - int i; + size_t r; + int i = 0; void *buf; - fread ( &i, sizeof ( int ), 1, fp ); + r = fread ( &i, sizeof ( int ), 1, fp ); + if (r != sizeof ( int )) + return ( 1 ); for ( ; i > 0 ; i-- ) { if ( ( buf = new char[size] ) == NULL ) return ( 0 ); Index: main.cc =================================================================== --- main.cc.orig +++ main.cc @@ -14,7 +14,7 @@ CVSID("$Id$"); int main( int argc, char *argv[] ) { /* Icky. Need to check for -name option here. */ char** argp = argv; - char* instanceName = "xosview"; // Default value. + const char* instanceName = "xosview"; // Default value. while (argp && *argp) { if (!strncmp(*argp, "-name", 6)) Index: xosview.1 =================================================================== --- xosview.1.orig +++ xosview.1 @@ -345,7 +345,7 @@ and \'purple\'): The following is a list of X resources supported by \fIxosview\fP. Each has a default value assigned to it. These values can be found in the file Xdefaults which can be obtained in the source distribution of xosview. -They can be overridden in the usual places (/usr/lib/X11/app-defaults/XOsview, +They can be overridden in the usual places (/usr/share/X11/app-defaults/XOsview, $HOME/.Xdefaults, etc.). It should be noted that it is OK to have a resource defined for a port of Index: xosview.cc =================================================================== --- xosview.cc.orig +++ xosview.cc @@ -9,6 +9,7 @@ #include <unistd.h> #include <stdlib.h> #include <sys/time.h> +#include <errno.h> #include "snprintf.h" #include "general.h" #include "xosview.h" @@ -64,7 +65,7 @@ CVSID("$Id$"); CVSID_DOT_H(XOSVIEW_H_CVSID); -XOSView::XOSView( char * instName, int argc, char *argv[] ) : XWin(), +XOSView::XOSView( const char * instName, int argc, char *argv[] ) : XWin(), xrm(Xrm("xosview", instName)){ // Check for version arguments first. This allows // them to work without the need for a connection @@ -106,7 +107,10 @@ XOSView::XOSView( char * instName, int a yoff_ = 0; nummeters_ = 0; meters_ = NULL; - name_ = "xosview"; + if ((name_ = strdup("xosview")) == NULL) { + std::cerr <<"Can not alloc memory : " <<strerror( errno ) << std::endl; + exit (-1); + } _isvisible = false; _ispartiallyvisible = false; exposed_once_flag_ = 0; @@ -168,9 +172,9 @@ void XOSView::checkVersion(int argc, cha void XOSView::figureSize ( void ) { if ( legend_ ){ if ( !usedlabels_ ) - xoff_ = textWidth( "XXXXX" ); + xoff_ = textWidth( "XXXXXM" ); else - xoff_ = textWidth( "XXXXXXXXX" ); + xoff_ = textWidth( "XXXXXXXXXXX" ); yoff_ = caption_ ? textHeight() + textHeight() / 4 : 0; } Index: xosview.h =================================================================== --- xosview.h.orig +++ xosview.h @@ -23,7 +23,7 @@ class Meter; class XOSView : public XWin { public: - XOSView( char* instName, int argc, char *argv[] ); + XOSView( const char* instName, int argc, char *argv[] ); ~XOSView( void ); void figureSize ( void ); Index: xwin.cc =================================================================== --- xwin.cc.orig +++ xwin.cc @@ -5,6 +5,7 @@ #include <X11/Xatom.h> #include <stdlib.h> #include <unistd.h> +#include <errno.h> #include "snprintf.h" #include "general.h" #include "xwin.h" @@ -47,10 +48,13 @@ void XWin::XWinInit (int argc, char** ar width_ = height_ = x_ = y_ = 0; xrmptr_ = xrm; - name_ = ""; + if ((name_ = strdup("")) == NULL) { + std::cerr <<"Can not alloc memory : " <<strerror( errno ) << std::endl; + exit (-1); + } font_ = NULL; done_ = 0; - + // Set up the default Events events_ = NULL; addEvent( new Event( this, ConfigureNotify, &XWin::configureEvent ) ); Index: config/Makefile.linux.memstat.in =================================================================== --- config/Makefile.linux.memstat.in.orig +++ config/Makefile.linux.memstat.in @@ -4,11 +4,43 @@ # # $Id$ # -CC = gcc +KERNEL_DIR=/usr/src/linux +ARCH=$(shell uname -m) +LVERSION=$(shell expr `uname -r` : '\([0-9]*\.[0-9]*\)') +include $(KERNEL_DIR)/.config + +ifeq ($(CONFIG_MODVERSION),y) +USE_MOD_VERSIONS=-DMODVERSIONS +endif + +ifeq ($(CONFIG_SMP),y) +LINUX_SMP=-D__SMP__ +endif + + # For some reason (which I am not sure of now), /usr/src/linux/include # needs to be added to the search patch or things break. +ifeq "$(ARCH)" "alpha" +CC = gcc +CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -I/usr/src/linux/include \ + -O2 -fomit-frame-pointer -pipe -DMODULE -ffixed-8 -DEXPORT_SYMTAB \ + $(USE_MOD_VERSIONS) $(LINUX_SMP) +else +ifeq "$(ARCH)" "sparc64" +CC = sparc64-linux-gcc CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -I/usr/src/linux/include \ - -O2 -fomit-frame-pointer -pipe -DMODULE @USE_MOD_VERSIONS@ @LINUX_SMP@ + -O2 -fomit-frame-pointer -fno-strict-aliasing -m64 -pipe -mno-fpu \ + -mcpu=ultrasparc -mcmodel=medlow -ffixed-g4 -fcall-used-g5 \ + -fcall-used-g7 -Wno-sign-compare -DMODULE \ + $(USE_MOD_VERSIONS) $(LINUX_SMP) +else +CC = gcc +CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -I/usr/src/linux/include \ + -O2 -fomit-frame-pointer -pipe -DMODULE \ + $(USE_MOD_VERSIONS) $(LINUX_SMP) +endif +endif + FEXT = c @@ -20,18 +52,27 @@ CFILES := $(OBJS:.o=.$(FEXT)) #----------------------------------------------------------------------- +ifeq "$(LVERSION)" "2.4" +all: +install: +else all: memstat.o #Memstat.o: memstat.o # ld -m elf_i386 -r -o Memstat.o memstat.o +install: memstat.o + mkdir -p /lib/modules/$(shell uname -r)/misc + install -m 0644 memstat.o /lib/modules/$(shell uname -r)/misc/ +endif + clean : rm -f $(DEPFILES) $(EXE) $(OBJS) *~ TAGS Memstat.o tags TAGS : etags $(CFILES) *.h -%.o : %-@LVERSION@.$(FEXT) +%.o : %-$(LVERSION).c $(CC) $(CFLAGS) -c $< -o $@ %.o : %.$(FEXT) @@ -42,4 +83,5 @@ tags TAGS : @$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \ | sed '\''s/$*.o/$*.o $@/'\'' > $@' -@AUTODEPEND@ +-include $(DEPFILES) + Index: linux/MeterMaker.cc =================================================================== --- linux/MeterMaker.cc.orig +++ linux/MeterMaker.cc @@ -82,6 +82,7 @@ void MeterMaker::makeMeters(void){ push(new SerialMeter(_xos, (SerialMeter::Device)i)); #endif +#if !defined(__s390__) && !defined(__s390x__) // check for the interrupt meter if (_xos->isResourceTrue("interrupts")) { int cpuCount = IntMeter::countCPUs(); @@ -89,6 +90,7 @@ void MeterMaker::makeMeters(void){ for (int i = 0 ; i < cpuCount ; i++) push(new IntMeter(_xos, i)); } +#endif // check for the battery meter if (_xos->isResourceTrue("battery")) Index: linux/cpumeter.cc =================================================================== --- linux/cpumeter.cc.orig +++ linux/cpumeter.cc @@ -80,6 +80,7 @@ void CPUMeter::getcputime( void ){ int oldindex = (cpuindex_+1)%2; for ( int i = 0 ; i < 7 ; i++ ){ fields_[i] = cputime_[cpuindex_][i] - cputime_[oldindex][i]; + if (fields_[i] < 0 ) fields_[i] = 0; // Bug workaround total_ += fields_[i]; } Index: linux/diskmeter.cc =================================================================== --- linux/diskmeter.cc.orig +++ linux/diskmeter.cc @@ -165,7 +165,7 @@ void DiskMeter::getvmdiskinfo(void) // read second value stats >> two; - updateinfo(one, two, 4); + updateinfo(one, two, 2); // The factor is 2 and NOT 4 } void DiskMeter::getdiskinfo( void ) Index: linux/diskmeter.h =================================================================== --- linux/diskmeter.h.orig +++ linux/diskmeter.h @@ -40,7 +40,7 @@ class DiskMeter : public FieldMeterGraph unsigned long int write_prev_; float maxspeed_; bool _vmstat; - char *_statFileName; + const char *_statFileName; }; #endif Index: linux/netmeter.cc =================================================================== --- linux/netmeter.cc.orig +++ linux/netmeter.cc @@ -30,6 +30,7 @@ #include "xosview.h" #include <unistd.h> +//#include <iomanip.h> #include <fstream> #include <string.h> #include <stdlib.h> Index: linux/netmeter.h =================================================================== --- linux/netmeter.h.orig +++ linux/netmeter.h @@ -31,7 +31,7 @@ private: int _ipsock; Timer _timer; unsigned long long _lastBytesIn, _lastBytesOut; - char *_netfilename; + const char *_netfilename; bool _usechains; int _bytesInDev; Index: linux/nfsmeter.cc =================================================================== --- linux/nfsmeter.cc.orig +++ linux/nfsmeter.cc @@ -36,7 +36,7 @@ #define NFSCLTSTAT "/proc/net/rpc/nfs" NFSMeter::NFSMeter(XOSView *parent, const char *name, int nfields, - char *fields, const char *statfile) + const char *fields, const char *statfile) : FieldMeterGraph<float>( parent, nfields, name, fields ){ _statfile = statfile; _statname = name; Index: linux/nfsmeter.h =================================================================== --- linux/nfsmeter.h.orig +++ linux/nfsmeter.h @@ -19,7 +19,7 @@ public: XOSView *parent, const char *name, int nfields, - char *files, + const char *files, const char *statfile); ~NFSMeter( void ); Index: linux/pagemeter.h =================================================================== --- linux/pagemeter.h.orig +++ linux/pagemeter.h @@ -25,7 +25,7 @@ protected: int pageindex_; float maxspeed_; bool _vmstat; - char *_statFileName; + const char *_statFileName; void getpageinfo( void ); void getvmpageinfo( void ); Index: linux/raidmeter.cc =================================================================== --- linux/raidmeter.cc.orig +++ linux/raidmeter.cc @@ -67,7 +67,7 @@ void RAIDMeter::checkResources( void ){ // parser for /proc/mdstat -int RAIDMeter::find1(char *key, char *findwhat, int num1){ +int RAIDMeter::find1(char *key, const char *findwhat, int num1){ char buf[80]; int rc; std::ostringstream os; @@ -78,7 +78,7 @@ int RAIDMeter::find1(char *key, char *fi return rc; } -int RAIDMeter::find2(char *key, char *findwhat, int num1, int num2){ +int RAIDMeter::find2(char *key, const char *findwhat, int num1, int num2){ char buf[80]; int rc; std::ostringstream os; Index: linux/raidmeter.h =================================================================== --- linux/raidmeter.h.orig +++ linux/raidmeter.h @@ -35,8 +35,8 @@ protected: unsigned long doneColor_, todoColor_, completeColor_; - int find1(char *key, char *findwhat, int num1); - int find2(char *key, char *findwhat, int num1, int num2); + int find1(char *key, const char *findwhat, int num1); + int find2(char *key, const char *findwhat, int num1, int num2); int raidparse(char *cp); Index: linux/serialmeter.cc =================================================================== --- linux/serialmeter.cc.orig +++ linux/serialmeter.cc @@ -112,7 +112,7 @@ const char *SerialMeter::getResourceName } unsigned short int SerialMeter::getPortBase(Device dev) const { - static char *deviceFile[] = { "/dev/ttyS0", + static const char *deviceFile[] = { "/dev/ttyS0", "/dev/ttyS1", "/dev/ttyS2", "/dev/ttyS3", Index: linux/lmstemp.cc =================================================================== --- linux/lmstemp.cc.orig +++ linux/lmstemp.cc @@ -29,7 +29,7 @@ LmsTemp::LmsTemp( XOSView *parent, const << std::endl; parent_->done(1); } - char *p; + const char *p; if ((p = strrchr(caption,'/')) != 0) _highest = atoi(p+1); else
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor