mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +00:00
AK: Move the userspace SharedBuffer from LibC to AK
This always felt out-of-place in LibC.
This commit is contained in:
parent
38f93ef13b
commit
fc86460134
22 changed files with 41 additions and 24 deletions
34
AK/SharedBuffer.h
Normal file
34
AK/SharedBuffer.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
class SharedBuffer : public RefCounted<SharedBuffer> {
|
||||
public:
|
||||
static RefPtr<SharedBuffer> create_with_size(int);
|
||||
static RefPtr<SharedBuffer> create_from_shared_buffer_id(int);
|
||||
~SharedBuffer();
|
||||
|
||||
bool share_globally();
|
||||
bool share_with(pid_t);
|
||||
int shared_buffer_id() const { return m_shared_buffer_id; }
|
||||
void seal();
|
||||
int size() const { return m_size; }
|
||||
void* data() { return m_data; }
|
||||
const void* data() const { return m_data; }
|
||||
void set_volatile();
|
||||
[[nodiscard]] bool set_nonvolatile();
|
||||
|
||||
private:
|
||||
SharedBuffer(int shared_buffer_id, int size, void*);
|
||||
|
||||
int m_shared_buffer_id { -1 };
|
||||
int m_size { 0 };
|
||||
void* m_data;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
using AK::SharedBuffer;
|
Loading…
Add table
Add a link
Reference in a new issue