![]() |
Max OS 0.3
|
A block memory that is mapped into multiple processes. More...
#include <ipc.h>
Public Member Functions | |
| SharedMemory (const string &name, size_t size, resource_type_t type) | |
| Creates a new shared memory block. | |
| void | open (size_t flags) final |
| Map the shared memory into the address space of the owning process. | |
| void | close (size_t flags) final |
| Frees the page containing the shared memory. | |
| int | read (void *buffer, size_t size, size_t flags) final |
| Get the address that the current process has this shared memory mapped to. | |
| uintptr_t | physical_address () const |
| Gets the physical address of the shared memory block. | |
| size_t | size () const |
| Gets the size of the shared memory block. | |
Public Member Functions inherited from MaxOS::processes::Resource | |
| Resource (const string &name, size_t flags, resource_type_t type) | |
| Constructs a new Resource object. | |
| string | name () |
| Gets the name of this resource. | |
| resource_type_t | type () |
| Gets the type of this resource. | |
| virtual int | write (const void *buffer, size_t size, size_t flags) |
| write a certain amount of bytes to a resource | |
| SharedMemory::SharedMemory | ( | const string & | name, |
| size_t | size, | ||
| resource_type_t | type | ||
| ) |
Creates a new shared memory block.
| name | The name of the block |
| size | The size of the shared memory region |
| type | The type of resource |
Definition at line 29 of file ipc.cpp.
References MaxOS::memory::PhysicalMemoryManager::s_current_manager, and size().
Frees the page containing the shared memory.
| flags | Not used for this resource |
Reimplemented from MaxOS::processes::Resource.
Definition at line 99 of file ipc.cpp.
References MaxOS::memory::PhysicalMemoryManager::s_current_manager.
Map the shared memory into the address space of the owning process.
| flags | Not used for this resource |
Reimplemented from MaxOS::processes::Resource.
Definition at line 82 of file ipc.cpp.
References MaxOS::processes::GlobalScheduler::current_process(), MaxOS::common::Map< Key, Value >::end(), MaxOS::common::Map< Key, Value >::find(), and MaxOS::common::Map< Key, Value >::insert().
| uintptr_t SharedMemory::physical_address | ( | ) | const |
Get the address that the current process has this shared memory mapped to.
| buffer | Not used |
| size | Not used |
| flags | Not used |
Reimplemented from MaxOS::processes::Resource.
Definition at line 47 of file ipc.cpp.
References MaxOS::processes::GlobalScheduler::current_process(), MaxOS::common::Map< Key, Value >::end(), and MaxOS::common::Map< Key, Value >::find().
| size_t SharedMemory::size | ( | ) | const |
Gets the size of the shared memory block.
Definition at line 72 of file ipc.cpp.
Referenced by SharedMemory().