i am creating a thread that will captures packets and will store some information in a structure "flow" for each packet. i am using static array of "flow" type structures. but when i run the program it retuns SIGSEGV error. here's the structure "flow":
typedef struct flow
{
unsigned int s_port;
unsigned int d_port;
char s_addr[20];
char d_addr[20];
int spi;
short total;
short data[10000];
struct timeval prev_t;
double ipt[10000];
flowParam info;
char status[100];
}flow;
note that flowParam is another structure whose object info is included in "flow". i also run program by commenting it but got same result...
and here's the main program:
int main()
{
pthread_t tid;
int err = pthread_create(&tid, NULL, Capture, NULL);
if (err != 0){
perror("\ncan't create capturing thread");
exit(-1);
}
else
printf("\nCapturing thread created!\n");
pthread_join(tid, NULL);
printf("Finished!!");
return 0;
}
void* Capture()
{
flow Register[5000]; /* flow Register */
//counter Counter[5000];
pthread_exit(NULL);
}
interestingly, when i use another structure "counter" and make its array in thread, it does not give such error.
typedef struct counter
{
char s_addr[20];
char d_addr[20];
}counter;
i tried to my best to solve this issue but could not find any clue.any help???