[comp.unix.ultrix] How to stop core files in /

mikem+@andrew.cmu.edu (Michael Meyer) (06/10/90)

The X server on my decstation 3100's has a nasty habit of crashing and
dropping a LARGE core file in /.  (*)  I can live with the X server
restarting itself, but I would prefer not to have my / filesystem filled
up with the core file.

Is there any way of inhibiting the core dump, something like the shell's
limit command except for root?

(*) I have a heavily used program which either tickles a bug in the X
server, or is itself buggy.

Thanks,
                            Michael M. Meyer
                      Statistics/Academic Computing
                       Carnegie Mellon University.

schemers@vela.acs.oakland.edu (Roland Schemers III) (06/10/90)

In article <IaQKjXq00VRUI0xVYB@andrew.cmu.edu> mikem+@andrew.cmu.edu (Michael Meyer) writes:
>The X server on my decstation 3100's has a nasty habit of crashing and
>dropping a LARGE core file in /.  (*)  I can live with the X server
>restarting itself, but I would prefer not to have my / filesystem filled
>up with the core file.
>

If you have root access try:

su
cp /dev/null /core
chmod 0 /core

That might stop it. By creating a empty core file owned by root and without
any write access to it the program that dumps core might not be able to
create a /core file.

Roland
-- 
Roland J. Schemers III                              Systems Programmer 
schemers@vela.acs.oakland.edu (Ultrix)              Oakland University 
schemers@argo.acs.oakland.edu (VMS)                 Rochester, MI 48309-4401
schemers@oakland (BITNET yuk!)

karish@mindcrf.UUCP (06/10/90)

In article <IaQKjXq00VRUI0xVYB@andrew.cmu.edu> mikem+@andrew.cmu.edu
(Michael Meyer) writes:
>The X server on my decstation 3100's has a nasty habit of crashing and
>dropping a LARGE core file in /.
>
>Is there any way of inhibiting the core dump, something like the shell's
>limit command except for root?

Write a small program that calls setrlimit() to set the maximum
core dump size to zero and then calls execv() to invoke the X server.

Cause this program to be invoked instead of X, either by changing the
invocation by the OS (I forget where this is; it used to be in /etc/ttys)
or by renaming X to X.real and this little program to X.

I used this approach to cause my system's news software to run with
an adequate maximum file size (ulimit).  It works fine here (on an
RT AIX system, not ULTRIX).
-- 

	Chuck Karish		karish@mindcraft.com
	Mindcraft, Inc.		(415) 323-9000		

omerzu@quando.UUCP (Thomas Omerzu) (06/10/90)

In article <IaQKjXq00VRUI0xVYB@andrew.cmu.edu> mikem+@andrew.cmu.edu (Michael Meyer) writes:
[...]
>Is there any way of inhibiting the core dump, something like the shell's
>limit command except for root?
[...]

You can use a csh-Skript to do the following:
	limit coredumpsize 1
	... <start server>

This limits the coredumpsize (for all children of this shell)
to 1 kB. If the core would exceed this size, it will not be dumped at all.
This does also apply to `root'-Processes.

--
	Thomas Omerzu, omerzu@quando.quantum.de

mathisen@dali.cs.montana.edu (Jaye Mathisen) (06/11/90)

In article <IaQKjXq00VRUI0xVYB@andrew.cmu.edu> mikem+@andrew.cmu.edu (Michael Meyer) writes:
>Is there any way of inhibiting the core dump, something like the shell's
>limit command except for root?





How about 

%ln -s /dev/null /core

??  

Of course, it must be done as root.

spa@fctunl.rccn.pt (Salvador Pinto Abreu) (06/11/90)

In article <1650@vela.acs.oakland.edu> schemers@vela.acs.oakland.edu (Roland Schemers III) writes:

> In article <IaQKjXq00VRUI0xVYB@andrew.cmu.edu> mikem+@andrew.cmu.edu (Michael Meyer) writes:
> >The X server on my decstation 3100's has a nasty habit of crashing and
> >dropping a LARGE core file in /.  (*)  I can live with the X server
> >restarting itself, but I would prefer not to have my / filesystem filled
> >up with the core file.
> >

> If you have root access try:

> su
> cp /dev/null /core
> chmod 0 /core

> That might stop it. By creating a empty core file owned by root and without
> any write access to it the program that dumps core might not be able to
> create a /core file.

> Roland

I'm not sure this would work, as the X server runs as root. However,
you may do something along the lines of:

	% su
	# rm -f /core
	# ln -s /dev/null /core

This doesn't prevent your program (X server?) from dumping core,
however, the dump itself goes into a black hole (remember Decus BH: on
RSX?) and won't bother you anymore.
--
---
Salvador Pinto Abreu	              BITNET/Internet: spa@fctunl.rccn.pt
 +---------------------------------+             UUCP: spa@unl.uucp
 |   Departamento de Informatica   +----------------------------------+
 |   Universidade Nova de Lisboa      2825 Monte Caparica, PORTUGAL   |
 +--------------------------------------------------------------------+

cmaarpc@cc.ic.ac.uk (Peter Churchyard) (06/11/90)

To stop core dumps just 
    ln -s /dev/null /core

Peter Churchyard.

deschamp@seti.inria.fr (Philippe Deschamp) (06/12/90)

   Sorry for the long citations. I'm still a beginner!

In article <IaQKjXq00VRUI0xVYB@andrew.cmu.edu> mikem+@andrew.cmu.edu
(Michael Meyer) writes in substance:
Michael> The X server on my decstation 3100 crashes and drops a LARGE
Michael> core file in /.  I would prefer not to have my / filesystem
Michael> filled up with the core file.

In article <1650@vela.acs.oakland.edu> schemers@vela.acs.oakland.edu
(Roland Schemers III) answers along this line:
Roland> If you have root access try:
Roland> 	su -c 'cp /dev/null /core; chmod 0 /core'
Roland> That might stop it.

In article <SPA.90Jun11125248@hal.fctunl.rccn.pt>, spa@fctunl.rccn.pt
(Salvador Pinto Abreu) responds with:
Salvador> I'm not sure this would work, as the X server runs as root.
Salvador> However, you may do something along the lines of:
Salvador> 	su -c 'rm -f /core; ln -s /dev/null /core'
Salvador> This doesn't prevent your program from dumping core,
Salvador> however, the dump itself goes into a black hole and won't
Salvador> bother you anymore.

   I do not have root access on a DECstation, but I cannot see why the
usual trick of creating a *directory* "/core" would not work:
	su -c 'rm -f /core; mkdir /core'
This should save the CPU the burden of a dump :-)
	time cat /vmunix > /dev/null
	0.0u 1.0s 0:11 9% 51+71+123k(24) 458+1io 0pf+0w
whereas:
	mkdir core; time cat /vmunix > core
	core: Is a directory
	0.0u 0.0s 0:00 100% 0+0+0k(0) 0+0io 0pf+0w
--
					Philippe Deschamp.
Tlx: 697033F   Fax: +33 (1) 39-63-53-30   Tel: +33 (1) 39-63-58-58
Email: deschamp@seti.inria.fr   ||   ...!inria!deschamp
Smail: INRIA, Rocquencourt, BP 105, 78153 Le Chesnay Cedex, France

alan@shodha.dec.com ( Alan's Home for Wayward Notes File.) (06/13/90)

In article <SPA.90Jun11125248@hal.fctunl.rccn.pt>, spa@fctunl.rccn.pt (Salvador Pinto Abreu) writes:

   In response to In article <1650@vela.acs.oakland.edu> 
	schemers@vela.acs.oakland.edu (Roland Schemers III):

	[ Using a 0 mode file to prevent core dumps ]
> 
> > Roland
> 
> I'm not sure this would work, as the X server runs as root. However,
> you may do something along the lines of:
> 
> 	% su
> 	# rm -f /core
> 	# ln -s /dev/null /core
> 
> Salvador Pinto Abreu	              BITNET/Internet: spa@fctunl.rccn.pt


	I tried the 0 mode /core on my DECstation and all it
	did was create a 20KB /core file.  As suspected by
	Salvador root can still write to it.  His suggestion
	of using a symbolic link to /dev/null did work as
	expected.  The program I used to experiment was:

		main()
		{
			abort() ;
		}

	The X11 server shouldn't ever crash and leave core dump.
	Probably what you should do is make a note of all the
	applications running, save the core dump to tape and
	submit an SPR.  You should be running the current version
	of UWS (V2.2 at the moment), but they may still accept
	SPRs on one of the previous versions.
-- 
Alan Rollow				alan@nabeth.enet.dec.com