extern "C" int fcntl(int fd, int cmd, ...)
{
  va_list ap;
  // Handling the variable number of arguments
  void *arg_in = NULL;
  void *arg = NULL;
  va_start( ap, cmd );
  arg_in = va_arg(ap, void *);
  va_end(ap);

  arg = arg_in;

  DMTCP_PLUGIN_DISABLE_CKPT();

  if (cmd == F_SETOWN) {
    pid_t virtualPid = VIRTUAL_TO_REAL_PID((pid_t) (unsigned long) arg_in);
    arg = (void*) (unsigned long) virtualPid;
  }

  int result = _real_fcntl(fd, cmd, arg);
  int retval = result;

  if (cmd == F_GETOWN) {
    retval = REAL_TO_VIRTUAL_PID(result);
  }

  DMTCP_PLUGIN_ENABLE_CKPT();
  return retval;
}
예제 #2
0
int ibv_fork_init(void)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("****** WRAPPER for ibv_fork_init ******\n");
  int rslt = _fork_init();
  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #3
0
int ibv_destroy_srq(struct ibv_srq *srq)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
 // PDEBUG("******** WRAPPER for ibv_destroy_srq\n");
  int rslt = _destroy_srq(srq);
  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #4
0
int ibv_query_srq(struct ibv_srq *srq, struct ibv_srq_attr *srq_attr)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******** WRAPPER for ibv_query_srq\n");
  int rslt = _query_srq(srq, srq_attr);
  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #5
0
extern "C" int
munmap(void *addr, size_t length)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
  int retval = _real_munmap(addr, length);
  DMTCP_PLUGIN_ENABLE_CKPT();
  return retval;
}
예제 #6
0
extern "C" void *mmap64(void *addr, size_t length, int prot, int flags,
                        int fd, off64_t offset)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
  void *retval = _real_mmap64(addr, length, prot, flags, fd, offset);
  DMTCP_PLUGIN_ENABLE_CKPT();
  return retval;
}
예제 #7
0
void ibv_ack_async_event(struct ibv_async_event *event)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
 // PDEBUG("******* WRAPPER FOR ibv_ack_async_event\n");

  _ack_async_event(event);

  DMTCP_PLUGIN_ENABLE_CKPT();
}
예제 #8
0
void ibv_free_device_list(struct ibv_device **list)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("********* WRAPPER for ibv_free_device_list\n");

  _free_device_list(list);

  DMTCP_PLUGIN_ENABLE_CKPT();
}
예제 #9
0
void ibv_ack_cq_events(struct ibv_cq * cq, unsigned int nevents)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
 // PDEBUG("******** WRAPPER for ibv_ack_cq_events\n");

  _ack_cq_events(cq, nevents);

  DMTCP_PLUGIN_ENABLE_CKPT();
}
예제 #10
0
struct ibv_ah * ibv_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr){
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******** WRAPPER for ibv_create_ah\n");

  struct ibv_ah *rslt = _create_ah(pd, attr);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #11
0
struct ibv_qp *ibv_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******** WRAPPER for ibv_create_qp\n");

  struct ibv_qp * user_copy = _create_qp(pd, qp_init_attr);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return user_copy;
}
예제 #12
0
int ibv_modify_srq(struct ibv_srq *srq,
                   struct ibv_srq_attr *srq_attr,
                   int srq_attr_mask)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******** WRAPPER for ibv_modify_srq\n");
  int rslt = _modify_srq(srq, srq_attr, srq_attr_mask);
  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #13
0
struct ibv_srq *ibv_create_srq(struct ibv_pd * pd, struct ibv_srq_init_attr * srq_init_attr)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
 // PDEBUG("******** WRAPPER for ibv_create_srq\n");

  struct ibv_srq * user_copy = _create_srq(pd, srq_init_attr);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return user_copy;
}
예제 #14
0
struct ibv_pd *ibv_alloc_pd(struct ibv_context *context)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******* WRAPPER FOR ibv_alloc_pd\n");

  struct ibv_pd * user_copy = _alloc_pd(context);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return user_copy;
}
예제 #15
0
int ibv_destroy_comp_channel(struct ibv_comp_channel * channel)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("****** WRAPPER for ibv_destroy_comp_channel\n");

  int rslt = _destroy_comp_channel(channel);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #16
0
uint64_t ibv_get_device_guid(struct ibv_device *device)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******* WRAPPER for ibv_get_device_guid\n");

  uint64_t rslt = _get_device_guid(device);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #17
0
int ibv_query_pkey(struct ibv_context *context, uint8_t port_num,  int index, uint16_t *pkey)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******* WRAPPER for begin of ibv_query_pkey\n");

  int rslt = _query_pkey(context,port_num, index, pkey);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #18
