<?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: Bus error in thread program in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-error-in-thread-program/m-p/2641142#M43686</link>
    <description>Hi&lt;BR /&gt;&lt;BR /&gt;Would help to know&lt;BR /&gt;1)OS&lt;BR /&gt;2)Compiler Version&lt;BR /&gt;3)Patch Level - Certainly shells and libs&lt;BR /&gt;4)Compile options.&lt;BR /&gt;5)The output of&lt;BR /&gt;file core&lt;BR /&gt;on one of the core files generated and the&lt;BR /&gt;exacr=t bus error.&lt;BR /&gt;&lt;BR /&gt;However looking in the latest C++ patches I find&lt;BR /&gt;&lt;BR /&gt;increase maximum string literal length from&lt;BR /&gt; 8 to 32K&lt;BR /&gt;&lt;BR /&gt;You are probably hitting that.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;               Steve Steel</description>
    <pubDate>Wed, 09 Jan 2002 08:22:20 GMT</pubDate>
    <dc:creator>Steve Steel</dc:creator>
    <dc:date>2002-01-09T08:22:20Z</dc:date>
    <item>
      <title>Bus error in thread program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-error-in-thread-program/m-p/2641141#M43685</link>
      <description>Hi, &lt;BR /&gt;&lt;BR /&gt;The following is simple thread program. But it receives Bus erorr and creates core.&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;PTHREAD.H&gt;&lt;BR /&gt;&lt;BR /&gt;#define THREAD_NUM       1&lt;BR /&gt;#define MAX_STRING_SIZE  64 * 1024&lt;BR /&gt;&lt;BR /&gt;void* foo(void* arg) {&lt;BR /&gt;  char data[MAX_STRING_SIZE];&lt;BR /&gt;&lt;BR /&gt;  bzero(data, sizeof(data));&lt;BR /&gt;  return;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int main() {&lt;BR /&gt;  int        i;&lt;BR /&gt;  pthread_t  threadId[16];&lt;BR /&gt;&lt;BR /&gt;  if (THREAD_NUM &amp;gt; 0) {  &lt;BR /&gt;    for (i = 0; i &amp;lt; THREAD_NUM; i++)&lt;BR /&gt;      pthread_create(&amp;amp;threadId[i], NULL, foo, NULL);&lt;BR /&gt;      &lt;BR /&gt;    for (i = 0; i &amp;lt; THREAD_NUM; i++)&lt;BR /&gt;      pthread_join(threadId[i], NULL);&lt;BR /&gt;  }&lt;BR /&gt;  else&lt;BR /&gt;    foo(NULL);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;When I decrese MAX_STRING_SIZE to 32K or run without thread, it runs successfully. How do you think I could resolve this? &lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;/PTHREAD.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Wed, 09 Jan 2002 06:48:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-error-in-thread-program/m-p/2641141#M43685</guid>
      <dc:creator>Sung-hee Kim</dc:creator>
      <dc:date>2002-01-09T06:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: Bus error in thread program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-error-in-thread-program/m-p/2641142#M43686</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Would help to know&lt;BR /&gt;1)OS&lt;BR /&gt;2)Compiler Version&lt;BR /&gt;3)Patch Level - Certainly shells and libs&lt;BR /&gt;4)Compile options.&lt;BR /&gt;5)The output of&lt;BR /&gt;file core&lt;BR /&gt;on one of the core files generated and the&lt;BR /&gt;exacr=t bus error.&lt;BR /&gt;&lt;BR /&gt;However looking in the latest C++ patches I find&lt;BR /&gt;&lt;BR /&gt;increase maximum string literal length from&lt;BR /&gt; 8 to 32K&lt;BR /&gt;&lt;BR /&gt;You are probably hitting that.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;               Steve Steel</description>
      <pubDate>Wed, 09 Jan 2002 08:22:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-error-in-thread-program/m-p/2641142#M43686</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2002-01-09T08:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: Bus error in thread program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-error-in-thread-program/m-p/2641143#M43687</link>
      <description>The excution environment is the follwing.&lt;BR /&gt;&lt;BR /&gt;1)OS: HP-UX 11.0 &lt;BR /&gt;2)Compiler Version: B.11.01.20(C/ANSI C Developer's Bundle for HP-UX 11.00)&lt;BR /&gt;3)Patch Level&lt;BR /&gt; - B.11.00.53.2 HP-UX General Release Patches, June 2001&lt;BR /&gt; - B.11.00.51.2 HP-UX Hardware Enablement and Critical Patches, December 2000 &lt;BR /&gt;4)Compile options. &lt;BR /&gt;  cc -o thr thr.c -lpthread</description>
      <pubDate>Wed, 09 Jan 2002 08:43:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-error-in-thread-program/m-p/2641143#M43687</guid>
      <dc:creator>Sung-hee Kim</dc:creator>
      <dc:date>2002-01-09T08:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Bus error in thread program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-error-in-thread-program/m-p/2641144#M43688</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;If you are missing any of these patches add them&lt;BR /&gt;&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHSS_25171&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHSS_25249&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHCO_25707&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHCO_23963&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHKL_18543&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHCO_23651&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHCO_21187&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHKL_24116&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHKL_24027&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHKL_20016&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHKL_22589&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHKL_23226&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHKL_22677&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHSS_24381&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHSS_24832&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHSS_24301&lt;BR /&gt;hp-ux_patches/s700_800/11.X/PHSS_24303&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Also&lt;BR /&gt;&lt;BR /&gt;What is the exact bus error and the output&lt;BR /&gt;of file core&lt;BR /&gt;&lt;BR /&gt;          Steve Steel</description>
      <pubDate>Wed, 09 Jan 2002 09:14:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-error-in-thread-program/m-p/2641144#M43688</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2002-01-09T09:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Bus error in thread program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-error-in-thread-program/m-p/2641145#M43689</link>
      <description>Thanks the replies.&lt;BR /&gt;&lt;BR /&gt;The output of "&amp;gt; file core" is&lt;BR /&gt;&lt;BR /&gt;core:           core file from 'thr'&lt;BR /&gt;&lt;BR /&gt;But I don't know what "exact bus error" is.&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Jan 2002 09:25:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-error-in-thread-program/m-p/2641145#M43689</guid>
      <dc:creator>Sung-hee Kim</dc:creator>
      <dc:date>2002-01-09T09:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Bus error in thread program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bus-error-in-thread-program/m-p/2641146#M43690</link>
      <description>You've hit the default thread stack size limit, which is 64k as shown by the following program:&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;PTHREAD.H&gt;&lt;BR /&gt;int main() {&lt;BR /&gt;  size_t stacksize;&lt;BR /&gt;  pthread_attr_t attr;&lt;BR /&gt;  pthread_attr_init(&amp;amp;attr);&lt;BR /&gt;  pthread_attr_getstacksize(&amp;amp;attr, &amp;amp;stacksize);&lt;BR /&gt;  printf("stacksize = %d\n", stacksize);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;$ gcc thrstack.c -o thrstack -lpthread&lt;BR /&gt;$ ./thrstack&lt;BR /&gt;stacksize = 65536&lt;BR /&gt;&lt;BR /&gt;- allocate memory off the heap with malloc() instead of using the stack.&lt;BR /&gt;&lt;BR /&gt;- change the default thread stack size attribute with pthread_attr_setstacksize().  Refer to the man page for details.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Steve&lt;/PTHREAD.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Wed, 09 Jan 2002 10:11:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bus-error-in-thread-program/m-p/2641146#M43690</guid>
      <dc:creator>Steven Gillard_2</dc:creator>
      <dc:date>2002-01-09T10:11:58Z</dc:date>
    </item>
  </channel>
</rss>

