Bug#751337: [PATCH] tests: test_ctf_writer: replace HOST_NAME_MAX
Quoted 8 lines · Sebastian Andrzej Siewior
This patch replaces
HOST_NAME_MAXbyxgethostname()which is a wrapper aroundmalloc()+gethostname()to get a large enough buffer to fit the hostname.xgethostname.cwas stolen from coreutils and slightly changed so it works withoutxreallocte().This should fix Debian #751337 where the package does not build KFreeBSD due to missing
HOST_NAME_MAX.
This may also work as well:
diff --git a/configure.ac b/configure.ac
index 80eba33..248044e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,17 @@ AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
+# FreeBSD does not define HOST_NAME_MAX
+AC_CHECK_DECL(HOST_NAME_MAX,,
+ [
+ AC_CHECK_DECL(_POSIX_HOST_NAME_MAX,
+ AC_DEFINE(HOST_NAME_MAX, _POSIX_HOST_NAME_MAX, []),
+ AC_DEFINE(HOST_NAME_MAX, 256, [Define to 256 if neither have HOST_NAME_MAX nor _POSIX_HOST_NAME_MAX]),
+ [[#include <limits.h>]])
+ ],
+ [[#include <limits.h>]]
+)
+
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MMAP
Signature · 1 line
Jon
Quoted 8 lines · Sebastian Andrzej Siewior
This patch replaces
HOST_NAME_MAXbyxgethostname()which is a wrapper aroundmalloc()+gethostname()to get a large enough buffer to fit the hostname.xgethostname.cwas stolen from coreutils and slightly changed so it works withoutxreallocte().This should fix Debian #751337 where the package does not build KFreeBSD due to missing
HOST_NAME_MAX.
This may also work as well:
diff --git a/configure.ac b/configure.ac
index 80eba33..248044e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,17 @@ AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
+# FreeBSD does not define HOST_NAME_MAX
+AC_CHECK_DECL(HOST_NAME_MAX,,
+ [
+ AC_CHECK_DECL(_POSIX_HOST_NAME_MAX,
+ AC_DEFINE(HOST_NAME_MAX, _POSIX_HOST_NAME_MAX, []),
+ AC_DEFINE(HOST_NAME_MAX, 256, [Define to 256 if neither have HOST_NAME_MAX nor _POSIX_HOST_NAME_MAX]),
+ [[#include <limits.h>]])
+ ],
+ [[#include <limits.h>]]
+)
+
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MMAP
Signature · 1 line
Jon
Quoted 8 lines · Sebastian Andrzej Siewior
This patch replaces
HOST_NAME_MAXbyxgethostname()which is a wrapper aroundmalloc()+gethostname()to get a large enough buffer to fit the hostname.xgethostname.cwas stolen from coreutils and slightly changed so it works withoutxreallocte().This should fix Debian #751337 where the package does not build KFreeBSD due to missing
HOST_NAME_MAX.
This may also work as well:
diff --git a/configure.ac b/configure.ac
index 80eba33..248044e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,17 @@ AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
+# FreeBSD does not define HOST_NAME_MAX
+AC_CHECK_DECL(HOST_NAME_MAX,,
+ [
+ AC_CHECK_DECL(_POSIX_HOST_NAME_MAX,
+ AC_DEFINE(HOST_NAME_MAX, _POSIX_HOST_NAME_MAX, []),
+ AC_DEFINE(HOST_NAME_MAX, 256, [Define to 256 if neither have HOST_NAME_MAX nor _POSIX_HOST_NAME_MAX]),
+ [[#include <limits.h>]])
+ ],
+ [[#include <limits.h>]]
+)
+
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MMAP
Signature · 1 line
Jon
Quoted 10 lines · Jon Bernard
This may also work as well:
diff --git a/configure.ac b/configure.ac
index 80eba33..248044e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,17 @@AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
Quoted 10 lines
+# FreeBSD does not define
HOST_NAME_MAX
+AC_CHECK_DECL(HOST_NAME_MAX,,
+ [
+ AC_CHECK_DECL(_POSIX_HOST_NAME_MAX,
+AC_DEFINE(HOST_NAME_MAX, _POSIX_HOST_NAME_MAX, []),
+AC_DEFINE(HOST_NAME_MAX, 256, [Define to 256 if neither have HOST_NAME_MAX nor _POSIX_HOST_NAME_MAX]),
+ [[#include <limits.h>]])
+ ],
+ [[#include <limits.h>]]
+)
Sure it will. I have no strong opinion on how it gets fixed :)
Quoted 5 lines
+
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MMAP
Sebastian
Fixed in both master (as of 22843b6) and stable 1.2 (as of 0954670) branches.
Quoted 31 lines · Sebastian Andrzej Siewior
Quoted 10 lines · Jon Bernard
This may also work as well:
diff --git a/configure.ac b/configure.ac
index 80eba33..248044e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,17 @@AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_TQuoted 10 lines
+# FreeBSD does not define
HOST_NAME_MAX
+AC_CHECK_DECL(HOST_NAME_MAX,,
+ [
+ AC_CHECK_DECL(_POSIX_HOST_NAME_MAX,
+AC_DEFINE(HOST_NAME_MAX, _POSIX_HOST_NAME_MAX, []),
+AC_DEFINE(HOST_NAME_MAX, 256, [Define to 256 if neither have HOST_NAME_MAX nor _POSIX_HOST_NAME_MAX]),
+ [[#include <limits.h>]])
+ ],
+ [[#include <limits.h>]]
+)Sure it will. I have no strong opinion on how it gets fixed :)
Quoted 5 lines
+
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MMAPSebastian
Signature · 3 lines
Jérémie Galarneau EfficiOS Inc. http://www.efficios.com
Fixed in both master (as of 22843b6) and stable 1.2 (as of 0954670) branches.
Quoted 31 lines · Sebastian Andrzej Siewior
Quoted 10 lines · Jon Bernard
This may also work as well:
diff --git a/configure.ac b/configure.ac
index 80eba33..248044e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,17 @@AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_TQuoted 10 lines
+# FreeBSD does not define
HOST_NAME_MAX
+AC_CHECK_DECL(HOST_NAME_MAX,,
+ [
+ AC_CHECK_DECL(_POSIX_HOST_NAME_MAX,
+AC_DEFINE(HOST_NAME_MAX, _POSIX_HOST_NAME_MAX, []),
+AC_DEFINE(HOST_NAME_MAX, 256, [Define to 256 if neither have HOST_NAME_MAX nor _POSIX_HOST_NAME_MAX]),
+ [[#include <limits.h>]])
+ ],
+ [[#include <limits.h>]]
+)Sure it will. I have no strong opinion on how it gets fixed :)
Quoted 5 lines
+
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MMAPSebastian
Signature · 3 lines
Jérémie Galarneau EfficiOS Inc. http://www.efficios.com
Fixed in both master (as of 22843b6) and stable 1.2 (as of 0954670) branches.
Quoted 31 lines · Sebastian Andrzej Siewior
Quoted 10 lines · Jon Bernard
This may also work as well:
diff --git a/configure.ac b/configure.ac
index 80eba33..248044e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,17 @@AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_TQuoted 10 lines
+# FreeBSD does not define
HOST_NAME_MAX
+AC_CHECK_DECL(HOST_NAME_MAX,,
+ [
+ AC_CHECK_DECL(_POSIX_HOST_NAME_MAX,
+AC_DEFINE(HOST_NAME_MAX, _POSIX_HOST_NAME_MAX, []),
+AC_DEFINE(HOST_NAME_MAX, 256, [Define to 256 if neither have HOST_NAME_MAX nor _POSIX_HOST_NAME_MAX]),
+ [[#include <limits.h>]])
+ ],
+ [[#include <limits.h>]]
+)Sure it will. I have no strong opinion on how it gets fixed :)
Quoted 5 lines
+
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MMAPSebastian
Signature · 8 lines
Jérémie Galarneau EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev