+void smpi_process_init(int *argc, char ***argv)
+{
+ int index;
+ smpi_process_data_t data;
+ smx_process_t proc;
+
+ if(argc && argv) {
+ proc = SIMIX_process_self();
+ index = atoi((*argv)[1]);
+ data = smpi_process_remote_data(index);
+ SIMIX_process_set_data(proc, data);
+ if (*argc > 2) {
+ free((*argv)[1]);
+ memmove(&(*argv)[1], &(*argv)[2], sizeof(char *) * (*argc - 2));
+ (*argv)[(*argc) - 1] = NULL;
+ }
+ (*argc)--;
+ data->argc = argc;
+ data->argv = argv;
+ DEBUG2("<%d> New process in the game: %p", index, proc);
+ }
+}
+
+void smpi_process_destroy(void)
+{
+ int index = smpi_process_index();
+
+ DEBUG1("<%d> Process left the game", index);
+}
+
+int smpi_process_argc(void) {
+ smpi_process_data_t data = smpi_process_data();
+
+ return data->argc ? *(data->argc) - 1 : 0;
+}
+
+int smpi_process_getarg(int* index, char* dst, size_t len) {
+ smpi_process_data_t data = smpi_process_data();
+ char* arg;
+ size_t i;
+
+ if(!data->argc || !data->argv
+ || *index < 1 || *index >= *(data->argc)) {
+ return -1;
+ }
+ arg = (*data->argv)[*index];
+ for(i = 0; i < len && arg[i] != '\0'; i++) {
+ dst[i] = arg[i];
+ }
+ for(; i < len; i++) {
+ dst[i] = ' ';
+ }
+ return 0;
+}
+
+int smpi_global_rank(void) {
+ return smpi_process_index();
+}
+
+int smpi_global_size(void) {
+ char* value = getenv("SMPI_GLOBAL_SIZE");
+
+ if(!value) {
+ abort();
+ }
+ return atoi(value);
+}
+
+smpi_process_data_t smpi_process_data(void)
+{