[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gtick-devel] Zombie Invasion
From: |
Simeon Gradinarski |
Subject: |
[Gtick-devel] Zombie Invasion |
Date: |
Mon, 10 Jan 2005 22:59:30 +0200 |
Hi,
I discovered gtick two days ago and I find it quite useful for my
guitar practices. But I noticed that it leaves pending zombie
processes. (I should mention I'm running kernel 2.6.9, i386
architecture.)
It looks like the problem is in util.c, the 'execute' function: it
seems that noone collects the terminated child processes, spawned via
fork call.
I would propose this piece of code for a fix (and apologize that I
didn't have time to try it myself - there may be an actual reason for
the missing wait ?! ):
/*
* forks and executes given command (with arguments) via sh
*/
void execute(char *command) {
pid_t result = fork();
char *argv[] = {"sh", "-c", command, NULL};
/* zombie process fix */
switch (result)
{
case -1: /* error */
fprintf(stderr, "Fork error.\n");
break;
case 0: /* we are the child */
if (execvp("sh", argv))
{
fprintf(stderr, "Exec error.\n");
exit(1);
}
break;
default:
wait(0);
}
/* end zombie process fix */
}
Best regards,
Simeon
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gtick-devel] Zombie Invasion,
Simeon Gradinarski <=