errno pb

Hello,

I need to make a lib with pthread, when I run my make file all is good. But when I run my test program, I test errno in the begining and is already set to 251. Is it normal ??? What can I modify in my Makefile to have errno set to 0 ???

Thanks

$make
gcc -D_REENTRANT -shared -fpic -lpthread gas_configuration.c gas_acquisition.c -o libgas_fifos.sl
gcc -L. -lgas_fifos testComm.c -o test
$./test
Begin
errno : 251
$

I need to test errno to know if my recvfrom return EAGAIN.

my code :

retour = recvfrom(t_sockets[indice].socket, payload, FRAME_LENGTH, O_NONBLOCK, &t_sockets[indice].sin_remote, &size_addr);
if(retour >= 0)
{
.......
}
else
{
     printf("errno %d\n", errno);
     if(errno != EAGAIN)
     {
          perror("Error in recvfrom");
     }
}

How can I correct the problem ??

Thanks for your help.

11

Error in recvfrom: Resource temporarily unavailable

I have resolved my problem. I use Multi-threaded and I have gorget the option with gcc :
-D_REENTRANT

Thankes for your help