Re: [PATCH] Unkillable process

From: Michael Mess (michael@kawo2.rwth-aachen.de)
Date: Fri Jan 14 2000 - 19:59:06 EST


...
>So the following program is unkillable :
>
> #include <stdio.h>
> #include <signal.h>
>
> int
>main (void)
>{
> sigset_t set;
> struct timespec timespec = {0, 0};
> sigfillset (& set);
> while (1)
> sigtimedwait (& set, NULL, & timespec);
> return (0);
>}
>
>Unkillable process means unable to umount the / partition >during
>shutdown, check forced at next reboot... :-(
>

It seems that even a SIGKILL is not toxic enough to for this process to
die certainly. But this seems to be like in chemistry. It is only a
question of the dose... :-)

<michael@rakete>:~>unkillable &
[3] 6525
<michael@rakete>:~>a=0; while kill -9 6525 ; do a=$[ $a+1 ] ; done;
echo $a
sh: kill: (6525) - No such pid
66648
[3]+ Killed unkillable
<michael@rakete>:~>

And one second try...

<michael@rakete>:~>unkillable &
[3] 6548
<michael@rakete>:~>a=0; while kill -9 6548 ; do a=$[ $a+1 ] ; done;
echo $a
sh: kill: (6548) - No such pid
481364
[3]+ Killed unkillable
<michael@rakete>:~>

Or try this one:

#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>

int main(int argc, char ** argv)
{
  if (argc !=3 ) {
    
    fprintf(stderr, "Usage: %s <PID> <SIG> gibt kill -SIG Dauerfeuer\n",
argv[0]);
  }
  else {
    int pid;
    pid=strtol(argv[1], 0, 10);
    int sig;
    sig=strtol(argv[2], 0, 10);
    printf("Sending signal %d to process %d:", sig, pid);
    while (kill(pid, sig)==0) {
      printf(".");
    }
  }
  return 0;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:24 EST