Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jan 2023 22:11:07 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 0d3b88bc5a8b - stable/13 - kboot: Pull in constants from Linux's mmap.h api
Message-ID:  <202301242211.30OMB7bR083498@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by imp:

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

commit 0d3b88bc5a8b45d9e0815126e12344dbbc689df7
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-06-28 16:43:42 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-01-24 21:49:25 +0000

    kboot: Pull in constants from Linux's mmap.h api
    
    Define the usual #defines for mmap(2) (with HOST_ prepended) and use
    them instead of hard coding constants.
    
    Sponsored by:           Netflix
    
    (cherry picked from commit 01c58e7e4fd830b736c2fdcee4965e135f6e6685)
---
 stand/kboot/host_syscall.h | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/stand/kboot/host_syscall.h b/stand/kboot/host_syscall.h
index 061f82b062b0..b867cd9f0d99 100644
--- a/stand/kboot/host_syscall.h
+++ b/stand/kboot/host_syscall.h
@@ -86,7 +86,20 @@ struct host_timeval {
 	long tv_usec;
 };
 
-#define HOST_AT_FDCWD		-100		/* Relative to current directory */
+/*
+ * Must match Linux's values see linux/tools/include/uapi/asm-generic/mman-common.h
+ * and linux/tools/include/linux/mman.h
+ *
+ * And pre-pend HOST_ here.
+ */
+#define HOST_PROT_READ	0x1
+#define HOST_PROT_WRITE	0x2
+#define HOST_PROT_EXEC	0x4
+
+#define HOST_MAP_SHARED		0x01
+#define	HOST_MAP_PRIVATE	0x02
+#define HOST_MAP_FIXED		0x10
+#define HOST_MAP_ANONYMOUS	0x20
 
 /* Mount flags from uapi */
 #define MS_RELATIME (1 << 21)
@@ -147,6 +160,8 @@ ssize_t host_write(int fd, const void *buf, size_t nbyte);
 /*
  * Wrappers / one-liners
  */
-#define host_getmem(size) host_mmap(0, size, 3 /* RW */, 0x22 /* ANON */, -1, 0);
+#define host_getmem(size) \
+	host_mmap(0, size, HOST_PROT_READ | HOST_PROT_WRITE, \
+	    HOST_MAP_PRIVATE | HOST_MAP_ANONYMOUS, -1, 0);
 
 #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202301242211.30OMB7bR083498>