delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/07/29/12:27:48

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Tue, 29 Jul 2003 12:26:59 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: chris <caj AT cs DOT york DOT ac DOT uk>
cc: cygwin AT cygwin DOT com
Subject: Re: Limit to size of pipe
In-Reply-To: <3F269CB0.7040706@cs.york.ac.uk>
Message-ID: <Pine.GSO.4.44.0307291221130.7444-100000@slinky.cs.nyu.edu>
Importance: Normal
MIME-Version: 1.0

On Tue, 29 Jul 2003, chris wrote:

> David Rothenberger wrote:
>
> >chris writes:
> > > Hello!
> > >
> > > Further to an earlier message I sent, I now attach an example. This
> > > tries to send a message of a fixed sized down a pipe. Under windows I
> > > can't seem to send much more than 25k down in one go, although I can
> > > send more if I chop it up into sections. Under linux however I can send
> > > as large amounts as I like. While it is possible to work around it, I
> > > thought I would mention it in case it was easy to fix, just no-one had
> > > requested it :)
> > >
> > > ------------
> > > Example program follows: setting MSGSIZE>25000ish on my computer causes
> > > fail (ie pipeval=-1)
> > > ------------
> > > #include <unistd.h>
> > > #include <stdio.h>
> > > #define MSGSIZE 23000
> > > char *msg1 = "message";
> >
> >I modified the program to allocate the message buffer to send on the
> >heap and to initialize the entire thing.  The test seems to work for
> >any size at that point.
> >
> <snip program>
>
> Thanks! I notice (by some fiddling) that it seems I have to instansiate
> (at least most of) the buffer before I send it. Is there some rule that
> you should instansiate memory before reading it? of course doing so is
> sensible, but I didn't know nessasary? Out of interest (because I
> couldn't actually find a 'mission plan'), what is the "plan" of Cygwin?
> to create a system wherebye any linux / unix program will compile
> without changes under windows? Or to simply make it much easier to
> convert but not try to support "stupid" activities?
>
> Having said that, I've been convinced I should change the program I'm
> converting from *BSD to not send stupidly large mostly-empty buffers
> anyway :)
>
> Chris

Cygwin's purpose is to provide a POSIX layer that helps in compiling
*portable* programs.  Relying on the C runtime to initialize automatic
arrays is non-portable, and probably won't work on many systems (including
Cygwin).  When in doubt, look at the SUS (which Cygwin tries to follow) --
if some implicit behavior is unspecified there, it's very likely to be
different on various Unix systems anyway, and you should explicitly
provide the behavior your program expects (e.g., initialize memory).
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019