Initial commit

This commit is contained in:
Emma Nora Theuer 2024-11-13 17:24:54 +01:00
parent 095d4452e5
commit 5f2c15daa6
2 changed files with 51 additions and 0 deletions

26
emmafs.h Normal file
View file

@ -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 <errno.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#endif // EMMAFS_H_

25
io.c Normal file
View file

@ -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);
}