Bug 118626

Summary: Bad interaction between SIGPIPE and threads.
Product: Base System Reporter: marka
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 6.3-PRERELEASE   
Hardware: Any   
OS: Any   

Description marka 2007-12-12 21:20:01 UTC
	SIGPIPE is a crude mechanism and we really should have a
	way to turn this on and off on a per file descriptor basis
	especially in threaded applications where you can't just
	ignore the signal for specific writes like you would for
	a unthreaded application.

	The resolver library, and I presume other sockets based
	libraries, need to be able to disable SIGPIPE for specific
	writes yet still have the application fail when writes to
	stdout fail because the application has not caught SIGPIPE.
Comment 1 David Schultz freebsd_committer freebsd_triage 2007-12-12 22:20:09 UTC
Have you tried the SO_NOSIGPIPE option to setsockopt()?
It's designed for exactly the sort of thing you describe,
although I'm given to believe that it only works with
send*() and not write().
Comment 2 Mark Andrews 2007-12-13 00:41:16 UTC
I'll definitely try it.

The man page for socket(2) should be updated to reference SO_NOSIGPIPE
where it talks about SIGPIPE being generated.
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2008-01-14 06:44:47 UTC
State Changed
From-To: open->feedback

To submitter: did the suggestion fix the problem?
Comment 4 Remko Lodder freebsd_committer freebsd_triage 2008-01-14 07:59:59 UTC
State Changed
From-To: feedback->closed

submitter replies that this had been resolved
Comment 5 Mark Linimon 2008-07-02 03:39:17 UTC
----- Forwarded message from David Schultz <das@FreeBSD.ORG> -----

From: David Schultz <das@FreeBSD.ORG>
To: Mark Andrews <Mark_Andrews@isc.org>, freebsd-bugs@FreeBSD.ORG

On Fri, Dec 14, 2007, Mark Andrews wrote:
> It's documented in setsockopt(2).  It just also needs to be documented
> in socket(2).

I added a note to the socket(2) manpage. Better late than never.

----- End forwarded message -----