"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "linux/serialmeter.cc" between
xosview-1.22.tar.gz and xosview-1.23.tar.gz

About: xosview is an X Windows based system monitor (cpu, memory, swap and network usage; interrupt and serial activities; load average).

serialmeter.cc  (xosview-1.22):serialmeter.cc  (xosview-1.23)
// //
// Copyright (c) 1994, 1995, 2006 by Mike Romberg ( mike.romberg@noaa.gov ) // Copyright (c) 1994, 1995, 2006 by Mike Romberg ( mike.romberg@noaa.gov )
// //
// This file may be distributed under terms of the GPL // This file may be distributed under terms of the GPL
// //
// //
// In order to use this new serial meter, xosview needs to be suid root. // In order to use this new serial meter, xosview needs to be suid root.
// //
#include "serialmeter.h" #include "serialmeter.h"
#include <linux/serial.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/types.h> #include <sys/types.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
// This should go away after types.h gets fixed in the kernel. /*
#ifdef __alpha__ * To fetch status information requires ioperm() and inb()
typedef unsigned char u8; * otherwise these meter is largely a no-op.
typedef signed short s16; */
typedef unsigned short u16; #if defined(__i386__) || defined(__ia64__) || defined(__amd64__)
typedef signed int s32;
typedef unsigned int u32;
typedef signed long long s64;
typedef unsigned long long u64;
#endif
#if defined(GNULIBC) || defined(__GLIBC__)
#if !defined(__powerpc__) && !defined(__hppa__) && !defined(__mips__) && !define
d(__sparc__) && !defined(__sh__) && !defined(__s390__) && !defined(__s390x__) &&
!defined(__m68k__) && !defined(__aarch64__) && !defined(__arm__)
#include <sys/io.h> #include <sys/io.h>
#endif
#if !defined(__alpha__) && !defined(__sparc__) && !defined(__powerpc__) && !defi
ned(__ia64__) && !defined(__hppa__) && !defined(__arm__) && !defined(__mips__) &
& !defined(__sh__) && !defined(__s390__) && !defined (__s390x__) && !defined(__m
68k__) && !defined(__aarch64__)
#include <sys/perm.h> #include <sys/perm.h>
#define HAVE_IOPERM #define HAVE_IOPERM
#endif #endif
#else
#if !defined(__alpha__) && !defined(__sparc__) && !defined(__powerpc__) && !defi
ned(__ia64__) && !defined(__m68k__)
#include <asm/io.h>
#endif
#endif
#include <linux/serial.h>
SerialMeter::SerialMeter( XOSView *parent, Device device ) SerialMeter::SerialMeter( XOSView *parent, Device device )
: BitMeter( parent, getTitle(device), "LSR bits(0-7), MSR bits(0-7)", 16){ : BitMeter( parent, getTitle(device), "LSR bits(0-7), MSR bits(0-7)", 16){
_device = device; _device = device;
_port = 0; _port = 0;
} }
SerialMeter::~SerialMeter( void ){ SerialMeter::~SerialMeter( void ){
} }
skipping to change at line 79 skipping to change at line 64
std::cerr << "SerialMeter::SerialMeter() : " std::cerr << "SerialMeter::SerialMeter() : "
<< "xosview must be suid root to use the serial meter." << std::endl; << "xosview must be suid root to use the serial meter." << std::endl;
parent_->done(1); parent_->done(1);
} }
} }
bool SerialMeter::getport(unsigned short int port){ bool SerialMeter::getport(unsigned short int port){
#ifdef HAVE_IOPERM #ifdef HAVE_IOPERM
return ioperm(port, 1, 1) != -1; return ioperm(port, 1, 1) != -1;
#else #else
return -1 != -1; return false;
#endif #endif
} }
void SerialMeter::getserial( void ){ void SerialMeter::getserial( void ){
#ifdef HAVE_IOPERM #ifdef HAVE_IOPERM
// get the LSR and MSR // get the LSR and MSR
unsigned char lsr = inb(_port + UART_LSR); unsigned char lsr = inb(_port + UART_LSR);
unsigned char msr = inb(_port + UART_MSR); unsigned char msr = inb(_port + UART_MSR);
setBits(0, lsr); setBits(0, lsr);
 End of changes. 5 change blocks. 
28 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)