0
int ibv_query_gid(struct ibv_context *context, uint8_t port_num, int index, union ibv_gid *gid)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******* WRAPPER for begin of ibv_query_gid\n");

  int rslt = _query_gid(context,port_num, index, gid);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #19
0
struct ibv_context *ibv_open_device(struct ibv_device *dev)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******* WRAPPER for begin of ibv_open_device\n");

  struct ibv_context * user_copy = _open_device(dev);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return user_copy;
}
예제 #20
0
int ibv_query_device(struct ibv_context *context, struct ibv_device_attr *device_attr)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******* WRAPPER for begin of ibv_query_device\n");

  int rslt = _query_device(context,device_attr);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #21
0
int ibv_close_device(struct ibv_context *context)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("***** WRAPPER for ibv_close_device\n");

  int rslt = _close_device(context);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #22
0
int ibv_dealloc_pd(struct ibv_pd *pd)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("****** WRAPPER for ibv_dealloc_pd\n");

  int rslt = _dealloc_pd(pd);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #23
0
int ibv_dereg_mr(struct ibv_mr *mr)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("****** WRAPPER for ibv_dereg_mr\n");

  int rslt = _dereg_mr(mr);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #24
0
int ibv_destroy_qp(struct ibv_qp *qp)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
  //PDEBUG("****** WRAPPER for ibv_destroy qp\n");

  int rslt = _destroy_qp(qp);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #25
0
int ibv_query_qp(struct ibv_qp * qp, struct ibv_qp_attr * attr,
                 int attr_mask, struct ibv_qp_init_attr *init_attr)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******** WRAPPER FOR ibv_query_qp\n");

  int rslt = _query_qp(qp, attr, attr_mask, init_attr);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
extern "C" int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options)
{
  int retval = 0;
  struct timespec sleepTime = {0, 1000};
  siginfo_t siginfop;
  memset(&siginfop, 0, sizeof(siginfop));

  /* waitid returns 0 in case of success as well as when WNOHANG is specified
   * and we need to distinguish those two cases.man page for waitid says:
   *   If WNOHANG was specified in options and there were no children in a
   *   waitable  state, then waitid() returns 0 immediately and the state of
   *   the siginfo_t structure pointed to by infop is unspecified.  To
   *   distinguish this case from that where a child was in a  waitable state,
   *   zero out the si_pid field before the call and check for a nonzero value
   *   in this field after the call returns.
   *
   * See comments above wait4()
   */
  while (retval == 0) {
    DMTCP_PLUGIN_DISABLE_CKPT();
    pid_t currPid = VIRTUAL_TO_REAL_PID (id);
    retval = _real_waitid (idtype, currPid, &siginfop, options | WNOHANG);

    if (retval != -1) {
      pid_t virtualPid = REAL_TO_VIRTUAL_PID ( siginfop.si_pid );
      siginfop.si_pid = virtualPid;

      if ( siginfop.si_code == CLD_EXITED || siginfop.si_code == CLD_KILLED )
        dmtcp::VirtualPidTable::instance().erase(virtualPid);
    }
    DMTCP_PLUGIN_ENABLE_CKPT();

    if ((options & WNOHANG) ||
        retval == -1 ||
        siginfop.si_pid != 0) {
      break;
    } else {
      if (sleepTime.tv_sec == 0) {
        sleepTime.tv_nsec *= 2;
        if (sleepTime.tv_nsec >= 1000 * 1000 * 1000) {
          sleepTime.tv_sec++;
          sleepTime.tv_nsec = 0;
        }
      }
      nanosleep(&sleepTime, NULL);
    }
  }

  if (retval == 0 && infop != NULL) {
    *infop = siginfop;
  }

  return retval;
}
예제 #27
0
struct ibv_comp_channel * ibv_create_comp_channel(struct ibv_context
                                                                *context)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******* WRAPPER for ibv_create_comp_channel\n");

  struct ibv_comp_channel * rslt = _create_comp_channel(context);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #28
0
int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
                   int attr_mask) //int attr_mask)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("********* WRAPPER for ibv_modify_qp\n");

  int rslt = _modify_qp(qp, attr, attr_mask);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #29
0
int ibv_resize_cq(struct ibv_cq *cq, int cqe)
{

  DMTCP_PLUGIN_DISABLE_CKPT();
  //PDEBUG("****** WRAPPER for ibv_resize_cq\n");

  int rslt = _resize_cq(cq,cqe);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}
예제 #30
0
int ibv_get_cq_event(struct ibv_comp_channel *channel, struct ibv_cq **cq,
                        void **cq_context)
{
  DMTCP_PLUGIN_DISABLE_CKPT();
//  PDEBUG("******** WRAPPER for ibv_get_cq_event");

  int rslt = _get_cq_event(channel, cq, cq_context);

  DMTCP_PLUGIN_ENABLE_CKPT();
  return rslt;
}