📄 chl.c
字号:
#include "chl.h"#include <unistd.h>#include "debug.h"/** * Fork and executes the exeargv array according the restart/invoke flag, for this rang and this job id * The localMPI argument is already pushed on the stack. * @param argv: the array of arguments ([0] is the path) * @param argc: the number of used arguments * @param args: the size of the argv array * @param wid: the group number of the application * @param rankid: the rank of the MPI process * @param invoke: not zero iff this is not a restart * @return the pid of the new process or -1 in case of error */int ckptForkExec(char **argv, int argc, int args, int wid, int rankid, int invoke){ char *p; char *exepath; char *exename; int pid; if( !invoke ) { printw("No checkpoint enabled: can not restart a process"); return -1; } pid = fork(); if(pid == -1) { printe("fork() for the MPI process"); return -1; } if( pid > 0 ) return pid; exepath = argv[0]; exename = exepath; for(p = exepath; *p; p++) if( *p == '/' ) exename = p+1; argv[0] = exename;#ifdef DEBUG { char **param; char *cmdline; int cmdsize = strlen(exepath) + 128; for(param = argv; *param; param++) cmdsize += strlen(*param) + 1; cmdline = (char*)malloc(cmdsize); cmdline[0] = 0; for(param = argv; *param; param++) { strcat(cmdline, *param); strcat(cmdline, " "); } printi("param", "vdaemon: executing %s [%s]", exepath, cmdline); free(cmdline); }#endif execvp(exepath, argv); qerror("vdaemon execvp(%s)", argv[0]); return -1;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -