public inbox for [email protected]
 help / color / mirror / Atom feed
From: Simon Zeni <[email protected]>
To: [email protected]
Cc: Simon Zeni <[email protected]>
Subject: [PATCH] examples: disable ucontext-cp if ucontext.h is not available
Date: Tue, 27 Oct 2020 22:31:21 -0400	[thread overview]
Message-ID: <[email protected]> (raw)

The header file `ucontext.h` is not available on musl based distros. The
example `ucontext-cp` is not built if `configure` fails to locate the
header.

Signed-off-by: Simon Zeni <[email protected]>
---

See [this mail][1] from the musl mailing list about why those functions
are not implemented

I also noticed that `make runtests` fails on alpinelinux (5.4.72-0-lts
with musl-1.2.1)

```
Tests failed:  <accept-reuse> <across-fork> <defer> <double-poll-crash>
<file-register> <file-update> <io_uring_enter> <io_uring_register> <lfs-openat>
<lfs-openat-write> <link-timeout> <link_drain> <open-close> <openat2>
<pipe-eof> <poll-cancel> <poll-cancel-ton> <poll-link> <read-write>
<sigfd-deadlock> <sq-poll-dup> <sq-poll-share> <sq-space_left> <timeout>
<statx>
```

I can post a full trace if needed.

Simon

[1]: https://www.openwall.com/lists/musl/2016/02/04/4

 configure         | 21 +++++++++++++++++++++
 examples/Makefile |  6 +++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index c911f59..3b96cde 100755
--- a/configure
+++ b/configure
@@ -287,6 +287,24 @@ if compile_prog_cxx "" "" "C++"; then
 fi
 print_config "C++" "$has_cxx"

+##########################################
+# check for ucontext support
+has_ucontext="no"
+cat > $TMPC << EOF
+#include <ucontext.h>
+int main(int argc, char **argv)
+{
+  ucontext_t ctx;
+  getcontext(&ctx);
+  return 0;
+}
+EOF
+if compile_prog "" "" "has_ucontext"; then
+  has_ucontext="yes"
+fi
+print_config "has_ucontext" "$has_ucontext"
+
+
 #############################################################################

 if test "$__kernel_rwf_t" = "yes"; then
@@ -304,6 +322,9 @@ fi
 if test "$has_cxx" = "yes"; then
   output_sym "CONFIG_HAVE_CXX"
 fi
+if test "$has_ucontext" = "yes"; then
+  output_sym "CONFIG_HAVE_UCONTEXT"
+fi

 echo "CC=$cc" >> $config_host_mak
 print_config "CC" "$cc"
diff --git a/examples/Makefile b/examples/Makefile
index 0eec627..60c1b71 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -10,7 +10,11 @@ ifneq ($(MAKECMDGOALS),clean)
 include ../config-host.mak
 endif

-all_targets += io_uring-test io_uring-cp link-cp ucontext-cp
+all_targets += io_uring-test io_uring-cp link-cp
+
+ifdef CONFIG_HAVE_UCONTEXT
+all_targets += ucontext-cp
+endif

 all: $(all_targets)

--
2.29.1


             reply	other threads:[~2020-10-28 22:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28  2:31 Simon Zeni [this message]
2020-10-28 22:33 ` [PATCH] examples: disable ucontext-cp if ucontext.h is not available Jens Axboe
2020-10-29  0:53   ` Simon Zeni
2020-10-29  1:06     ` Jens Axboe
2020-10-29  1:23       ` Simon Zeni
2020-10-29  3:00         ` Jens Axboe

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    /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