#ifndef KPROCESS_H
#define KPROCESS_H

#include <stdint.h>

#include <vfs.h>

#define MAX_PROCESS_FDS 32

typedef enum {
    STATE_READY = 1,
    STATE_SLEEPING = 2,
    STATE_BLOCKED = 3,
    STATE_DEAD = 4,
    STATE_ZOMBIE = 5,
} process_state_t;

typedef enum {
    PROCESS_FLAG_NONE = 0,
    PROCESS_FLAG_KERNEL = 1 << 0,
    PROCESS_FLAG_USER = 1 << 1
} process_flags_t;

struct process_t;
typedef struct process_t {
    uint32_t pid;
    uint32_t esp;
    uint32_t kstack_top;
    uint32_t cr3;
    process_state_t state;
    uint32_t sleep;
    uint32_t heap_end;
    uint32_t flags;
    file_t* fd_table[MAX_PROCESS_FDS];
    struct process_t* sched_next;
    struct process_t* waiting;
    int exit_status;
} __attribute__((packed)) process_t;

#endif 