[LCP] zombie process...
Sayang Oin
sayangoin at hotmail.com
Wed Nov 14 15:30:34 UTC 2007
Hello,
can someone help me?
I start a process via clone function but I don't know how to exit my child process without get a zombie...
thank you in addvance
Sayangoin
// source code.................
#include <signal.h>#include <stdio.h>#include <sys/types.h>#include <sys/wait.h>#include <sched.h>#include <unistd.h>#include <syscall.h> // for syscall(SYS_getpid)#include <syslog.h>#include <errno.h>#include <fcntl.h>#include <sys/stat.h>
#include "logCtrl.h"
int transProcessId=0;char transStack[0x40000];
pid_t mypid;
int transProcess(){ mypid = syscall(SYS_getpid);
printLog(logTRANS,"create transProc %i",mypid);
return 0;}
void startTransProcess(){ mypid = syscall(SYS_getpid);
printLog(logMODUL1,"create transProc %i",mypid);
if(transProcessId>0) transProcessId=0; // transProcessId initialisieren
transProcessId=clone(transProcess, &transStack[sizeof(transStack)-10],CLONE_VM|CLONE_FILES|CLONE_FS , 0);
if(transProcessId>0){ printLog(logMODUL1,"transProc gestartet (PID: %d)",transProcessId); } else { printLog(logMODUL1,"transProc nicht startet (PID: %d)",transProcessId); }};
void modul1(){ //printLog(logMODUL1,"Modul1"); if (!transProcessId) startTransProcess(); }
int mainprog(){ printLog(logMAIN,"Programm start");
while(1) { modul1(); usleep(10*1000); } return 0;
}
// -------------------------------------------------------------------------// // -------------------------------------------------------------------------////// *******************************************************************************************////// *******************************************************************************************//int main (int argc,char *argv[]){ initLogCtrl();
mainprog(); return 0; }
_________________________________________________________________
Windows Live Writer Beta - Veröffentlichen Sie Multimediainhalte in Ihrem Blog!
http://get.live.com/betas/writer_betas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20071114/839bdea3/attachment.htm
More information about the linuxCprogramming
mailing list