aboutsummaryrefslogtreecommitdiff
path: root/sys/linux
diff options
context:
space:
mode:
authorNicholas <nbnoll@eml.cc>2021-11-20 17:07:23 -0800
committerNicholas <nbnoll@eml.cc>2021-11-20 17:07:23 -0800
commitc9a32c1a43d2bdded07eaa45732c3a6e195a5442 (patch)
treecb7e9cb8c34cbe6551b801eff4201afcf71dd0fd /sys/linux
parente97c8c469db0aa27985dab2879dc1f14905c7387 (diff)
Chore: cleaned up the exit code to cleanly interface with libc
We use weak linking to ensure we clean up at exit time correctly. If libc is linked, then we call our cleanup function by registering an atexit callback with the library. If libc is not linked, we have a weak symbol that results in a noop. Similarly, if we call rt·exit while linked with libc, this immediately calls libc's exit (which will call our cleanup as we registered it). If we are not linked to libc, exit() is given as a weak link to a noop function.
Diffstat (limited to 'sys/linux')
-rw-r--r--sys/linux/amd64/arch/constants.h23
-rw-r--r--sys/linux/arm/arch/constants.h20
-rw-r--r--sys/linux/arm64/arch/constants.h22
-rw-r--r--sys/linux/i386/arch/constants.h20
-rw-r--r--sys/linux/port/os/constants.h13
-rw-r--r--sys/linux/riscv64/arch/constants.h20
6 files changed, 105 insertions, 13 deletions
diff --git a/sys/linux/amd64/arch/constants.h b/sys/linux/amd64/arch/constants.h
new file mode 100644
index 0000000..1949bdf
--- /dev/null
+++ b/sys/linux/amd64/arch/constants.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#define sys·OCreate 0100
+#define sys·OUnique 0200
+#define sys·ONoTTY 0400
+#define sys·OTrunc 01000
+#define sys·OAppend 02000
+#define sys·ONoBlock 04000
+#define sys·ODsync 010000
+#define sys·OSync 04010000
+#define sys·ORsync 04010000
+#define sys·ODirectory 0200000
+#define sys·ONoFollow 0400000
+#define sys·OCloseExec 02000000
+
+#define sys·OAsync 020000
+#define sys·ODirect 040000
+#define sys·OLargeFile 0
+#define sys·ONoATime 01000000
+#define sys·OPath 010000000
+#define sys·OTempFile 020200000
+
+#define SYS·HAVE_FCNTL
diff --git a/sys/linux/arm/arch/constants.h b/sys/linux/arm/arch/constants.h
new file mode 100644
index 0000000..149c2eb
--- /dev/null
+++ b/sys/linux/arm/arch/constants.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#define sys·OCreate 0100
+#define sys·OUnique 0200
+#define sys·ONoTTY 0400
+#define sys·OTrunc 01000
+#define sys·OAppend 02000
+#define sys·ONoBlock 04000
+#define sys·ODsync 010000
+#define sys·OSync 04010000
+#define sys·ORsync 04010000
+#define sys·ODirectory 040000
+#define sys·ONoFollow 0100000
+#define sys·OCloseExec 02000000
+#define sys·OAsync 020000
+#define sys·ODirect 0200000
+#define sys·OLargeFile 0400000
+#define sys·ONoATime 01000000
+#define sys·OPath 010000000
+#define sys·OTempFile 020040000
diff --git a/sys/linux/arm64/arch/constants.h b/sys/linux/arm64/arch/constants.h
new file mode 100644
index 0000000..f3f42e5
--- /dev/null
+++ b/sys/linux/arm64/arch/constants.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#define sys·OCreate 0100
+#define sys·OUnique 0200
+#define sys·ONoTTY 0400
+#define sys·OTrunc 01000
+#define sys·OAppend 02000
+#define sys·ONoBlock 04000
+#define sys·ODsync 010000
+#define sys·OSync 04010000
+#define sys·ORsync 04010000
+#define sys·ODirectory 040000
+#define sys·ONoFollow 0100000
+#define sys·OCloseExec 02000000
+#define sys·OAsync 020000
+#define sys·ODirect 0200000
+#define sys·OLargeFile 0400000
+#define sys·ONoATime 01000000
+#define sys·OPath 010000000
+#define sys·OTempFile 020040000
+
+#define SYS·HAVE_FCNTL
diff --git a/sys/linux/i386/arch/constants.h b/sys/linux/i386/arch/constants.h
new file mode 100644
index 0000000..ff6aa0c
--- /dev/null
+++ b/sys/linux/i386/arch/constants.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#define sys·OCreate 0100
+#define sys·OUnique 0200
+#define sys·ONoTTY 0400
+#define sys·OTrunc 01000
+#define sys·OAppend 02000
+#define sys·ONoBlock 04000
+#define sys·ODsync 010000
+#define sys·OSync 04010000
+#define sys·ORsync 04010000
+#define sys·ODirectory 0200000
+#define sys·ONoFollow 0400000
+#define sys·OCloseExec 02000000
+#define sys·OAsync 020000
+#define sys·ODirect 040000
+#define sys·OLargeFile 0100000
+#define sys·ONoATime 01000000
+#define sys·OPath 010000000
+#define sys·OTempfile 020200000
diff --git a/sys/linux/port/os/constants.h b/sys/linux/port/os/constants.h
index 8fb913f..ffe8610 100644
--- a/sys/linux/port/os/constants.h
+++ b/sys/linux/port/os/constants.h
@@ -1,18 +1,5 @@
#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
diff --git a/sys/linux/riscv64/arch/constants.h b/sys/linux/riscv64/arch/constants.h
new file mode 100644
index 0000000..ff6aa0c
--- /dev/null
+++ b/sys/linux/riscv64/arch/constants.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#define sys·OCreate 0100
+#define sys·OUnique 0200
+#define sys·ONoTTY 0400
+#define sys·OTrunc 01000
+#define sys·OAppend 02000
+#define sys·ONoBlock 04000
+#define sys·ODsync 010000
+#define sys·OSync 04010000
+#define sys·ORsync 04010000
+#define sys·ODirectory 0200000
+#define sys·ONoFollow 0400000
+#define sys·OCloseExec 02000000
+#define sys·OAsync 020000
+#define sys·ODirect 040000
+#define sys·OLargeFile 0100000
+#define sys·ONoATime 01000000
+#define sys·OPath 010000000
+#define sys·OTempfile 020200000