From owner-freebsd-stable@FreeBSD.ORG Wed Feb 1 22:07:34 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6C8CA16A420 for ; Wed, 1 Feb 2006 22:07:34 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6668843D49 for ; Wed, 1 Feb 2006 22:07:30 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.3/8.13.3) with ESMTP id k11M72Pv032638; Thu, 2 Feb 2006 01:07:02 +0300 (MSK) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.3/8.13.3/Submit) id k11M72WU032636; Thu, 2 Feb 2006 01:07:02 +0300 (MSK) (envelope-from yar) Date: Thu, 2 Feb 2006 01:07:01 +0300 From: Yar Tikhiy To: Pete French Message-ID: <20060201220701.GA29980@comp.chem.msu.su> References: <43E10E44.1040502@fer.hr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Cc: peterjeremy@optushome.com.au, freebsd-stable@freebsd.org, ivoras@fer.hr Subject: Re: Restartable system call behaviour X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2006 22:07:34 -0000 On Wed, Feb 01, 2006 at 08:48:30PM +0000, Pete French wrote: > > >>I have a piece of coode which does some networking, in which I see read > > >>and write calls failing with 'Interrupted system call' from time to time. > > > > > > You will get EINTR if the interrupt occurs before any data is read > > > or written. > > > > Will it also happen with recv() with MSG_WAITALL flag set? > > Actually I have narrowed this down now, and I wwas wrong in the original > posting - I was getting the EINTR returned by connect. Now I am not > sure if this is correct behaviour or not - if a signal has SA_RESTART set > then it should restart, but connect returns EINTR and then continues > to connect in the background. > > I had alwways belived that if system calls are restrtable then you will never > see EINTR at all. Now I dont know if this is a problem with my understanding > of how the system works, or an actual bug. have filed a pr anyway, just in > case it *is* a bug. To the best of my knowledge, connect() being always interruptable is correct and well-known. And my 4.11-STABLE system will interrupt connect() on a signal with SA_RESTART set, which disagrees with your observations yet agrees with the standard. Perhaps some logic in your software has changed since 4.11 times. Your software can poll, select, or just loop over connect() until errno != EALREADY if connect() returned EINTR. -- Yar