Esempio n. 1
0
int ccKeyBoard::send(uint16_t type, int32_t keycode, int32_t value) {
    int result = 0;
    if(type==EV_REL){
        result += send_unit(EV_REL,REL_X,keycode);
        result += send_unit(EV_REL,REL_Y,value);
        result += send_unit(EV_SYN,SYN_REPORT,0);
    }else if(type==EV_KEY){
        result += send_unit(EV_KEY,keycode,value);
        result += send_unit(EV_SYN,SYN_REPORT,0);
    } else return -1;
    return result==0? 0:-1;
}
Esempio n. 2
0
int client(void) {
  int forks = 0;

  unsigned i;
  for (i = 0; i < PRODUCERS_COUNT; i++) {
    pid_t pid = fork();
    assert(pid >= 0);

    if (pid == 0) {
      send_units(UNITS_PER_PRODUCER*i, UNITS_PER_PRODUCER);
      return 0;
    } else {
      forks++;
    }
  }

  while (forks > 0) {
    int res = wait(NULL);
    assert(res != -1);
    forks--;
  }

  int unit;
  klee_make_symbolic(&unit, sizeof(unit), "negative unit");
  klee_assume(unit < -10);
  send_unit(unit);

  return 0;
}
Esempio n. 3
0
void send_units(int start, int count) {
  int i;
  for (i = start; i < start + count; i++) {
    send_unit(i);
  }
}