1998Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: Technical C/C++ coding question -->
<!--X-From-R13: Eunja Vnycraal <znynpunvNvanzr.pbz> -->
<!--X-Date: Wed, 17 Jun 1998 08:41:23 &#45;0700 -->
<!--X-Message-Id: 19980617113731.A13544#sun104,humb.nt.com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 19980616164557.01201#divcom,slimy.com -->
<!--X-Reference: Pine.LNX.3.93.980616180310.10713A&#45;100000#the486,bradley.edu -->
<!--X-Reference: 19980616183038.28854#divcom,slimy.com -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, [MUD-Dev] Re: Technical C/C++ coding question</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:malachai#iname,com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg01107.html">Previous</a>
&nbsp;|&nbsp;<a href="msg01109.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg01095.html">Previous</a>
&nbsp;|&nbsp;<a href="msg01110.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#01108">Author</A>
&nbsp;|&nbsp;<A HREF="#01108">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#01108">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] Re: Technical C/C++ coding question</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Subject</em>: [MUD-Dev] Re: Technical C/C++ coding question</LI>
<LI><em>From</em>: Shawn Halpenny &lt;<A HREF="mailto:malachai#iname,com">malachai#iname,com</A>&gt;</LI>
<LI><em>Date</em>: Wed, 17 Jun 1998 11:37:31 -0400</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
On Tue, Jun 16, 1998 at 06:30:38PM -0700, Jon Leonard wrote:
&gt; On Tue, Jun 16, 1998 at 06:20:53PM -0500, Katrina McClelan wrote:
&gt; &gt; On Tue, 16 Jun 1998, Jon Leonard wrote:
&gt; &gt; &gt; On Sun, Jun 14, 1998 at 07:57:38AM -0700, J C Lawrence wrote:
&gt; &gt; &gt; &gt; Katrina McClelan&lt;kitkat#the486,bradley.edu&gt; wrote:
&gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; &gt; 	if(!fork()) { /* child copy starts here */
&gt; &gt; &gt; &gt; &gt;         kill(getpid(),SIGSEGV); /* this'll dump core */ 
&gt; &gt; &gt; &gt; &gt;         sleep(10); /* make sure it stops here */ 
&gt; &gt; &gt; &gt; &gt;         /* dead by here */ 
&gt; &gt; &gt; &gt; &gt;       }
&gt; &gt; &gt; &gt; &gt; 	/* parent continues unaware */
&gt; &gt; &gt; &gt; 
&gt; &gt; &gt; If I read the code right, the sleep is in the child, to keep the child
&gt; &gt; &gt; from executing additional parent code.  I'd include an exit() after the
&gt; &gt; &gt; sleep, so that if the kill doesn't work (SIGSEGV blocked?), the child
&gt; &gt; &gt; doesn't do any damage.
&gt; &gt; 
&gt; &gt; This is probably good.... the code I submitted was not meant (in my mind) 
&gt; &gt; to be fail safe.  The exit makes sure the child does no damage and is thus
&gt; &gt; good.  It's not really elegant, but then how elegant can you be when
&gt; &gt; you're trying to dump core ;)?  I assume this is only a tool and not going
&gt; &gt; to be a part of the finished server?  Even if it is, Ben can figure out
&gt; &gt; how to make it "perfect" from there.  SIGSEGV can be blocked, but
&gt; &gt; shouldn't be.  Actually I think the sleep is unneeded since the child
&gt; &gt; kills itself which is executed linear, so kill won't return until the
&gt; &gt; signal is sent and received thus killing the process in kill().  The exit
&gt; &gt; should be used incase kill fails. 

&lt;&lt;this is the second of Kat's MUD-dev responses to
this thread which I haven't received, so the threading of this message
will be somewhat borked--local mail delivery problems I think&gt;&gt;

&lt;&lt;JCL:  When I searched the archives (on 6/17/98, 11am EDT) for the missing
messages, the dates given in the result list were all June, 1998--the dates
the messages were indexed, I assume).  Would it be possible to have the
date the message was posted appear in the result list instead?

