Example #1
0
SEXP Rhpc_mpi_finalize(void)
{
  int cmd[CMDLINESZ];

  if(finalize){
    warning("Rhpc were already finalized.");
    return(R_NilValue);
  }
  if(!initialize){
    warning("Rhpc not initialized.");
    return(R_NilValue);
  }

  SET_CMD(cmd, CMD_NAME_ENDL, SUBCMD_NORMAL, 0, 0);
  _M(MPI_Bcast(cmd, CMDLINESZ, MPI_INT, 0, RHPC_Comm));
  MPI_Finalize();
  finalize =1;
  Rhpc_set_options( -1, -1, MPI_COMM_NULL);
  return(R_NilValue);
}
Example #2
0
int ipvs_command(int cmd, struct ip_vs_rule_user *urule)
{
	ipvs_cmd = SET_CMD(cmd);
	return setsockopt(sockfd, IPPROTO_IP,
			  cmd, (char *)urule, sizeof(*urule));
}
Example #3
0
const char *ipvs_strerror(int err)
{
	unsigned int i;
	struct table_struct {
		int cmd;
		int err;
		const char *message;
	} table [] =
	  { { 0, EPERM, "Permission denied (you must be root)" },
	    { 0, EINVAL, "Module is wrong version" },
	    { 0, ENOPROTOOPT, "Protocol not available" },
	    { 0, ENOMEM, "Memory allocation problem" },
	    { SET_CMD(IP_VS_SO_SET_ADD), EEXIST, "Service already exists" },
	    { SET_CMD(IP_VS_SO_SET_ADD), ENOENT, "Scheduler not found" },
	    { SET_CMD(IP_VS_SO_SET_EDIT), ESRCH, "No such service" },
	    { SET_CMD(IP_VS_SO_SET_EDIT), ENOENT, "Scheduler not found" },
	    { SET_CMD(IP_VS_SO_SET_DEL), ESRCH, "No such service" },
	    { SET_CMD(IP_VS_SO_SET_ADDDEST), ESRCH, "Service not defined" },
	    { SET_CMD(IP_VS_SO_SET_ADDDEST), EEXIST,
	      "Destination already exists" },
	    { SET_CMD(IP_VS_SO_SET_EDITDEST), ESRCH, "Service not defined" },
	    { SET_CMD(IP_VS_SO_SET_EDITDEST), ENOENT, "No such destination" },
	    { SET_CMD(IP_VS_SO_SET_DELDEST), ESRCH, "Service not defined" },
	    { SET_CMD(IP_VS_SO_SET_DELDEST), ENOENT, "No such destination" },
	    { SET_CMD(IP_VS_SO_SET_STARTDAEMON), EEXIST,
	      "Daemon has already run" },
	    { SET_CMD(IP_VS_SO_SET_STOPDAEMON), ESRCH,
	      "No daemon is running" },
	    { SET_CMD(IP_VS_SO_SET_STOPDAEMON), ESRCH,
	      "No daemon is running" },
	    { SET_CMD(IP_VS_SO_SET_ZERO), ESRCH, "No such service" },
	    { GET_CMD(IP_VS_SO_GET_SERVICE), ESRCH, "No such service" },
	    { GET_CMD(IP_VS_SO_GET_DESTS), ESRCH, "No such service" },
	  };

	for (i = 0; i < sizeof(table)/sizeof(struct table_struct); i++) {
		if ((!table[i].cmd || table[i].cmd == ipvs_cmd)
		    && table[i].err == err)
			return table[i].message;
	}

	return strerror(err);
}