MicrOS
micros_process.c File Reference
#include "micros_process.h"

Functions

void micros_process_exit_process (int status)
 Forces current process to exit. More...
 
uint32_t micros_process_get_processes_count ()
 Returns number of processes. More...
 
void micros_process_get_current_process_info (micros_process_user_info *user_info)
 Retrieves from the kernel information about the current process. More...
 
bool micros_process_get_process_info (uint32_t id, micros_process_user_info *user_info)
 Retrieves from the kernel information about the process with the specified id. More...
 
void micros_process_get_all_processes_info (micros_process_user_info *user_info)
 Retrieves from the kernel information about all processes. More...
 
void micros_process_set_current_process_name (char *name)
 Sets name of the current process. More...
 
void micros_process_current_process_sleep (uint32_t milliseconds)
 Stops process for the specified amount of time. More...
 
uint32_t micros_process_start_process (char *path, char *arguments, bool child, bool active)
 Creates new process. More...
 
void micros_process_set_current_process_signal_handler (void(*signal_handler)(micros_signal_params *))
 Sets function which will be called on the signal raise. More...
 
void micros_process_finish_signal_handler (micros_signal_params *old_state)
 Confirms the end of signal handler execution. More...
 
void micros_process_wait_for_process (uint32_t process_id_to_wait)
 Stops process until the end of the another process. More...
 
uint32_t micros_process_start_thread (void *entry_point, void *param)
 Creates new thread. More...
 
void micros_process_abort_thread ()
 Forces current thread to exit. More...
 

Function Documentation

◆ micros_process_abort_thread()

void micros_process_abort_thread ( )

Forces current thread to exit.

Forces current thread to exit.

◆ micros_process_current_process_sleep()

void micros_process_current_process_sleep ( uint32_t  milliseconds)

Stops process for the specified amount of time.

Stops process for the specified amount of time. Kernel won't jump to this process until the time will pass.

Parameters
millisecondsMilliseconds to wait.

◆ micros_process_exit_process()

void micros_process_exit_process ( int  status)

Forces current process to exit.

Forces current process to exit with the specified status code (typically 0 means success).

Parameters
statusExit status code.

◆ micros_process_finish_signal_handler()

void micros_process_finish_signal_handler ( micros_signal_params old_state)

Confirms the end of signal handler execution.

Confirms the end of signal handler execution. Kernel will return to the last instruction before signal was raised.

Parameters
old_stateSignal state retrieved from the kernel.

◆ micros_process_get_all_processes_info()

void micros_process_get_all_processes_info ( micros_process_user_info user_info)

Retrieves from the kernel information about all processes.

Retrieves from the kernel information about all processes id and saves them to the passed structure.

Parameters
user_infoPointer to the structure where the information about all processes will be stored.

◆ micros_process_get_current_process_info()

void micros_process_get_current_process_info ( micros_process_user_info user_info)

Retrieves from the kernel information about the current process.

Retrieves from the kernel information about the current process and saves it to the passed structure.

Parameters
user_infoPointer to the structure where the information about the current process will be stored.

◆ micros_process_get_process_info()

bool micros_process_get_process_info ( uint32_t  id,
micros_process_user_info user_info 
)

Retrieves from the kernel information about the process with the specified id.

Retrieves from the kernel information about the process with the specified id and saves it to the passed structure.

Parameters
user_infoPointer to the structure where the information about the process with the specified id will be stored.
Returns
True if process with the specified ID was found, otherwise false.

◆ micros_process_get_processes_count()

uint32_t micros_process_get_processes_count ( )

Returns number of processes.

Returns number of processes working in the operating system.

Returns
Number of the working processes.

◆ micros_process_set_current_process_name()

void micros_process_set_current_process_name ( char *  name)

Sets name of the current process.

Sets name of the current process. Name cannot be longer than 32 chars.

Parameters
nameNew name of the current process.

◆ micros_process_set_current_process_signal_handler()

void micros_process_set_current_process_signal_handler ( void(*)(micros_signal_params *)  signal_handler)

Sets function which will be called on the signal raise.

Sets function which will be called on the signal raise. Should be called by the standard library before entering to the main function of the program.

Parameters
micros_signal_paramsPointer to the function.

◆ micros_process_start_process()

uint32_t micros_process_start_process ( char *  path,
char *  arguments,
bool  child,
bool  active 
)

Creates new process.

Creates new process from the specified path with parameters.

Parameters
pathPath to the executable file.
argumentsArguments passed to the main function of the new process.
childFlag indicates it the newly created process will be child of the current process.
activeFlag indicates if the newly created process will become active (on foreground).
Returns
ID of the create process.

◆ micros_process_start_thread()

uint32_t micros_process_start_thread ( void *  entry_point,
void *  param 
)

Creates new thread.

Creates new thread with the specified parameters.

Parameters
entry_pointAddress of the entry point from which thread will start.
paramParameter which will be passed to the thread function.
Returns
ID of the create thread.

◆ micros_process_wait_for_process()

void micros_process_wait_for_process ( uint32_t  process_id_to_wait)

Stops process until the end of the another process.

Stops process until the end of the another process with the specified ID.

Parameters
process_id_to_waitProcess ID to wait.