#include <stdint.h>
#include <sys/types.h>
#include "rpc.h"
Go to the source code of this file.
◆ thread_state
Represents the state of a thread
Enumerator |
---|
THREAD_RUNNING | The state of a running thread.
|
THREAD_READY | The state of a ready to run thread.
|
THREAD_EXITED | The state of an exited thread.
|
THREAD_BLOCKED | The state of a generically blocked thread.
|
THREAD_WAITING_FOR_RPC | The state of a thread waiting for an RPC call to return.
|
THREAD_WAITING_FOR_RPC_INIT | The state of a thread waiting for a process to fully initilaize it's RPC functions.
|
◆ tasking_block()
Block the current thread & yield
- Parameters
-
newstate | The state to block it in |
◆ tasking_check_proc_exists()
char tasking_check_proc_exists |
( |
pid_t |
pid | ) |
|
Check if a process exists
- Parameters
-
pid | The param of the process to check |
- Returns
- Whether the process exists
◆ tasking_create_task()
void tasking_create_task |
( |
void * |
eip, |
|
|
void * |
address_space, |
|
|
char |
kmode, |
|
|
void * |
param1, |
|
|
void * |
param2, |
|
|
char |
isThread |
|
) |
| |
Create a task
- Parameters
-
eip | The start address of the task |
address_space | The address space of the task |
kmode | Whether the task is a kernel mode task |
param1 | The thread's start function first parameter |
param2 | The thread's start function second parameter |
isThread | Whether we are creating a new process or a thread in a process. If we are creating a theead, param2_arg becomes the PID for the newly created thread. |
◆ tasking_exit()
void tasking_exit |
( |
int |
code | ) |
|
Terminate the current thread If the main thread terminates, the whole process terminates.
- Note
- Currently, calling tasking_exit from any thread terminates the whole process.
- Parameters
-
code | The exit code of the thread |
◆ tasking_get_address_space()
void* tasking_get_address_space |
( |
pid_t |
pid | ) |
|
Get the address_space of a process
- Parameters
-
pid | the PID of the process |
- Returns
- the address_space of the process
◆ tasking_get_errno_address()
int* tasking_get_errno_address |
( |
| ) |
|
Get the adddress of errno for the current thread
- Returns
- The address of errno
◆ tasking_get_PID()
pid_t tasking_get_PID |
( |
| ) |
|
Get the PID of the current thread.
- Returns
- The current thread's PID
◆ tasking_get_rpc_calling_thread()
pid_t tasking_get_rpc_calling_thread |
( |
pid_t * |
tid | ) |
|
Get the RPC calling thread for the current thread
- Parameters
-
tid | A pointer to a pid_t to store the return TID |
- Returns
- the return PID
- Note
- This is only applicable for an RPC handler thread
◆ tasking_get_rpc_ret_buf()
void* tasking_get_rpc_ret_buf |
( |
| ) |
|
Get the RPC return buffer for the current thread
- Returns
- the return buffer
◆ tasking_get_TID()
pid_t tasking_get_TID |
( |
| ) |
|
Get the TID of the current thread.
- Returns
- The current thread's TID
◆ tasking_init()
◆ tasking_is_privleged()
char tasking_is_privleged |
( |
| ) |
|
Check whether the current process is privleged
- Returns
- whether the current process is privleged
◆ tasking_new_thread()
pid_t tasking_new_thread |
( |
void * |
start, |
|
|
pid_t |
pid, |
|
|
void * |
param |
|
) |
| |
Create a new thread
- Parameters
-
start | The start address of the task |
pid | The PID that gets the new thread |
param | The thread's start function parameter |
- Returns
- the TID of the thread
◆ tasking_set_rpc_calling_thread()
void tasking_set_rpc_calling_thread |
( |
pid_t |
pid, |
|
|
pid_t |
tid |
|
) |
| |
Set the RPC calling thread for an RPC handler thread to the current threasd
- Parameters
-
pid | The PID of the handler thread |
tid | The TID of the handler thread |
◆ tasking_set_rpc_ret_buf()
void tasking_set_rpc_ret_buf |
( |
void * |
buf | ) |
|
Set the RPC return buffer for the calling thread
- Parameters
-
◆ tasking_thread_exit()
void tasking_thread_exit |
( |
| ) |
|
Terminate the current thread
◆ tasking_unblock()
void tasking_unblock |
( |
pid_t |
pid, |
|
|
pid_t |
tid |
|
) |
| |
Unblock a thread
- Parameters
-
pid | The PID that contains the thread to unblock |
tid | The TID in the process to unblock. |
◆ tasking_yield()
Yield to the next ready thread in any process