Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jan 2003 10:31:30 -0700
From:      lattera@softhome.net
To:        freebsd-questions@freebsd.org
Subject:   too many kill()'s
Message-ID:  <courier.3E2C3272.000072BC@softhome.net>

next in thread | raw e-mail | index | archive | help
The following source code:
#include <stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <errno.h> 

extern int errno; 

int main(int argc, char *argv[])
{
       signal(SIGINT, SIG_IGN);
       signal(SIGTERM, SIG_IGN);
       if (!fork())
       {
               while(1) {
                       kill(getppid(), SIGTERM);
               }
       }
}
// End of source 

when compiled and ran, makes my 4.7-release box quit EVERY SINGLE PROGRAM 
(including boot-time daemons), and go into a fix-it shell. 

My question is this: why does this happen? I can't seem to figure it out. 
I've worked with many other people about this, and they don't seem to know. 

(When you exit the fix-it shell, the computer finishes booting, it's like 
going into single-user mode upon boot) 

Run this code and see what happens (nothing bad, just wierd). 

bash-2.05b# uname -a
FreeBSD  4.7-RELEASE FreeBSD 4.7-RELEASE #1: Sun Jan 19 17:46:33 MST 2003    
shawn@:/usr/obj/usr/src/sys/FIREWALLED  i386
bash-2.05b# 

Thanks, 

lattera 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?courier.3E2C3272.000072BC>