From owner-freebsd-questions@FreeBSD.ORG Wed Mar 5 22:04:14 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A685C1065672 for ; Wed, 5 Mar 2008 22:04:14 +0000 (UTC) (envelope-from derek@computinginnovations.com) Received: from betty.computinginnovations.com (mail.computinginnovations.com [64.81.227.250]) by mx1.freebsd.org (Postfix) with ESMTP id 567948FC2B for ; Wed, 5 Mar 2008 22:04:13 +0000 (UTC) (envelope-from derek@computinginnovations.com) Received: from p28.computinginnovations.com (dhcp-10-20-30-100.computinginnovations.com [10.20.30.100]) (authenticated bits=0) by betty.computinginnovations.com (8.14.2/8.13.8) with ESMTP id m25M3jjZ098555; Wed, 5 Mar 2008 16:03:45 -0600 (CST) (envelope-from derek@computinginnovations.com) Message-Id: <6.0.0.22.2.20080305155857.025bbe98@mail.computinginnovations.com> X-Sender: derek@mail.computinginnovations.com X-Mailer: QUALCOMM Windows Eudora Version 6.0.0.22 Date: Wed, 05 Mar 2008 16:03:27 -0600 To: Martin McCormick , freebsd-questions@freebsd.org From: Derek Ragona In-Reply-To: <200803052126.m25LQX7J035593@m.it.okstate.edu> References: <200803052126.m25LQX7J035593@m.it.okstate.edu> Mime-Version: 1.0 X-ComputingInnovations-MailScanner-Information: Please contact the ISP for more information X-ComputingInnovations-MailScanner: Found to be clean X-ComputingInnovations-MailScanner-From: derek@computinginnovations.com X-Spam-Status: No Content-Type: text/plain; charset="us-ascii"; format=flowed X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: SIGHUP and Program Flow in a 6.2 Application X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Mar 2008 22:04:14 -0000 At 03:26 PM 3/5/2008, Martin McCormick wrote: > A SIGHUP signal to a running process needs a signal >handler like > >signal( SIGHUP ,startlogging); > > What sort of end statement needs to be in the function >called to allow program execution to resume back in the main >caller? > > I had put a return; statement in the function and >noticed that things were wrong after the application stopped >catching the SIGHUP after the first call. > > A gdb trace shows that the signal causes a branch to the >code pointed to by the signal statement. The code runs and then >if it reaches the return; statement, the flow is lost and knows >not where to go next. > > Thank you. > > >Martin McCormick WB5AGZ Stillwater, OK >Systems Engineer >OSU Information Technology Department Network Operations Group Nothing needs to be in your handler function to continue running simply return from your function. However, depending on the signal you may wish to call the original signal handler. Signals like interrupts are chained linked lists of handlers. You can choose to break the chain, and have only your handler called, or keep the chain intact calling the other handlers. Read the man page on signal for more information. -Derek -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.