aboutsummaryrefslogtreecommitdiff
path: root/sys/linux/port
diff options
context:
space:
mode:
Diffstat (limited to 'sys/linux/port')
-rw-r--r--sys/linux/port/arch/constants.h45
-rw-r--r--sys/linux/port/arch/types.h35
-rw-r--r--sys/linux/port/os/constants.h98
-rw-r--r--sys/linux/port/os/errno.h (renamed from sys/linux/port/arch/errno.h)0
-rw-r--r--sys/linux/port/os/types.h72
5 files changed, 170 insertions, 80 deletions
diff --git a/sys/linux/port/arch/constants.h b/sys/linux/port/arch/constants.h
deleted file mode 100644
index b8d3878..0000000
--- a/sys/linux/port/arch/constants.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#pragma once
-
-/* open */
-#define sys·OCreate 0x40u
-#define sys·ONoTTY 0x100u
-#define sys·OTrunc 0x200u
-#define sys·OAppend 0x400u
-#define sys·ONoBlock 0x800u
-#define sys·OSync 0x1000u
-#define sys·OAsync 0x2000u
-#define sys·OLargeFile 0x8000u
-#define sys·ODirectory 0x10000u
-#define sys·ONoFollow 0x20000u
-#define sys·OTmpFile 0x410000u
-
-/* mmap */
-#define sys·ProtNone 0
-#define sys·ProtRead 1
-#define sys·ProtWrite 2
-#define sys·ProtExec 4
-#define sys·ProtGrowsDown 0x01000000
-#define sys·ProtGrowsUp 0x02000000
-
-#define sys·MapFile 0
-#define sys·MapShared 0x01
-#define sys·MapPrivate 0x02
-#define sys·MapSharedValidate 0x03
-#define sys·MapType 0x0f
-#define sys·MapFixed 0x10
-#define sys·MapAnon 0x20
-#define sys·MapNoReserve 0x4000
-#define sys·MapGrowsDown 0x0100
-#define sys·MapDenyWrite 0x0800
-#define sys·MapExecutable 0x1000
-#define sys·MapLocked 0x2000
-#define sys·MapPopulate 0x8000
-#define sys·MapNonBlock 0x10000
-#define sys·MapStack 0x20000
-#define sys·MapHugetlb 0x40000
-#define sys·MapSync 0x80000
-#define sys·MapFixedNoReplace 0x100000
-
-#define sys·RemapCanMove 1
-#define sys·RemapFixed 2
-#define sys·RemapNoUnmap 4
diff --git a/sys/linux/port/arch/types.h b/sys/linux/port/arch/types.h
deleted file mode 100644
index 014e4cb..0000000
--- a/sys/linux/port/arch/types.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#pragma once
-
-// XXX: os vs sys prefix...
-
-typedef struct os·Directory os·Directory;
-typedef struct os·DirEntry os·DirEntry;
-
-struct os·Directory
-{
- intptr off;
- int fd;
- int pad;
- int pos, end;
- /* buf needs fall on (off_t) 8 byte alignment */
- char buf[2048];
-};
-
-struct os·DirEntry
-{
- ulong ino; /* inode number */
- ulong off; /* offset to next entry (from start of directory */
- ushort len; /* length of entry (in bytes) */
- uchar type; /* filetype */
- char name[]; /* filename */
-};
-
-/* types of DirEntry (last byte) */
-#define os·EntryUnknown 0
-#define os·EntryFifo 1
-#define os·EntryChar 2
-#define os·EntryDir 4
-#define os·EntryBlock 6
-#define os·EntryFile 8
-#define os·EntryLink 10
-#define os·EntrySocket 12
diff --git a/sys/linux/port/os/constants.h b/sys/linux/port/os/constants.h
new file mode 100644
index 0000000..8abf1fa
--- /dev/null
+++ b/sys/linux/port/os/constants.h
@@ -0,0 +1,98 @@
+#pragma once
+
+/* open */
+#define sys·OCreate 0x40u
+#define sys·ONoTTY 0x100u
+#define sys·OTrunc 0x200u
+#define sys·OAppend 0x400u
+#define sys·ONoBlock 0x800u
+#define sys·OSync 0x1000u
+#define sys·OAsync 0x2000u
+#define sys·OLargeFile 0x8000u
+#define sys·ODirectory 0x10000u
+#define sys·ONoFollow 0x20000u
+#define sys·OTmpFile 0x410000u
+
+/* device modes */
+#define sys·ModeFile 0170000
+#define sys·ModeDir 0040000
+#define sys·ModeChar 0020000
+#define sys·ModeBlock 0060000
+#define sys·ModeBasic 0100000
+#define sys·ModeFifo 0010000
+#define sys·ModeLink 0120000
+#define sys·ModeSocket 0140000
+
+/* mmap */
+#define sys·ProtNone 0
+#define sys·ProtRead 1
+#define sys·ProtWrite 2
+#define sys·ProtExec 4
+#define sys·ProtGrowsDown 0x01000000
+#define sys·ProtGrowsUp 0x02000000
+
+#define sys·MapFile 0
+#define sys·MapShared 0x01
+#define sys·MapPrivate 0x02
+#define sys·MapSharedValidate 0x03
+#define sys·MapType 0x0f
+#define sys·MapFixed 0x10
+#define sys·MapAnon 0x20
+#define sys·MapNoReserve 0x4000
+#define sys·MapGrowsDown 0x0100
+#define sys·MapDenyWrite 0x0800
+#define sys·MapExecutable 0x1000
+#define sys·MapLocked 0x2000
+#define sys·MapPopulate 0x8000
+#define sys·MapNonBlock 0x10000
+#define sys·MapStack 0x20000
+#define sys·MapHugetlb 0x40000
+#define sys·MapSync 0x80000
+#define sys·MapFixedNoReplace 0x100000
+
+#define sys·RemapCanMove 1
+#define sys·RemapFixed 2
+#define sys·RemapNoUnmap 4
+
+/* types of DirEntry (last byte) */
+#define sys·EntryUnknown 0
+#define sys·EntryFifo 1
+#define sys·EntryChar 2
+#define sys·EntryDir 4
+#define sys·EntryBlock 6
+#define sys·EntryFile 8
+#define sys·EntryLink 10
+#define sys·EntrySocket 12
+
+/* at flags */
+#define sys·FdCwd (-100)
+
+#define sys·AtNoFollowLink 0x100
+#define sys·AtRemoveDir 0x200
+#define sys·AtFollowLink 0x400
+#define sys·AtEmptyPath 0x1000
+
+/* stat(x) */
+
+// flags
+#define sys·InfoSyncLegacy 0x0000
+#define sys·InfoSyncType 0x6000
+#define sys·InfoForceSync 0x2000
+#define sys·InfoNoSync 0x4000
+
+// masks
+#define sys·InfoType 0x00000001u /* want/got stx_mode & s_ifmt */
+#define sys·InfoMode 0x00000002u /* want/got stx_mode & ~s_ifmt */
+#define sys·InfoNLink 0x00000004u /* want/got stx_nlink */
+#define sys·InfoUid 0x00000008u /* want/got stx_uid */
+#define sys·InfoGid 0x00000010u /* want/got stx_gid */
+#define sys·InfoAccessTime 0x00000020u /* want/got stx_atime */
+#define sys·InfoModifyTime 0x00000040u /* want/got stx_mtime */
+#define sys·InfoChangeTime 0x00000080u /* want/got stx_ctime */
+#define sys·InfoInode 0x00000100u /* want/got stx_ino */
+#define sys·InfoSize 0x00000200u /* want/got stx_size */
+#define sys·InfoBlocks 0x00000400u /* want/got stx_blocks */
+#define sys·InfoBasic 0x000007ffu /* the stuff in the normal stat struct*/
+#define sys·InfoCreateTime 0x00000800u /* want/got stx_btime */
+#define sys·InfoMntId 0x00001000u /* got stx_mnt_id */
+#define sys·InfoAll (sys·InfoBasic|sys·InfoCreateTime)
diff --git a/sys/linux/port/arch/errno.h b/sys/linux/port/os/errno.h
index 9d7e66e..9d7e66e 100644
--- a/sys/linux/port/arch/errno.h
+++ b/sys/linux/port/os/errno.h
diff --git a/sys/linux/port/os/types.h b/sys/linux/port/os/types.h
new file mode 100644
index 0000000..6e5c0c6
--- /dev/null
+++ b/sys/linux/port/os/types.h
@@ -0,0 +1,72 @@
+#pragma once
+
+/*
+ * time
+ */
+
+/* timeval */
+typedef struct sys·TimeStamp sys·TimeStamp;
+
+struct sys·TimeStamp
+{
+ int64 sec;
+ uint32 nano;
+ int32 femto;
+};
+
+/*
+ * files
+ */
+
+typedef struct sys·Info sys·Info;
+typedef struct sys·Directory sys·Directory;
+typedef struct sys·DirEntry sys·DirEntry;
+
+/* statx */
+struct sys·Info
+{
+ uint32 mask;
+ uint32 blksize;
+ uint64 attr;
+ uint32 nlink;
+ uint32 uid;
+ uint32 gid;
+ uint16 mode;
+ uint16 _pad;
+ uint64 inode;
+ uint64 size;
+ uint64 nblk;
+ uint64 attrmask;
+
+ sys·TimeStamp access, create, status, modify;
+
+ struct{
+ uint32 major;
+ uint32 minor;
+ }spdev;
+ struct{
+ uint32 major;
+ uint32 minor;
+ }device;
+
+ uint64 spare[14];
+};
+
+struct sys·Directory
+{
+ intptr off;
+ int fd;
+ int pad;
+ int pos, end;
+ /* buf needs fall on (off_t) 8 byte alignment */
+ char buf[2048];
+};
+
+struct sys·DirEntry
+{
+ ulong ino; /* inode number */
+ ulong off; /* offset to next entry (from start of directory */
+ ushort len; /* length of entry (in bytes) */
+ uchar type; /* filetype */
+ char name[]; /* filename */
+};