0

I noticed when I do the following, the gnome-terminal simply goes into "Zombie State"

char *cmd = "kill <pidofterminal>"
popen(cmd, "r");

Is there a way to completely kill off the program? I need it to release its PID.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
  • How about specify kill command with -9, `"kill -9 "`? – billz Feb 04 '13 at 02:49
  • somehow when i try to do a kill -9 in my program, the terminal simply goes into Zombie state...but when i do kill -9 in a terminal, it kills the gnome-terminal off totally, any idea why is that so? – user2031879 Feb 04 '13 at 02:58
  • are you `root or sudo` when you run your program? – billz Feb 04 '13 at 02:59
  • To billz: no its not. will something like "chmod u+s /sbin/shutdown" solve the problem? i not sure where the kill executable is located. – user2031879 Feb 04 '13 at 03:07
  • `kill` command is in `/bin/kill`, you could run `which` or `whereis` to locate it – billz Feb 04 '13 at 03:16

1 Answers1

1

You could specify -9 in kill command

char *cmd = "kill -9 <pidofterminal>"
popen(cmd, "r");

Run program under sudo or root:

sudo ./program

It will kill all processes you can kill.

billz
  • 44,644
  • 9
  • 83
  • 100