[1/2] systemd: Add missed sys/file.h includes for musl

Message ID 20220620161228.5267-1-pavel@zhukoff.net
State Accepted, archived
Commit 526e0ab4275a130b354090ac42a6147f5660e169
Headers show
Series [1/2] systemd: Add missed sys/file.h includes for musl | expand

Commit Message

Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
---
 .../0001-Add-sys-file.h-for-LOCK_.patch       | 80 +++++++++++++++++++
 meta/recipes-core/systemd/systemd_251.2.bb    |  2 +-
 2 files changed, 81 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch

Comments

Khem Raj June 21, 2022, 12:09 a.m. UTC | #1
This could be a generic patch and also submit it upstream

On Mon, Jun 20, 2022 at 9:43 PM Pavel Zhukov <pavel@zhukoff.net> wrote:

> Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
> ---
>  .../0001-Add-sys-file.h-for-LOCK_.patch       | 80 +++++++++++++++++++
>  meta/recipes-core/systemd/systemd_251.2.bb    |  2 +-
>  2 files changed, 81 insertions(+), 1 deletion(-)
>  create mode 100644
> meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch
>
> diff --git
> a/meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch
> b/meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch
> new file mode 100644
> index 0000000000..25a1042a9d
> --- /dev/null
> +++ b/meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch
> @@ -0,0 +1,80 @@
> +From 7ae39374fda539aa613caeeee09be8d050a9bb79 Mon Sep 17 00:00:00 2001
> +From: Pavel Zhukov <pavel.zhukov@huawei.com>
> +Date: Mon, 20 Jun 2022 11:24:52 +0200
> +Subject: [PATCH] Add sys/file.h for LOCK_
> +Cc: pavel@zhukoff.net
> +
> +Upstream-Status: Inappropriate [musl specific]
> +
> +Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
> +---
> + src/core/namespace.c       | 1 +
> + src/dissect/dissect.c      | 1 +
> + src/shared/dissect-image.c | 2 ++
> + src/sysext/sysext.c        | 1 +
> + src/test/test-loop-block.c | 1 +
> + 5 files changed, 6 insertions(+)
> +
> +diff --git a/src/core/namespace.c b/src/core/namespace.c
> +index 926aa96174..39f9e21c93 100644
> +--- a/src/core/namespace.c
> ++++ b/src/core/namespace.c
> +@@ -7,6 +7,7 @@
> + #include <sys/mount.h>
> + #include <unistd.h>
> + #include <linux/fs.h>
> ++#include <sys/file.h> // For LOCK_ musl-specific
> +
> + #include "alloc-util.h"
> + #include "base-filesystem.h"
> +diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c
> +index bd94a755db..a0d2a6f287 100644
> +--- a/src/dissect/dissect.c
> ++++ b/src/dissect/dissect.c
> +@@ -6,6 +6,7 @@
> + #include <stdio.h>
> + #include <sys/ioctl.h>
> + #include <sys/mount.h>
> ++#include <sys/file.h> // musl specific for LOCK_
> +
> + #include "architecture.h"
> + #include "chase-symlinks.h"
> +diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
> +index 1ab88839aa..a9e3fe4b44 100644
> +--- a/src/shared/dissect-image.c
> ++++ b/src/shared/dissect-image.c
> +@@ -4,6 +4,8 @@
> + #include <valgrind/memcheck.h>
> + #endif
> +
> ++#include <sys/file.h> // For LOCK (musl specific)
> ++
> + #include <linux/blkpg.h>
> + #include <linux/dm-ioctl.h>
> + #include <linux/loop.h>
> +diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c
> +index 364af195e0..85686c0fab 100644
> +--- a/src/sysext/sysext.c
> ++++ b/src/sysext/sysext.c
> +@@ -5,6 +5,7 @@
> + #include <linux/loop.h>
> + #include <sys/mount.h>
> + #include <unistd.h>
> ++#include <sys/file.h> // LOCK_ (musl-specific)
> +
> + #include "capability-util.h"
> + #include "chase-symlinks.h"
> +diff --git a/src/test/test-loop-block.c b/src/test/test-loop-block.c
> +index d1793222f0..6886c4cd31 100644
> +--- a/src/test/test-loop-block.c
> ++++ b/src/test/test-loop-block.c
> +@@ -3,6 +3,7 @@
> + #include <fcntl.h>
> + #include <linux/loop.h>
> + #include <pthread.h>
> ++#include <sys/file.h> // LOCK_ (Musl specific)
> +
> + #include "alloc-util.h"
> + #include "dissect-image.h"
> +--
> +2.35.1
> diff --git a/meta/recipes-core/systemd/systemd_251.2.bb
> b/meta/recipes-core/systemd/systemd_251.2.bb
> index 8370bec0ca..88216ccf6e 100644
> --- a/meta/recipes-core/systemd/systemd_251.2.bb
> +++ b/meta/recipes-core/systemd/systemd_251.2.bb
> @@ -35,7 +35,6 @@ SRC_URI_MUSL = "\
>
> file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \
>
> file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
>                 file://0008-add-missing-FTW_-macros-for-musl.patch \
> -
>  file://0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch \
>                 file://0010-Use-uintmax_t-for-handling-rlim_t.patch \
>
> file://0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \
>
> file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \
> @@ -51,6 +50,7 @@ SRC_URI_MUSL = "\
>                 file://0001-pass-correct-parameters-to-getdents64.patch \
>                 file://0002-Add-sys-stat.h-for-S_IFDIR.patch \
>                 file://0001-Adjust-for-musl-headers.patch \
> +               file://0001-Add-sys-file.h-for-LOCK_.patch \
>                 "
>
>  PAM_PLUGINS = " \
> --
> 2.35.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#167121):
> https://lists.openembedded.org/g/openembedded-core/message/167121
> Mute This Topic: https://lists.openembedded.org/mt/91880524/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Luca Ceresoli June 21, 2022, 8:48 a.m. UTC | #2
Hi Pavel,

On Mon, 20 Jun 2022 18:12:28 +0200
"Pavel Zhukov" <pavel@zhukoff.net> wrote:

> Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
> ---
>  .../0001-Add-sys-file.h-for-LOCK_.patch       | 80 +++++++++++++++++++
>  meta/recipes-core/systemd/systemd_251.2.bb    |  2 +-
>  2 files changed, 81 insertions(+), 1 deletion(-)
>  create mode 100644 meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch
> 
> diff --git a/meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch b/meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch
> new file mode 100644
> index 0000000000..25a1042a9d
> --- /dev/null
> +++ b/meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch
> @@ -0,0 +1,80 @@
> +From 7ae39374fda539aa613caeeee09be8d050a9bb79 Mon Sep 17 00:00:00 2001
> +From: Pavel Zhukov <pavel.zhukov@huawei.com>
> +Date: Mon, 20 Jun 2022 11:24:52 +0200
> +Subject: [PATCH] Add sys/file.h for LOCK_
> +Cc: pavel@zhukoff.net
> +
> +Upstream-Status: Inappropriate [musl specific]
> +
> +Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
> +---
> + src/core/namespace.c       | 1 +
> + src/dissect/dissect.c      | 1 +
> + src/shared/dissect-image.c | 2 ++
> + src/sysext/sysext.c        | 1 +
> + src/test/test-loop-block.c | 1 +
> + 5 files changed, 6 insertions(+)
> +
> +diff --git a/src/core/namespace.c b/src/core/namespace.c
> +index 926aa96174..39f9e21c93 100644
> +--- a/src/core/namespace.c
> ++++ b/src/core/namespace.c
> +@@ -7,6 +7,7 @@
> + #include <sys/mount.h>
> + #include <unistd.h>
> + #include <linux/fs.h>
> ++#include <sys/file.h> // For LOCK_ musl-specific
> +
> + #include "alloc-util.h"
> + #include "base-filesystem.h"
> +diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c
> +index bd94a755db..a0d2a6f287 100644
> +--- a/src/dissect/dissect.c
> ++++ b/src/dissect/dissect.c
> +@@ -6,6 +6,7 @@
> + #include <stdio.h>
> + #include <sys/ioctl.h>
> + #include <sys/mount.h>
> ++#include <sys/file.h> // musl specific for LOCK_
> +
> + #include "architecture.h"
> + #include "chase-symlinks.h"
> +diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
> +index 1ab88839aa..a9e3fe4b44 100644
> +--- a/src/shared/dissect-image.c
> ++++ b/src/shared/dissect-image.c
> +@@ -4,6 +4,8 @@
> + #include <valgrind/memcheck.h>
> + #endif
> +
> ++#include <sys/file.h> // For LOCK (musl specific)
> ++
> + #include <linux/blkpg.h>
> + #include <linux/dm-ioctl.h>
> + #include <linux/loop.h>
> +diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c
> +index 364af195e0..85686c0fab 100644
> +--- a/src/sysext/sysext.c
> ++++ b/src/sysext/sysext.c
> +@@ -5,6 +5,7 @@
> + #include <linux/loop.h>
> + #include <sys/mount.h>
> + #include <unistd.h>
> ++#include <sys/file.h> // LOCK_ (musl-specific)
> +
> + #include "capability-util.h"
> + #include "chase-symlinks.h"
> +diff --git a/src/test/test-loop-block.c b/src/test/test-loop-block.c
> +index d1793222f0..6886c4cd31 100644
> +--- a/src/test/test-loop-block.c
> ++++ b/src/test/test-loop-block.c
> +@@ -3,6 +3,7 @@
> + #include <fcntl.h>
> + #include <linux/loop.h>
> + #include <pthread.h>
> ++#include <sys/file.h> 

Minor nit: better using always the same string. Now there 4 different
comments saying the same thing.

> diff --git a/meta/recipes-core/systemd/systemd_251.2.bb b/meta/recipes-core/systemd/systemd_251.2.bb
> index 8370bec0ca..88216ccf6e 100644
> --- a/meta/recipes-core/systemd/systemd_251.2.bb
> +++ b/meta/recipes-core/systemd/systemd_251.2.bb
> @@ -35,7 +35,6 @@ SRC_URI_MUSL = "\
>                 file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \
>                 file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
>                 file://0008-add-missing-FTW_-macros-for-musl.patch \
> -               file://0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch \

This line should be in patch 2/2.
Luca Ceresoli June 21, 2022, 8:53 a.m. UTC | #3
Hi Pavel,

On Tue, 21 Jun 2022 10:48:13 +0200
"Luca Ceresoli via lists.openembedded.org"
<luca.ceresoli=bootlin.com@lists.openembedded.org> wrote:

> Hi Pavel,
> 
> On Mon, 20 Jun 2022 18:12:28 +0200
> "Pavel Zhukov" <pavel@zhukoff.net> wrote:
> 
> > Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
> > ---
> >  .../0001-Add-sys-file.h-for-LOCK_.patch       | 80 +++++++++++++++++++
> >  meta/recipes-core/systemd/systemd_251.2.bb    |  2 +-
> >  2 files changed, 81 insertions(+), 1 deletion(-)
> >  create mode 100644 meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch
> > 
> > diff --git a/meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch b/meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch
> > new file mode 100644
> > index 0000000000..25a1042a9d
> > --- /dev/null
> > +++ b/meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch
> > @@ -0,0 +1,80 @@
> > +From 7ae39374fda539aa613caeeee09be8d050a9bb79 Mon Sep 17 00:00:00 2001
> > +From: Pavel Zhukov <pavel.zhukov@huawei.com>
> > +Date: Mon, 20 Jun 2022 11:24:52 +0200
> > +Subject: [PATCH] Add sys/file.h for LOCK_
> > +Cc: pavel@zhukoff.net
> > +
> > +Upstream-Status: Inappropriate [musl specific]
> > +
> > +Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
> > +---
> > + src/core/namespace.c       | 1 +
> > + src/dissect/dissect.c      | 1 +
> > + src/shared/dissect-image.c | 2 ++
> > + src/sysext/sysext.c        | 1 +
> > + src/test/test-loop-block.c | 1 +
> > + 5 files changed, 6 insertions(+)
> > +
> > +diff --git a/src/core/namespace.c b/src/core/namespace.c
> > +index 926aa96174..39f9e21c93 100644
> > +--- a/src/core/namespace.c
> > ++++ b/src/core/namespace.c
> > +@@ -7,6 +7,7 @@
> > + #include <sys/mount.h>
> > + #include <unistd.h>
> > + #include <linux/fs.h>
> > ++#include <sys/file.h> // For LOCK_ musl-specific
> > +
> > + #include "alloc-util.h"
> > + #include "base-filesystem.h"
> > +diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c
> > +index bd94a755db..a0d2a6f287 100644
> > +--- a/src/dissect/dissect.c
> > ++++ b/src/dissect/dissect.c
> > +@@ -6,6 +6,7 @@
> > + #include <stdio.h>
> > + #include <sys/ioctl.h>
> > + #include <sys/mount.h>
> > ++#include <sys/file.h> // musl specific for LOCK_
> > +
> > + #include "architecture.h"
> > + #include "chase-symlinks.h"
> > +diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
> > +index 1ab88839aa..a9e3fe4b44 100644
> > +--- a/src/shared/dissect-image.c
> > ++++ b/src/shared/dissect-image.c
> > +@@ -4,6 +4,8 @@
> > + #include <valgrind/memcheck.h>
> > + #endif
> > +
> > ++#include <sys/file.h> // For LOCK (musl specific)
> > ++
> > + #include <linux/blkpg.h>
> > + #include <linux/dm-ioctl.h>
> > + #include <linux/loop.h>
> > +diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c
> > +index 364af195e0..85686c0fab 100644
> > +--- a/src/sysext/sysext.c
> > ++++ b/src/sysext/sysext.c
> > +@@ -5,6 +5,7 @@
> > + #include <linux/loop.h>
> > + #include <sys/mount.h>
> > + #include <unistd.h>
> > ++#include <sys/file.h> // LOCK_ (musl-specific)
> > +
> > + #include "capability-util.h"
> > + #include "chase-symlinks.h"
> > +diff --git a/src/test/test-loop-block.c b/src/test/test-loop-block.c
> > +index d1793222f0..6886c4cd31 100644
> > +--- a/src/test/test-loop-block.c
> > ++++ b/src/test/test-loop-block.c
> > +@@ -3,6 +3,7 @@
> > + #include <fcntl.h>
> > + #include <linux/loop.h>
> > + #include <pthread.h>
> > ++#include <sys/file.h>   
> 
> Minor nit: better using always the same string. Now there 4 different
> comments saying the same thing.
> 
> > diff --git a/meta/recipes-core/systemd/systemd_251.2.bb b/meta/recipes-core/systemd/systemd_251.2.bb
> > index 8370bec0ca..88216ccf6e 100644
> > --- a/meta/recipes-core/systemd/systemd_251.2.bb
> > +++ b/meta/recipes-core/systemd/systemd_251.2.bb
> > @@ -35,7 +35,6 @@ SRC_URI_MUSL = "\
> >                 file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \
> >                 file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
> >                 file://0008-add-missing-FTW_-macros-for-musl.patch \
> > -               file://0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch \  
> 
> This line should be in patch 2/2.

