libnx  v4.6.0
Data Structures | Functions
shmem.h File Reference

Shared memory object handling. More...

#include "../types.h"

Go to the source code of this file.

Data Structures

struct  SharedMemory
 Shared memory information structure. More...
 

Functions

Result shmemCreate (SharedMemory *s, size_t size, Permission local_perm, Permission remote_perm)
 Creates a shared memory object. More...
 
void shmemLoadRemote (SharedMemory *s, Handle handle, size_t size, Permission perm)
 Loads a shared memory object coming from a remote process. More...
 
Result shmemMap (SharedMemory *s)
 Maps a shared memory object. More...
 
Result shmemUnmap (SharedMemory *s)
 Unmaps a shared memory object. More...
 
static void * shmemGetAddr (SharedMemory *s)
 Retrieves the mapped address of a shared memory object. More...
 
Result shmemClose (SharedMemory *s)
 Frees up resources used by a shared memory object, unmapping and closing handles, etc. More...
 

Detailed Description

Shared memory object handling.

Author
plutoo
Remarks
Shared memory differs from transfer memory in the fact that the kernel (as opposed to the user process) allocates and owns its backing memory.

Function Documentation

◆ shmemClose()

Result shmemClose ( SharedMemory s)

Frees up resources used by a shared memory object, unmapping and closing handles, etc.

Parameters
sShared memory information structure.
Returns
Result code.

◆ shmemCreate()

Result shmemCreate ( SharedMemory s,
size_t  size,
Permission  local_perm,
Permission  remote_perm 
)

Creates a shared memory object.

Parameters
sShared memory information structure which will be filled in.
sizeSize of the shared memory object to create.
local_permPermissions with which the shared memory object will be mapped in the local process.
remote_permPermissions with which the shared memory object will be mapped in the remote process (can be Perm_DontCare).
Returns
Result code.
Warning
This is a privileged operation; in normal circumstances applications cannot use this function.

◆ shmemGetAddr()

static void* shmemGetAddr ( SharedMemory s)
inlinestatic

Retrieves the mapped address of a shared memory object.

Parameters
sShared memory information structure.
Returns
Mapped address of the shared memory object.

◆ shmemLoadRemote()

void shmemLoadRemote ( SharedMemory s,
Handle  handle,
size_t  size,
Permission  perm 
)

Loads a shared memory object coming from a remote process.

Parameters
sShared memory information structure which will be filled in.
handleHandle of the shared memory object.
sizeSize of the shared memory object that is being loaded.
permPermissions with which the shared memory object will be mapped in the local process.

◆ shmemMap()

Result shmemMap ( SharedMemory s)

Maps a shared memory object.

Parameters
sShared memory information structure.
Returns
Result code.

◆ shmemUnmap()

Result shmemUnmap ( SharedMemory s)

Unmaps a shared memory object.

Parameters
sShared memory information structure.
Returns
Result code.