interrupted system call on "poll"

interrupted system call on "poll"

Post by naomi avigdo » Sat, 26 Aug 2000 04:00:00



hi,

I get -1 (minus 1) returned from a poll call to my network. the
errno is "Interrupted system call".

can some one tell me please what causes this kind of an error?

here is the code:

            ufds.fd = mySocket;
            ufds.events = POLLIN;
            nfds = 1;

            /* timeout needs to be in ms */
            n = poll(&ufds, nfds, (msTimeout));
            if (n == -1)
            {
                fprintf(stderr, " (%s)\n", sys_errlist[errno]);
            }

thank you,
naomi avigdor

 
 
 

interrupted system call on "poll"

Post by Wallace Owe » Mon, 28 Aug 2000 04:00:00


It's not an 'error' as such.  Well, they return -1 but if you read
the man page, you'll see that what this means is that a signal was
caught by the app.  This is the right way to get unstuck from a poll
call to be informed that, for example, the socket you're waiting to
read from was closed at the other end, or that some other signal
wants your attention.  If the poll call didn't return you'd never
get a chance to service that signal.  If it's unrelated to the socket
you're polling, then loop back and poll again.  If it's not the inter-
rupted system call errno it's a real error.

Read "Advanced Programming in the Unix Environment" by W. Richard
Stevens - It explains all this very well.

  // Wally


> hi,

> I get -1 (minus 1) returned from a poll call to my network. the
> errno is "Interrupted system call".

> can some one tell me please what causes this kind of an error?

> here is the code:

>             ufds.fd = mySocket;
>             ufds.events = POLLIN;
>             nfds = 1;

>             /* timeout needs to be in ms */
>             n = poll(&ufds, nfds, (msTimeout));
>             if (n == -1)
>             {
>                 fprintf(stderr, " (%s)\n", sys_errlist[errno]);
>             }

> thank you,
> naomi avigdor


 
 
 

interrupted system call on "poll"

Post by maverick6.. » Sun, 03 Sep 2000 05:11:41


This is exactly my problem, too. Could somebody
please give me a brief solution for that.
The only difference of my program and this one is
that I'm use "read" function.
I have tried to ignore this 'error' and read
again,
but after several tries, the socket goes dead.

Thanks a lot.



Quote:> It's not an 'error' as such.  Well, they

return -1 but if you read
Quote:> the man page, you'll see that what this means

is that a signal was
Quote:> caught by the app.  This is the right way to

get unstuck from a poll
Quote:> call to be informed that, for example, the

socket you're waiting to
Quote:> read from was closed at the other end, or that
some other signal
> wants your attention.  If the poll call didn't
return you'd never
> get a chance to service that signal.  If it's

unrelated to the socket
Quote:> you're polling, then loop back and poll again.

If it's not the inter-
Quote:> rupted system call errno it's a real error.

> Read "Advanced Programming in the Unix

Environment" by W. Richard
> Stevens - It explains all this very well.

>   // Wally


> > hi,

> > I get -1 (minus 1) returned from a poll call
to my network. the
> > errno is "Interrupted system call".

> > can some one tell me please what causes this
kind of an error?

> > here is the code:

> >             ufds.fd = mySocket;
> >             ufds.events = POLLIN;
> >             nfds = 1;

> >             /* timeout needs to be in ms */
> >             n = poll(&ufds, nfds,
(msTimeout));
> >             if (n == -1)
> >             {
> >                 fprintf(stderr, " (%s)\n",

sys_errlist[errno]);

Quote:> >             }

> > thank you,
> > naomi avigdor

Sent via Deja.com http://www.deja.com/
Before you buy.