git: ae366d510684 - main - kboot: Add HOST_O_ constants for open, etc

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 15 Jul 2022 18:03:55 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=ae366d5106844c26ecec54b6926c13064a224aa9

commit ae366d5106844c26ecec54b6926c13064a224aa9
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-07-01 17:57:02 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-07-15 18:00:50 +0000

    kboot: Add HOST_O_ constants for open, etc
    
    Add the common O_ constants for the open, fcntl, etc system calls. They
    are different than FreeBSD's. While they can differ based on
    architecture, they are constant for architectures we care about, and
    those architectures use the 'generic' version so future architectures
    will also work.
    
    Sponsored by:           Netflix
---
 stand/kboot/host_syscall.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/stand/kboot/host_syscall.h b/stand/kboot/host_syscall.h
index b13829e4d05b..24b966b34ed8 100644
--- a/stand/kboot/host_syscall.h
+++ b/stand/kboot/host_syscall.h
@@ -32,6 +32,27 @@
 
 long host_syscall(int number, ...);
 
+/*
+ * Constants for open, fcntl, etc
+ *
+ * Note: Some of these are arch dependent on Linux, but are the same for
+ * powerpc, x86, arm*, and riscv. We should be futureproof, though, since these
+ * are the 'generic' values and only older architectures (no longer supported by
+ * FreeBSD) vary.
+ *
+ * These are from tools/include/uapi/asm-generic/fcntl.h and use the octal
+ * notation. Beware, hex is used in other places creating potential confsion.
+ */
+#define HOST_O_RDONLY		    0
+#define HOST_O_WRONLY		    1
+#define HOST_O_RDWR		    2
+#define HOST_O_CREAT		00100
+#define HOST_O_EXCL		00200
+#define HOST_O_NOCTTY		00400
+#define HOST_O_TRUNC		01000
+#define HOST_O_APPEND		02000
+#define HOST_O_NONBLOCK		04000
+
 /*
  * Data types
  */