Browse Source

* Don't try to include arpa/inet.h in kernel mode.

tags/v0.99.beta14
Sam Hocevar sam 19 years ago
parent
commit
f1e8a80b64
1 changed files with 12 additions and 9 deletions
  1. +12
    -9
      common.h

+ 12
- 9
common.h View File

@@ -17,7 +17,7 @@
* function prototypes that are sometimes missing.
*/

#if defined(HAVE_INTTYPES_H) && !defined(__KERNEL__)
#if defined HAVE_INTTYPES_H && !defined __KERNEL__
# include <inttypes.h>
#else
typedef signed char int8_t;
@@ -32,22 +32,24 @@ typedef long int intptr_t;
typedef unsigned long int uintptr_t;
#endif

#if defined(HAVE_HTONS)
# if defined(HAVE_ARPA_INET_H)
#if defined HAVE_HTONS
# if defined __KERNEL__
/* Nothing to do */
# elif defined HAVE_ARPA_INET_H
# include <arpa/inet.h>
# elif defined(HAVE_NETINET_IN_H)
# elif defined HAVE_NETINET_IN_H
# include <netinet/in.h>
# endif
# define hton16 htons
# define hton32 htonl
#else
# if defined(HAVE_ENDIAN_H)
# if defined HAVE_ENDIAN_H
# include <endian.h>
# endif
static inline uint16_t hton16(uint16_t x)
{
/* This is compile-time optimised with at least -O1 or -Os */
#if defined(HAVE_ENDIAN_H)
#if defined HAVE_ENDIAN_H
if(__BYTE_ORDER == __BIG_ENDIAN)
#else
uint32_t const dummy = 0x12345678;
@@ -61,7 +63,7 @@ static inline uint16_t hton16(uint16_t x)
static inline uint32_t hton32(uint32_t x)
{
/* This is compile-time optimised with at least -O1 or -Os */
#if defined(HAVE_ENDIAN_H)
#if defined HAVE_ENDIAN_H
if(__BYTE_ORDER == __BIG_ENDIAN)
#else
uint32_t const dummy = 0x12345678;
@@ -74,6 +76,7 @@ static inline uint32_t hton32(uint32_t x)
}
#endif

#if defined(__KERNEL__)
#undef HAVE_ERRNO_H
#if defined __KERNEL__
# undef HAVE_ERRNO_H
#endif


Loading…
Cancel
Save