include: fix 'ulong' definition on musl targets

The build failure was originally reported on arm64-musl
target at https://bugs.gentoo.org/703132. Here is the amd64-musl
variant:

```
$ LANG=C make CROSS_COMPILE=x86_64-gentoo-linux-musl- tools-only_defconfig -j$(nproc)
$ LANG=C make CROSS_COMPILE=x86_64-gentoo-linux-musl- tools-all            -j$(nproc)
...
In file included from tools/env/../../env/flags.c:7,
                 from tools/env/env_flags.c:1:
include/env.h:159:1: error: unknown type name 'ulong'; did you mean 'long'?
  159 | ulong env_get_ulong(const char *name, int base, ulong default_val);
      | ^~~~~
      | long
```

Note: 'ulong' is not defined there.

On glibc 'ulong' comes from <sys/types.h>:

```c
/* Old compatibility names for C types.  */
typedef unsigned long int ulong;
```

On musl it comes from <sys/types.h> as well but from under different guards:

```c
typedef unsigned long u_long, ulong;
```

The change inlines 'ulong' define similar to 'uint' define.

Bug: https://bugs.gentoo.org/703132
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
This commit is contained in:
Sergei Trofimovich 2019-12-30 15:53:41 +00:00 committed by Tom Rini
parent 4b75aa5aa7
commit d11fa9c16b

View File

@ -46,7 +46,6 @@
# include <byteswap.h> # include <byteswap.h>
#elif defined(__MACH__) || defined(__FreeBSD__) #elif defined(__MACH__) || defined(__FreeBSD__)
# include <machine/endian.h> # include <machine/endian.h>
typedef unsigned long ulong;
#endif #endif
#ifdef __FreeBSD__ #ifdef __FreeBSD__
# include <sys/endian.h> /* htole32 and friends */ # include <sys/endian.h> /* htole32 and friends */
@ -66,6 +65,7 @@ typedef uint8_t __u8;
typedef uint16_t __u16; typedef uint16_t __u16;
typedef uint32_t __u32; typedef uint32_t __u32;
typedef unsigned int uint; typedef unsigned int uint;
typedef unsigned long ulong;
#define uswap_16(x) \ #define uswap_16(x) \
((((x) & 0xff00) >> 8) | \ ((((x) & 0xff00) >> 8) | \