From c9a32c1a43d2bdded07eaa45732c3a6e195a5442 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Sat, 20 Nov 2021 17:07:23 -0800 Subject: Chore: cleaned up the exit code to cleanly interface with libc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- sys/linux/riscv64/arch/constants.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 sys/linux/riscv64/arch/constants.h (limited to 'sys/linux/riscv64/arch/constants.h') 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 -- cgit v1.2.1