From 5f2c15daa69dd8bd557a707e078731681cd7a233 Mon Sep 17 00:00:00 2001 From: Emma Nora Theuer Date: Wed, 13 Nov 2024 17:24:54 +0100 Subject: [PATCH] Initial commit --- emmafs.h | 26 ++++++++++++++++++++++++++ io.c | 25 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 emmafs.h create mode 100644 io.c diff --git a/emmafs.h b/emmafs.h new file mode 100644 index 0000000..1571570 --- /dev/null +++ b/emmafs.h @@ -0,0 +1,26 @@ +#ifndef EMMAFS_H_ +#define EMMAFS_H_ + +/* For now, this is just a collection of includes. + * This is for the purpose of avoid redundant importing of + * commonly used includes like stdlib, stdbool or errno, + * that are used in almost all files. It really is meant to make + * The beginning of reach file more readable. + * In the future, I will also use this to define some structs + * that are needed in many other places to help juggling + * loads of different includes. */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + + +#endif // EMMAFS_H_ diff --git a/io.c b/io.c new file mode 100644 index 0000000..8ec8cf8 --- /dev/null +++ b/io.c @@ -0,0 +1,25 @@ +#include "io.h" + +struct file_descriptor emmafs_stdin { + *inode = NONE; + off_t = NONE; + flags = NONE; + int ref_count = 0; +}; + +struct Process* initialize_process() { + struct Process* new_proc = (struct Process*) malloc(sizeof(struct Process)); + if (new_proc == NULL) { + errno = ENOMEM; + perror("Failed memory allocation for Process"); + return NULL; + } + new_proc->fd_table[0] = emmafs_stdin; +} + +int allocate_fd(struct Process proc, Inode inode, int flags, ...) { + va_list argptr; + va_start(argptr, flags); + + va_end(argptr); +}