V
vamsi
Hi,
I have a program, where involves creation of a thread with stack size
of 16k(minimum stack size). There is an fprintf statement in the
created thread code.
I see that there is a core dump occuring at fprintf.
code snippet :
*********************************************************************************
#include<pthread.h>
#include<stdlib.h>
#include<stdio.h>
void func(void *);
#define OUTSTREAM stderr
pthread_attr_t attr;
main()
{
pthread_t p[10];
void *exitstatus;
int i;
pthread_attr_init(&attr);
if(pthread_attr_setstacksize (&attr,16ul * 1024ul))
{
printf("\n\n\nfailed to set stack size");
}
pthread_create(&p,&attr,func,NULL);
sleep(1000);
}
void func(void *ptr)
{
int i ;
char str[100];
fprintf(OUTSTREAM," FIRST :: Thread Created and here is fprintf
\n");
}
core dump trace in gdb:
Starting program: /users/a21313/fprintf/ftest_clean
[Thread debugging using libthread_db enabled]
[New Thread -1208084800 (LWP 32021)]
[New Thread -1207960656 (LWP 32024)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1207960656 (LWP 32024)]
0x008d1b06 in buffered_vfprintf () from /lib/tls/libc.so.6
(gdb) bt
#0 0x008d1b06 in buffered_vfprintf () from /lib/tls/libc.so.6
#1 0x008d1deb in vfprintf () from /lib/tls/libc.so.6
#2 0x008da40f in fprintf () from /lib/tls/libc.so.6
#3 0x080485b0 in func (ptr=0x0) at fprintf_thread_clean.c:28
#4 0x00ade341 in start_thread () from /lib/tls/libpthread.so.0
#5 0x0095efee in clone () from /lib/tls/libc.so.6
*********************************************************************************
If i change stderr to stdout. the fprintf does not dump core.
OS used : Linux 2.6.9-11.ELsmp
Please help me.
Thanks in advance
Vamsi
I have a program, where involves creation of a thread with stack size
of 16k(minimum stack size). There is an fprintf statement in the
created thread code.
I see that there is a core dump occuring at fprintf.
code snippet :
*********************************************************************************
#include<pthread.h>
#include<stdlib.h>
#include<stdio.h>
void func(void *);
#define OUTSTREAM stderr
pthread_attr_t attr;
main()
{
pthread_t p[10];
void *exitstatus;
int i;
pthread_attr_init(&attr);
if(pthread_attr_setstacksize (&attr,16ul * 1024ul))
{
printf("\n\n\nfailed to set stack size");
}
pthread_create(&p,&attr,func,NULL);
sleep(1000);
}
void func(void *ptr)
{
int i ;
char str[100];
fprintf(OUTSTREAM," FIRST :: Thread Created and here is fprintf
\n");
}
core dump trace in gdb:
Starting program: /users/a21313/fprintf/ftest_clean
[Thread debugging using libthread_db enabled]
[New Thread -1208084800 (LWP 32021)]
[New Thread -1207960656 (LWP 32024)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1207960656 (LWP 32024)]
0x008d1b06 in buffered_vfprintf () from /lib/tls/libc.so.6
(gdb) bt
#0 0x008d1b06 in buffered_vfprintf () from /lib/tls/libc.so.6
#1 0x008d1deb in vfprintf () from /lib/tls/libc.so.6
#2 0x008da40f in fprintf () from /lib/tls/libc.so.6
#3 0x080485b0 in func (ptr=0x0) at fprintf_thread_clean.c:28
#4 0x00ade341 in start_thread () from /lib/tls/libpthread.so.0
#5 0x0095efee in clone () from /lib/tls/libc.so.6
*********************************************************************************
If i change stderr to stdout. the fprintf does not dump core.
OS used : Linux 2.6.9-11.ELsmp
Please help me.
Thanks in advance
Vamsi