Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Feb 2006 01:07:01 +0300
From:      Yar Tikhiy <yar@comp.chem.msu.su>
To:        Pete French <petefrench@ticketswitch.com>
Cc:        peterjeremy@optushome.com.au, freebsd-stable@freebsd.org, ivoras@fer.hr
Subject:   Re: Restartable system call behaviour
Message-ID:  <20060201220701.GA29980@comp.chem.msu.su>
In-Reply-To: <E1F4Oty-000JEi-9R@dilbert.firstcallgroup.co.uk>
References:  <43E10E44.1040502@fer.hr> <E1F4Oty-000JEi-9R@dilbert.firstcallgroup.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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