This commit is contained in:
Oliver Lehmann 1989-05-26 16:37:15 +00:00
parent 0abad3c194
commit ca8a7ba60d
2 changed files with 50 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,50 @@
# include <stdio.h>
# define SIG 15
char c;
catch()
{
putchar(c);
fflush(stdout);
}
main(argc, argv)
int argc;
char *argv[];
{
register int i;
register int pid;
char buf[BUFSIZ];
setbuf(stdout, buf);
c = *argv[1];
pid = getpid();
printf("\nstart %c of child %d\n", c, pid);
fflush(stdout);
if (ptrace(0) < 0)
{
printf("child %d dies via ptrace\n", pid);
fflush(stdout);
exit(1);
}
if (signal(SIG, catch) < 0)
{
printf("child %d dies via signal\n", pid);
fflush(stdout);
exit(2);
}
for (i = 0; ; )
{
kill(pid, SIG);
printf("\ngo %c | rc = %d\n", c, i);
fflush(stdout);
for (i = 1; i < 2000; i++)
c = c;
kill(pid, SIG);
}
}