From: Daniel Mack <daniel@zonque.org>
To: Andrew Morton <akpm@linux-foundation.org>,
Greg KH <gregkh@linuxfoundation.org>
Cc: dh.herrmann@gmail.com, jslaby@suse.cz, tixxdz@opendz.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] samples: kdbus: build kdbus-workers conditionally
Date: Fri, 03 Apr 2015 13:02:36 +0200 [thread overview]
Message-ID: <551E734C.2020601@zonque.org> (raw)
In-Reply-To: <20150401144121.c1ae57c1d6ab5562a1fca766@linux-foundation.org>
[-- Attachment #1: Type: text/plain, Size: 2482 bytes --]
Hi Andrew,
On 04/01/2015 11:41 PM, Andrew Morton wrote:
> On Wed, 1 Apr 2015 14:47:20 +0200 Greg KH <gregkh@linuxfoundation.org> wrote:
>
>> On Tue, Mar 31, 2015 at 03:11:34PM +0200, Daniel Mack wrote:
>>> Give the kdbus sample its own config switch and only build it if it's
>>> explicitly switched on.
>>>
>>> Signed-off-by: Daniel Mack <daniel@zonque.org>
>>> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
>>> Reported-by: Jiri Slaby <jslaby@suse.cz>
>>> ---
>>> samples/Kconfig | 7 +++++++
>>> samples/kdbus/Makefile | 2 +-
>>> 2 files changed, 8 insertions(+), 1 deletion(-)
>>
>> Now applied, thanks.
>
> Is this going to fix i386 allmodconfig, currently unhappy on my Fedora
> Core 6 (lol) machine?
As allmodconfig will select CONFIG_SAMPLE_KDBUS just as it selected
CONFIG_SAMPLES, that won't help, no.
> samples/kdbus/kdbus-workers.c:73:26: error: sys/signalfd.h: No such file or directory
> samples/kdbus/kdbus-workers.c: In function 'master_new':
> samples/kdbus/kdbus-workers.c:231: warning: implicit declaration of function 'signalfd'
> samples/kdbus/kdbus-workers.c:231: error: 'SFD_CLOEXEC' undeclared (first use in this function)
> samples/kdbus/kdbus-workers.c:231: error: (Each undeclared identifier is reported only once
> samples/kdbus/kdbus-workers.c:231: error: for each function it appears in.)
> samples/kdbus/kdbus-workers.c: In function 'master_handle_signal':
> samples/kdbus/kdbus-workers.c:406: error: storage size of 'val' isn't known
> samples/kdbus/kdbus-workers.c:406: warning: unused variable 'val'
> samples/kdbus/kdbus-workers.c: In function 'child_run':
> samples/kdbus/kdbus-workers.c:773: error: 'CLOCK_MONOTONIC_COARSE' undeclared (first use in this function)
> samples/kdbus/kdbus-workers.c: In function 'bus_open_connection':
> samples/kdbus/kdbus-workers.c:1038: error: 'O_CLOEXEC' undeclared (first use in this function)
> samples/kdbus/kdbus-workers.c: In function 'bus_make':
> samples/kdbus/kdbus-workers.c:1275: error: 'O_CLOEXEC' undeclared (first use in this function)
Hmm, so your libc headers lack support for signalfds, which were
introduced in kernel v2.6.22 (2007), one year after the release of your
distribution.
We can't probe for the existance of files in the local toolchain before
compilation with kdbuild, so we have to stub out the code for glibc
version that are known to lack features. This isn't particularly nice,
but it should work.
Does the attached patch work for you?
Thanks,
Daniel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-samples-kdbus-stub-out-code-for-glibc-2.7.patch --]
[-- Type: text/x-diff; name="0001-samples-kdbus-stub-out-code-for-glibc-2.7.patch", Size: 3245 bytes --]
From 37871360c096b68928750903ac29968a7932e873 Mon Sep 17 00:00:00 2001
From: Daniel Mack <daniel@zonque.org>
Date: Fri, 3 Apr 2015 12:41:52 +0200
Subject: [PATCH] samples: kdbus: stub out code for glibc < 2.7
Andrew Morton reports the following build error in samples/kdbus on Fedora
Core 6:
samples/kdbus/kdbus-workers.c:73:26: error: sys/signalfd.h: No such file or directory
samples/kdbus/kdbus-workers.c: In function 'master_new':
samples/kdbus/kdbus-workers.c:231: warning: implicit declaration of function 'signalfd'
samples/kdbus/kdbus-workers.c:231: error: 'SFD_CLOEXEC' undeclared (first use in this function)
samples/kdbus/kdbus-workers.c:231: error: (Each undeclared identifier is reported only once
samples/kdbus/kdbus-workers.c:231: error: for each function it appears in.)
samples/kdbus/kdbus-workers.c: In function 'master_handle_signal':
samples/kdbus/kdbus-workers.c:406: error: storage size of 'val' isn't known
samples/kdbus/kdbus-workers.c:406: warning: unused variable 'val'
samples/kdbus/kdbus-workers.c: In function 'child_run':
samples/kdbus/kdbus-workers.c:773: error: 'CLOCK_MONOTONIC_COARSE' undeclared (first use in this function)
samples/kdbus/kdbus-workers.c: In function 'bus_open_connection':
samples/kdbus/kdbus-workers.c:1038: error: 'O_CLOEXEC' undeclared (first use in this function)
samples/kdbus/kdbus-workers.c: In function 'bus_make':
samples/kdbus/kdbus-workers.c:1275: error: 'O_CLOEXEC' undeclared (first use in this function)
Fedora Core 6 was released in 2006, which predates the introduction of
signalfds in the kernel (v2.6.22, 2007).
The example cannot be built without signalfds, and kbuild cannot depend on
specific features of the local libc when building userspace executables, so
we have to work around the issue by checking for specific glibc versions at
compile time and stub the entire thing if it can't be compiled.
Signed-off-by: Daniel Mack <daniel@zonque.org>
Reported-by: Andrew Morton <akpm@linux-foundation.org>
---
samples/kdbus/kdbus-workers.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/samples/kdbus/kdbus-workers.c b/samples/kdbus/kdbus-workers.c
index d1d8f7a..e9ecec8 100644
--- a/samples/kdbus/kdbus-workers.c
+++ b/samples/kdbus/kdbus-workers.c
@@ -57,6 +57,12 @@
* top-down, but requires some forward-declarations. Just ignore those.
*/
+#include <stdio.h>
+#include <stdlib.h>
+
+/* glibc < 2.7 does not ship sys/signalfd.h */
+#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 7
+
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
@@ -65,8 +71,6 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/poll.h>
@@ -1324,3 +1328,18 @@ static int bus_make(uid_t uid, const char *name)
return fd;
}
+
+#else
+
+#warning "Skipping compilation due to unsupported libc version"
+
+int main(int argc, char **argv)
+{
+ fprintf(stderr,
+ "Compilation of %s was skipped due to unsupported libc.\n",
+ argv[0]);
+
+ return EXIT_FAILURE;
+}
+
+#endif /* libc sanity check */
--
2.3.4
next prev parent reply other threads:[~2015-04-03 11:02 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-09 13:09 [PATCH v4 00/14] Add kdbus implementation Greg Kroah-Hartman
2015-03-09 13:09 ` [PATCH 01/14] kdbus: add documentation Greg Kroah-Hartman
2015-03-09 13:09 ` [PATCH 02/14] kdbus: add uapi header file Greg Kroah-Hartman
2015-03-09 13:09 ` [PATCH 03/14] kdbus: add driver skeleton, ioctl entry points and utility functions Greg Kroah-Hartman
2015-03-09 13:09 ` [PATCH 04/14] kdbus: add connection pool implementation Greg Kroah-Hartman
2015-03-09 13:09 ` [PATCH 05/14] kdbus: add connection, queue handling and message validation code Greg Kroah-Hartman
2015-03-09 13:09 ` [PATCH 06/14] kdbus: add node and filesystem implementation Greg Kroah-Hartman
2015-03-09 13:09 ` [PATCH 07/14] kdbus: add code to gather metadata Greg Kroah-Hartman
2015-03-09 13:09 ` [PATCH 08/14] kdbus: add code for notifications and matches Greg Kroah-Hartman
2015-03-09 13:09 ` [PATCH 09/14] kdbus: add code for buses, domains and endpoints Greg Kroah-Hartman
2015-03-09 13:09 ` [PATCH 10/14] kdbus: add name registry implementation Greg Kroah-Hartman
2015-03-09 13:09 ` [PATCH 11/14] kdbus: add policy database implementation Greg Kroah-Hartman
2015-03-09 13:09 ` [PATCH 12/14] kdbus: add Makefile, Kconfig and MAINTAINERS entry Greg Kroah-Hartman
2015-03-24 15:15 ` Jiri Slaby
2015-03-24 18:51 ` [PATCH] kdbus: Fix CONFIG_KDBUS help text Daniel Mack
2015-03-25 1:05 ` David Herrmann
2015-03-25 9:51 ` Greg KH
2015-03-09 13:09 ` [PATCH 13/14] kdbus: add walk-through user space example Greg Kroah-Hartman
2015-03-12 14:52 ` Sasha Levin
2015-03-12 16:27 ` [PATCH] samples/kdbus: add -lrt David Herrmann
2015-03-12 21:40 ` [PATCH] kdbus: " Greg Kroah-Hartman
2015-03-12 16:34 ` [PATCH 13/14] kdbus: add walk-through user space example David Herrmann
2015-03-24 16:46 ` Jiri Slaby
2015-03-24 17:15 ` David Herrmann
2015-03-24 17:37 ` Jiri Slaby
2015-03-24 18:22 ` Michal Marek
2015-03-24 18:51 ` Daniel Mack
2015-03-31 13:11 ` [PATCH] samples: kdbus: build kdbus-workers conditionally Daniel Mack
2015-04-01 12:47 ` Greg KH
2015-04-01 21:41 ` Andrew Morton
2015-04-03 11:02 ` Daniel Mack [this message]
2015-03-09 13:09 ` [PATCH 14/14] kdbus: add selftests Greg Kroah-Hartman
2015-03-15 5:13 ` [PATCH] kdbus: fix minor typo in the walk-through example Nicolas Iooss
2015-03-15 9:32 ` Greg KH
2015-03-17 19:24 ` [PATCH v4 00/14] Add kdbus implementation Andy Lutomirski
2015-03-18 13:54 ` David Herrmann
2015-03-18 18:24 ` Andy Lutomirski
2015-03-19 11:26 ` David Herrmann
2015-03-19 15:48 ` Andy Lutomirski
2015-03-23 15:28 ` David Herrmann
2015-03-23 23:24 ` Andy Lutomirski
2015-03-24 0:20 ` Eric W. Biederman
2015-03-25 17:29 ` David Herrmann
2015-03-25 18:12 ` Andy Lutomirski
2015-03-30 16:56 ` David Herrmann
2015-03-31 13:58 ` Andy Lutomirski
2015-03-31 15:10 ` Tom Gundersen
2015-03-31 18:29 ` Andy Lutomirski
2015-04-03 11:51 ` David Herrmann
2015-04-05 12:09 ` Eric W. Biederman
2015-04-05 13:46 ` Greg Kroah-Hartman
2015-04-08 22:38 ` Andy Lutomirski
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=551E734C.2020601@zonque.org \
--to=daniel@zonque.org \
--cc=akpm@linux-foundation.org \
--cc=dh.herrmann@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=tixxdz@opendz.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