- 论坛徽章:
- 1
|
-
- 28 int exec() {
- 29 const char *pname=m_procname.c_str();
- 30 const char *pparam=m_param.c_str();
- 31 if (m_num==0) {
- 32 printf("restart filed num lager restart tiems \n");
- 33 return 0;
- 34 }
- 35 m_pid=fork();
- 36 if (m_pid < 0) {
- 37 return -1;
- 38 } else if(m_pid == 0) {
- 39 if (execlp(pname,pname,pparam,0) < 0) {
- 40 exit(1);
- 41 }
- 42 } else {
- 43 printf("Begin Start [%s][%s][%d]\n",m_procname.c_str(),m_param.c_str(),m_pid);
- 44 if ( kill(m_pid,0)<0 && errno == ESRCH) {
- 45 printf("Process[%s][%s][%s] Start Error\n",pname,pparam,strerror(errno));
- 46 printf ("Process [%d] not exist\n",m_pid);
- 47 m_pid=0;
- 48 }
- 49 }
- 50 return 0;
- 51 }
复制代码 进程已经退出可,为何在44行没有进入执行呢? |
|