These functions are used to manage handles opened by a process.
◆ handleAllocate()
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
-
table | Pointer to the handle table |
object | Pointer 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()
Returns the number of handles in a handletable.
- Parameters
-
table | Pointer to the handle table |
- Returns
- Number of handles
Definition at line 268 of file handle.c.
◆ handleForkTable()
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
-
destination | Pointer to the destination handle table (which will be initialized) |
source | Pointer to the source handle table |
Definition at line 68 of file handle.c.
◆ handleGet()
Returns the kernel object associated to a handle.
- Parameters
-
table | Pointer to the handle table |
handle | Handle / 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
-
table | Pointer to the handle table |
handle | Handle / 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
-
table | Pointer to the handle table |
handle | Handle which will be replaced |
object | Pointer to some kernel object |
- Returns
- True on success, otherwise false (handle out of range)
Definition at line 168 of file handle.c.
◆ handleTableFree()
Releases the memory of the handle table and all associated objects.
- Parameters
-
table | Pointer to the handle table |
Definition at line 94 of file handle.c.
◆ handleTableInit()
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
-
table | Pointer to the handle table |
Definition at line 48 of file handle.c.