All checks were successful
Build documentation / build-and-deploy (push) Successful in 35s
57 lines
1.3 KiB
C
57 lines
1.3 KiB
C
#ifndef _KERNEL_PROC_PROC_H
|
|
#define _KERNEL_PROC_PROC_H
|
|
|
|
#include <aux/compiler.h>
|
|
#include <aux/elf.h>
|
|
#include <libk/list.h>
|
|
#include <libk/rbtree.h>
|
|
#include <libk/std.h>
|
|
#include <proc/procgroup.h>
|
|
#include <proc/resource.h>
|
|
#include <proc/suspension_q.h>
|
|
#include <sync/spin_lock.h>
|
|
#include <sys/mm.h>
|
|
|
|
#if defined(__x86_64__)
|
|
#include <amd64/gdt.h> /* KSTACK_SIZE */
|
|
#include <amd64/proc.h> /* USTACK_SIZE */
|
|
#endif
|
|
|
|
#define PROC_NEED_RESCHEDULE true
|
|
#define PROC_NO_RESCHEDULE false
|
|
|
|
/* process states */
|
|
#define PROC_READY 0
|
|
#define PROC_DEAD 1
|
|
#define PROC_SUSPENDED 2
|
|
|
|
/* process flags */
|
|
#define PROC_USTK_PREALLOC (1 << 0)
|
|
|
|
struct cpu;
|
|
|
|
struct proc {
|
|
int pid;
|
|
struct rb_node_link proc_tree_link;
|
|
struct rb_node_link procgroup_memb_tree_link;
|
|
struct list_node_link cpu_run_q_link;
|
|
struct list_node_link reap_link;
|
|
struct list_node_link* sq_entries;
|
|
struct procgroup* procgroup;
|
|
struct proc_platformdata pdata;
|
|
uint32_t flags;
|
|
spin_lock_t lock;
|
|
struct cpu* cpu;
|
|
atomic_int state;
|
|
};
|
|
|
|
void proc_sched (void);
|
|
void proc_kill (struct proc* proc);
|
|
struct elf_aux proc_load_segments (struct proc* proc, uint8_t* elf);
|
|
void proc_register (struct proc* proc, struct cpu* cpu);
|
|
struct proc* proc_find_pid (int pid);
|
|
struct proc* proc_spawn_rd (char* name);
|
|
void proc_init (void);
|
|
|
|
#endif // _KERNEL_PROC_PROC_H
|