PatchworkOS
Loading...
Searching...
No Matches
Shared Memory

Shared Memory. More...

Data Structures

struct  shmem_object_t
 Represents a shared memory object. More...
 

Functions

void shmem_init (void)
 Initializes the shared memory subsystem.
 

Detailed Description

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).

Creating Shared Memory

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.

Using Shared Memory

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.

Function Documentation

◆ shmem_init()

void shmem_init ( void  )

Initializes the shared memory subsystem.

Definition at line 196 of file shmem.c.

References DEREF, fileOps, newFile, NULL, panic(), shmemDir, sysfs_dir_new(), and sysfs_file_new().

Referenced by init_finalize().