diff --git a/include/fs/vfs.h b/include/fs/vfs.h index bea6c68..07da9c2 100644 --- a/include/fs/vfs.h +++ b/include/fs/vfs.h @@ -154,8 +154,6 @@ int closedir(DIR *dir); char *basename(char *path); char *dirname(char *path); -struct file_descriptor *fd_special(); -void fd_special_free(struct file_descriptor *fd); int stdout_write(struct file_descriptor *fdesc, void *buf, size_t len); diff --git a/sched/proc.c b/sched/proc.c index c3e9c29..7c9723e 100644 --- a/sched/proc.c +++ b/sched/proc.c @@ -143,30 +143,6 @@ void schedule() } } -static struct file_descriptor *proc_insert_charfd(struct proc *proc, int fdno, int flags) -{ - struct file_descriptor *fd = fd_special(); - fd->file = vfs_open(NULL, (void *)0x4); /* FIXME LATER */ - fd->pos = 0; - fd->fd = fdno; - fd->flags = flags; - fd->file->type = FTYPE_CHARDEV; - fd->file->vnode->flags = VFS_VNO_CHARDEV; - fd->buf = NULL; - fd->buf_len = 0; - fd->fs = NULL; - - memset(fd->file->vnode, 0, sizeof(struct vnode)); - - fd->buf_write = NULL; - fd->buf_read = NULL; - - struct rbnode *fd_node = rbt_insert(&proc->fd_map, fdno); - fd_node->value = (uintptr_t)fd; - - return fd; -} - struct proc *proc_create() { struct proc *proc = slab_alloc(proc_slab); @@ -180,14 +156,6 @@ struct proc *proc_create() struct rbnode *proc_node = rbt_insert(proc_tree, proc->pid); proc_node->value = (uintptr_t)proc; - /* insert stdin, stdout, stderr */ - struct file_descriptor *fd; - fd = proc_insert_charfd(proc, STDIN_FILENO, O_RDONLY); - fd = proc_insert_charfd(proc, STDOUT_FILENO, O_WRONLY); - fd->buf_write = stdout_write; - fd = proc_insert_charfd(proc, STDERR_FILENO, O_WRONLY); - fd->buf_write = stdout_write; - spinlock_release(&proc->lock); return proc; diff --git a/sched/syscall.c b/sched/syscall.c index 82577d2..5ae7516 100644 --- a/sched/syscall.c +++ b/sched/syscall.c @@ -14,25 +14,6 @@ typedef void (*syscall_t)(uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t syscall_t syscall_table[SYSCALL_MAX]; slab_t *fd_slab; -struct file_descriptor *fd_special() -{ - struct file_descriptor *fd = slab_alloc(fd_slab); - if (!fd) { - kprintf(LOG_ERROR "Failed to allocate file descriptor\n"); - return NULL; - } - - memset(fd, 0, sizeof(struct file_descriptor)); - - return fd; -} - -void fd_special_free(struct file_descriptor *fd) -{ - slab_free(fd_slab, fd); -} - - void syscall(uint64_t syscall_no, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5) { syscall_t syscall = (void *)syscall_table[syscall_no];