summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjirka-h <hladky.jiri@gmail.com>2021-03-22 00:12:41 +0100
committerGitHub <noreply@github.com>2021-03-22 00:12:41 +0100
commit76da16386a0ff5105288db16eca81ee8174e13e5 (patch)
treeb6870dd3f4f5ad3f7f5ab08afd5192f543dd5a92
parentAdded dracut conf file which can be placed in /etc/dracut.conf.d/haveged.conf (diff)
parenthaveged: fix build on uclibc (diff)
downloadhaveged-76da16386a0ff5105288db16eca81ee8174e13e5.tar.xz
haveged-76da16386a0ff5105288db16eca81ee8174e13e5.zip
Merge pull request #58 from texierp/topic/uclibc-fixes
haveged: fix build on uclibc
-rw-r--r--config.h.in6
-rw-r--r--configure.ac3
-rw-r--r--src/haveged.c4
3 files changed, 12 insertions, 1 deletions
diff --git a/config.h.in b/config.h.in
index d0882ea..08e36e1 100644
--- a/config.h.in
+++ b/config.h.in
@@ -33,6 +33,9 @@
/* Define to 1 if you have the `floor' function. */
#undef HAVE_FLOOR
+/* Define to 1 if you have the `getauxval' function. */
+#undef HAVE_GETAUXVAL
+
/* Define to 1 if you have the `getsockopt' function. */
#undef HAVE_GETSOCKOPT
@@ -138,6 +141,9 @@
/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
+/* Define to 1 if you have the <sys/auxv.h> header file. */
+#undef HAVE_SYS_AUXV_H
+
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
diff --git a/configure.ac b/configure.ac
index c172a10..cd3df3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,7 +110,7 @@ AC_HEADER_TIME
AC_PROG_GCC_TRADITIONAL
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
-AC_CHECK_FUNCS([__rdtsc accept accept4 bind connect execv floor getsockopt gettimeofday listen memset pow pselect recv sched_yield select send setsockopt socket sqrt])
+AC_CHECK_FUNCS([__rdtsc accept accept4 bind connect execv floor getauxval getsockopt gettimeofday listen memset pow pselect recv sched_yield select send setsockopt socket sqrt])
## Checks for header files.
AC_HEADER_STDC
@@ -124,6 +124,7 @@ AC_CHECK_HEADERS(stdint.h)
AC_CHECK_HEADERS(stdio.h)
AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_HEADERS(string.h)
+AC_CHECK_HEADERS([sys/auxv.h])
AC_CHECK_HEADERS(sys/ioctl.h)
AC_CHECK_HEADERS(sys/mman.h)
AC_CHECK_HEADERS(sys/types.h)
diff --git a/src/haveged.c b/src/haveged.c
index b9cb77b..1c22b3b 100644
--- a/src/haveged.c
+++ b/src/haveged.c
@@ -19,7 +19,9 @@
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
+#ifdef HAVE_SYS_AUXV_H
#include <sys/auxv.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
#include <getopt.h>
@@ -135,8 +137,10 @@ int main(int argc, char **argv)
{
volatile char *path = strdup(argv[0]);
volatile char *arg0 = argv[0];
+#ifdef HAVE_GETAUXVAL
if (path[0] != '/')
path = (char*)getauxval(AT_EXECFN);
+#endif
static const char* cmds[] = {
"b", "buffer", "1", SETTINGR("Buffer size [KW], default: ",COLLECT_BUFSIZE),
"d", "data", "1", SETTINGR("Data cache size [KB], with fallback to: ", GENERIC_DCACHE ),