From owner-freebsd-net@FreeBSD.ORG Thu Mar 1 20:33:46 2007 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4CAE916A400 for ; Thu, 1 Mar 2007 20:33:46 +0000 (UTC) (envelope-from njm@njm.f2s.com) Received: from outmail1.freedom2surf.net (outmail1.freedom2surf.net [194.106.33.237]) by mx1.freebsd.org (Postfix) with ESMTP id 07B8313C471 for ; Thu, 1 Mar 2007 20:33:46 +0000 (UTC) (envelope-from njm@njm.f2s.com) Received: from ariel.njm.f2s.com (i-195-137-21-170.freedom2surf.net [195.137.21.170]) by outmail1.freedom2surf.net (Postfix) with ESMTP id C5A1656CD3 for ; Thu, 1 Mar 2007 20:00:36 +0000 (GMT) Received: from ariel.njm.f2s.com (localhost.njm.f2s.com [127.0.0.1]) by ariel.njm.f2s.com (8.13.8/8.13.8) with ESMTP id l21K0Z9l011061 for ; Thu, 1 Mar 2007 20:00:35 GMT (envelope-from njm@ariel.njm.f2s.com) Received: (from njm@localhost) by ariel.njm.f2s.com (8.13.8/8.13.8/Submit) id l21K0ZbL011060 for freebsd-net@freebsd.org; Thu, 1 Mar 2007 20:00:35 GMT (envelope-from njm) Date: Thu, 1 Mar 2007 20:00:35 +0000 From: "N.J. Mann" To: freebsd-net@freebsd.org Message-ID: <20070301200035.GA9041@ariel.njm.f2s.com> Mail-Followup-To: freebsd-net@freebsd.org References: <2110071423.20070301151729@citrin.ru> <20070301152942.GA27336@rambler-co.ru> <1047693239.20070301194653@citrin.ru> <45E70EBA.3030808@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45E70EBA.3030808@FreeBSD.org> X-Operating-System: FreeBSD 6.2-STABLE User-Agent: Mutt/1.5.13 (2006-08-11) Subject: Re: [PATCH] Re: is setsockopt SO_NOSIGPIPE work? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Mar 2007 20:33:46 -0000 On Thursday, 1 March, 2007 at 17:34:50 +0000, Bruce M. Simpson wrote: > Anton Yuzhaninov wrote: > > > >Thanks, with send() it works fine. > >I think it should be documented in setsockopt(2). > Try this patch. The comment doesn't reflect what the code does. SIGPIPE > may actually be getting queued twice in your case. It is most likely > that the process's main thread wasn't preempted before return from the > syscall. > > Perhaps someone more familiar with the signal code than I can chime in. > > --- sys_generic.c 14 Oct 2006 19:01:55 -0000 1.151 > +++ sys_generic.c 1 Mar 2007 17:30:39 -0000 > @@ -489,7 +489,7 @@ dofilewrite(td, fd, fp, auio, offset, fl > error == EINTR || error == EWOULDBLOCK)) > error = 0; > /* Socket layer is responsible for issuing SIGPIPE. */ > - if (error == EPIPE) { > + if (fp->f_type != DTYPE_SOCKET && error == EPIPE) { > PROC_LOCK(td->td_proc); > psignal(td->td_proc, SIGPIPE); > PROC_UNLOCK(td->td_proc); Could this be why mail from cron doesn't work for me in 6.2? I got as far as finding that cron receives a SIGPIPE while sending the mail message to sendmail, but never worked out why. I ended up hacking cron to ignore SIGPIPE and then ENOTIME to investigate further. Cheers, Nick. -- Please do not CC me on replies, I read the list and don't need the dupes.