<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>Hello,<BR>
<BR>
can someone help me?<BR>
<BR>
I start a process via clone function but I don't know how to exit my child process without get a zombie...<BR>
<BR>
thank you in addvance<BR>
Sayangoin<BR>
<BR>
<BR>
<BR>
// source code.................<BR>
<BR>
#include <signal.h><BR>#include <stdio.h><BR>#include <sys/types.h><BR>#include <sys/wait.h><BR>#include <sched.h><BR>#include <unistd.h><BR>#include <syscall.h> // for syscall(SYS_getpid)<BR>#include <syslog.h><BR>#include <errno.h><BR>#include <fcntl.h><BR>#include <sys/stat.h><BR>
<BR>#include "logCtrl.h"<BR>
int transProcessId=0;<BR>char transStack[0x40000];<BR>
pid_t mypid;<BR>
<BR>int transProcess(){<BR> <BR> mypid = syscall(SYS_getpid);<BR>
printLog(logTRANS,"create transProc %i",mypid); <BR>
return 0;<BR>}<BR>
void startTransProcess(){<BR> <BR> mypid = syscall(SYS_getpid);<BR>
printLog(logMODUL1,"create transProc %i",mypid);<BR>
if(transProcessId>0) transProcessId=0; // transProcessId initialisieren<BR>
transProcessId=clone(transProcess, &transStack[sizeof(transStack)-10],CLONE_VM|CLONE_FILES|CLONE_FS , 0);<BR>
if(transProcessId>0){<BR> printLog(logMODUL1,"transProc gestartet (PID: %d)",transProcessId);<BR> }<BR> else {<BR> printLog(logMODUL1,"transProc nicht startet (PID: %d)",transProcessId); <BR> }<BR>};<BR>
<BR>void modul1()<BR>{<BR> //printLog(logMODUL1,"Modul1"); <BR> <BR> if (!transProcessId) startTransProcess(); <BR> <BR>}<BR>
<BR>
int mainprog()<BR>{<BR> printLog(logMAIN,"Programm start"); <BR>
while(1) { <BR> <BR> modul1();<BR> <BR> usleep(10*1000);<BR> <BR> }<BR> <BR> return 0; <BR>
}<BR>
<BR> <BR>
// -------------------------------------------------------------------------<BR>// <BR>// -------------------------------------------------------------------------<BR>//<BR>//<BR>// *******************************************************************************************<BR>//<BR>//<BR>// *******************************************************************************************<BR>//<BR>int main (int argc,char *argv[]){<BR> <BR> initLogCtrl();<BR>
mainprog(); <BR> return 0;<BR> <BR>}<BR><BR><br /><hr />Schon gesehen? Tolle Bilder von Sarah Connor gibt es hier! <a href='http://redirect.gimas.net/?cat=hmtl&n=M1007S&d=http://search.msn.de/images/results.aspx?q=Sarah%20Connor' target='_new'>Live Search</a></body>
</html>