mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 14:02:32 +01:00
7eb84da890
The following 6.0 revisions were analyzed: - sp1r-brian@zim.(none)-20071228102738-21894 - sp1r-brian@zim.(none)-20071228121841-56447 - sp1r-brian@zim.(none)-20071228205403-56423 - sp1r-brian@zim.(none)-20071228221139-55341 - sp1r-brian@zim.(none)-20071228233443-55352 - sp1r-brian@zim.(none)-20071229094527-61763 - sp1r-brian@zim.(none)-20071230203739-61746 - sp1r-brian@zim.(none)-20080102213805-61741 - sp1r-brian@zim.(none)-20080103201041-61746 - sp1r-brian@zim.(none)-20080104234927-59875 - sp1r-brian@zim.(none)-20080105005827-59874 - sp1r-brian@zim.(none)-20080105012020-59865 - sp1r-brian@zim.(none)-20080106003858-59857 - sp1r-brian@zim.(none)-20080123195552-31680 - sp1r-brian@zim.(none)-20080124201848-29999 - sp1r-brian@zim.(none)-20080129075144-36991 - sp1r-cbell/Chuck@mysql_cab_desk.-20080215041806-21954 - sp1r-vvaintroub@wva.-20080212124547-06272 - sp1r-dfischer/mysqldev@mysql.com/production.mysql.com-20071223184258-15140 - sp1r-brian@zim.(none)-20080206122216-35774 - sp1r-baker@bk-internal.mysql.com-20080209005622-35947 - sp1r-baker@bk-internal.mysql.com-20080224215608-24613 - sp1r-baker@bk-internal.mysql.com-20080307170710-63543 - sp1r-baker@bk-internal.mysql.com-20080312233205-13069 - sp1r-Reggie@core.-20080402175211-28643 - kpettersson@mysql.com-20080901101150-4ne74r8v0492vv42 - alik@sun.com-20090805173811-9fzt0ymcp9tsvn7k - alik@sun.com-20090805173937-fcv1fdveodq5x9gb - alik@sun.com-20090805175009-g1od16i3t1xkw2qr - kostja@sun.com-20090805200643-j9i4fy7ii8ijho5c - alik@sun.com-20090807195303-j4fb5m4l1dgdahwo - alik@sun.com-20090808114848-3rkzr9kifrijzaqy - alik@sun.com-20090810041739-ugmx34h34uid8mox - alik@sun.com-20090810105306-rf43rfyzzblsy5e7 - alik@sun.com-20090810123113-ccdjwai68b5woqdm - alik@sun.com-20090811080423-gb7pibec1znaydzy - alik@sun.com-20090811082130-5uckar1vx3kdsw7g - alik@sun.com-20090812202051-uqkfwwxxcjvo5ean The following bugfixes are also backported within this patch: - Bug#34292: netdb.h missing in hostname.cc - Bug#39153: Failing to lookup a host name can lead to crash in current IPv6 implementation - Bug#38247: Server does not resolve connecting ip's - Bug#43006: main.skip_name_resolve fails on Windows in PB2 - Bug#45606: ACL requires IPv4-mapped addresses to be used - Bug#45584: Host name cache does not work as a cache
114 lines
3.2 KiB
C
114 lines
3.2 KiB
C
/* Copyright (C) 2000 MySQL AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
/*
|
|
thread safe version of some common functions:
|
|
my_inet_ntoa
|
|
|
|
This file is also used to make handling of sockets and ioctl()
|
|
portable accross systems.
|
|
|
|
*/
|
|
|
|
#ifndef _my_net_h
|
|
#define _my_net_h
|
|
C_MODE_START
|
|
|
|
#include <errno.h>
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
#include <sys/socket.h>
|
|
#endif
|
|
#ifdef HAVE_NETINET_IN_H
|
|
#include <netinet/in.h>
|
|
#endif
|
|
#ifdef HAVE_ARPA_INET_H
|
|
#include <arpa/inet.h>
|
|
#endif
|
|
#ifdef HAVE_POLL
|
|
#include <sys/poll.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_IOCTL_H
|
|
#include <sys/ioctl.h>
|
|
#endif
|
|
|
|
#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__NETWARE__)
|
|
#include <netinet/in_systm.h>
|
|
#include <netinet/in.h>
|
|
#include <netinet/ip.h>
|
|
#if !defined(alpha_linux_port)
|
|
#include <netinet/tcp.h>
|
|
#endif
|
|
#endif
|
|
|
|
#if defined(__WIN__)
|
|
#define O_NONBLOCK 1 /* For emulation of fcntl() */
|
|
|
|
/*
|
|
SHUT_RDWR is called SD_BOTH in windows and
|
|
is defined to 2 in winsock2.h
|
|
#define SD_BOTH 0x02
|
|
*/
|
|
#define SHUT_RDWR 0x02
|
|
|
|
#endif
|
|
|
|
/*
|
|
On OSes which don't have the in_addr_t, we guess that using uint32 is the best
|
|
possible choice. We guess this from the fact that on HP-UX64bit & FreeBSD64bit
|
|
& Solaris64bit, in_addr_t is equivalent to uint32. And on Linux32bit too.
|
|
*/
|
|
#ifndef HAVE_IN_ADDR_T
|
|
#define in_addr_t uint32
|
|
#endif
|
|
|
|
/* Thread safe or portable version of some functions */
|
|
|
|
void my_inet_ntoa(struct in_addr in, char *buf);
|
|
|
|
/*
|
|
Handling of gethostbyname_r()
|
|
*/
|
|
|
|
#if !defined(HAVE_GETHOSTBYNAME_R)
|
|
struct hostent *my_gethostbyname_r(const char *name,
|
|
struct hostent *result, char *buffer,
|
|
int buflen, int *h_errnop);
|
|
void my_gethostbyname_r_free();
|
|
#elif defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
|
|
struct hostent *my_gethostbyname_r(const char *name,
|
|
struct hostent *result, char *buffer,
|
|
int buflen, int *h_errnop);
|
|
#define my_gethostbyname_r_free()
|
|
#if !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) && !defined(HPUX10)
|
|
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
|
|
#endif /* !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
|
|
|
|
#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT)
|
|
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
|
|
struct hostent *my_gethostbyname_r(const char *name,
|
|
struct hostent *result, char *buffer,
|
|
int buflen, int *h_errnop);
|
|
#define my_gethostbyname_r_free()
|
|
#else
|
|
#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
|
|
#define my_gethostbyname_r_free()
|
|
#endif /* !defined(HAVE_GETHOSTBYNAME_R) */
|
|
|
|
#ifndef GETHOSTBYNAME_BUFF_SIZE
|
|
#define GETHOSTBYNAME_BUFF_SIZE 2048
|
|
#endif
|
|
|
|
C_MODE_END
|
|
#endif
|