lkml.org 
[lkml]   [2000]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Unkillable process
...
>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/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:1.753 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site