|
MentOS
0.8.0
The Mentoring Operating System
|
Process data structures and functions. More...
Macros | |
| #define | __DEBUG_HEADER__ "[PROC ]" |
| Change header. | |
| #define | __DEBUG_LEVEL__ LOGLEVEL_NOTICE |
| Set log level. | |
Functions | |
| static int | __count_args (char **args) |
| Counts the number of arguments. More... | |
| static int | __count_args_bytes (char **args) |
| Counts the bytes occupied by the arguments. More... | |
| static char ** | __push_args_on_stack (uintptr_t *stack, char *args[]) |
| Pushes the arguments on the stack. More... | |
| static int | __reset_process (task_struct *task) |
| Resets the process. More... | |
| static int | __has_shebang (vfs_file_t *file) |
| Checks if the file starts with a shebang. More... | |
| static int | __load_executable (const char *path, task_struct *task, uint32_t *entry) |
| Replace the current process with a loaded exectuable. More... | |
| static task_struct * | __alloc_task (task_struct *source, task_struct *parent, const char *name) |
| Allocates the memory for a task. More... | |
| int | init_tasking (void) |
| Initialize the task management. More... | |
| task_struct * | process_create_init (const char *path) |
| Create and spawn the init process. More... | |
| char * | sys_getcwd (char *buf, size_t size) |
| Get current working directory. More... | |
| int | sys_chdir (char const *path) |
| Changes the working directory. More... | |
| int | sys_fchdir (int fd) |
| Changes the working directory. More... | |
| pid_t | sys_fork (pt_regs *f) |
| Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is replaced by a call to ‘execve’. More... | |
| int | sys_execve (pt_regs *f) |
| Replaces the current process image with a new process image. More... | |
Variables | |
| static kmem_cache_t * | task_struct_cache |
| Cache for creating the task structs. | |
| static task_struct * | init_proc |
| The task_struct of the init process. | |
Process data structures and functions.
|
inlinestatic |
Allocates the memory for a task.
| source | the source task we use for the copy. |
| parent | the parent process. |
| name | the name of the new process. |
|
inlinestatic |
Counts the number of arguments.
| args | the array of arguments, it must be NULL terminated. |
|
inlinestatic |
Counts the bytes occupied by the arguments.
| args | the array of arguments, it must be NULL terminated. |
|
static |
Checks if the file starts with a shebang.
| file | the file to check. |
|
static |
Replace the current process with a loaded exectuable.
| path | the path to the executable to load. |
| task | the task to laod the exectuable. |
| entry |
|
inlinestatic |
Pushes the arguments on the stack.
| stack | pointer to the stack location. |
| args | the list of arguments. |
|
static |
Resets the process.
| task | the process to reset. |
| int init_tasking | ( | void | ) |
Initialize the task management.
| task_struct* process_create_init | ( | const char * | path | ) |
Create and spawn the init process.
| path | Path of the init program. |
| int sys_chdir | ( | char const * | path | ) |
Changes the working directory.
| path | The new working directory. |
| int sys_execve | ( | pt_regs * | f | ) |
Replaces the current process image with a new process image.
| f | CPU registers whe calling this function. |
| int sys_fchdir | ( | int | fd | ) |
Changes the working directory.
| fd | File descriptor of the new working directory. |
Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is replaced by a call to ‘execve’.
| f | CPU registers whe calling this function. |
| char* sys_getcwd | ( | char * | buf, |
| size_t | size | ||
| ) |
Get current working directory.
| buf | The array where the CWD will be copied. |
| size | The size of the array. |