Date: Fri, 15 Jul 2022 18:04:08 GMT From: Warner Losh <imp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 01c58e7e4fd8 - main - kboot: Pull in constants from Linux's mmap.h api Message-ID: <202207151804.26FI48Io060433@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=01c58e7e4fd830b736c2fdcee4965e135f6e6685 commit 01c58e7e4fd830b736c2fdcee4965e135f6e6685 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2022-06-28 16:43:42 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2022-07-15 18:00:51 +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 --- 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?202207151804.26FI48Io060433>