diff --git a/kernel/fs/portlfs/portlfs.c b/kernel/fs/portlfs/portlfs.c index 743f809..a789c51 100644 --- a/kernel/fs/portlfs/portlfs.c +++ b/kernel/fs/portlfs/portlfs.c @@ -2,7 +2,7 @@ #include #include "fs/littlefs/lfs.h" #include "vfs/vfs.h" -#include "hdrs/errors.h" +#include "errors.h" #include "kprintf.h" #include "dlmalloc/malloc.h" #include "hal/hal.h" diff --git a/kernel/hal/x86_64/intr.c b/kernel/hal/x86_64/intr.c index 4fab54a..b58c51e 100644 --- a/kernel/hal/x86_64/intr.c +++ b/kernel/hal/x86_64/intr.c @@ -12,7 +12,7 @@ #include "pit.h" #include "proc/proc.h" #include "syscall/syscall.h" -#include "hdrs/errors.h" +#include "errors.h" void hal_intr_disable(void) { asm volatile("cli"); diff --git a/kernel/proc/proc.c b/kernel/proc/proc.c index 6a86fc2..c0081ab 100644 --- a/kernel/proc/proc.c +++ b/kernel/proc/proc.c @@ -9,7 +9,7 @@ #include "util/util.h" #include "kprintf.h" #include "elf.h" -#include "hdrs/errors.h" +#include "errors.h" #include "vfs/vfs.h" #include "bootinfo/bootinfo.h" diff --git a/kernel/proc/proc.h b/kernel/proc/proc.h index 1f3acee..7215590 100644 --- a/kernel/proc/proc.h +++ b/kernel/proc/proc.h @@ -5,6 +5,7 @@ #include "hal/hal.h" #include "spinlock/spinlock.h" #include "bitmap/bitmap.h" +#include "vfs/vfs.h" #define PROC_NAME_MAX 0x100 @@ -12,6 +13,7 @@ #define PROC_STACKSIZE (PROC_STACKBLOCKS * BITMAP_BLOCK_SIZE) #define PROC_MAX 0x100 // max amount of processes +#define PROC_VFSHANDLES_MAX 0x80 typedef struct { IntrStackFrame trapframe; @@ -28,12 +30,17 @@ enum { typedef struct Proc { struct Proc *next; + uint64_t pid; char name[PROC_NAME_MAX]; + ProcPlatformData platformdata; uint8_t state; VasRange *vas; + bool kern; + + VfsObj *vobjs[PROC_VFSHANDLES_MAX]; } Proc; typedef struct { diff --git a/kernel/storedev/ramsd.c b/kernel/storedev/ramsd.c index 531bc0d..cadfa3c 100644 --- a/kernel/storedev/ramsd.c +++ b/kernel/storedev/ramsd.c @@ -1,7 +1,7 @@ #include #include #include "spinlock/spinlock.h" -#include "hdrs/errors.h" +#include "errors.h" #include "dlmalloc/malloc.h" #include "ramsd.h" #include "storedev.h" diff --git a/kernel/storedev/storedev.c b/kernel/storedev/storedev.c index 3dd52c4..57ce702 100644 --- a/kernel/storedev/storedev.c +++ b/kernel/storedev/storedev.c @@ -3,7 +3,7 @@ #include "storedev.h" #include "spinlock/spinlock.h" #include "kprintf.h" -#include "hdrs/errors.h" +#include "errors.h" #include "dlmalloc/malloc.h" #include "ramsd.h" #include "util/util.h" diff --git a/kernel/syscall/processctl.c b/kernel/syscall/processctl.c index 4d8d087..6daef58 100644 --- a/kernel/syscall/processctl.c +++ b/kernel/syscall/processctl.c @@ -2,23 +2,15 @@ #include "syscall.h" #include "proc/proc.h" #include "spinlock/spinlock.h" -#include "hdrs/errors.h" +#include "errors.h" #include "util/util.h" +#include "sysdefs/processctl.h" #define PID_SELF_MAGIC 0x5E1F -enum { - PCTL_KILL = 0, -}; - -typedef struct { - -} ProcessCtl; - int32_t SYSCALL3(sys_processctl, pid1, cmd1, optsptr1) { uint64_t pid = pid1; uint64_t cmd = cmd1; - ProcessCtl *pctl = (ProcessCtl *)(void *)optsptr1; int32_t ret = E_OK; spinlock_acquire(&PROCS.spinlock); diff --git a/kernel/syscall/syscall.c b/kernel/syscall/syscall.c index 5288798..38a1055 100644 --- a/kernel/syscall/syscall.c +++ b/kernel/syscall/syscall.c @@ -1,9 +1,9 @@ #include #include "syscall.h" -#include "hdrs/errors.h" +#include "errors.h" #include "kprintf.h" #include "processctl.h" -#include "hdrs/syscall.h" +#include "sysdefs/syscall.h" int32_t SYSCALL1(sys_debugprint, string) { char *p = (char *)string; diff --git a/kernel/vfs/vfs.c b/kernel/vfs/vfs.c index d08299d..a275c07 100644 --- a/kernel/vfs/vfs.c +++ b/kernel/vfs/vfs.c @@ -7,7 +7,7 @@ #include "util/util.h" #include "hshtb.h" #include "assert.h" -#include "hdrs/errors.h" +#include "errors.h" #include "fs/portlfs/portlfs.h" #include "storedev/storedev.h" #include "baseimg/baseimg.h" diff --git a/share/hdrs/errors.h b/share/errors.h similarity index 100% rename from share/hdrs/errors.h rename to share/errors.h diff --git a/share/sysdefs/processctl.h b/share/sysdefs/processctl.h new file mode 100644 index 0000000..1efadc2 --- /dev/null +++ b/share/sysdefs/processctl.h @@ -0,0 +1,8 @@ +#ifndef SHARE_HDRS_PROCESSCTL_H_ +#define SHARE_HDRS_PROCESSCTL_H_ + +enum { + PCTL_KILL = 0, +}; + +#endif // SHARE_HDRS_PROCESSCTL_H_ diff --git a/share/hdrs/syscall.h b/share/sysdefs/syscall.h similarity index 87% rename from share/hdrs/syscall.h rename to share/sysdefs/syscall.h index 5583673..f28fc1b 100644 --- a/share/hdrs/syscall.h +++ b/share/sysdefs/syscall.h @@ -4,6 +4,7 @@ enum { SYS_DEBUGPRINT = 1, SYS_PROCESSCTL = 2, + SYS_IOCTL = 3, }; #endif // SHARE_HDRS_SYSCALL_H_ diff --git a/ulib/Makefile b/ulib/Makefile index 33cbef5..a0864d5 100644 --- a/ulib/Makefile +++ b/ulib/Makefile @@ -11,7 +11,7 @@ SRCFILES := $(call GRABSRC, \ system \ ) -CFLAGS += -isystem $(ROOT)/share/hdrs -isystem $(ROOT)/ulib -isystem $(ROOT)/std/include +CFLAGS += -isystem $(ROOT)/share -isystem $(ROOT)/ulib -isystem $(ROOT)/std/include ASFILES := $(call GET_ASFILES, $(SRCFILES)) CFILES := $(call GET_CFILES, $(SRCFILES)) diff --git a/ulib/libulib.a b/ulib/libulib.a index 2a45b30..320c8f2 100644 Binary files a/ulib/libulib.a and b/ulib/libulib.a differ diff --git a/ulib/system/system.c b/ulib/system/system.c index ba176bb..0f0cfda 100644 --- a/ulib/system/system.c +++ b/ulib/system/system.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include void sys_debugprint(const char *string) { syscall(SYS_DEBUGPRINT, (uint64_t)string, 0, 0, 0, 0, 0);