# # patch "netxx_pipe.cc" # from [d34d5a637aa3e2a1036637db2ddd8e99fe7c8822] # to [211a5abf7b199f8f8fc401bf2a885da81dab84c0] # # patch "netxx_pipe.hh" # from [d34d5a637aa3e2a1036637db2ddd8e99fe7c8822] # to [6a72e14557bee75bdb2508cbdf9c693a6b9d6898] # =============================================== --- netxx_pipe.cc d34d5a637aa3e2a1036637db2ddd8e99fe7c8822 +++ netxx_pipe.cc 211a5abf7b199f8f8fc401bf2a885da81dab84c0 @@ -1,24 +1,42 @@ // -*- mode: C++; c-file-style: "gnu"; indent-tabs-mode: nil -*- // copyright (C) 2005 Christof Petig // all rights reserved. // licensed to the public under the terms of the GNU GPL (>= 2) // see the file COPYING for details -#include +#include -namespace Netxx { +Netxx::PipeStream::PipeStream(int _readfd, int _writefd) + : readfd(_readfd), writefd(_writefd) +{ pi_.add_socket(readfd); + pi_.add_socket(writefd); +} -class PipeStream : public StreamBase { - int readfd, writefd; -public: - explicit PipeStream (int readfd, int writefd); -// explicit PipeStream (const std::string &cmd, const std::vector &args); - virtual signed_size_type read (void *buffer, size_type length); - virtual signed_size_type write (const void *buffer, size_type length); - virtual void close (void); - virtual socket_type get_socketfd (void) const; - virtual const ProbeInfo* get_probe_info (void) const; - int get_readfd(void) const { return readfd; } - int get_writefd(void) const { return writefd; } +Netxx::PipeStream::signed_size_type Netxx::PipeStream::read (void *buffer, size_type length) +{ return ::read(readfd,buffer,length); +} + +Netxx::PipeStream::signed_size_type Netxx::PipeStream::write(const void *buffer, size_type length) +{ return ::write(writefd,buffer,length); +} + +void Netxx::PipeStream::close (void) +{ ::close(readfd); + ::close(writefd); +} + +Netxx::socket_type Netxx::PipeStream::get_socketfd (void) const +{ return Netxx::socket_type(-1); +} + +namespace { +class PipeProbe : public Netxx::ProbeInfo +{public: + virtual bool needs_pending_check (void) const; + virtual pending_type check_pending (socket_type, pending_type) const; }; } + +const Netxx::ProbeInfo* Netxx::PipeStream::get_probe_info (void) const +{ return &pi_; +} =============================================== --- netxx_pipe.hh d34d5a637aa3e2a1036637db2ddd8e99fe7c8822 +++ netxx_pipe.hh 6a72e14557bee75bdb2508cbdf9c693a6b9d6898 @@ -10,6 +10,7 @@ class PipeStream : public StreamBase { int readfd, writefd; + ProbeInfo pi_; public: explicit PipeStream (int readfd, int writefd); // explicit PipeStream (const std::string &cmd, const std::vector &args);