21 #include "pedigree/kernel/LockGuard.h" 22 #include "pedigree/kernel/process/Mutex.h" 23 #include "pedigree/kernel/process/Process.h" 24 #include "pedigree/kernel/process/Thread.h" 25 #include "pedigree/kernel/processor/Processor.h" 26 #include "pedigree/kernel/processor/ProcessorInformation.h" 27 #include "pedigree/kernel/utilities/ZombieQueue.h" 28 #include "pedigree/kernel/utilities/new" 44 ZombiePipe::~ZombiePipe()
46 NOTICE(
"ZombiePipe: freeing " << m_pPipe);
51 :
File(), m_bIsAnonymous(true), m_bIsEOF(false), m_Buffer(PIPE_BUF_MAX),
55 NOTICE(
"Pipe: new anonymous pipe " << reinterpret_cast<uintptr_t>(
this));
60 const String &name, Time::Timestamp accessedTime,
61 Time::Timestamp modifiedTime, Time::Timestamp creationTime, uintptr_t inode,
64 name, accessedTime, modifiedTime, creationTime, inode, pFs, size,
71 "Pipe: new " << (bIsAnonymous ?
"anonymous" :
"named") <<
" pipe " 99 uint64_t location, uint64_t size, uintptr_t buffer,
bool bCanBlock)
107 uint8_t *pBuf =
reinterpret_cast<uint8_t *
>(buffer);
112 uint64_t location, uint64_t size, uintptr_t buffer,
bool bCanBlock)
120 uint8_t *pBuf =
reinterpret_cast<uint8_t *
>(buffer);
140 void Pipe::increaseRefCount(
bool bIsWriter)
169 bool bDataChanged =
false;
173 if (m_nReaders == 0 && m_nWriters == 0)
176 ERROR(
"Pipe: decreasing refcount when refcount is already zero.");
203 if (m_nReaders == 0 && m_nWriters == 0)
212 #ifdef VERBOSE_KERNEL 214 "Adding pipe [" << pid <<
"] " <<
this 215 <<
" to ZombieQueue");
217 ZombieQueue::instance().addObject(
new ZombiePipe(
this));
218 bDataChanged =
false;
229 bool Pipe::waitForReader()
virtual bool isFifo() const
bool acquire(size_t n=1, size_t timeoutSecs=0, size_t timeoutUsecs=0)
virtual uint64_t writeBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
bool canWrite(bool block)
virtual bool isPipe() const
Buffer< uint8_t > m_Buffer
size_t read(T *buffer, size_t count, bool block=true)
static ProcessorInformation & information()
virtual int select(bool bWriting=false, int timeout=0)
virtual void decreaseRefCount(bool bIsWriter)
virtual uint64_t readBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
size_t write(const T *buffer, size_t count, bool block=true)