git: 952c48de876d - stable/13 - kboot: Add HOST_O_ constants for open, etc

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 24 Jan 2023 22:10:55 UTC
The branch stable/13 has been updated by imp:

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

commit 952c48de876d666464dbc198e86cf7c61ea8ef08
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-07-01 17:57:02 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-01-24 21:49:24 +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
    
    (cherry picked from commit ae366d5106844c26ecec54b6926c13064a224aa9)
---
 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
  */