IBNOS
Classes | Macros | Functions | Variables
Handle

Classes

struct  handleTable
 

Macros

#define MIN_HANDLES   0x100
 
#define MAX_HANDLES   0x10000
 

Functions

void handleTableInit (struct handleTable *table)
 Initializes the handle table structure which is part of each process. More...
 
void handleForkTable (struct handleTable *destination, struct handleTable *source)
 Forks a handle table. More...
 
void handleTableFree (struct handleTable *table)
 Releases the memory of the handle table and all associated objects. More...
 
uint32_t handleAllocate (struct handleTable *table, struct object *object)
 Allocates a handle (index) for a specific kernel object. More...
 
bool handleSet (struct handleTable *table, uint32_t handle, struct object *object)
 Associates a handle (index) with a kernel object. More...
 
struct objecthandleGet (struct handleTable *table, uint32_t handle)
 Returns the kernel object associated to a handle. More...
 
bool handleRelease (struct handleTable *table, uint32_t handle)
 Releases the object associated with a handle. More...
 
uint32_t handleCount (struct handleTable *table)
 Returns the number of handles in a handletable. More...
 

Variables

struct handleTable __attribute__
 

Detailed Description

Macro Definition Documentation

◆ MAX_HANDLES

#define MAX_HANDLES   0x10000

Definition at line 43 of file handle.h.

◆ MIN_HANDLES

#define MIN_HANDLES   0x100

Definition at line 42 of file handle.h.

Function Documentation

◆ handleAllocate()

uint32_t handleAllocate ( struct handleTable table,
struct object object 
)

Allocates a handle (index) for a specific kernel object.

Allocates the lowest possible handle for a specific kernel object. This function also increases the refcount, such that the object will stay there until the last reference was deleted.

Parameters
tablePointer to the handle table
objectPointer to some kernel object
Returns
Handle which is valid inside of the process associated to the table

Definition at line 117 of file handle.c.

◆ handleCount()

uint32_t handleCount ( struct handleTable table)

Returns the number of handles in a handletable.

Parameters
tablePointer to the handle table
Returns
Number of handles

Definition at line 268 of file handle.c.

◆ handleForkTable()

void handleForkTable ( struct handleTable destination,
struct handleTable source 
)

Forks a handle table.

Initializes the destination handle table and duplicates references to all the kernel objects in the source handle table. This function is used to implement the fork syscall.

Parameters
destinationPointer to the destination handle table (which will be initialized)
sourcePointer to the source handle table

Definition at line 68 of file handle.c.

◆ handleGet()

struct object* handleGet ( struct handleTable table,
uint32_t  handle 
)

Returns the kernel object associated to a handle.

Parameters
tablePointer to the handle table
handleHandle / index
Returns
Pointer to the kernel object (without increasing refcount)

Definition at line 213 of file handle.c.

◆ handleRelease()

bool handleRelease ( struct handleTable table,
uint32_t  handle 
)

Releases the object associated with a handle.

Parameters
tablePointer to the handle table
handleHandle / index which will be released
Returns
True on success, otherwise false (out of range or not set)

Definition at line 227 of file handle.c.

◆ handleSet()

bool handleSet ( struct handleTable table,
uint32_t  handle,
struct object object 
)

Associates a handle (index) with a kernel object.

Releases the previous object which was associated with the handle (if any), afterwards assigns the new kernel object to it.

Parameters
tablePointer to the handle table
handleHandle which will be replaced
objectPointer to some kernel object
Returns
True on success, otherwise false (handle out of range)

Definition at line 168 of file handle.c.

◆ handleTableFree()

void handleTableFree ( struct handleTable table)

Releases the memory of the handle table and all associated objects.

Parameters
tablePointer to the handle table

Definition at line 94 of file handle.c.

◆ handleTableInit()

void handleTableInit ( struct handleTable table)

Initializes the handle table structure which is part of each process.

Initializes all members of the handle table structure, which is used to keep track of all kernel objects available for the user mode. The newly allocated table is empty.

Parameters
tablePointer to the handle table

Definition at line 48 of file handle.c.

Variable Documentation

◆ __attribute__

struct handleTable __attribute__