delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2006/12/19/13:56:11

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Subject: Possible improvement to pipe() handling?
To: djgpp AT delorie DOT com
X-Mailer: Lotus Notes Release 6.5.4 CCH5 September 12, 2005
Message-ID: <OFF7CFC9A2.29AFB584-ON87257249.0067C597-87257249.0067E0EB@seagate.com>
From: Gordon DOT Schumacher AT seagate DOT com
Date: Tue, 19 Dec 2006 11:54:38 -0700
X-MIMETrack: Serialize by Router on SV-GW1/Seagate Internet(Release 7.0.1 HF29|March 07, 2006) at
12/19/2006 10:54:44 AM
MIME-Version: 1.0
X-Proofpoint-FWRule: outbound2
X-Proofpoint-Virus-Version: vendor=fsecure engine=4.65.5446:2.3.11,1.2.37,4.0.164 definitions=2006-12-19_03:2006-12-19,2006-12-18,2006-12-19 signatures=0

I sent this initially to DJGPP-Workers; it occurred to me that it might
be better to send it here, so... :)  Comments welcome.

__________________

I was pleased to see that there's now an implementation of pipe() in the
v2.04 beta, but I tripped over an idiosyncrasy of it when working with the
GNU Pth port that led me to start thinking about how it could be improved.

It appears that currently, calling pipe() creates a file in $TEMP which is
used as storage for data being written to the pipe, and pulled back out as
it is read out.  This caused some spectacular failures in Pth when either
running off of read-only media or when $TEMP was not set, and some pretty
awful performance when running off a floppy.

It seems to me that the reason for using a tempfile is because of the need
for persistence of the data in the case of "cat foo | less" since that is
two separate processes.  Am I guessing correctly here?

Otherwise, I would think in the case of a pipe that is used entirely within
a single process that it would be preferable to simply allocate a memory
buffer (fixed-size or perhaps growing?) and use that to store the data.  Is
there a way to tell the difference between these two cases or am I over-
simplifying the situation?  :)

Lastly, if *that* works I find myself wondering if there's a reliable way
to tell the DPMI host "I'm allocating this block of memory; please hang on
to it after I quit".

- Raw text -


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