2026-06-26 20:05:01 -05:00
|
|
|
#ifndef KPROCESS_H
|
|
|
|
|
#define KPROCESS_H
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2026-07-07 00:13:24 -05:00
|
|
|
#include <vfs.h>
|
|
|
|
|
|
|
|
|
|
#define MAX_PROCESS_FDS 32
|
|
|
|
|
|
2026-06-26 20:05:01 -05:00
|
|
|
typedef enum {
|
2026-07-04 00:26:20 -05:00
|
|
|
STATE_READY = 1,
|
|
|
|
|
STATE_SLEEPING = 2,
|
|
|
|
|
STATE_BLOCKED = 3,
|
|
|
|
|
STATE_DEAD = 4,
|
2026-06-26 20:05:01 -05:00
|
|
|
} process_state_t;
|
|
|
|
|
|
2026-07-01 20:00:22 -05:00
|
|
|
typedef enum {
|
|
|
|
|
PROCESS_FLAG_NONE = 0,
|
|
|
|
|
PROCESS_FLAG_KERNEL = 1 << 0,
|
|
|
|
|
PROCESS_FLAG_USER = 1 << 1
|
|
|
|
|
} process_flags_t;
|
|
|
|
|
|
2026-07-07 00:13:24 -05:00
|
|
|
struct process_t;
|
|
|
|
|
typedef struct process_t {
|
2026-06-26 20:05:01 -05:00
|
|
|
uint32_t pid;
|
|
|
|
|
uint32_t esp;
|
2026-07-01 20:00:22 -05:00
|
|
|
uint32_t kstack_top;
|
2026-06-26 20:05:01 -05:00
|
|
|
uint32_t cr3;
|
|
|
|
|
process_state_t state;
|
|
|
|
|
uint32_t sleep;
|
2026-06-29 17:00:07 -05:00
|
|
|
uint32_t heap_end;
|
2026-07-01 20:00:22 -05:00
|
|
|
uint32_t flags;
|
2026-07-07 00:13:24 -05:00
|
|
|
file_t* fd_table[MAX_PROCESS_FDS];
|
|
|
|
|
struct process_t* sched_next;
|
2026-06-26 20:05:01 -05:00
|
|
|
} __attribute__((packed)) process_t;
|
|
|
|
|
|
|
|
|
|
#endif
|