Ejemplo n.º 1
0
      /** @brief helper function to send task */
      int process_send_call(reg_s * reg, process_descriptor_t * proc, process_descriptor_t * remote_proc, void * data)
      {
      XBT_DEBUG("Entering process_send_call");
      if (socket_registered(proc, (int) reg->arg[0]) != -1) { 
      if (!socket_netlink(proc, (int) reg->arg[0])) {
      XBT_DEBUG("%d This is not a netlink socket", (int) reg->arg[0]);
      //   compute_computation_time(proc);   // cree la computation task
      struct infos_socket *is = get_infos_socket(proc, (int) reg->arg[0]);
      struct infos_socket *s = comm_get_peer(is);
      is->ref_nb++;
      s->ref_nb++;

      XBT_DEBUG("%d->%d", (int) reg->arg[0], (int) reg->ret);
      XBT_DEBUG("Sending data(%d) on socket %d", (int) reg->ret, s->fd.fd);
      handle_new_send(reg, is, data);

      msg_task_t task = create_send_communication_task(proc, is, (int) reg->ret, proc->host, s->fd.proc->host);
      XBT_DEBUG("hosts: %s send to %s (size: %d)", MSG_host_get_name(proc->host), MSG_host_get_name(s->fd.proc->host),
	(int) reg->ret);


      MSG_task_set_bytes_amount(task, (int) reg->ret);
      MSG_task_set_data(task, data);

      send_task(s->fd.proc->host, task);

      is->ref_nb--;
      s->ref_nb--;
      return 1;
    }
      return 0;
    } else
	xbt_die("The socket is not registered");
      return 0;
    }
Ejemplo n.º 2
0
/** @brief retrieve the arguments of write syscall */
void get_args_write(process_descriptor_t * proc, reg_s * reg, syscall_arg_u * sysarg)
{
	read_arg_t arg = &(sysarg->read);
	arg->fd = reg->arg1;
	arg->dest = (void *) reg->arg2;
	arg->ret = reg->ret;
	arg->count = reg->arg3;
#ifndef address_translation
	pid_t pid = proc->pid;
	if (socket_registered(proc, arg->fd)) {
		if (socket_network(proc, arg->fd)) {
			arg->data = malloc(arg->count);
			ptrace_cpy(pid, arg->data, (void *) reg->arg2, arg->count, "write");
		}
	}
#endif
}