[#444] io_write()/fwrite() and EINTR on Solaris — Jos Backus <jos@...>

I am encountering a problem similar to the one mentioned here,

19 messages 2002/09/06
[#453] Re: io_write()/fwrite() and EINTR on Solaris — nobu.nokada@... 2002/09/08

Hi,

[#454] Re: io_write()/fwrite() and EINTR on Solaris — matz@... (Yukihiro Matsumoto) 2002/09/09

Hi

[#469] Re: io_write()/fwrite() and EINTR on Solaris — Jos Backus <jos@...> 2002/09/09

On Mon, Sep 09, 2002 at 03:55:13PM +0900, Yukihiro Matsumoto wrote:

[#479] Re: io_write()/fwrite() and EINTR on Solaris — Jos Backus <jos@...> 2002/09/10

On Tue, Sep 10, 2002 at 01:04:10AM +0900, Jos Backus wrote:

[#492] Re: io_write()/fwrite() and EINTR on Solaris — Jos Backus <jos@...> 2002/09/21

On Wed, Sep 11, 2002 at 02:23:33AM +0900, Jos Backus wrote:

io_write()/fwrite() and EINTR on Solaris

From: Jos Backus <jos@...>
Date: 2002-09-06 03:29:51 UTC
List: ruby-core #444
I am encountering a problem similar to the one mentioned here,

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&th=16d3eb9718c73a88&rnum=1
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&th=ec398d145e0e36c1&rnum=2

except that mine happens with the fwrite() call in io_write(). A script using
two threads occasionally sees an exception being raised when calling IO#puts.
The code in io.c looks like this:

    n = fwrite(RSTRING(str)->ptr, 1, RSTRING(str)->len, f);
    if (n != RSTRING(str)->len && ferror(f)) {
        rb_sys_fail(fptr->path);
    }

How do I fix this? I don't suppose it's possible to wrap the fwrite() call
with TRAP_BEG/ TRAP_END, and if ferror(f) and errno == EINTR or ERESTART, just
ignore the result and skip raising the exception? What do I return from
io_write() in this case?

Fwiw, this is with ruby 1.7.3 (2002-09-03) [sparc-solaris2.8].

Thanks,
-- 
Jos Backus                       _/  _/_/_/      Sunnyvale, CA
                                _/  _/   _/
                               _/  _/_/_/
                          _/  _/  _/    _/
jos at catnook.com        _/_/   _/_/_/          require 'std/disclaimer'

In This Thread

Prev Next