diff --git a/include/user/errno.h b/include/user/errno.h index 8fd630a..1f332df 100644 --- a/include/user/errno.h +++ b/include/user/errno.h @@ -38,10 +38,13 @@ #define ENOSYS 38 #define ELOOP 40 +#define EOVERFLOW 75 #define EADDRINUSE 98 #define ECONNRESET 104 #define ECONNREFUSED 111 +#define ENOTSUP 9926 + #if defined(__KERNEL__) const char *kstrerror(int e); #endif diff --git a/include/user/fcntl.h b/include/user/fcntl.h index 9a2c8d9..6eadc06 100644 --- a/include/user/fcntl.h +++ b/include/user/fcntl.h @@ -18,23 +18,27 @@ // execution #define O_EXEC (1 << 2) -#define O_ACCMODE 00000003 -#define O_RDONLY 00000000 -#define O_WRONLY 00000001 -#define O_RDWR 00000002 -#define O_CREAT 00000100 -// #define O_EXCL 00000200 +#define O_ACCMODE (3 << 0) +#define O_RDONLY (0 << 0) +#define O_WRONLY (1 << 0) +#define O_RDWR (2 << 0) +#define O_CREAT (1 << 6) +#define O_EXCL (1 << 7) +#define O_TRUNC (1 << 9) +#define O_APPEND (1 << 10) +#define O_DIRECTORY (1 << 16) +#define O_CLOEXEC (1 << 19) // #define O_NOCTTY 00000400 -#define O_TRUNC 00001000 -#define O_APPEND 00002000 // #define O_NONBLOCK 00004000 // #define O_DSYNC 00010000 // #define FASYNC 00020000 // #define O_DIRECT 00040000 // #define O_LARGEFILE 00100000 -//#define O_DIRECTORY 00200000 -#define O_DIRECTORY 0x200000 // #define O_NOFOLLOW 00400000 // #define O_NOATIME 01000000 -// #define O_CLOEXEC 02000000 -#define O_CLOEXEC (1 << 19) + +#define FD_CLOEXEC (1 << 0) + +// fcntl() commands +#define F_GETFD 1 +#define F_SETFD 2 diff --git a/include/user/stat.h b/include/user/stat.h index 2325959..16a7e0b 100644 --- a/include/user/stat.h +++ b/include/user/stat.h @@ -5,8 +5,10 @@ #pragma once #if defined(__KERNEL__) #include "sys/types.h" +#include "user/time.h" #else #include +#include #endif #define S_IFMT 0170000 @@ -56,7 +58,7 @@ struct stat { uint32_t st_size; uint32_t st_blksize; uint32_t st_blocks; - uint32_t st_atime; - uint32_t st_mtime; - uint32_t st_ctime; + time_t st_atime; + time_t st_mtime; + time_t st_ctime; };