home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.hp
- Path: sparky!uunet!ncube.com!db1!russell
- From: russell@ncube.com
- Subject: Re: Inhibiting core dumps on HP7xx
- Message-ID: <1992Jul27.165150.19339@ncube.com>
- Sender: usenet@ncube.com
- Nntp-Posting-Host: db1_pdx
- Organization: nCUBE CORPORATION
- References: <l6pa0tINNnd4@girtab.usc.edu> <1992Jul24.145006.20539@hubcap.clemson.edu>
- Date: Mon, 27 Jul 1992 16:51:50 GMT
- Lines: 60
-
- In article <1992Jul24.145006.20539@hubcap.clemson.edu>, elwin@gamma.phys.clemson.edu (Lawrence E. Brown) writes:
- |> I'm very tired of frequent dumps of 10-40Meg core files every
- |> time I have a floating exception somewhere in my code (mostly
- |> Fortran some C). Is there any way to prevent core dumps in
- |> HPUX8.0x on an HP700 series machine?
-
- I posted this recently ...
-
- Thanks to a wonderful example from hooft@prl.philips.nl (who pointed out that
- the BSD hooks are still in HP-UX), I ended up with the program "nocore",
- which you can say:
- nocore progname argument1 argument2
- instead of just:
- progname argument1 argument2
-
- There is no way of setting it for your current shell. But you can start a
- new shell with "nocore $SHELL" (the limit will then be set for the new
- shell's child processes).
-
- Good luck!
-
- Russell Randolph
- nCUBE, Beaverton, Oregon
- russell@ncube.com
-
- --------------------------------- nocore.c -----------------------------------
- /* Prevents core dumps from whatever is run.
- * Tested on HP-UX 8.07 on 7xx series.
- * To compile: cc -o nocore -I/etc/conf/h -D_KERNEL nocore.c
- * Modified from example program by (hooft@prl.philips.nl)
- * Russell Randolph (russell@ncube.com)
- */
- #include <stdio.h>
- #include <signal.h>
- #include <sys/syscall.h>
- #include <sys/resource.h>
- #include <sys/time.h>
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
- struct rlimit rl;
-
- if (!argc) {
- fprintf(stderr,"Usage: nocore <programname> [arguements ...]\n");
- fprintf(stderr,"Example: nocore spice -b circuit.sp\n");
- fprintf(stderr,"Example: exec nocore $SHELL\n");
- fprintf(stderr,"Note: child processes will also have their limits set to 0 bytes.\n");
- exit(1);
- }
- getrlimit(RLIMIT_CORE, &rl);
- rl.rlim_cur = 0;
- setrlimit(RLIMIT_CORE, &rl);
- *argv++;
- execvp(*argv,argv);
- fprintf(stderr,"Error: execvp of %s failed.\n", *argv);
- exit(1);
- }
-
-