<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Catching signals sent by OS to the process in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/catching-signals-sent-by-os-to-the-process/m-p/3104997#M717604</link>
    <description>Shashi,&lt;BR /&gt;  Let me compensate for my previous response.&lt;BR /&gt;&lt;BR /&gt;  Attached is the file.  This is for SIGSEGV.  Uncomment the other half for SIGBUS.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Umapathy</description>
    <pubDate>Wed, 29 Oct 2003 06:12:39 GMT</pubDate>
    <dc:creator>Umapathy S</dc:creator>
    <dc:date>2003-10-29T06:12:39Z</dc:date>
    <item>
      <title>Catching signals sent by OS to the process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/catching-signals-sent-by-os-to-the-process/m-p/3104994#M717601</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I want to execute some code when a SIGSEGV/SIGBUS is sent by OS to my process.&lt;BR /&gt;&lt;BR /&gt;I have written the attached code(gencatchsignal.C) to do this:&lt;BR /&gt;&lt;BR /&gt;I compile it using aCC on HP-UX 11i as:&lt;BR /&gt;aCC -g gencatchsignal.C -lpthread&lt;BR /&gt;&lt;BR /&gt;The line 33: "*str_tok_end    = '\0';" generates a SIGBUS error.&lt;BR /&gt;But the application immediately dumps the core.&lt;BR /&gt;&lt;BR /&gt;I had expected that the function: Signalhandler_SIGBUS which is configured to handle SIGBUS should get invoked.&lt;BR /&gt;&lt;BR /&gt;Can anyone please suggest a way for me to handle this SIGBUS signal.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Shashibhushan Gokhale&lt;BR /&gt;***********************************************&lt;BR /&gt;PS:&lt;BR /&gt;Actually I want to implement this for a SIGSEGV, but am facing the following problem. I understand that if I generate SIGSEGV using the following code snippet(which I got from Elmar in response to my earlier question):&lt;BR /&gt;&lt;BR /&gt;int main(int argc, char** argv)&lt;BR /&gt;{   int i;&lt;BR /&gt;    for (i =0; ; i++)&lt;BR /&gt;    argv[1] = argv[i];&lt;BR /&gt;}&lt;BR /&gt;The system stack gets exhausted and hence SignalHandler cannot be loaded.&lt;BR /&gt;&lt;BR /&gt;Hence have taken this example of SIGBUS.&lt;BR /&gt;&lt;BR /&gt;It would be fantastic if someone can generate and then catch a SIGSEGV(The function SignalHandler_SIGSEGV should get called) in my program.</description>
      <pubDate>Wed, 29 Oct 2003 04:24:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/catching-signals-sent-by-os-to-the-process/m-p/3104994#M717601</guid>
      <dc:creator>Shashibhushan Gokhale</dc:creator>
      <dc:date>2003-10-29T04:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Catching signals sent by OS to the process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/catching-signals-sent-by-os-to-the-process/m-p/3104995#M717602</link>
      <description>I can't test this as I don't have aCC, but isn't is simply that you have not yet called your signalhandlers at the point you generate the violation ?&lt;BR /&gt;&lt;BR /&gt;ie if you copy the 2 calls to &lt;BR /&gt;&lt;BR /&gt;   signal(SIGBUS,SignalHandler_SIGBUS) ;&lt;BR /&gt;   signal(SIGSEGV,SignalHandler_SIGSEGV) ;&lt;BR /&gt;&lt;BR /&gt;to the first executable lines of main(), then you will arm the signal handlers in time and the signal will be trapped.&lt;BR /&gt;&lt;BR /&gt;-- Graham</description>
      <pubDate>Wed, 29 Oct 2003 05:20:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/catching-signals-sent-by-os-to-the-process/m-p/3104995#M717602</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-10-29T05:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Catching signals sent by OS to the process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/catching-signals-sent-by-os-to-the-process/m-p/3104996#M717603</link>
      <description>Strange... I have it compiled using gcc, after some simple altering (cout construct you use doesn't compile in gcc, iostream.h is not available, interupthandler needs a parameter name) and it does exactly what you want: end in the SEGV routine.&lt;BR /&gt;&lt;BR /&gt;At first I tried setting the signal function calls before creating the pthread, but that is not necessary. But perhaps it is in your aCC to make sure that this is set before you generate the signal. I am not sure if the interupthandler is called before the thread is started, you see.&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Oct 2003 05:20:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/catching-signals-sent-by-os-to-the-process/m-p/3104996#M717603</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2003-10-29T05:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Catching signals sent by OS to the process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/catching-signals-sent-by-os-to-the-process/m-p/3104997#M717604</link>
      <description>Shashi,&lt;BR /&gt;  Let me compensate for my previous response.&lt;BR /&gt;&lt;BR /&gt;  Attached is the file.  This is for SIGSEGV.  Uncomment the other half for SIGBUS.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Umapathy</description>
      <pubDate>Wed, 29 Oct 2003 06:12:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/catching-signals-sent-by-os-to-the-process/m-p/3104997#M717604</guid>
      <dc:creator>Umapathy S</dc:creator>
      <dc:date>2003-10-29T06:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Catching signals sent by OS to the process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/catching-signals-sent-by-os-to-the-process/m-p/3104998#M717605</link>
      <description>ok, compiled it on aCC 03.33 (11.00)&lt;BR /&gt;with warnings (ignorable)&lt;BR /&gt;&lt;BR /&gt;Warning 829: "sign.c", line 29 # Implicit conversion of string literal to&lt;BR /&gt;    'char *' is deprecated.&lt;BR /&gt;            txt_ErrMsg = "TEST DATA";&lt;BR /&gt;            ^^^^^^^^^^^              &lt;BR /&gt;Warning 829: "sign.c", line 15 # Implicit conversion of string literal to&lt;BR /&gt;    'char *' is deprecated.&lt;BR /&gt;            char *name="SHASHI";&lt;BR /&gt;                       ^^^^^^^^ &lt;BR /&gt;Warning 361: "sign.c", line 37 # Value-returning function might end without&lt;BR /&gt;    executing a return statement.&lt;BR /&gt;    void* interruptHandler(void*)&lt;BR /&gt;&lt;BR /&gt;executable fails with pthread_create failed with error code:251Exiting...&lt;BR /&gt;&lt;BR /&gt;....didn't check libc,pthread,aCC patches.</description>
      <pubDate>Wed, 29 Oct 2003 07:38:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/catching-signals-sent-by-os-to-the-process/m-p/3104998#M717605</guid>
      <dc:creator>Zeev Schultz</dc:creator>
      <dc:date>2003-10-29T07:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Catching signals sent by OS to the process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/catching-signals-sent-by-os-to-the-process/m-p/3104999#M717606</link>
      <description>Shahi,&lt;BR /&gt;   I've not used pthread see if its ok with you,&lt;BR /&gt;==============================&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;MALLOC.H&gt;&lt;BR /&gt;#include &lt;STRING.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;&lt;BR /&gt;void hndl_sgnl(int);&lt;BR /&gt;int main(int argc,char **argv)&lt;BR /&gt;{&lt;BR /&gt;   signal(SIGSEGV,hndl_sgnl);&lt;BR /&gt;&lt;BR /&gt;   for (int i =0;i &amp;lt; 40 ; i++)&lt;BR /&gt;   {&lt;BR /&gt;      argv[1] = *(argv + i);&lt;BR /&gt;      printf("\n %s\n",argv[1]);&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;   printf("\n Oops ! Didn't do it \n");&lt;BR /&gt;&lt;BR /&gt;   return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;void hndl_sgnl(int sgnl)&lt;BR /&gt;{&lt;BR /&gt;   printf("\n Recvd &amp;lt;%d&amp;gt; signal\n",sgnl);&lt;BR /&gt;   printf("\n Carry out cleaning activity and then exit\n");&lt;BR /&gt;   exit(-1);&lt;BR /&gt;}&lt;BR /&gt;===================================&lt;/STDLIB.H&gt;&lt;/STRING.H&gt;&lt;/MALLOC.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Sun, 09 Nov 2003 00:11:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/catching-signals-sent-by-os-to-the-process/m-p/3104999#M717606</guid>
      <dc:creator>yogiraj</dc:creator>
      <dc:date>2003-11-09T00:11:21Z</dc:date>
    </item>
  </channel>
</rss>

