more thorough fix for systems with strange socklen_t

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2010-02-02 12:45:38 +01:00
parent 5b9b1365a0
commit bb1dcc9aab
6 changed files with 36 additions and 32 deletions

View File

@ -6,8 +6,10 @@
* Heavily modified by Manuel Novoa III Mar 12, 2001 * Heavily modified by Manuel Novoa III Mar 12, 2001
* *
*/ */
#ifndef INET_COMMON_H
#define INET_COMMON_H 1
#include "platform.h" PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
/* hostfirst!=0 If we expect this to be a hostname, /* hostfirst!=0 If we expect this to be a hostname,
try hostname database first try hostname database first
@ -24,3 +26,7 @@ int INET6_resolve(const char *name, struct sockaddr_in6 *sin6) FAST_FUNC;
/* These return malloced string */ /* These return malloced string */
char *INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t netmask) FAST_FUNC; char *INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t netmask) FAST_FUNC;
char *INET6_rresolve(struct sockaddr_in6 *sin6, int numeric) FAST_FUNC; char *INET6_rresolve(struct sockaddr_in6 *sin6, int numeric) FAST_FUNC;
POP_SAVED_FUNCTION_VISIBILITY
#endif

View File

@ -30,10 +30,6 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/socket.h> #include <sys/socket.h>
#if defined __FreeBSD__
# include <netinet/in.h>
# include <arpa/inet.h>
#endif
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
@ -44,39 +40,26 @@
/* Try to pull in PATH_MAX */ /* Try to pull in PATH_MAX */
#include <limits.h> #include <limits.h>
#include <sys/param.h> #include <sys/param.h>
#ifndef PATH_MAX
# define PATH_MAX 256
#endif
#ifndef BUFSIZ
# define BUFSIZ 4096
#endif
#ifdef HAVE_MNTENT_H #ifdef HAVE_MNTENT_H
#include <mntent.h> #include <mntent.h>
#endif #endif
#ifdef HAVE_SYS_STATFS_H #ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h> #include <sys/statfs.h>
#endif #endif
#if ENABLE_SELINUX #if ENABLE_SELINUX
#include <selinux/selinux.h> #include <selinux/selinux.h>
#include <selinux/context.h> #include <selinux/context.h>
#include <selinux/flask.h> #include <selinux/flask.h>
#include <selinux/av_permissions.h> #include <selinux/av_permissions.h>
#endif #endif
#if ENABLE_LOCALE_SUPPORT #if ENABLE_LOCALE_SUPPORT
# include <locale.h> # include <locale.h>
#else #else
# define setlocale(x,y) ((void)0) # define setlocale(x,y) ((void)0)
#endif #endif
#ifdef DMALLOC #ifdef DMALLOC
# include <dmalloc.h> # include <dmalloc.h>
#endif #endif
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
#if ENABLE_FEATURE_SHADOWPASSWDS #if ENABLE_FEATURE_SHADOWPASSWDS
@ -87,6 +70,23 @@
# include <shadow.h> # include <shadow.h>
# endif # endif
#endif #endif
#if defined __FreeBSD__
# include <netinet/in.h>
# include <arpa/inet.h>
#elif defined __APPLE__
# include <netinet/in.h>
#else
# include <arpa/inet.h>
# if !defined(__socklen_t_defined) && !defined(_SOCKLEN_T_DECLARED)
/* We #define socklen_t *after* includes, otherwise we get
* typedef redefinition errors from system headers
* (in case "is it defined already" detection above failed)
*/
# define socklen_t bb_socklen_t
typedef unsigned socklen_t;
# endif
#endif
/* Some libc's forget to declare these, do it ourself */ /* Some libc's forget to declare these, do it ourself */
@ -121,6 +121,12 @@ struct sysinfo {
char _f[20 - 2 * sizeof(long) - sizeof(int)]; /* Padding: libc5 uses this.. */ char _f[20 - 2 * sizeof(long) - sizeof(int)]; /* Padding: libc5 uses this.. */
}; };
int sysinfo(struct sysinfo* info); int sysinfo(struct sysinfo* info);
#ifndef PATH_MAX
# define PATH_MAX 256
#endif
#ifndef BUFSIZ
# define BUFSIZ 4096
#endif
/* Make all declarations hidden (-fvisibility flag only affects definitions) */ /* Make all declarations hidden (-fvisibility flag only affects definitions) */

View File

@ -210,18 +210,6 @@
} while (0) } while (0)
#endif #endif
/* ---- Networking ------------------------------------------ */
#ifndef __APPLE__
# include <arpa/inet.h>
# if !defined(__socklen_t_defined) && !defined(_SOCKLEN_T_DECLARED)
# define socklen_t bb_socklen_t
typedef int socklen_t;
# endif
#else
# include <netinet/in.h>
#endif
/* ---- Compiler dependent settings ------------------------- */ /* ---- Compiler dependent settings ------------------------- */
#if (defined __digital__ && defined __unix__) \ #if (defined __digital__ && defined __unix__) \

View File

@ -5,6 +5,8 @@
#ifndef UNICODE_H #ifndef UNICODE_H
#define UNICODE_H 1 #define UNICODE_H 1
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
enum { enum {
UNICODE_UNKNOWN = 0, UNICODE_UNKNOWN = 0,
UNICODE_OFF = 1, UNICODE_OFF = 1,
@ -79,4 +81,6 @@ int iswpunct(wint_t wc) FAST_FUNC;
#endif /* FEATURE_ASSUME_UNICODE */ #endif /* FEATURE_ASSUME_UNICODE */
POP_SAVED_FUNCTION_VISIBILITY
#endif #endif

View File

@ -36,8 +36,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <netinet/if_ether.h> #include <netinet/if_ether.h>
#endif #endif
#include "inet_common.h"
#include "libbb.h" #include "libbb.h"
#include "inet_common.h"
#if ENABLE_FEATURE_IFCONFIG_SLIP #if ENABLE_FEATURE_IFCONFIG_SLIP
# include <net/if_slip.h> # include <net/if_slip.h>

View File

@ -33,8 +33,8 @@
#include <net/if.h> #include <net/if.h>
#include <net/if_arp.h> #include <net/if_arp.h>
#include "inet_common.h"
#include "libbb.h" #include "libbb.h"
#include "inet_common.h"
#if ENABLE_FEATURE_HWIB #if ENABLE_FEATURE_HWIB