kernel/inc/proc/process.h

52 lines
1.5 KiB
C

// This file is part of noxos and licensed under the MIT open source license
#ifndef NOX_PROCESS_H
#define NOX_PROCESS_H
#include "utils/stdtypes.h"
#include "utils/string.h"
#include "utils/bitmap.h"
#include "proc/file_descriptor.h"
#include "mm/page_map.h"
#include "drivers/elf/elf.h"
#define MAX_THREADS_PER_PROCESS 64
#define THREAD_ID_INVALID (-1)
typedef uint32_t pid_t;
typedef enum {
PROCESS_NONE,
PROCESS_KERNEL
} processes_standard_E;
typedef struct process_T process_T;
struct process_T {
char name [128];
pid_t id;
void* chunk;
uint32_t chunk_id;
page_map_T* page_map;
elf_executable_T* executable;
file_descriptor_array_T* fd_array;
uint32_t num_threads;
void* threads;
bitmap_T thread_ids;
process_T* parent;
process_T* childs;
process_T* prev;
process_T* next;
};
void process_kernel_spawn (elf_executable_T* executable);
pid_t process_spawn (pid_t parent, string_t name, elf_executable_T* executable, void* buffer);
int32_t process_get_thread_id (process_T* process);
void process_clear_thread_id (process_T* process, uint32_t id);
void process_kill_pid (pid_t pid);
void process_kill (process_T* process);
#endif //NOX_PROCESS_H