Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!usc!samsung!aplcen!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: core files under SV Message-ID: <20772@mimsy.umd.edu> Date: 15 Nov 89 10:22:49 GMT References: Distribution: comp Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 36 In article mrd@sun.soe.clarkson.edu (Michael DeCorte) writes: >NOTE I want to generate a core file but NOT exit. Yup I just want to >go along on my merry way. (You are not going to like this :-) ) int make_core_file() { int pid = fork(), w, status; extern int errno; switch (pid) { case -1: /*DEBUG*/ /* perror("cannot fork to make core file"); */ return (-1); case 0: /* child */ abort(); /*DEBUG*/ /* (void) write(2, "could not make core file\n", 25); */ _exit(1); /* NOTREACHED */ } /* parent */ /* should use wait4() here, but no one has it yet */ while ((w = wait(&status)) != pid) if (w == -1 && errno != EINTR) break; if (status & 0200) /* made a core file */ return (0); return (1); /* fork succeeded, but no core dump */ } -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris