mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] fix POSIX_FADV_DONTNEED/_NOREUSE on s390x
@ 2019-02-18 15:06 Jonathan Neuschäfer
  2019-02-19  1:40 ` Rich Felker
  2019-02-20 15:47 ` Jonathan Neuschäfer
  0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Neuschäfer @ 2019-02-18 15:06 UTC (permalink / raw)
  To: musl; +Cc: Jonathan Neuschäfer

On s390x, POSIX_FADV_DONTNEED and POSIX_FADV_NOREUSE have different
values than on all other architectures that Linux supports[1].

Handle this difference by moving their definition to arch/*/bits/fcntl.h.

This bug was caught by a build failure in strace[2].

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/fadvise.h#n10
[2]: https://git.alpinelinux.org/aports/commit/main/strace/APKBUILD?id=91ba657eca2cd8342dfcf6e077cae7cf3f1fc22c
---

I'm not completely sure if this is the right solution, or if there is
one with less duplication.
---
 arch/aarch64/bits/fcntl.h   | 3 +++
 arch/arm/bits/fcntl.h       | 3 +++
 arch/generic/bits/fcntl.h   | 3 +++
 arch/m68k/bits/fcntl.h      | 3 +++
 arch/mips/bits/fcntl.h      | 3 +++
 arch/mips64/bits/fcntl.h    | 3 +++
 arch/mipsn32/bits/fcntl.h   | 3 +++
 arch/powerpc/bits/fcntl.h   | 3 +++
 arch/powerpc64/bits/fcntl.h | 3 +++
 arch/s390x/bits/fcntl.h     | 3 +++
 arch/x32/bits/fcntl.h       | 3 +++
 arch/x86_64/bits/fcntl.h    | 3 +++
 include/fcntl.h             | 2 --
 13 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/arch/aarch64/bits/fcntl.h b/arch/aarch64/bits/fcntl.h
index 92787976..e7c80b29 100644
--- a/arch/aarch64/bits/fcntl.h
+++ b/arch/aarch64/bits/fcntl.h
@@ -36,3 +36,6 @@
 #define F_GETOWN_EX 16
 
 #define F_GETOWNER_UIDS 17
+
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
diff --git a/arch/arm/bits/fcntl.h b/arch/arm/bits/fcntl.h
index 4cb1753b..204bfbe1 100644
--- a/arch/arm/bits/fcntl.h
+++ b/arch/arm/bits/fcntl.h
@@ -38,3 +38,6 @@
 #define F_GETOWN_EX 16
 
 #define F_GETOWNER_UIDS 17
+
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
diff --git a/arch/generic/bits/fcntl.h b/arch/generic/bits/fcntl.h
index ae233cc0..0c25a535 100644
--- a/arch/generic/bits/fcntl.h
+++ b/arch/generic/bits/fcntl.h
@@ -38,3 +38,6 @@
 #define F_GETOWN_EX 16
 
 #define F_GETOWNER_UIDS 17
+
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
diff --git a/arch/m68k/bits/fcntl.h b/arch/m68k/bits/fcntl.h
index f1c8400f..1cbfa1b7 100644
--- a/arch/m68k/bits/fcntl.h
+++ b/arch/m68k/bits/fcntl.h
@@ -38,3 +38,6 @@
 #define F_GETOWN_EX 16
 
 #define F_GETOWNER_UIDS 17
+
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
diff --git a/arch/mips/bits/fcntl.h b/arch/mips/bits/fcntl.h
index 9fd8c23e..57bf3479 100644
--- a/arch/mips/bits/fcntl.h
+++ b/arch/mips/bits/fcntl.h
@@ -38,3 +38,6 @@
 #define F_GETOWN_EX 16
 
 #define F_GETOWNER_UIDS 17
+
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
diff --git a/arch/mips64/bits/fcntl.h b/arch/mips64/bits/fcntl.h
index 3bcec15e..83845c0c 100644
--- a/arch/mips64/bits/fcntl.h
+++ b/arch/mips64/bits/fcntl.h
@@ -38,3 +38,6 @@
 #define F_GETOWN_EX 16
 
 #define F_GETOWNER_UIDS 17
+
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
diff --git a/arch/mipsn32/bits/fcntl.h b/arch/mipsn32/bits/fcntl.h
index 9fd8c23e..57bf3479 100644
--- a/arch/mipsn32/bits/fcntl.h
+++ b/arch/mipsn32/bits/fcntl.h
@@ -38,3 +38,6 @@
 #define F_GETOWN_EX 16
 
 #define F_GETOWNER_UIDS 17
+
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
diff --git a/arch/powerpc/bits/fcntl.h b/arch/powerpc/bits/fcntl.h
index c3f875e5..03f6430e 100644
--- a/arch/powerpc/bits/fcntl.h
+++ b/arch/powerpc/bits/fcntl.h
@@ -38,3 +38,6 @@
 #define F_GETOWN_EX 16
 
 #define F_GETOWNER_UIDS 17
+
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
diff --git a/arch/powerpc64/bits/fcntl.h b/arch/powerpc64/bits/fcntl.h
index 6f20bac5..61a19647 100644
--- a/arch/powerpc64/bits/fcntl.h
+++ b/arch/powerpc64/bits/fcntl.h
@@ -38,3 +38,6 @@
 #define F_GETOWN_EX 16
 
 #define F_GETOWNER_UIDS 17
+
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
diff --git a/arch/s390x/bits/fcntl.h b/arch/s390x/bits/fcntl.h
index 1eca6ba5..a231efb4 100644
--- a/arch/s390x/bits/fcntl.h
+++ b/arch/s390x/bits/fcntl.h
@@ -38,3 +38,6 @@
 #define F_GETOWN_EX 16
 
 #define F_GETOWNER_UIDS 17
+
+#define POSIX_FADV_DONTNEED   6
+#define POSIX_FADV_NOREUSE    7
diff --git a/arch/x32/bits/fcntl.h b/arch/x32/bits/fcntl.h
index 1b88ad39..e0602778 100644
--- a/arch/x32/bits/fcntl.h
+++ b/arch/x32/bits/fcntl.h
@@ -38,3 +38,6 @@
 #define F_GETOWN_EX 16
 
 #define F_GETOWNER_UIDS 17
+
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
diff --git a/arch/x86_64/bits/fcntl.h b/arch/x86_64/bits/fcntl.h
index 1b88ad39..e0602778 100644
--- a/arch/x86_64/bits/fcntl.h
+++ b/arch/x86_64/bits/fcntl.h
@@ -38,3 +38,6 @@
 #define F_GETOWN_EX 16
 
 #define F_GETOWNER_UIDS 17
+
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
diff --git a/include/fcntl.h b/include/fcntl.h
index 4d91338b..a8808a0c 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -66,8 +66,6 @@ int posix_fallocate(int, off_t, off_t);
 #define POSIX_FADV_RANDOM     1
 #define POSIX_FADV_SEQUENTIAL 2
 #define POSIX_FADV_WILLNEED   3
-#define POSIX_FADV_DONTNEED   4
-#define POSIX_FADV_NOREUSE    5
 
 #undef SEEK_SET
 #undef SEEK_CUR
-- 
2.20.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fix POSIX_FADV_DONTNEED/_NOREUSE on s390x
  2019-02-18 15:06 [PATCH] fix POSIX_FADV_DONTNEED/_NOREUSE on s390x Jonathan Neuschäfer
@ 2019-02-19  1:40 ` Rich Felker
  2019-02-19  3:18   ` Markus Wichmann
  2019-02-20 15:47 ` Jonathan Neuschäfer
  1 sibling, 1 reply; 5+ messages in thread
From: Rich Felker @ 2019-02-19  1:40 UTC (permalink / raw)
  To: musl

On Mon, Feb 18, 2019 at 04:06:23PM +0100, Jonathan Neuschäfer wrote:
> On s390x, POSIX_FADV_DONTNEED and POSIX_FADV_NOREUSE have different
> values than on all other architectures that Linux supports[1].
> 
> Handle this difference by moving their definition to arch/*/bits/fcntl.h.
> 
> This bug was caught by a build failure in strace[2].
> 
> [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/fadvise.h#n10
> [2]: https://git.alpinelinux.org/aports/commit/main/strace/APKBUILD?id=91ba657eca2cd8342dfcf6e077cae7cf3f1fc22c
> ---
> 
> I'm not completely sure if this is the right solution, or if there is
> one with less duplication.

Anyone have opinions on this? We could do #ifndef in the top-level
fcntl.h so that bits only has to define it when it has a weird value.
Not sure if this is better or worse.

Rich


> ---
>  arch/aarch64/bits/fcntl.h   | 3 +++
>  arch/arm/bits/fcntl.h       | 3 +++
>  arch/generic/bits/fcntl.h   | 3 +++
>  arch/m68k/bits/fcntl.h      | 3 +++
>  arch/mips/bits/fcntl.h      | 3 +++
>  arch/mips64/bits/fcntl.h    | 3 +++
>  arch/mipsn32/bits/fcntl.h   | 3 +++
>  arch/powerpc/bits/fcntl.h   | 3 +++
>  arch/powerpc64/bits/fcntl.h | 3 +++
>  arch/s390x/bits/fcntl.h     | 3 +++
>  arch/x32/bits/fcntl.h       | 3 +++
>  arch/x86_64/bits/fcntl.h    | 3 +++
>  include/fcntl.h             | 2 --
>  13 files changed, 36 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/aarch64/bits/fcntl.h b/arch/aarch64/bits/fcntl.h
> index 92787976..e7c80b29 100644
> --- a/arch/aarch64/bits/fcntl.h
> +++ b/arch/aarch64/bits/fcntl.h
> @@ -36,3 +36,6 @@
>  #define F_GETOWN_EX 16
>  
>  #define F_GETOWNER_UIDS 17
> +
> +#define POSIX_FADV_DONTNEED   4
> +#define POSIX_FADV_NOREUSE    5
> diff --git a/arch/arm/bits/fcntl.h b/arch/arm/bits/fcntl.h
> index 4cb1753b..204bfbe1 100644
> --- a/arch/arm/bits/fcntl.h
> +++ b/arch/arm/bits/fcntl.h
> @@ -38,3 +38,6 @@
>  #define F_GETOWN_EX 16
>  
>  #define F_GETOWNER_UIDS 17
> +
> +#define POSIX_FADV_DONTNEED   4
> +#define POSIX_FADV_NOREUSE    5
> diff --git a/arch/generic/bits/fcntl.h b/arch/generic/bits/fcntl.h
> index ae233cc0..0c25a535 100644
> --- a/arch/generic/bits/fcntl.h
> +++ b/arch/generic/bits/fcntl.h
> @@ -38,3 +38,6 @@
>  #define F_GETOWN_EX 16
>  
>  #define F_GETOWNER_UIDS 17
> +
> +#define POSIX_FADV_DONTNEED   4
> +#define POSIX_FADV_NOREUSE    5
> diff --git a/arch/m68k/bits/fcntl.h b/arch/m68k/bits/fcntl.h
> index f1c8400f..1cbfa1b7 100644
> --- a/arch/m68k/bits/fcntl.h
> +++ b/arch/m68k/bits/fcntl.h
> @@ -38,3 +38,6 @@
>  #define F_GETOWN_EX 16
>  
>  #define F_GETOWNER_UIDS 17
> +
> +#define POSIX_FADV_DONTNEED   4
> +#define POSIX_FADV_NOREUSE    5
> diff --git a/arch/mips/bits/fcntl.h b/arch/mips/bits/fcntl.h
> index 9fd8c23e..57bf3479 100644
> --- a/arch/mips/bits/fcntl.h
> +++ b/arch/mips/bits/fcntl.h
> @@ -38,3 +38,6 @@
>  #define F_GETOWN_EX 16
>  
>  #define F_GETOWNER_UIDS 17
> +
> +#define POSIX_FADV_DONTNEED   4
> +#define POSIX_FADV_NOREUSE    5
> diff --git a/arch/mips64/bits/fcntl.h b/arch/mips64/bits/fcntl.h
> index 3bcec15e..83845c0c 100644
> --- a/arch/mips64/bits/fcntl.h
> +++ b/arch/mips64/bits/fcntl.h
> @@ -38,3 +38,6 @@
>  #define F_GETOWN_EX 16
>  
>  #define F_GETOWNER_UIDS 17
> +
> +#define POSIX_FADV_DONTNEED   4
> +#define POSIX_FADV_NOREUSE    5
> diff --git a/arch/mipsn32/bits/fcntl.h b/arch/mipsn32/bits/fcntl.h
> index 9fd8c23e..57bf3479 100644
> --- a/arch/mipsn32/bits/fcntl.h
> +++ b/arch/mipsn32/bits/fcntl.h
> @@ -38,3 +38,6 @@
>  #define F_GETOWN_EX 16
>  
>  #define F_GETOWNER_UIDS 17
> +
> +#define POSIX_FADV_DONTNEED   4
> +#define POSIX_FADV_NOREUSE    5
> diff --git a/arch/powerpc/bits/fcntl.h b/arch/powerpc/bits/fcntl.h
> index c3f875e5..03f6430e 100644
> --- a/arch/powerpc/bits/fcntl.h
> +++ b/arch/powerpc/bits/fcntl.h
> @@ -38,3 +38,6 @@
>  #define F_GETOWN_EX 16
>  
>  #define F_GETOWNER_UIDS 17
> +
> +#define POSIX_FADV_DONTNEED   4
> +#define POSIX_FADV_NOREUSE    5
> diff --git a/arch/powerpc64/bits/fcntl.h b/arch/powerpc64/bits/fcntl.h
> index 6f20bac5..61a19647 100644
> --- a/arch/powerpc64/bits/fcntl.h
> +++ b/arch/powerpc64/bits/fcntl.h
> @@ -38,3 +38,6 @@
>  #define F_GETOWN_EX 16
>  
>  #define F_GETOWNER_UIDS 17
> +
> +#define POSIX_FADV_DONTNEED   4
> +#define POSIX_FADV_NOREUSE    5
> diff --git a/arch/s390x/bits/fcntl.h b/arch/s390x/bits/fcntl.h
> index 1eca6ba5..a231efb4 100644
> --- a/arch/s390x/bits/fcntl.h
> +++ b/arch/s390x/bits/fcntl.h
> @@ -38,3 +38,6 @@
>  #define F_GETOWN_EX 16
>  
>  #define F_GETOWNER_UIDS 17
> +
> +#define POSIX_FADV_DONTNEED   6
> +#define POSIX_FADV_NOREUSE    7
> diff --git a/arch/x32/bits/fcntl.h b/arch/x32/bits/fcntl.h
> index 1b88ad39..e0602778 100644
> --- a/arch/x32/bits/fcntl.h
> +++ b/arch/x32/bits/fcntl.h
> @@ -38,3 +38,6 @@
>  #define F_GETOWN_EX 16
>  
>  #define F_GETOWNER_UIDS 17
> +
> +#define POSIX_FADV_DONTNEED   4
> +#define POSIX_FADV_NOREUSE    5
> diff --git a/arch/x86_64/bits/fcntl.h b/arch/x86_64/bits/fcntl.h
> index 1b88ad39..e0602778 100644
> --- a/arch/x86_64/bits/fcntl.h
> +++ b/arch/x86_64/bits/fcntl.h
> @@ -38,3 +38,6 @@
>  #define F_GETOWN_EX 16
>  
>  #define F_GETOWNER_UIDS 17
> +
> +#define POSIX_FADV_DONTNEED   4
> +#define POSIX_FADV_NOREUSE    5
> diff --git a/include/fcntl.h b/include/fcntl.h
> index 4d91338b..a8808a0c 100644
> --- a/include/fcntl.h
> +++ b/include/fcntl.h
> @@ -66,8 +66,6 @@ int posix_fallocate(int, off_t, off_t);
>  #define POSIX_FADV_RANDOM     1
>  #define POSIX_FADV_SEQUENTIAL 2
>  #define POSIX_FADV_WILLNEED   3
> -#define POSIX_FADV_DONTNEED   4
> -#define POSIX_FADV_NOREUSE    5
>  
>  #undef SEEK_SET
>  #undef SEEK_CUR
> -- 
> 2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fix POSIX_FADV_DONTNEED/_NOREUSE on s390x
  2019-02-19  1:40 ` Rich Felker
@ 2019-02-19  3:18   ` Markus Wichmann
  2019-02-19  5:47     ` Rich Felker
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Wichmann @ 2019-02-19  3:18 UTC (permalink / raw)
  To: musl

On Mon, Feb 18, 2019 at 08:40:14PM -0500, Rich Felker wrote:
> Anyone have opinions on this? We could do #ifndef in the top-level
> fcntl.h so that bits only has to define it when it has a weird value.
> Not sure if this is better or worse.
> 
> Rich

The less duplication the better. I think programmers should have special
keyboards with a knife in the C button that is armed when pressing Ctrl.
OK, make it a needle, because sometimes copying is necessary, but it
should be minimized.

Ultimately, though, it is down to taste.

Ciao,
Markus


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fix POSIX_FADV_DONTNEED/_NOREUSE on s390x
  2019-02-19  3:18   ` Markus Wichmann
@ 2019-02-19  5:47     ` Rich Felker
  0 siblings, 0 replies; 5+ messages in thread
From: Rich Felker @ 2019-02-19  5:47 UTC (permalink / raw)
  To: musl

On Tue, Feb 19, 2019 at 04:18:02AM +0100, Markus Wichmann wrote:
> On Mon, Feb 18, 2019 at 08:40:14PM -0500, Rich Felker wrote:
> > Anyone have opinions on this? We could do #ifndef in the top-level
> > fcntl.h so that bits only has to define it when it has a weird value.
> > Not sure if this is better or worse.
> > 
> > Rich
> 
> The less duplication the better. I think programmers should have special
> keyboards with a knife in the C button that is armed when pressing Ctrl.
> OK, make it a needle, because sometimes copying is necessary, but it
> should be minimized.

Thankfully I use C-k and C-y. ;-)

Rich


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fix POSIX_FADV_DONTNEED/_NOREUSE on s390x
  2019-02-18 15:06 [PATCH] fix POSIX_FADV_DONTNEED/_NOREUSE on s390x Jonathan Neuschäfer
  2019-02-19  1:40 ` Rich Felker
@ 2019-02-20 15:47 ` Jonathan Neuschäfer
  1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Neuschäfer @ 2019-02-20 15:47 UTC (permalink / raw)
  To: Rich Felker; +Cc: musl, Jonathan Neuschäfer

[-- Attachment #1: Type: text/plain, Size: 434 bytes --]

(Sorry for the messed-up In-Reply-To header; I wasn't subscribed so I read your
mail in the archive.)

Hi,

On Mon, Feb 18, 2019 at 08:40:14PM -0500, Rich Felker wrote:
> Anyone have opinions on this? We could do #ifndef in the top-level
> fcntl.h so that bits only has to define it when it has a weird value.
> Not sure if this is better or worse.

I'll try this approach for version 2.


Thanks,
Jonathan Neuschäfer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-20 15:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-18 15:06 [PATCH] fix POSIX_FADV_DONTNEED/_NOREUSE on s390x Jonathan Neuschäfer
2019-02-19  1:40 ` Rich Felker
2019-02-19  3:18   ` Markus Wichmann
2019-02-19  5:47     ` Rich Felker
2019-02-20 15:47 ` Jonathan Neuschäfer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).