monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] cvssync, ssh, serve stdio need a missing common infrast


From: Christof Petig
Subject: [Monotone-devel] cvssync, ssh, serve stdio need a missing common infrastructure
Date: Wed, 25 May 2005 09:45:53 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050404)

Hi Nathaniel,
Hi Jon (Bright),

while dusting off the ssh (and serve stdio) branch I realized that all
these works need a common infrastructure: The ability to
(cross-platform!) deal with pipes.

Since serve stdio seemed the least intrusive I looked into separating it
from the rest ... but ...

serve stdio needs a Netxx Stream which uses one fd for reading (0) and
one fd for writing (1). While I know enough of unix architecture to
design such a beast (it is part of the ssh branch) I don't know deeply
enough how Windows handles such things.

I need one Netxx::Stream which handles stdi/o (two file descriptors
accessed via read/select/write on unix) and one Stream which handles a
bidirectional pipe (the same on unix!). Are these tasks on Windows!
similar enough to get covered by one class?

I have a working example of a pipe invocation on Windows (2*CreatePipe +
CreateProcess) but the HANDLE s are accessed via Read/WriteFile and not
via read/write (are write and HANDLEs compatible?).

On the other hand my Pipe class is derived from Netxx::Stream but IIRC
netxx is designed to handle sockets which are totally different on
Windows (I see that get_last_error always uses WSAGetLastError which is
nonsense if you access files). So if my worst fears come true
netxx::Stream is uncapable on handling even the writing/reading half of
neither pipes nor stdio.

<looking into the source> the (undocumented >:-( ) Netxx::Socket uses
recv() and only handles files on unix because of unix' philosophy.

:-(

So it looks like I have to write a Socket replacement, too. So my questions:

Do you see any alternative to this (e.g. using c++ streambufs in netsync
(which is a common interface/superset of netxx::Sockets and files))?
IIRC likely to fail because streambufs have no similar concept to
select()/Netxx::Probe().

Should I hack netsync (I need a pair<int,int> instead of int for
sockets) in a way which disables these features on Windows. (serve stdio
is useless on Windows unless combined with ssh:/file:)

Jon: Do you think that stdio and 2*pipe are similar enough on Windows to
get covered by one single class? Would you suggest to use read() or
ReadFile()?

   Christof

PS: This nicely explains why windows compatibility indead is the
greatest hurdle to merging any of these branches into mainline.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]