From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EA831C7619A for ; Sat, 8 Apr 2023 19:30:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plEFZ-0002JC-MR; Sat, 08 Apr 2023 15:29:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1plEFU-0002Il-MV for qemu-devel@nongnu.org; Sat, 08 Apr 2023 15:29:20 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1plEFS-0007qS-EY for qemu-devel@nongnu.org; Sat, 08 Apr 2023 15:29:20 -0400 Received: by mail-ej1-x635.google.com with SMTP id gb34so4183408ejc.12 for ; Sat, 08 Apr 2023 12:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; t=1680982154; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=HBwZjoMef3VxK6BVfK8AV5+XcZanopEEzqB864jQj/k=; b=027qqZUGChhS9jiu8HcuYFDJuGtebvIDhsjhZoEbgcY5DgJKUL5rEVVavPJeaH7ayr eCMzWvlol0f3yxccp4Souq1LcaQbDnDjH5VL25zNbGQd82FLsyH/JbY/u7DqzRkZPtcK innUGgVBiaCub+OeYBEZDQrgAzNgELMtek0ghRPOF3y49j4KAaMw6ji43GrO6lMGBQOg Oon7w8dsp9OG/QyNybfG4yoWheZxTBwGVS9li77Bj13mRbUcZyA2h+AG8CaVtXFbQIok g5Q/nHGrJmW7cbLEdtz17beXvqLpZEPJ3jBLXKrxFyl0kRE79hroBoxmqHP8Uw8nNraB R7ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680982154; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HBwZjoMef3VxK6BVfK8AV5+XcZanopEEzqB864jQj/k=; b=iL+kOlCCibQqEcv8riQEjhandbsDnFAhi2iShRJNq+bcn1yvACmvwPk2tJTd4X6YYN nO0l5btKty+Jm6RhFMBfKIygD2kj9GgOa952tfFK/Vp8KOR9AQPjMY2jKzHKuG+XNQld G27CEx4p0bGoViEq5TM8N2bslaCeeLgQL8P6bulLDn6d3cTy7HLj5hBFsZtGb6KlJP5C CMmsE4ZbeY/rW8/aKndDCHcD3RlqgDDtZvr5x05xezYsfcAiwY+iZ4kio2lcD7QCUQ+b Nya1ZlF1P9sfUWKiVFANHF6c2flLqMHznUzh9kTYo3EFMUabXfKe2En1zQ4lsT4OIzKr U5pg== X-Gm-Message-State: AAQBX9ftOjQqcb4i64t4Wagt2JvOPwASm/c0hkEniH+wVENVOkoBsKKs 51Z+TJT5pRcKZHdF4gDPgrmi8Jm/roROm2Shi+yfXw== X-Google-Smtp-Source: AKy350aZKgTErbeqlYdC6cJhGumvHS7cOKP0oPuTeX90nLDJsAbSqkIs686+lsXwK01PTPU7TFHZKe7/fU4RmjZYxls= X-Received: by 2002:a17:907:c208:b0:947:c623:2c84 with SMTP id ti8-20020a170907c20800b00947c6232c84mr1479498ejc.2.1680982154366; Sat, 08 Apr 2023 12:29:14 -0700 (PDT) MIME-Version: 1.0 References: <20230405213612.15942-1-imp@bsdimp.com> <20230405213612.15942-3-imp@bsdimp.com> In-Reply-To: From: Warner Losh Date: Sat, 8 Apr 2023 13:29:05 -0600 Message-ID: Subject: Re: [PATCH 02/16] bsd-user: Ifdef a few MAP_ constants for NetBSD To: Richard Henderson Cc: qemu-devel@nongnu.org, reinoud@netbsd.org, riastradh@netbsd.org, ryoon@netbsd.org, jrtc27@jrtc27.com, kevans@freebsd.org, Brad Smith Content-Type: multipart/alternative; boundary="0000000000002f66de05f8d8286b" Received-SPF: none client-ip=2a00:1450:4864:20::635; envelope-from=wlosh@bsdimp.com; helo=mail-ej1-x635.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org --0000000000002f66de05f8d8286b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Apr 8, 2023 at 1:03=E2=80=AFPM 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 > > --- > > 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 --0000000000002f66de05f8d8286b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Sat, Apr 8, 2023 at 1:03=E2=80=AFP= M Richard Henderson <ric= hard.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>
> ---
>=C2=A0 =C2=A0bsd-user/mmap.c | 10 ++++++++++
>=C2=A0 =C2=A01 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,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0qemu_log("M= AP_ALIGNED(%u) ",
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (flags & MAP_ALIGNMENT_MASK) >> MAP_ALIGNMENT_SHIFT= );
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> +#ifdef MAP_GUARD
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (flags & MAP_GUARD) { >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0qemu_log("M= AP_GUARD ");
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> +#endif

Maybe better as

#ifndef MAP_GUARD
#define MAP_GUARD 0
#endif

etc, somewhere common, and let the compiler eliminate the always false cond= itions.

Interesting notion...=C2=A0 I c= an 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 abo= ut always true or always
false conditions...=C2=A0 It would be le= ss invasive though...

Warner
--0000000000002f66de05f8d8286b--