aboutsummaryrefslogtreecommitdiff
path: root/sys/linux/port/os
diff options
context:
space:
mode:
Diffstat (limited to 'sys/linux/port/os')
-rw-r--r--sys/linux/port/os/constants.h98
-rw-r--r--sys/linux/port/os/errno.h134
-rw-r--r--sys/linux/port/os/types.h72
3 files changed, 304 insertions, 0 deletions
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/os/errno.h b/sys/linux/port/os/errno.h
new file mode 100644
index 0000000..9d7e66e
--- /dev/null
+++ b/sys/linux/port/os/errno.h
@@ -0,0 +1,134 @@
+#define sys·ErrorNotPermit 1
+#define sys·ErrorNoEntry 2
+#define sys·ErrorNoProc 3
+#define sys·ErrorInterrupt 4
+#define sys·ErrorIO 5
+#define sys·ErrorNoDevAddr 6
+#define sys·ErrorArgLen 7
+#define sys·ErrorExecFmt 8
+#define sys·ErrorBadFd 9
+#define sys·ErrorNoChild 10
+#define sys·ErrorAgain 11
+#define sys·ErrorNoMemory 12
+#define sys·ErrorAccess 13
+#define sys·ErrorBadAddr 14
+#define sys·ErrorNotBlk 15
+#define sys·ErrorBusy 16
+#define sys·ErrorExists 17
+#define sys·ErrorExDevice 18
+#define sys·ErrorNoDevice 19
+#define sys·ErrorNotDir 20
+#define sys·ErrorIsDir 21
+#define sys·ErrorBadArg 22
+#define sys·ErrorNoFiles 23
+#define sys·ErrorNoFd 24
+#define sys·ErrorNotTTY 25
+#define sys·ErrorTxtBusy 26
+#define sys·ErrorBigFile 27
+#define sys·ErrorNoSpace 28
+#define sys·ErrorNoSeek 29
+#define sys·ErrorReadOnly 30
+#define sys·ErrorNoLink 31
+#define sys·ErrorBadPipe 32
+#define sys·ErrorBadDomain 33
+#define sys·ErrorBadResult 34
+#define sys·ErrorDeadlock 35
+#define sys·ErrorNameLen 36
+#define sys·ErrorNoLock 37
+#define sys·ErrorNoSyscall 38
+#define sys·ErrorNotEmptyDir 39
+#define sys·ErrorLinkLoop 40
+#define sys·ErrorBlocks sys·ErrorAgain
+#define sys·ErrorNoMsg 42
+#define sys·ErrorNoIdent 43
+#define sys·ErrorBadChannel 44
+#define sys·ErrorLvl2NoSync 45
+#define sys·ErrorLvl3Halt 46
+#define sys·ErrorLvl3Reset 47
+#define sys·ErrorLongChannel 48
+#define sys·ErrorNoDriver 49
+#define sys·ErrorNoCSI 50
+#define sys·ErrorLvl2Halt 51
+#define sys·ErrorBadExchange 52
+#define sys·ErrorBadRequest 53
+#define sys·ErrorFullExchange 54
+#define sys·ErrorNoAnode 55
+#define sys·ErrorBadRequestCode 56
+#define sys·ErrorBadSlot 57
+#define sys·ErrorDeadlock2 sys·ErrorDeadlock
+#define sys·ErrorBadFont 59
+#define sys·ErrorNoStr 60
+#define sys·ErrorNoData 61
+#define sys·ErrorTimeout 62
+#define sys·ErrorNoStream 63
+#define sys·ErrorNoNet 64
+#define sys·ErrorNoPkg 65
+#define sys·ErrorIsRemote 66
+#define sys·ErrorDeadLink 67
+#define sys·ErrorAdv 68
+#define sys·ErrorSrmnt 69
+#define sys·ErrorCommunicate 70
+#define sys·ErrorProtocol 71
+#define sys·ErrorMultihop 72
+#define sys·ErrorDotDot 73
+#define sys·ErrorBadMsg 74
+#define sys·ErrorOverflow 75
+#define sys·ErrorNotUnique 76
+#define sys·ErrorBadFdState 77
+#define sys·ErrorNewAddress 78
+#define sys·ErrorShlibAccess 79
+#define sys·ErrorBadShlib 80
+#define sys·ErrorBadLibCode 81
+#define sys·ErrorShlibLen 82
+#define sys·ErrorSlibExec 83
+#define sys·ErrorBadWideChar 84
+#define sys·ErrorRestart 85
+#define sys·ErrorStreamPipe 86
+#define sys·ErrorUserLen 87
+#define sys·ErrorNotSocket 88
+#define sys·ErrorNeedDstAddr 89
+#define sys·ErrorMsgLen 90
+#define sys·ErrorBadProtocol 91
+#define sys·ErrorNoProtocol 92
+#define sys·ErrorNoProtocolSupport 93
+#define sys·ErrorNoSocketSupport 94
+#define sys·ErrorProtocolSupport 95
+#define sys·ErrorNoSupport sys·ErrorProtocolSupport
+#define sys·ErrorNoPFSupport 96
+#define sys·ErrorNoAFSupport 97
+#define sys·ErrorAddrInUse 98
+#define sys·ErrorAddrNotAvail 99
+#define sys·ErrorNetDown 100
+#define sys·ErrorNetHang 101
+#define sys·ErrorNetReset 102
+#define sys·ErrorAbortConnect 103
+#define sys·ErrorResetConnect 104
+#define sys·ErrorNoBuffer 105
+#define sys·ErrorIsConnect 106
+#define sys·ErrorNotConnect 107
+#define sys·ErrorShutdown 108
+#define sys·ErrorRefsLen 109
+#define sys·ErrorTimedOut 110
+#define sys·ErrorRefuseConnect 111
+#define sys·ErrorHostDown 112
+#define sys·ErrorHostHang 113
+#define sys·ErrorAlreadyConnect 114
+#define sys·ErrorInProgress 115
+#define sys·ErrorStale 116
+#define sys·ErrorNeedClean 117
+#define sys·ErrorNotNamed 118
+#define sys·ErrorNotAvail 119
+#define sys·ErrorIsNamed 120
+#define sys·ErrorRemoteIO 121
+#define sys·ErrorDiskQuota 122
+#define sys·ErrorNoMedium 123
+#define sys·ErrorBadMedium 124
+#define sys·ErrorCancel 125
+#define sys·ErrorNoKey 126
+#define sys·ErrorExpireKey 127
+#define sys·ErrorRevokeKey 128
+#define sys·ErrorRejectKey 129
+#define sys·ErrorOwnerDie 130
+#define sys·ErrorNoRecover 131
+#define sys·ErrorRFKill 132
+#define sys·ErrorHWPoison 133
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 */
+};