Discussion:
select: Interrupted system call
Gerald Waugh
2002-04-27 15:04:07 UTC
Permalink
I am attempting to run a program that manages several tcp/ip connections
It runs for a while then I get the subject error, also below
select: Interrupted system call
I think it may be because I am not handling any signals.
How do I fix it? Asn which signals should I be catching?
TIA
--
Gerald Waugh : Registered Linux user # 255245
http://www.frontstreetnetworks.com
Front Street Networks LLC - ph. 203.785.0699
229 Front Street, Ste. #C, New Haven, CT, United States of America
11:01am up 36 days, 18:28, 3 users, load average: 1.09, 1.18, 1.14
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Glynn Clements
2002-04-27 15:28:35 UTC
Permalink
Post by Gerald Waugh
I am attempting to run a program that manages several tcp/ip connections
It runs for a while then I get the subject error, also below
select: Interrupted system call
I think it may be because I am not handling any signals.
select() returns EINTR if a signal is caught and handled. If a signal
is caught but not handled, it will either do nothing, or terminate the
process, depending upon the signal.
Post by Gerald Waugh
How do I fix it?
If select() indicates an error, check whether it is EINTR. If it is,
ignore it. Alternatively, you can block the signal (with sigprocmask())
for the duration of the call to select().
--
Glynn Clements <***@virgin.net>
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Gerald Waugh
2002-04-27 20:37:24 UTC
Permalink
+ #include <errno.h>
rdsocks = select(hs+1, &socks, (fd_set *) 0,
(fd_set *) 0, &timeout);
- if (rdsocks < 0) {
+ if (rdsocks < 0 && errno != EINTR) {
perror("select");
continue;
// exit(EXIT_FAILURE);
}
I commented out the exit(EXIT_FAILURE); and added continue;
but I still get " select: Interrupted system call ", it keeps running
and managing the connections...
Seems like I should be able to find out whats causing it,
Interrupted system call Does not seem to tell me much.
You should handle this case rather than trying to prevent it.
Prevention is fragile; if the program is subsequently changed to catch
a new signal (possibly via a library function), the problem will
re-appear.
Handling this case will ensure that the program is robust. Terminating
due to transient errors isn't a good idea.
I was testing to see if I could keep it going, I did similar to your
suggestion:
Only I did if (rdsocks < 0 && rdsocks != EINTR) {
And I was still getting a printout of " select: Interrupted system call "
Now I'll try
if (rdsocks < 0 && errno != EINTR) {

I would really like to know why select()
gets that Interrupted system call
--
Gerald Waugh : Registered Linux user # 255245
http://www.frontstreetnetworks.com
Front Street Networks LLC - ph. 203.785.0699
229 Front Street, Ste. #C, New Haven, CT, United States of America
4:32pm up 36 days, 23:59, 3 users, load average: 0.80, 1.14, 1.27
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Glynn Clements
2002-04-27 23:20:16 UTC
Permalink
Post by Gerald Waugh
I would really like to know why select()
gets that Interrupted system call
If you have "strace", that should show which signal is being caught.
--
Glynn Clements <***@virgin.net>
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Continue reading on narkive:
Loading...