qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 02/16] bsd-user: Ifdef a few MAP_ constants for NetBSD


From: Warner Losh
Subject: Re: [PATCH 02/16] bsd-user: Ifdef a few MAP_ constants for NetBSD
Date: Sat, 8 Apr 2023 13:29:05 -0600



On Sat, Apr 8, 2023 at 1:03 PM Richard Henderson <richard.henderson@linaro.org> wrote:
On 4/5/23 14:35, Warner Losh wrote:
> MAP_GUARD, MAP_EXCL, and MAP_NOCORE are FreeBSD only. Add back the
> ifdefs that I removed in 36d5d891559f (but only these ifdefs, the
> rest of the commit is not reverted).
>
> Signed-off-by: Warner Losh<imp@bsdimp.com>
> ---
>   bsd-user/mmap.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
> index d6c5a344c9b..f732a6f6f2b 100644
> --- a/bsd-user/mmap.c
> +++ b/bsd-user/mmap.c
> @@ -416,27 +416,33 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
>               qemu_log("MAP_ALIGNED(%u) ",
>                        (flags & MAP_ALIGNMENT_MASK) >> MAP_ALIGNMENT_SHIFT);
>           }
> +#ifdef MAP_GUARD
>           if (flags & MAP_GUARD) {
>               qemu_log("MAP_GUARD ");
>           }
> +#endif

Maybe better as

#ifndef MAP_GUARD
#define MAP_GUARD 0
#endif

etc, somewhere common, and let the compiler eliminate the always false conditions.

Interesting notion...  I can do that in syscall_defs.h. If that's the pattern in qemu I'll
do it here.... but I've been burned in the past by warnings about always true or always
false conditions...  It would be less invasive though...

Warner

reply via email to

[Prev in Thread] Current Thread [Next in Thread]