public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v2] io/mmap.c: fix musl build on mips64
Date: Tue, 10 May 2022 11:51:59 -0700	[thread overview]
Message-ID: <20220510185159.GA27195@magnolia> (raw)
In-Reply-To: <20220508193029.1277260-1-fontaine.fabrice@gmail.com>

On Sun, May 08, 2022 at 09:30:29PM +0200, Fabrice Fontaine wrote:
> musl undefines MAP_SYNC on some architectures such as mips64 since
> version 1.1.20 and
> https://github.com/ifduyue/musl/commit/9b57db3f958d9adc3b1c7371b5c6723aaee448b7
> resulting in the following build failure:
> 
> mmap.c: In function 'mmap_f':
> mmap.c:196:33: error: 'MAP_SYNC' undeclared (first use in this function); did you mean 'MS_SYNC'?
>   196 |                         flags = MAP_SYNC | MAP_SHARED_VALIDATE;
>       |                                 ^~~~~~~~
>       |                                 MS_SYNC
> 
> This build failure is raised because header includes have been tangled
> up:
> 
> input.h -> libfrog/projects.h -> xfs.h -> linux.h.
> 
> As a result, linux.h will be included before sys/mman.h and the
> following piece of code from linux.h will be "overriden" on platforms
> without MAP_SYNC:
> 
>  #ifndef HAVE_MAP_SYNC
>  #define MAP_SYNC 0
>  #define MAP_SHARED_VALIDATE 0
>  #else
>  #include <asm-generic/mman.h>
>  #include <asm-generic/mman-common.h>
>  #endif /* HAVE_MAP_SYNC */
> 
> To fix this build failure, include <sys/mman.h> before the other
> includes.
> 
> A more long-term solution would be to untangle the headers.
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/3296194907baf7d3fe039f59bcbf595aa8107a28
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

LGTM,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
> Changes v1 -> v2 (after review of Dave Chinner):
>  - Update commit message
> 
>  io/mmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/io/mmap.c b/io/mmap.c
> index 8c048a0a..b8609295 100644
> --- a/io/mmap.c
> +++ b/io/mmap.c
> @@ -4,9 +4,9 @@
>   * All Rights Reserved.
>   */
>  
> +#include <sys/mman.h>
>  #include "command.h"
>  #include "input.h"
> -#include <sys/mman.h>
>  #include <signal.h>
>  #include "init.h"
>  #include "io.h"
> -- 
> 2.35.1
> 

      parent reply	other threads:[~2022-05-10 18:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-08 19:30 [PATCH v2] io/mmap.c: fix musl build on mips64 Fabrice Fontaine
2022-05-10  9:31 ` Christoph Hellwig
2022-05-10 18:51 ` Darrick J. Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220510185159.GA27195@magnolia \
    --to=djwong@kernel.org \
    --cc=fontaine.fabrice@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox