|
PatchworkOS
28a9544
A non-POSIX operating system.
|
Shared Memory. More...
Data Structures | |
| struct | shmem_object_t |
| Represents a shared memory object. More... | |
Functions | |
| static void | shmem_object_free (shmem_object_t *shmem) |
| static shmem_object_t * | shmem_object_new (void) |
| static void | shmem_vmm_callback (void *private) |
| static void * | shmem_object_allocate_pages (shmem_object_t *shmem, uint64_t pageAmount, space_t *space, void *address, pml_flags_t flags) |
| static uint64_t | shmem_open (file_t *file) |
| static void | shmem_close (file_t *file) |
| static void * | shmem_mmap (file_t *file, void *address, uint64_t length, uint64_t *offset, pml_flags_t flags) |
| static uint64_t | shmem_init (void) |
| static void | shmem_deinit (void) |
Variables | |
| static dentry_t * | shmemDir = NULL |
| static dentry_t * | newFile = NULL |
| static file_ops_t | fileOps |
Shared Memory.
Shared memory is exposed in the /dev/shmem directory. Shared memory allows multiple processes to share a section of memory for inter-process communication (IPC).
Shared memory objects are created using the /dev/shmem/new file. Opening this file using open() will create a new anonymous shared memory object and return a file descriptor to it.
Shared memory objects can be mapped to the current process's address space using the mmap() system call. The first call to mmap() will decide the size of the shared memory object. Subsequent calls to mmap() will map the existing shared memory object.
|
static |
|
static |
|
static |
Definition at line 229 of file shmem.c.
References DEREF, ERR, fileOps, LOG_ERR, newFile, NULL, shmemDir, sysfs_dir_new(), and sysfs_file_new().
Referenced by _module_procedure().
|
static |
Definition at line 168 of file shmem.c.
References address, assert, BYTES_TO_PAGES, EINVAL, errno, file, shmem_object_t::lock, LOCK_SCOPE, MIN, NULL, PAGE_SIZE, pageAmount, shmem_object_t::pageAmount, shmem_object_t::pages, dentry_t::private, REF, sched_process_unsafe(), shmem_object_allocate_pages(), shmem_vmm_callback(), process_t::space, and vmm_map_pages().
|
static |
Definition at line 100 of file shmem.c.
References address, free(), malloc(), NULL, pageAmount, shmem_object_t::pageAmount, shmem_object_t::pages, pmm_alloc(), pmm_free(), REF, shmem_vmm_callback(), and vmm_map_pages().
Referenced by shmem_mmap().
|
static |
Definition at line 54 of file shmem.c.
References assert, free(), NULL, shmem_object_t::pageAmount, shmem_object_t::pages, and pmm_free().
Referenced by shmem_object_new().
|
static |
Definition at line 74 of file shmem.c.
References shmem_object_t::lock, lock_init(), malloc(), NULL, shmem_object_t::pageAmount, shmem_object_t::pages, shmem_object_t::ref, ref_init(), and shmem_object_free().
Referenced by shmem_open().
Definition at line 145 of file shmem.c.
References ERR, file, NULL, dentry_t::private, and shmem_object_new().
|
static |
Definition at line 89 of file shmem.c.
Referenced by shmem_mmap(), and shmem_object_allocate_pages().
|
static |
Definition at line 223 of file shmem.c.
Referenced by shmem_init().
Definition at line 52 of file shmem.c.
Referenced by shmem_deinit(), and shmem_init().
Definition at line 51 of file shmem.c.
Referenced by shmem_deinit(), and shmem_init().