file decriptors

This commit is contained in:
Matheus
2022-08-19 18:01:32 -03:00
parent 4de0ff2556
commit 1d3405ba10
3 changed files with 92 additions and 3 deletions
+36
View File
@@ -0,0 +1,36 @@
#ifndef _FD_H_INCLUDE
#define _FD_H_INCLUDE
#define O_RDONLY 00
#define O_WRONLY 01
#define O_RDWR 02
#define O_ACCMODE 001000003
#define O_CREAT 0100
#define O_EXCL 0200
#define O_NOCTTY 0400
#define O_TRUNC 01000
#define O_APPEND 02000
#define O_NONBLOCK 04000
#define O_DSYNC 010000
#define O_ASYNC 020000
#define O_LARGEFILE 0100000
#define O_DIRECTORY 0200000
#define O_NOFOLLOW 0400000
#define O_NOATIME 01000000
#define O_CLOEXEC 02000000
#define O_SYNC 04010000
#define O_RSYNC 04010000
#define O_TMPFILE 020000000
typedef struct {
vnode_t* node;
off_t offset;
int flags;
} fd_t;
#endif
+4
View File
@@ -5,6 +5,7 @@
#include <arch/regs.h>
#include <kernel/vfs.h>
#include <kernel/vmm.h>
#include <kernel/fd.h>
#define THREAD_PRIORITY_INTERRUPT 0
#define THREAD_PRIORITY_KERNEL 1
@@ -39,6 +40,9 @@ typedef struct _proc_t{
pid_t pid;
gid_t gid;
uid_t uid;
fd_t* fds;
size_t fdcount;
off_t firstfreefd;
vmm_context* context;
thread_t** threads;
size_t threadcount;