diff options
author | Konstantin Osipov <kostja@sun.com> | 2009-12-03 14:37:42 +0300 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2009-12-03 14:37:42 +0300 |
commit | c659143c1eab033ca7edb37beb0774db89de0fd9 (patch) | |
tree | 175c9a131e8db03f979cae325a0c524fa714d860 /include | |
parent | eef538ab962c444d9f4728e046fcf34638104c6d (diff) | |
parent | 94f25504a342152c50b0003ab698411ab83198d4 (diff) | |
download | mariadb-git-c659143c1eab033ca7edb37beb0774db89de0fd9.tar.gz |
Merge next-mr -> next-4284
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile.am | 1 | ||||
-rw-r--r-- | include/config-win.h | 14 | ||||
-rw-r--r-- | include/my_net.h | 16 | ||||
-rw-r--r-- | include/my_rdtsc.h | 129 | ||||
-rw-r--r-- | include/violite.h | 24 |
5 files changed, 160 insertions, 24 deletions
diff --git a/include/Makefile.am b/include/Makefile.am index 83a22f1beec..fff162474a5 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -38,6 +38,7 @@ noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \ my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \ thr_lock.h t_ctype.h violite.h my_md5.h base64.h \ my_handler.h my_time.h service_versions.h \ + my_rdtsc.h \ my_vle.h my_user.h my_atomic.h atomic/nolock.h \ atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \ atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \ diff --git a/include/config-win.h b/include/config-win.h index 431bfcfa702..68248c09bef 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -20,6 +20,13 @@ #define BIG_TABLES +/* + Minimal version of Windows we should be able to run on. + Currently Windows XP. +*/ +#define _WIN32_WINNT 0x0501 + + #if defined(_MSC_VER) && _MSC_VER >= 1400 /* Avoid endless warnings about sprintf() etc. being unsafe. */ #define _CRT_SECURE_NO_DEPRECATE 1 @@ -27,6 +34,7 @@ #include <sys/locking.h> #include <winsock2.h> +#include <Ws2tcpip.h> #include <fcntl.h> #include <io.h> #include <malloc.h> @@ -88,6 +96,12 @@ #define S_IROTH S_IREAD /* for my_lib */ +/* Winsock2 constant (Vista SDK and later)*/ +#define IPPROTO_IPV6 41 +#ifndef IPV6_V6ONLY +#define IPV6_V6ONLY 27 +#endif + #ifdef __BORLANDC__ #define FILE_BINARY O_BINARY /* my_fopen in binary mode */ #define O_TEMPORARY 0 diff --git a/include/my_net.h b/include/my_net.h index 3af79ea3db5..18fb3db8e88 100644 --- a/include/my_net.h +++ b/include/my_net.h @@ -43,7 +43,7 @@ C_MODE_START #include <sys/ioctl.h> #endif -#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__NETWARE__) +#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__NETWARE__) #include <netinet/in_systm.h> #include <netinet/in.h> #include <netinet/ip.h> @@ -73,11 +73,6 @@ C_MODE_START #define in_addr_t uint32 #endif -/* On some operating systems (e.g. Solaris) INADDR_NONE is not defined */ -#ifndef INADDR_NONE -#define INADDR_NONE -1 /* Error value from inet_addr */ -#endif - /* Thread safe or portable version of some functions */ void my_inet_ntoa(struct in_addr in, char *buf); @@ -86,9 +81,6 @@ void my_inet_ntoa(struct in_addr in, char *buf); Handling of gethostbyname_r() */ -#if !defined(HPUX10) -struct hostent; -#endif /* HPUX */ #if !defined(HAVE_GETHOSTBYNAME_R) struct hostent *my_gethostbyname_r(const char *name, struct hostent *result, char *buffer, @@ -118,11 +110,5 @@ struct hostent *my_gethostbyname_r(const char *name, #define GETHOSTBYNAME_BUFF_SIZE 2048 #endif -/* On SCO you get a link error when refering to h_errno */ -#ifdef SCO -#undef h_errno -#define h_errno errno -#endif - C_MODE_END #endif diff --git a/include/my_rdtsc.h b/include/my_rdtsc.h new file mode 100644 index 00000000000..81bc1aafb58 --- /dev/null +++ b/include/my_rdtsc.h @@ -0,0 +1,129 @@ +/* Copyright (C) 2008, 2009 Sun Microsystems, Inc + + 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 */ + +/* + rdtsc3 -- multi-platform timer code + pgulutzan@mysql.com, 2005-08-29 + modified 2008-11-02 +*/ + +#ifndef MY_RDTSC_H +#define MY_RDTSC_H + +/** + Characteristics of a timer. +*/ +struct my_timer_unit_info +{ + /** Routine used for the timer. */ + ulonglong routine; + /** Overhead of the timer. */ + ulonglong overhead; + /** Frequency of the timer. */ + ulonglong frequency; + /** Resolution of the timer. */ + ulonglong resolution; +}; + +/** + Characteristics of all the supported timers. + @sa my_timer_init(). +*/ +struct my_timer_info +{ + /** Characteristics of the cycle timer. */ + struct my_timer_unit_info cycles; + /** Characteristics of the nanosecond timer. */ + struct my_timer_unit_info nanoseconds; + /** Characteristics of the microsecond timer. */ + struct my_timer_unit_info microseconds; + /** Characteristics of the millisecond timer. */ + struct my_timer_unit_info milliseconds; + /** Characteristics of the tick timer. */ + struct my_timer_unit_info ticks; +}; + +typedef struct my_timer_info MY_TIMER_INFO; + +C_MODE_START + +/** + A cycle timer. + @return the current timer value, in cycles. +*/ +ulonglong my_timer_cycles(void); + +/** + A namoseconds timer. + @return the current timer value, in nanoseconds. +*/ +ulonglong my_timer_nanoseconds(void); + +/** + A microseconds timer. + @return the current timer value, in microseconds. +*/ +ulonglong my_timer_microseconds(void); + +/** + A millisecond timer. + @return the current timer value, in milliseconds. +*/ +ulonglong my_timer_milliseconds(void); + +/** + A ticks timer. + @return the current timer value, in ticks. +*/ +ulonglong my_timer_ticks(void); + +/** + Timer initialization function. + @param [out] mti the timer characteristics. +*/ +void my_timer_init(MY_TIMER_INFO *mti); + +C_MODE_END + +#define MY_TIMER_ROUTINE_ASM_X86 1 +#define MY_TIMER_ROUTINE_ASM_X86_64 2 +#define MY_TIMER_ROUTINE_RDTSCLL 3 +#define MY_TIMER_ROUTINE_ASM_X86_WIN 4 +#define MY_TIMER_ROUTINE_RDTSC 5 +#define MY_TIMER_ROUTINE_ASM_IA64 6 +#define MY_TIMER_ROUTINE_ASM_PPC 7 +#define MY_TIMER_ROUTINE_SGI_CYCLE 8 +#define MY_TIMER_ROUTINE_GETHRTIME 9 +#define MY_TIMER_ROUTINE_READ_REAL_TIME 10 +#define MY_TIMER_ROUTINE_CLOCK_GETTIME 11 +#define MY_TIMER_ROUTINE_NXGETTIME 12 +#define MY_TIMER_ROUTINE_GETTIMEOFDAY 13 +#define MY_TIMER_ROUTINE_QUERYPERFORMANCECOUNTER 14 +#define MY_TIMER_ROUTINE_GETTICKCOUNT 15 +#define MY_TIMER_ROUTINE_TIME 16 +#define MY_TIMER_ROUTINE_TIMES 17 +#define MY_TIMER_ROUTINE_FTIME 18 +#define MY_TIMER_ROUTINE_ASM_PPC64 19 +#define MY_TIMER_ROUTINE_ASM_SUNPRO_SPARC64 20 +#define MY_TIMER_ROUTINE_ASM_SUNPRO_SPARC32 21 +#define MY_TIMER_ROUTINE_ASM_SUNPRO_I386 22 +#define MY_TIMER_ROUTINE_ASM_GCC_SPARC64 23 +#define MY_TIMER_ROUTINE_ASM_GCC_SPARC32 24 +#define MY_TIMER_ROUTINE_MACH_ABSOLUTE_TIME 25 +#define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26 +#define MY_TIMER_ROUTINE_ASM_SUNPRO_X86_64 27 + +#endif + diff --git a/include/violite.h b/include/violite.h index 3e8e430392b..eed6c46271f 100644 --- a/include/violite.h +++ b/include/violite.h @@ -81,13 +81,19 @@ int vio_errno(Vio*vio); /* Get socket number */ my_socket vio_fd(Vio*vio); /* Remote peer's address and name in text form */ -my_bool vio_peer_addr(Vio* vio, char *buf, uint16 *port); -/* Remotes in_addr */ -void vio_in_addr(Vio *vio, struct in_addr *in); +my_bool vio_peer_addr(Vio *vio, char *buf, uint16 *port, size_t buflen); my_bool vio_poll_read(Vio *vio, uint timeout); my_bool vio_is_connected(Vio *vio); ssize_t vio_pending(Vio *vio); +my_bool vio_get_normalized_ip_string(const struct sockaddr *addr, int addr_length, + char *ip_string, size_t ip_string_size); + +int vio_getnameinfo(const struct sockaddr *sa, + char *hostname, size_t hostname_size, + char *port, size_t port_size, + int flags); + #ifdef HAVE_OPENSSL #include <openssl/opensslv.h> #if OPENSSL_VERSION_NUMBER < 0x0090700f @@ -154,8 +160,7 @@ void vio_end(void); #define vio_should_retry(vio) (vio)->should_retry(vio) #define vio_was_interrupted(vio) (vio)->was_interrupted(vio) #define vio_close(vio) ((vio)->vioclose)(vio) -#define vio_peer_addr(vio, buf, prt) (vio)->peer_addr(vio, buf, prt) -#define vio_in_addr(vio, in) (vio)->in_addr(vio, in) +#define vio_peer_addr(vio, buf, prt, buflen) (vio)->peer_addr(vio, buf, prt, buflen) #define vio_timeout(vio, which, seconds) (vio)->timeout(vio, which, seconds) #define vio_poll_read(vio, timeout) (vio)->poll_read(vio, timeout) #define vio_is_connected(vio) (vio)->is_connected(vio) @@ -180,8 +185,9 @@ struct st_vio HANDLE hPipe; my_bool localhost; /* Are we from localhost? */ int fcntl_mode; /* Buffered fcntl(sd,F_GETFL) */ - struct sockaddr_in local; /* Local internet address */ - struct sockaddr_in remote; /* Remote internet address */ + struct sockaddr_storage local; /* Local internet address */ + struct sockaddr_storage remote; /* Remote internet address */ + int addrLen; /* Length of remote address */ enum enum_vio_type type; /* Type of connection */ char desc[30]; /* String description */ char *read_buffer; /* buffer for vio_read_buff */ @@ -197,8 +203,8 @@ struct st_vio my_bool (*is_blocking)(Vio*); int (*viokeepalive)(Vio*, my_bool); int (*fastsend)(Vio*); - my_bool (*peer_addr)(Vio*, char *, uint16*); - void (*in_addr)(Vio*, struct in_addr*); + my_bool (*peer_addr)(Vio*, char *, uint16*, size_t); + void (*in_addr)(Vio*, struct sockaddr_storage*); my_bool (*should_retry)(Vio*); my_bool (*was_interrupted)(Vio*); int (*vioclose)(Vio*); |