Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aarch64 build fixes #3755

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build/entire/entire-aarch64.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ system/fru-id
system/fru-id/platform
system/ipc
system/kernel/dtrace/providers O
system/kernel/platform/meson-gxbb
system/kernel/platform/qemu-virtual
system/kernel/platform/raspberry-pi-4
system/kernel/suspend-resume
Expand Down
7 changes: 7 additions & 0 deletions build/pv/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ CONFIGURE_OPTS="
--disable-nls
"

# can be removed once we can drop the configure.ac patch
pre_configure() {
! cross_arch $1 && return

run_autoreconf -fi
}

init
download_source $PROG $PROG $VER
patch_source
Expand Down
183 changes: 183 additions & 0 deletions build/pv/patches/cross-compile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
From d51c57379a5641795880454fcac5f4ea085141a0 Mon Sep 17 00:00:00 2001
From: Andrew Wood <[email protected]>
Date: Tue, 3 Dec 2024 21:04:58 +0000
Subject: [PATCH] When cross-compiling, we cannot run a test program to check
whether a siginfo_t provides the signal sender PID, so we fall back to
assuming that it does, and also check that SA_SIGINFO is declared so
compilation will not fail on systems without it (#120).

---
configure.ac | 7 ++++++-
src/include/config-aux.h | 8 ++++++++
src/include/config.h.in | 4 ++++
src/include/pv-internal.h | 4 ++--
src/include/pv.h | 2 +-
src/main/help.c | 4 ++--
src/main/remote.c | 6 +++---
src/pv/signal.c | 6 +++---
8 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index d6a8b02..cddfe3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,7 @@ AC_CHECK_HEADERS([sys/ioctl.h])
AC_CHECK_HEADERS([libintl.h locale.h])
AC_CHECK_HEADERS([sys/sysmacros.h])
AC_CHECK_MEMBERS([struct stat.st_blksize])
+AC_CHECK_DECLS([SA_SIGINFO], [], [], [[#include <signal.h>]])

AC_SEARCH_LIBS([sqrtl],[m])
AC_CHECK_HEADERS([math.h])
@@ -98,7 +99,11 @@ AC_MSG_RESULT([yes])
AC_DEFINE([SIGINFO_PROVIDES_PID], [1], [Signal handlers can determine the sending PID])
], [
AC_MSG_RESULT([no])
-])
+], [
+AC_MSG_RESULT([cannot check, assuming yes])
+AC_DEFINE([SIGINFO_PROVIDES_PID], [1], [Signal handlers can determine the sending PID])
+]
+)

