Skip to contentSkip to conversation

Bug#751337: [PATCH] tests: test_ctf_writer: replace HOST_NAME_MAX

DISCUSSION Jon Bernard 3 participants 7 messages Aug 5, 2014 – Aug 7, 2014 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 8 lines · Sebastian Andrzej Siewior

This patch replaces HOST_NAME_MAX by xgethostname() which is a wrapper around malloc() + gethostname() to get a large enough buffer to fit the hostname.
xgethostname.c was stolen from coreutils and slightly changed so it works without xreallocte().

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
#2 lore raw
In reply to a message not in the archive
Quoted 8 lines · Sebastian Andrzej Siewior

This patch replaces HOST_NAME_MAX by xgethostname() which is a wrapper around malloc() + gethostname() to get a large enough buffer to fit the hostname.
xgethostname.c was stolen from coreutils and slightly changed so it works without xreallocte().

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
#3 lore raw
In reply to a message not in the archive
Quoted 8 lines · Sebastian Andrzej Siewior

This patch replaces HOST_NAME_MAX by xgethostname() which is a wrapper around malloc() + gethostname() to get a large enough buffer to fit the hostname.
xgethostname.c was stolen from coreutils and slightly changed so it works without xreallocte().

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

A message that is not in the archive (sent off-list or not yet received): 20140805201412.GA11272@helmut

#5 lore raw
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

#6 lore raw

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_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

Signature · 3 lines
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
#7 lore raw
In reply to Sebastian Andrzej Siewior

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_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

Signature · 3 lines
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
#8 lore raw
In reply to Sebastian Andrzej Siewior

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_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

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