[ Responding to Kat's post ]

It is best not to rely on when the SIGSEGV will actually be handled in the
child (unless perhaps on a single OS with which you are familiar with the
kernel).  You are right that the sleep() is not necessary, but there needs
to be something in place there (I agree it should be pause() ) so that the
next signal to the child will continue processing.  After the pause(), do
your exit().  Mind you, like Jon Leonard said, abort() was made for things
like this and dispenses with the explicit use of kill() entirely.

Note that depending on your OS it may be possible to externally generate a core
image of a running process (and leave it running) using the gcore utility.

-- 
Shawn Halpenny

I know that you believe you understand what you think I said, but,
I am not sure you realize that what you heard is not what I meant.  


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="01224" HREF="msg01224.html">[MUD-Dev] Re: Technical C/C++ coding question</A></strong>
<ul compact><li><em>From:</em> J C Lawrence &lt;claw#under,engr.sgi.com&gt;</li></ul>
<li><strong><A NAME="01110" HREF="msg01110.html">[MUD-Dev] Re: Technical C/C++ coding question</A></strong>
<ul compact><li><em>From:</em> Shawn Halpenny &lt;malachai#iname,com&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="01088" HREF="msg01088.html">[MUD-Dev] Re: Technical C/C++ coding question</A></STRONG>
<UL><LI><EM>From:</EM> Jon Leonard &lt;jleonard#divcom,slimy.com&gt;</LI></UL></LI>
<LI><STRONG><A NAME="01089" HREF="msg01089.html">[MUD-Dev] Re: Technical C/C++ coding question</A></STRONG>
<UL><LI><EM>From:</EM> Katrina McClelan &lt;kitkat#the486,bradley.edu&gt;</LI></UL></LI>
<LI><STRONG><A NAME="01091" HREF="msg01091.html">[MUD-Dev] Re: Technical C/C++ coding question</A></STRONG>
<UL><LI><EM>From:</EM> Jon Leonard &lt;jleonard#divcom,slimy.com&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg01107.html">[MUD-Dev] Re: stuff that makes me leave</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg01109.html">[MUD-Dev] ADMIN: OS Wars</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg01095.html">[MUD-Dev] Re: Technical C/C++ coding question</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg01110.html">[MUD-Dev] Re: Technical C/C++ coding question</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#01108"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#01108"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>[MUD-Dev] Re: Technical C/C++ coding question</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<LI><strong><A NAME="01089" HREF="msg01089.html">[MUD-Dev] Re: Technical C/C++ coding question</A></strong>, 
Katrina McClelan <a href="mailto:kitkat#the486,bradley.edu">kitkat#the486,bradley.edu</a>, Wed 17 Jun 1998, 00:34 GMT
<UL>
<LI><strong><A NAME="01091" HREF="msg01091.html">[MUD-Dev] Re: Technical C/C++ coding question</A></strong>, 
Jon Leonard <a href="mailto:jleonard#divcom,slimy.com">jleonard#divcom,slimy.com</a>, Wed 17 Jun 1998, 01:36 GMT
<UL>
<LI><strong><A NAME="01092" HREF="msg01092.html">[MUD-Dev] Re: Technical C/C++ coding question</A></strong>, 
Katrina McClelan <a href="mailto:kitkat#the486,bradley.edu">kitkat#the486,bradley.edu</a>, Wed 17 Jun 1998, 01:50 GMT
</LI>
<LI><strong><A NAME="01095" HREF="msg01095.html">[MUD-Dev] Re: Technical C/C++ coding question</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Wed 17 Jun 1998, 03:00 GMT
</LI>
<LI><strong><A NAME="01108" HREF="msg01108.html">[MUD-Dev] Re: Technical C/C++ coding question</A></strong>, 
Shawn Halpenny <a href="mailto:malachai#iname,com">malachai#iname,com</a>, Wed 17 Jun 1998, 15:41 GMT
<UL>
<LI><strong><A NAME="01110" HREF="msg01110.html">[MUD-Dev] Re: Technical C/C++ coding question</A></strong>, 
Shawn Halpenny <a href="mailto:malachai#iname,com">malachai#iname,com</a>, Wed 17 Jun 1998, 15:53 GMT
</LI>
<LI><strong><A NAME="01224" HREF="msg01224.html">[MUD-Dev] Re: Technical C/C++ coding question</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Fri 26 Jun 1998, 21:38 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</LI>
<LI><strong><A NAME="00932" HREF="msg00932.html">[MUD-Dev] Nested Coordinate spaces.</A></strong>, 
Elis Pomales <a href="mailto:pomales#caip,rutgers.edu">pomales#caip,rutgers.edu</a>, Wed 10 Jun 1998, 18:17 GMT
<UL>
<LI><strong><A NAME="01140" HREF="msg01140.html">[MUD-Dev] Re: Nested Coordinate spaces.</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Fri 19 Jun 1998, 17:22 GMT
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>