AH_BOTTOM([#include "config-aux.h"])

diff --git a/src/include/config-aux.h b/src/include/config-aux.h
index c1d48e7..4624fd2 100644
--- a/src/include/config-aux.h
+++ b/src/include/config-aux.h
@@ -43,3 +43,11 @@ typedef bool _Bool;
# define true 1
# define __bool_true_false_are_defined 1
#endif
+
+/* Whether "--remote" should be available. */
+#undef PV_REMOTE_CONTROL
+#if HAVE_DECL_SA_SIGINFO
+# if SIGINFO_PROVIDES_PID
+#define PV_REMOTE_CONTROL 1
+# endif
+#endif
diff --git a/src/include/config.h.in b/src/include/config.h.in
index 04a8ddf..fc96b93 100644
--- a/src/include/config.h.in
+++ b/src/include/config.h.in
@@ -28,6 +28,10 @@
*/
#undef HAVE_DCGETTEXT

+/* Define to 1 if you have the declaration of `SA_SIGINFO', and to 0 if you
+ don't. */
+#undef HAVE_DECL_SA_SIGINFO
+
/* Define to 1 if you have the `dup2' function. */
#undef HAVE_DUP2

diff --git a/src/include/pv-internal.h b/src/include/pv-internal.h
index 21186ca..d954d89 100644
--- a/src/include/pv-internal.h
+++ b/src/include/pv-internal.h
@@ -159,13 +159,13 @@ struct pvstate_s {
struct sigaction old_sigint;
struct sigaction old_sighup;
struct sigaction old_sigterm;
-#ifdef SIGINFO_PROVIDES_PID
+#ifdef PV_REMOTE_CONTROL
struct sigaction old_sigusr2;
#endif
struct sigaction old_sigalrm;
struct timespec tstp_time; /* see pv_sig_tstp() / __cont() */
struct timespec toffset; /* total time spent stopped */
-#ifdef SIGINFO_PROVIDES_PID
+#ifdef PV_REMOTE_CONTROL
volatile sig_atomic_t rxusr2; /* whether SIGUSR2 was received */
volatile pid_t sender; /* PID of sending process for SIGUSR2 */
#endif
diff --git a/src/include/pv.h b/src/include/pv.h
index e00dc04..e4f4fc0 100644
--- a/src/include/pv.h
+++ b/src/include/pv.h
@@ -238,7 +238,7 @@ extern off_t pv_calc_total_size(pvstate_t);
*/
extern void pv_sig_init(pvstate_t);

-#ifdef SIGINFO_PROVIDES_PID
+#ifdef PV_REMOTE_CONTROL
/*
* Return true if SIGUSR2 has been received, and indicate the sender.
*/
diff --git a/src/main/help.c b/src/main/help.c
index d29bab6..b59cc0c 100644
--- a/src/main/help.c
+++ b/src/main/help.c
@@ -405,11 +405,11 @@ void display_help(void)
{ "-d", "--watchfd", N_("PID[:FD]"),
N_("watch file FD opened by process PID"),
{ 0, 0, 0, 0} },
-#ifdef SIGINFO_PROVIDES_PID
+#ifdef PV_REMOTE_CONTROL
{ "-R", "--remote", N_("PID"),
N_("update settings of process PID"),
{ 0, 0, 0, 0} },
-#endif /* SIGINFO_PROVIDES_PID */
+#endif /* PV_REMOTE_CONTROL */
{ "", NULL, NULL, NULL, { 0, 0, 0, 0} },
{ "-P", "--pidfile", N_("FILE"),
N_("save process ID in FILE"),
diff --git a/src/main/remote.c b/src/main/remote.c
index df346b0..c62df9a 100644
--- a/src/main/remote.c
+++ b/src/main/remote.c
@@ -21,7 +21,7 @@
#include <sys/time.h>
#include <sys/stat.h>

-#ifdef SIGINFO_PROVIDES_PID
+#ifdef PV_REMOTE_CONTROL
void pv_error(pvstate_t, char *, ...);

struct remote_msg {
@@ -407,10 +407,10 @@ void pv_remote_fini(void)
{
}

-#else /* !SIGINFO_PROVIDES_PID */
+#else /* !PV_REMOTE_CONTROL */

/*
- * Dummy stubs for remote control when we don't have SIGINFO_PROVIDES_PID.
+ * Dummy stubs for remote control when we don't have PV_REMOTE_CONTROL.
*/
void pv_remote_init(void)
{
diff --git a/src/pv/signal.c b/src/pv/signal.c
index 93cf808..4a6abad 100644
--- a/src/pv/signal.c
+++ b/src/pv/signal.c
@@ -226,7 +226,7 @@ static void pv_sig_term( /*@unused@ */ __attribute__((unused))
}


-#ifdef SIGINFO_PROVIDES_PID
+#ifdef PV_REMOTE_CONTROL
/*
* Handle a SIGUSR2 by setting a flag to say we received it, after recording
* the sending PID.
@@ -375,7 +375,7 @@ void pv_sig_init(pvstate_t state)
sa.sa_flags = 0;
(void) sigaction(SIGTERM, &sa, &(pv_sig_state->signal.old_sigterm));

-#ifdef SIGINFO_PROVIDES_PID
+#ifdef PV_REMOTE_CONTROL
/*
* Handle SIGUSR2 by setting a flag to say the signal has been
* received, and storing the sending process's PID.
@@ -431,7 +431,7 @@ void pv_sig_fini( /*@unused@ */ __attribute__((unused)) pvstate_t state)
(void) sigaction(SIGINT, &(pv_sig_state->signal.old_sigint), NULL);
(void) sigaction(SIGHUP, &(pv_sig_state->signal.old_sighup), NULL);
(void) sigaction(SIGTERM, &(pv_sig_state->signal.old_sigterm), NULL);
-#ifdef SIGINFO_PROVIDES_PID
+#ifdef PV_REMOTE_CONTROL
(void) sigaction(SIGUSR2, &(pv_sig_state->signal.old_sigusr2), NULL);
#endif
(void) sigaction(SIGALRM, &(pv_sig_state->signal.old_sigalrm), NULL);
1 change: 1 addition & 0 deletions build/pv/patches/series
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cross-compile.patch
2 changes: 1 addition & 1 deletion doc/baseline.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ omnios driver/graphics/dcam1394/devfsadm-dcam1394
omnios driver/graphics/usbvc
omnios driver/ktest
omnios driver/misc/ccid
omnios driver/misc/viommionex
omnios driver/misc/virtio
omnios driver/network/afe
omnios driver/network/arbel o
Expand Down Expand Up @@ -496,7 +497,6 @@ omnios system/kernel
omnios system/kernel/cpu-counters
omnios system/kernel/dtrace/providers
omnios system/kernel/platform
omnios system/kernel/platform/meson-gxbb
omnios system/kernel/platform/qemu-virtual
omnios system/kernel/platform/raspberry-pi-4
omnios system/kernel/power
Expand Down
Loading