diff options
author | Anton Kling <anton@kling.gg> | 2023-10-22 19:50:38 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-10-22 19:50:38 +0200 |
commit | 4e09bca9e34c226b6d7e34b4fa11248405fd988e (patch) | |
tree | 80f156b7940d9d19971395f335530170c69516c7 /sched/scheduler.h |
Move everything into a new repo.
Diffstat (limited to 'sched/scheduler.h')
-rw-r--r-- | sched/scheduler.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/sched/scheduler.h b/sched/scheduler.h new file mode 100644 index 0000000..7ff0734 --- /dev/null +++ b/sched/scheduler.h @@ -0,0 +1,60 @@ +#ifndef SCHEDULER_H +#define SCHEDULER_H +#include <fs/ext2.h> +#include <fs/vfs.h> +#include <halts.h> +#include <mmu.h> + +#define MAX_PATH 256 +#define KEYBOARD_HALT 0 +#define WAIT_CHILD_HALT 1 + +int fork(void); +int exec(const char *filename, char **argv); +void switch_task(); +void tasking_init(void); +void exit(int status); + +void *mmap(void *addr, size_t length, int prot, int flags, int fd, + size_t offset); +int munmap(void *addr, size_t length); +int msync(void *addr, size_t length, int flags); + +typedef struct { + void *u_address; + void *k_address; + int fd; +} MemoryMap; + +typedef struct Process process_t; + +struct Process { + uint32_t pid; + char program_name[100]; + char current_working_directory[MAX_PATH]; + uint32_t eip, esp, ebp; + PageDirectory *cr3; + vfs_fd_t *file_descriptors[100]; + vfs_inode_t *read_halt_inode[100]; + vfs_inode_t *write_halt_inode[100]; + vfs_inode_t *disconnect_halt_inode[100]; + // struct vfs_fd_t ** file_descriptors; + uint32_t halts[2]; + struct Halt *halt_list; + void *data_segment_end; + // uint32_t *halts; + process_t *next; + process_t *parent; + process_t *child; + MemoryMap *maps[100]; + uint32_t sleep_until; + int child_rc; + int dead; + // FIXME: Create a linkedlisti of childs so that the parent process + // can do stuff such as reap zombies and get status. +}; + +process_t *get_current_task(void); +int get_free_fd(process_t *p, int allocate); +void free_process(void); +#endif |