Now I noticed you already addressed both of my remarks in your v2 which
has just reached my inbox. Sorry for the noise.

Patch

diff --git a/meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch b/meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch
new file mode 100644
index 0000000000..25a1042a9d
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-Add-sys-file.h-for-LOCK_.patch
@@ -0,0 +1,80 @@ 
+From 7ae39374fda539aa613caeeee09be8d050a9bb79 Mon Sep 17 00:00:00 2001
+From: Pavel Zhukov <pavel.zhukov@huawei.com>
+Date: Mon, 20 Jun 2022 11:24:52 +0200
+Subject: [PATCH] Add sys/file.h for LOCK_
+Cc: pavel@zhukoff.net
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
+---
+ src/core/namespace.c       | 1 +
+ src/dissect/dissect.c      | 1 +
+ src/shared/dissect-image.c | 2 ++
+ src/sysext/sysext.c        | 1 +
+ src/test/test-loop-block.c | 1 +
+ 5 files changed, 6 insertions(+)
+
+diff --git a/src/core/namespace.c b/src/core/namespace.c
+index 926aa96174..39f9e21c93 100644
+--- a/src/core/namespace.c
++++ b/src/core/namespace.c
+@@ -7,6 +7,7 @@
+ #include <sys/mount.h>
+ #include <unistd.h>
+ #include <linux/fs.h>
++#include <sys/file.h> // For LOCK_ musl-specific
+
+ #include "alloc-util.h"
+ #include "base-filesystem.h"
+diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c
+index bd94a755db..a0d2a6f287 100644
+--- a/src/dissect/dissect.c
++++ b/src/dissect/dissect.c
+@@ -6,6 +6,7 @@
+ #include <stdio.h>
+ #include <sys/ioctl.h>
+ #include <sys/mount.h>
++#include <sys/file.h> // musl specific for LOCK_
+
+ #include "architecture.h"
+ #include "chase-symlinks.h"
+diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
+index 1ab88839aa..a9e3fe4b44 100644
+--- a/src/shared/dissect-image.c
++++ b/src/shared/dissect-image.c
+@@ -4,6 +4,8 @@
+ #include <valgrind/memcheck.h>
+ #endif
+
++#include <sys/file.h> // For LOCK (musl specific)
++
+ #include <linux/blkpg.h>
+ #include <linux/dm-ioctl.h>
+ #include <linux/loop.h>
+diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c
+index 364af195e0..85686c0fab 100644
+--- a/src/sysext/sysext.c
++++ b/src/sysext/sysext.c
+@@ -5,6 +5,7 @@
+ #include <linux/loop.h>
+ #include <sys/mount.h>
+ #include <unistd.h>
++#include <sys/file.h> // LOCK_ (musl-specific)
+
+ #include "capability-util.h"
+ #include "chase-symlinks.h"
+diff --git a/src/test/test-loop-block.c b/src/test/test-loop-block.c
+index d1793222f0..6886c4cd31 100644
+--- a/src/test/test-loop-block.c
++++ b/src/test/test-loop-block.c
+@@ -3,6 +3,7 @@
+ #include <fcntl.h>
+ #include <linux/loop.h>
+ #include <pthread.h>
++#include <sys/file.h> // LOCK_ (Musl specific)
+
+ #include "alloc-util.h"
+ #include "dissect-image.h"
+--
+2.35.1
diff --git a/meta/recipes-core/systemd/systemd_251.2.bb b/meta/recipes-core/systemd/systemd_251.2.bb
index 8370bec0ca..88216ccf6e 100644
--- a/meta/recipes-core/systemd/systemd_251.2.bb
+++ b/meta/recipes-core/systemd/systemd_251.2.bb
@@ -35,7 +35,6 @@  SRC_URI_MUSL = "\
                file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \
                file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
                file://0008-add-missing-FTW_-macros-for-musl.patch \
-               file://0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch \
                file://0010-Use-uintmax_t-for-handling-rlim_t.patch \
                file://0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \
                file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \
@@ -51,6 +50,7 @@  SRC_URI_MUSL = "\
                file://0001-pass-correct-parameters-to-getdents64.patch \
                file://0002-Add-sys-stat.h-for-S_IFDIR.patch \
                file://0001-Adjust-for-musl-headers.patch \
+               file://0001-Add-sys-file.h-for-LOCK_.patch \
                "
 
 PAM_PLUGINS = " \