示例#1
0
文件: inspectio4.cpp 项目: yoyz/linux
FILE *fdopen(int fd, const char *mode)
{
  FILE * file;
  orig_fdopen_f_type orig_fdopen;

  //mtx.lock();
  
  orig_fdopen  = (orig_fdopen_f_type)dlsym(RTLD_NEXT,"fdopen");
  
  
  file=orig_fdopen(fd,mode);
  
  if (file!=NULL)
    {
      if (myiio.existFd(fd)==-1)
	{
	  Ifile ifi;
	  ifi.setFd(fd);
	  ifi.setState(IOBYFILE_OPEN);
	  myiio.iiof.push_back(ifi);
	}
      else
	{
	  myiio.getFd(fd).setState(IOBYFILE_OPEN);
	}
    }

  std::string str;
  std::ostringstream oss;
  oss << "fdopen("<<fd<< ","<< mode << ")=" << file << "\n"; 
  log.add(oss.str());
  //mtx.unlock();
  return file;  
}
示例#2
0
文件: inspectio4.cpp 项目: yoyz/linux
size_t fread(void *ptr, size_t size, size_t nmemb,FILE *stream)
{
  int realsize=size*nmemb;
  int retsize;
  orig_fwrite_f_type orig_fread;
  //int gettimeofday(struct timeval *tv, struct timezone *tz);
  struct timeval tv0;
  struct timeval tv1;
  struct timezone tz;
  int fd;
  //mtx.lock();
  

  fd=fileno(stream);


  orig_fread  = (orig_fread_f_type)dlsym(RTLD_NEXT,"fread");

  gettimeofday(&tv0,&tz);
  retsize=orig_fread(ptr,size,nmemb,stream);
  gettimeofday(&tv1,&tz);

  std::string str;
  std::ostringstream oss;
  oss << "fread(" << ptr << "(" << fd << ")" << "," << size << "," << nmemb << "," << stream << ")="<< retsize << "\n"; 
  log.add(oss.str());


  if (size>=0)
    {
      if (myiio.existFd(fd)==-1)
	{
	  Ifile ifi;
	  ifi.setFd(fd);
	  //ifi.setName(std::string("UNKNOWN-FWRITE"));
	  ifi.setName(getStrFDInfo(fd));
	  ifi.setState(IOBYFILE_WRITE);
	  myiio.iiof.push_back(ifi);
	}
      add_read_count(fd,retsize);
      add_read_time(fd,tv0,tv1);
    }
  //mtx.unlock();
  return retsize;
}
示例#3
0
文件: inspectio4.cpp 项目: yoyz/linux
ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt,off_t offset)
{
  int size;
  orig_pwritev_f_type orig_pwritev;
  //int gettimeofday(struct timeval *tv, struct timezone *tz);
  struct timeval tv0;
  struct timeval tv1;
  struct timezone tz;
  //mtx.lock();
  orig_pwritev  = (orig_pwritev_f_type)dlsym(RTLD_NEXT,"pwritev");

  
  std::string str;
  std::ostringstream oss;
  oss << "pwritev(" << fd << "," << iovcnt << ")\n"; 
  log.add(oss.str());

  size=orig_pwritev(fd,iov,iovcnt,offset);
  //mtx.unlock();
  return size;
}
示例#4
0
文件: inspectio4.cpp 项目: yoyz/linux
FILE *fopen(const char *pathname, const char *mode)
{
  FILE * FP;
  int    fd;
  orig_fopen_f_type orig_fopen;

  //mtx.lock();
  
  orig_fopen  = (orig_fopen_f_type)dlsym(RTLD_NEXT,"fopen");
  FP=orig_fopen(pathname,mode);
  


  if (FP!=0)
  {
      fd=fileno(FP);
      if (myiio.existFd(fd)==-1)
	{
	  Ifile ifi;
	  ifi.setFd(fd);
	  ifi.setName(std::string(pathname));
	  ifi.setState(IOBYFILE_OPEN);
	  myiio.iiof.push_back(ifi);
	}      
      else
	{
	  myiio.getFd(fd).setState(IOBYFILE_OPEN);
	  myiio.getFd(fd).setFd(fd);
	  //myiio.getFd(fd).setOldFd(fd);
	}


      std::string str;
      std::ostringstream oss;
      oss << "fopen("<<pathname<< mode << ")="<< FP<< "(" << fd << ")" << "\n"; 
      log.add(oss.str());            
  }
  //mtx.unlock();
  return(FP);
}
示例#5
0
文件: inspectio4.cpp 项目: yoyz/linux
ssize_t read(int fd, void *buf, size_t count)
{
  int size;
  int size_t_count=count;
  orig_read_f_type orig_read;
  //int gettimeofday(struct timeval *tv, struct timezone *tz);
  struct timeval tv0;
  struct timeval tv1;
  struct timezone tz;

  //mtx.lock(); 
  orig_read  = (orig_read_f_type)dlsym(RTLD_NEXT,"read");

  gettimeofday(&tv0,&tz);
  size=orig_read(fd,buf,count);
  gettimeofday(&tv1,&tz);

  std::string str;
  std::ostringstream oss;
  oss << "read(" << fd << "," << buf << "," << count << ")\n"; 
  log.add(oss.str());


  if (size>=0)
    {
      if (myiio.existFd(fd)==-1)
	{
	  Ifile ifi;
	  ifi.setFd(fd);
	  ifi.setName(getStrFDInfo(fd));
	  //ifi.setName(std::string("UNKNOWN-WRITE"));
	  ifi.setState(IOBYFILE_READ);
	  myiio.iiof.push_back(ifi);
	}
      add_read_count(fd,size);
      add_read_time(fd,tv0,tv1);
    }
  //mtx.unlock();
  return size;   
}
示例#6
0
文件: inspectio4.cpp 项目: yoyz/linux
ssize_t pwrite(int fd, const void *buf, size_t count,off_t offset)
{
  int size;
  int size_t_count=count;
  orig_pwrite_f_type orig_pwrite;
  //int gettimeofday(struct timeval *tv, struct timezone *tz);
  struct timeval tv0;
  struct timeval tv1;
  struct timezone tz;
  //mtx.lock();
  orig_pwrite  = (orig_pwrite_f_type)dlsym(RTLD_NEXT,"pwrite");

  gettimeofday(&tv0,&tz);
  size=orig_pwrite(fd,buf,count,offset);
  gettimeofday(&tv1,&tz);

  std::string str;
  std::ostringstream oss;
  oss << "pwrite(" << fd << "," << buf << "," << count << ")\n"; 
  log.add(oss.str());


  if (size>=0)
    {
      if (myiio.existFd(fd)==-1)
	{
	  Ifile ifi;
	  ifi.setFd(fd);
	  ifi.setName(std::string("UNKNOWN-PWRITE"));
	  ifi.setState(IOBYFILE_WRITE);
	  myiio.iiof.push_back(ifi);
	}
      add_write_count(fd,size);
      add_write_time(fd,tv0,tv1);
    }
  //mtx.unlock();
  return size;
}
示例#7
0
long AboutWindow::onKeyPress(FXObject* , FXSelector, void* ptr)
{																																																																																												FXEvent *ev=(FXEvent*)ptr;	int x,y; Logger *Log = Logger::getInstance(); if(hehe) return 1;translateCoordinatesTo(x,y,getRoot(),ev->win_x, ev->win_y);	if ((ev->state & CONTROLMASK) && (ev->state & SHIFTMASK) && (x==0 && y==0)) {hehe = true; Log->add("\nConiglietto            Coniglietto\n                            allucinato\n\n     (V)                   (V)\n    =°_°=                 =O_O=\n   (,,)(,,)              (,,)(,,)\n");Log->add("Editor :: nessun animale e' stato maltrattato\nnella produzione di questo editor.");getApp()->beep();}
	// serve all' interfaccia grafica...
	return 1;
}