Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Oct 2009 13:53:55 -0400
From:      "Mikhail T." <mi+thun@aldan.algebra.com>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        stable@FreeBSD.org
Subject:   Re: Can close-ing a pipe trigger a SIGPIPE?
Message-ID:  <4ADA04B3.1000704@aldan.algebra.com>
In-Reply-To: <20091017172718.GJ2160@deviant.kiev.zoral.com.ua>
References:  <4AD9F4ED.2050002@aldan.algebra.com> <20091017172718.GJ2160@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
Kostik Belousov ΞΑΠΙΣΑΧ(ΜΑ):
> Take ktrace of both parent and child.
>   
I can see the curious piece right here:

The child exits:

 92723 tclsh8.5 CALL  exit(0)

The parent masks SIGPIPE (as part of my workaround):

 92722 tclsh8.5 CALL  sigaction(SIGPIPE,0x7fffffffa9e0,0)
 92722 tclsh8.5 RET   sigaction 0

This 0-size write must be part of the pipe-closing -- descriptors 4 and
5 must be the pipe's:

 92722 tclsh8.5 CALL  write(0x4,0x800e24028,0)
 92722 tclsh8.5 RET   write -1 errno 32 Broken pipe
 92722 tclsh8.5 PSIG  SIGPIPE caught handler=0x800f126d0 mask=0x0 code=0x0
 92722 tclsh8.5 CALL  sigreturn(0x7fffffffa0c0)
 92722 tclsh8.5 RET   sigreturn JUSTRETURN
 92722 tclsh8.5 CALL  close(0x5)
 92722 tclsh8.5 RET   close 0
 92722 tclsh8.5 CALL  close(0x4)
 92722 tclsh8.5 RET   close 0

Why would it write 0 bytes? Is doing so triggering a SIGPIPE now -- but,
perhaps, didn't use to?

Thanks!

    -mi




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4ADA04B3.1000704>