Re: [AD] errno = EINTR troubles - any unix experts?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 15 September 2002 15:13, Elias Pschernig wrote:
[snip]
> I read the libc section on EINTR, but i'm not sure what it means. And
> if there's really a problem, it probably doesn't effect only
> datafiles, but all stdio functions. Should a check for EINTR added to
> all stdio functions in the packfile routines, and set errno to 0 if
> it sees EINTR?

I know about EINTR, but not how it relates to Allegro.

An EINTR error occurs when you make a system call (in your case, this 
will be in one of the POSIX functions such as 'open', 'write', etc), 
and during execution of that call, the process receives a signal (such 
as SIGALARM).

I'm not sure why, but POSIX states that the system call is aborted and 
must be restarted. The error value of the system call is EINTR. Under 
BSD, the system call is restarted automatically, so EINTR doesn't exist 
there.

There are some solutions to this problem: you can wrap all your system 
calls in code such as:

do { errno = 0; system_call(); } while(errno = EINTR);
(nothing wrong with that, but cumbersome)

You can block signals, which might or might not be a good solution. And 
you can also (under glibc) specify in your signal handlers that you 
want them to restart any system calls when they exit.

Sorry, but I don't know if Allegro does any of the above, or why you are 
getting such problems and yet nobody else is reporting them. OTOH, I'm 
sure I remember somebody posting about this issue before, so maybe you 
could search the list archives for the users list and failing that bug 
someone like Peter who has kept many mails from this list :-)

Bye for now,
- -- 
Laurence Withers,  lwithers@xxxxxxxxxx
(GnuPG 04A646EA) http://www.lwithers.demon.co.uk/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9hPbEUdhclgSmRuoRAmH+AJ9YwGcOpLg91iYwSLO9n9i8IbFXdQCfeaNL
aDvsO6nOswLa7CYTS0lhG7I=
=ZLAj
-----END PGP SIGNATURE-----



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/