XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
shm.h File Reference
#include <stdint.h>
#include <process.h>
Include dependency graph for shm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _shm_
 
struct  _shm_mapping_
 

Macros

#define USER_SHARED_MEM_START   0x0000000080000000
 

Typedefs

typedef struct _shm_ AuSHM
 
typedef struct _shm_mapping_ AuSHMMappings
 

Functions

void AuInitialiseSHMMan ()
 AuInitialiseSHMMan – initialise shm manager.
 
AuSHMAuGetSHMByID (uint16_t id)
 AuGetSHMSeg – searches and return a shm segment by its key.
 
int AuCreateSHM (AuProcess *proc, uint16_t key, size_t sz, uint8_t flags)
 AuCreateSHM – create a new shared memory segment or returns previously allocated one.
 
void * AuSHMObtainMem (AuProcess *proc, uint16_t id, void *shmaddr, int shmflg)
 AuSHMObtainMem – obtains a virtual memory from given shm segment.
 
void AuSHMUnmap (uint16_t key, AuProcess *proc)
 AuSHMUnmap – unmaps a shared memory segment.
 
void AuSHMUnmapAll (AuProcess *proc)
 AuSHMUnmapAll – unmaps all mappings for this process.
 

Macro Definition Documentation

◆ USER_SHARED_MEM_START

#define USER_SHARED_MEM_START   0x0000000080000000

BSD 2-Clause License

Copyright (c) 2022-2023, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Typedef Documentation

◆ AuSHM

typedef struct _shm_ AuSHM

◆ AuSHMMappings

typedef struct _shm_mapping_ AuSHMMappings

Function Documentation

◆ AuCreateSHM()

int AuCreateSHM ( AuProcess proc,
uint16_t  key,
size_t  sz,
uint8_t  flags 
)
extern

AuCreateSHM – create a new shared memory segment or returns previously allocated one.

Parameters
proc– Creator process
key– unique key to use
sz– size in multiple of PAGE_SIZE
flags– security flags
Returns
id of newly created SHM, -1 on failure

◆ AuGetSHMByID()

AuSHM * AuGetSHMByID ( uint16_t  id)
extern

AuGetSHMSeg – searches and return a shm segment by its key.

Parameters
key– key to search
Returns
Pointer to shm on success, NULL on failure

◆ AuInitialiseSHMMan()

void AuInitialiseSHMMan ( )
extern

AuInitialiseSHMMan – initialise shm manager.

◆ AuSHMObtainMem()

void * AuSHMObtainMem ( AuProcess proc,
uint16_t  id,
void *  shmaddr,
int  shmflg 
)
extern

AuSHMObtainMem – obtains a virtual memory from given shm segment.

Parameters
proc– Calling process
id– shm segment id
shmaddr– starting shared memory address to map @parma shmflg – flags
Returns
starting address of this shm on success, NULL on failure

◆ AuSHMUnmap()

void AuSHMUnmap ( uint16_t  key,
AuProcess proc 
)
extern

AuSHMUnmap – unmaps a shared memory segment.

Parameters
key– key to search
proc– process to look

◆ AuSHMUnmapAll()

void AuSHMUnmapAll ( AuProcess proc)
extern

AuSHMUnmapAll – unmaps all mappings for this process.

Parameters
proc– Pointer to process that needs unmapping