Framework for exporting system header to user space (#59)
[lunaix-os.git] / lunaix-os / includes / usr / lunaix / fcntl.h
diff --git a/lunaix-os/includes/usr/lunaix/fcntl.h b/lunaix-os/includes/usr/lunaix/fcntl.h
new file mode 100644 (file)
index 0000000..ba88b5b
--- /dev/null
@@ -0,0 +1,68 @@
+#ifndef _LUNAIX_UHDR_SYS_FCNTL_DEFS_H
+#define _LUNAIX_UHDR_SYS_FCNTL_DEFS_H
+
+#include "fstypes.h"
+#include "types.h"
+
+#define FO_CREATE               0x1
+#define FO_APPEND               0x2
+#define FO_DIRECT               0x4
+#define FO_WRONLY               0x8
+#define FO_RDONLY               0x10
+#define FO_RDWR                 0x20
+#define FO_TRUNC                0x40
+
+#define FO_NOFOLLOW             0x10000
+
+#define FSEEK_SET               0x1
+#define FSEEK_CUR               0x2
+#define FSEEK_END               0x3
+
+#define O_CREAT                 FO_CREATE
+#define O_APPEND                FO_APPEND
+#define O_DIRECT                FO_DIRECT
+#define O_WRONLY                FO_WRONLY
+#define O_RDONLY                FO_RDONLY
+#define O_RDWR                  FO_RDWR
+#define O_TRUNC                 FO_TRUNC
+
+#define AT_SYMLINK_FOLLOW       0b0000
+#define AT_SYMLINK_NOFOLLOW     0b0001
+#define AT_FDCWD                0b0010
+#define AT_EACCESS              0b0100
+
+#define R_OK                    0b100100100
+#define W_OK                    0b010010010
+#define X_OK                    0b001001001
+#define F_OK                    0b111111111
+
+/* Mount with read-only flag */
+#define MNT_RO                  (1 << 0)
+
+/* Mount with block-cache-disabled flag */
+#define MNT_NC                  (1 << 1)
+
+typedef unsigned int mode_t;
+typedef unsigned int nlink_t;
+
+struct file_stat
+{
+    __lunaix_dev_t   st_dev;
+    __lunaix_ino_t   st_ino;
+    mode_t           st_mode;
+    nlink_t          st_nlink;
+    __lunaix_uid_t   st_uid;
+    __lunaix_gid_t   st_gid;
+    __lunaix_dev_t   st_rdev;
+    __lunaix_size_t  st_size;
+    __lunaix_size_t  st_blksize;
+    __lunaix_size_t  st_blocks;
+
+    unsigned long    st_atim;
+    unsigned long    st_ctim;
+    unsigned long    st_mtim;
+
+    __lunaix_size_t  st_ioblksize;
+};
+
+#endif /* _LUNAIX_UHDR_FNCTL_DEFS_H */