From ae366d5106844c26ecec54b6926c13064a224aa9 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Fri, 1 Jul 2022 11:57:02 -0600 Subject: [PATCH] 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 */