Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Message-ID: <3B6E88FE.70BF483@hplb.hpl.hp.com>
Date: Mon, 06 Aug 2001 13:09:34 +0100
From: Bill Petheram <bilpet@hplb.hpl.hp.com>
Organization: TESL, HP Labs Bristol
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.3-20mdksmp i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Corinna Vinschen <cygwin@cygwin.com>, Lapo Luchini <lapo@lapo.it>
Subject: Re: Rsync: found the problem
References: <610A1F4808E9D411888F0001023F6361A2EC@MUCX> <3B46E116.20508.C8E5ACB@localhost> <20010707095422.C7298@redhat.com> <3B499BF7.6D8FCABC@hplb.hpl.hp.com> <20010709222226.A16128@cygbert.vinschen.de> <3B6960FA.8099DD72@hplb.hpl.hp.com> <3B6A943A.10E925C8@hplb.hpl.hp.com> <20010803190741.Z23782@cygbert.vinschen.de>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Is it a bug or a feature?

Internally cygwin uses a flag OLD_O_NDELAY with the value 0x0004. This
is used for backward compatibility (according to the comment). There is
code to check that if either the OLD_O_NDELAY flag is set or if O_NDELAY
(0x4000) is set they both get set.

So when rsync does a GETFL it does the 'normal':- val &= ~NONBLOCK_FLAG
to set to blocking. Unfortunately the OLD_O_NDELAY bit is still set so
the when the SETFL is called is sets the O_FNDELAY bit as well.
Obviously this means that once a socket is set to non-blocking mode it
cannot be reset using this method. Note that the OLD_O_NDELAY is not
defined in the installed header files, only internally to cygwin.

I think that it is not possible to run old executables with newer DLLs,
so may be the OLD_O_NDELAY flag can be removed.

I added this patch to rsync.h

470a471,474
> #ifdef __CYGWIN32__
> #define OLD_O_NDELAY 0x0004
> #define NONBLOCK_FLAG (O_NONBLOCK | OLD_O_NDELAY)
> #else
476a481
> #endif

This fixes the problem for rsync.

bill

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

