mirror of
https://review.haiku-os.org/haiku
synced 2025-02-04 12:46:58 +01:00
b19ee1e164
- Send() now also gets the message to send as parameter. - Added methods to reserve and unreserve space in the buffer. * RequestAllocator: Uses the port buffer reservation methods now. This allows to let more than one RequestAllocator use a Port in a stack-like manner. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29565 a95241bf-73f2-0310-859d-f6bbb57e9c96
64 lines
1.2 KiB
C++
64 lines
1.2 KiB
C++
/*
|
|
* Copyright 2001-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef USERLAND_FS_PORT_H
|
|
#define USERLAND_FS_PORT_H
|
|
|
|
#include <OS.h>
|
|
|
|
class KernelDebug;
|
|
|
|
namespace UserlandFSUtil {
|
|
|
|
struct PortInfo {
|
|
};
|
|
|
|
class Port {
|
|
public:
|
|
struct Info {
|
|
port_id owner_port;
|
|
port_id client_port;
|
|
int32 size;
|
|
};
|
|
|
|
public:
|
|
Port(int32 size);
|
|
Port(const Info* info);
|
|
~Port();
|
|
|
|
void Close();
|
|
|
|
status_t InitCheck() const;
|
|
|
|
const Info* GetInfo() const;
|
|
|
|
void* GetBuffer() const { return fBuffer; }
|
|
int32 GetCapacity() const { return fCapacity; }
|
|
|
|
void Reserve(int32 endOffset);
|
|
void Unreserve(int32 endOffset);
|
|
int32 ReservedSize() const { return fReservedSize; }
|
|
|
|
status_t Send(const void* message, int32 size);
|
|
status_t Receive(void** _message, size_t* _size,
|
|
bigtime_t timeout = -1);
|
|
|
|
private:
|
|
friend class ::KernelDebug;
|
|
|
|
Info fInfo;
|
|
uint8* fBuffer;
|
|
int32 fCapacity;
|
|
int32 fReservedSize;
|
|
status_t fInitStatus;
|
|
bool fOwner;
|
|
};
|
|
|
|
} // namespace UserlandFSUtil
|
|
|
|
using UserlandFSUtil::PortInfo;
|
|
using UserlandFSUtil::Port;
|
|
|
|
#endif // USERLAND_FS_PORT_H
|