diff mbox series

[1/2] Fix compilation on FreeBSD broken by __u64 usage

Message ID 20181018130628.17133-1-christian.storm@siemens.com
State Accepted
Headers show
Series [1/2] Fix compilation on FreeBSD broken by __u64 usage | expand

Commit Message

Storm, Christian Oct. 18, 2018, 1:06 p.m. UTC
Commits c85acb3 and 7f8b34f broke compilation on
FreeBSD because the BSDs don't define __u64.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 corelib/artifacts_versions.c | 3 +++
 include/compat.h             | 5 +++++
 include/util.h               | 2 ++
 3 files changed, 10 insertions(+)

Comments

Stefano Babic Oct. 22, 2018, 4:27 p.m. UTC | #1
On 18/10/18 15:06, Christian Storm wrote:
> Commits c85acb3 and 7f8b34f broke compilation on
> FreeBSD because the BSDs don't define __u64.
> 
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>  corelib/artifacts_versions.c | 3 +++
>  include/compat.h             | 5 +++++
>  include/util.h               | 2 ++
>  3 files changed, 10 insertions(+)
> 
> diff --git a/corelib/artifacts_versions.c b/corelib/artifacts_versions.c
> index 4551f29..dc5e496 100644
> --- a/corelib/artifacts_versions.c
> +++ b/corelib/artifacts_versions.c
> @@ -13,7 +13,10 @@
>  #include <fcntl.h>
>  #include <errno.h>
>  #include <sys/stat.h>
> +#if defined(__linux__)
>  #include <linux/types.h>
> +#endif
> +#include <compat.h>
>  #include <limits.h>
>  #include <assert.h>
>  #include "generated/autoconf.h"
> diff --git a/include/compat.h b/include/compat.h
> index a98a388..8bbce90 100644
> --- a/include/compat.h
> +++ b/include/compat.h
> @@ -31,4 +31,9 @@
>   * 61 on FreeBSD is ECONNREFUSED.
>   */
>  #define ENODATA ENOATTR
> +
> +/*
> + * The BSDs don't define this while Linux does.
> + */
> +#define __u64 uint64_t
>  #endif
> diff --git a/include/util.h b/include/util.h
> index 7804ff5..06f4a83 100644
> --- a/include/util.h
> +++ b/include/util.h
> @@ -10,7 +10,9 @@
>  
>  #include <stdint.h>
>  #include <string.h>
> +#if defined(__linux__)
>  #include <linux/types.h>
> +#endif
>  #include "swupdate.h"
>  #include "swupdate_status.h"
>  #include "compat.h"
> 

Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/corelib/artifacts_versions.c b/corelib/artifacts_versions.c
index 4551f29..dc5e496 100644
--- a/corelib/artifacts_versions.c
+++ b/corelib/artifacts_versions.c
@@ -13,7 +13,10 @@ 
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/stat.h>
+#if defined(__linux__)
 #include <linux/types.h>
+#endif
+#include <compat.h>
 #include <limits.h>
 #include <assert.h>
 #include "generated/autoconf.h"
diff --git a/include/compat.h b/include/compat.h
index a98a388..8bbce90 100644
--- a/include/compat.h
+++ b/include/compat.h
@@ -31,4 +31,9 @@ 
  * 61 on FreeBSD is ECONNREFUSED.
  */
 #define ENODATA ENOATTR
+
+/*
+ * The BSDs don't define this while Linux does.
+ */
+#define __u64 uint64_t
 #endif
diff --git a/include/util.h b/include/util.h
index 7804ff5..06f4a83 100644
--- a/include/util.h
+++ b/include/util.h
@@ -10,7 +10,9 @@ 
 
 #include <stdint.h>
 #include <string.h>
+#if defined(__linux__)
 #include <linux/types.h>
+#endif
 #include "swupdate.h"
 #include "swupdate_status.h"
 #include "compat.h"