List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:January 24 2011 10:01pm
Subject:bzr push into mysql-trunk-wl4896 branch (chris.powers:3217 to 3218) WL#4896
View as plain text  
 3218 Christopher Powers	2011-01-24
      WL#4896 Performance Schema Net IO
      
      Winsock support
     @ include/mysql/psi/mysql_socket.h
        Disabled socket APIs not supported by Winsock
     @ storage/perfschema/pfs.cc
        - Disabled socket APIs not supported by Winsock
        - Implemented Win32 versions of inet_ntop() and inet_pton() for
          converting IP from internal format to string
     @ storage/perfschema/pfs_instr.h
        Winsock support

    modified:
      include/mysql/psi/mysql_socket.h*
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_instr.h
 3217 Christopher Powers	2011-01-14 [merge]
      merge w/ mysql-trunk

    removed:
      include/my_no_pthread.h
      mysys/mf_brkhant.c
    added:
      mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc
      mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc
      mysql-test/include/plugin.defs
      mysql-test/r/filesort_debug.result
      mysql-test/suite/sys_vars/r/autocommit_func4.result
      mysql-test/suite/sys_vars/r/autocommit_func5.result
      mysql-test/suite/sys_vars/t/autocommit_func4-master.opt
      mysql-test/suite/sys_vars/t/autocommit_func4.test
      mysql-test/suite/sys_vars/t/autocommit_func5-master.opt
      mysql-test/suite/sys_vars/t/autocommit_func5.test
      mysql-test/t/filesort_debug.test
      unittest/gunit/my_decimal-t.cc
    modified:
      client/mysqladmin.cc
      client/mysqldump.c
      client/mysqlslap.c
      client/mysqltest.cc
      cmd-line-utils/readline/CMakeLists.txt
      config.h.cmake
      dbug/dbug.c
      dbug/dbug_analyze.c
      dbug/my_main.c
      dbug/tests.c
      include/CMakeLists.txt
      include/heap.h
      include/my_base.h
      include/my_bitmap.h
      include/my_global.h
      include/my_pthread.h
      include/my_sys.h
      include/myisam.h
      include/thr_alarm.h
      libmysql/client_settings.h
      libmysql/libmysql.c
      mysql-test/collections/README.experimental
      mysql-test/collections/default.experimental
      mysql-test/collections/mysql-trunk.weekly
      mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
      mysql-test/include/func_in.inc
      mysql-test/include/icp_tests.inc
      mysql-test/include/select.inc
      mysql-test/include/setup_fake_relay_log.inc
      mysql-test/include/subquery.inc
      mysql-test/include/wait_for_status_var.inc
      mysql-test/lib/mtr_cases.pm
      mysql-test/lib/mtr_report.pm
      mysql-test/mysql-test-run.pl
      mysql-test/r/auto_increment.result
      mysql-test/r/client_xml.result
      mysql-test/r/func_in_icp.result
      mysql-test/r/func_in_icp_mrr.result
      mysql-test/r/func_in_mrr.result
      mysql-test/r/func_in_mrr_cost.result
      mysql-test/r/func_in_none.result
      mysql-test/r/func_math.result
      mysql-test/r/func_str.result
      mysql-test/r/gis.result
      mysql-test/r/innodb_icp.result
      mysql-test/r/innodb_icp_all.result
      mysql-test/r/innodb_icp_none.result
      mysql-test/r/innodb_mysql_sync.result
      mysql-test/r/join_outer.result
      mysql-test/r/myisam_icp.result
      mysql-test/r/myisam_icp_all.result
      mysql-test/r/myisam_icp_none.result
      mysql-test/r/myisam_mrr_all.result
      mysql-test/r/myisam_mrr_cost_all.result
      mysql-test/r/mysqlbinlog_row_big.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/mysqldump.result
      mysql-test/r/mysqltest.result
      mysql-test/r/not_embedded_server.result
      mysql-test/r/order_by_all.result
      mysql-test/r/partition.result
      mysql-test/r/partition_error.result
      mysql-test/r/partition_range.result
      mysql-test/r/select_all.result
      mysql-test/r/select_all_jcl6.result
      mysql-test/r/select_icp_mrr.result
      mysql-test/r/select_icp_mrr_jcl6.result
      mysql-test/r/select_none.result
      mysql-test/r/select_none_jcl6.result
      mysql-test/r/show_check.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_none.result
      mysql-test/r/subquery_sj_none.result
      mysql-test/r/type_timestamp.result
      mysql-test/r/udf.result
      mysql-test/r/union.result
      mysql-test/r/update.result
      mysql-test/r/view_grant.result
      mysql-test/suite/bugs/t/bug57108.test
      mysql-test/suite/engines/funcs/r/db_alter_character_set.result
      mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result
      mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result
      mysql-test/suite/engines/funcs/r/in_multicolumn_string_pk_constraint_error.result
      mysql-test/suite/engines/funcs/r/in_multicolumn_string_pk_constraint_ignore.result
      mysql-test/suite/engines/funcs/r/in_multicolumn_string_unique_constraint_error.result
      mysql-test/suite/engines/funcs/r/in_string_pk_constraint_error.result
      mysql-test/suite/engines/funcs/r/in_string_unique_constraint_error.result
      mysql-test/suite/engines/funcs/r/rpl000013.result
      mysql-test/suite/engines/funcs/r/rpl_000015.result
      mysql-test/suite/engines/funcs/r/rpl_change_master.result
      mysql-test/suite/engines/funcs/r/rpl_drop.result
      mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
      mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
      mysql-test/suite/engines/funcs/r/rpl_log_pos.result
      mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result
      mysql-test/suite/engines/funcs/r/rpl_row_drop.result
      mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
      mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result
      mysql-test/suite/engines/funcs/r/rpl_row_sp005.result
      mysql-test/suite/engines/funcs/r/rpl_row_trig003.result
      mysql-test/suite/engines/funcs/r/rpl_row_until.result
      mysql-test/suite/engines/funcs/r/rpl_server_id1.result
      mysql-test/suite/engines/funcs/r/rpl_server_id2.result
      mysql-test/suite/engines/funcs/r/rpl_session_var.result
      mysql-test/suite/engines/funcs/r/rpl_slave_status.result
      mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result
      mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
      mysql-test/suite/engines/funcs/r/rpl_temp_table.result
      mysql-test/suite/engines/funcs/r/rpl_trigger.result
      mysql-test/suite/engines/funcs/r/se_join_left.result
      mysql-test/suite/engines/funcs/r/se_join_left_outer.result
      mysql-test/suite/engines/funcs/r/se_join_natural_left.result
      mysql-test/suite/engines/funcs/r/se_join_natural_left_outer.result
      mysql-test/suite/engines/funcs/r/sf_alter.result
      mysql-test/suite/engines/funcs/r/sf_cursor.result
      mysql-test/suite/engines/funcs/r/sp_alter.result
      mysql-test/suite/engines/funcs/r/sp_cursor.result
      mysql-test/suite/engines/funcs/r/ta_rename.result
      mysql-test/suite/engines/funcs/t/db_alter_collate_utf8.test
      mysql-test/suite/engines/funcs/t/disabled.def
      mysql-test/suite/engines/funcs/t/in_multicolumn_string_pk_constraint_error.test
      mysql-test/suite/engines/funcs/t/in_multicolumn_string_pk_constraint_ignore.test
      mysql-test/suite/engines/funcs/t/in_multicolumn_string_unique_constraint_error.test
      mysql-test/suite/engines/funcs/t/in_string_pk_constraint_error.test
      mysql-test/suite/engines/funcs/t/in_string_unique_constraint_error.test
      mysql-test/suite/engines/funcs/t/rpl000013.test
      mysql-test/suite/engines/funcs/t/rpl_000015.test
      mysql-test/suite/engines/funcs/t/rpl_change_master.test
      mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test
      mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
      mysql-test/suite/engines/funcs/t/rpl_get_lock.test
      mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
      mysql-test/suite/engines/funcs/t/rpl_loadfile.test
      mysql-test/suite/engines/funcs/t/rpl_log_pos.test
      mysql-test/suite/engines/funcs/t/rpl_misc_functions.test
      mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test
      mysql-test/suite/engines/funcs/t/rpl_row_drop.test
      mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
      mysql-test/suite/engines/funcs/t/rpl_row_until.test
      mysql-test/suite/engines/funcs/t/rpl_server_id1.test
      mysql-test/suite/engines/funcs/t/rpl_server_id2.test
      mysql-test/suite/engines/funcs/t/rpl_slave_status.test
      mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
      mysql-test/suite/engines/funcs/t/rpl_temp_table.test
      mysql-test/suite/engines/funcs/t/rpl_temporary.test
      mysql-test/suite/engines/funcs/t/rpl_trigger.test
      mysql-test/suite/engines/funcs/t/se_join_left.test
      mysql-test/suite/engines/funcs/t/se_join_left_outer.test
      mysql-test/suite/engines/funcs/t/se_join_natural_left.test
      mysql-test/suite/engines/funcs/t/se_join_natural_left_outer.test
      mysql-test/suite/engines/iuds/r/insert_number.result
      mysql-test/suite/engines/iuds/r/strings_charsets_update_delete.result
      mysql-test/suite/engines/iuds/r/strings_update_delete.result
      mysql-test/suite/engines/iuds/r/type_bit_iuds.result
      mysql-test/suite/engines/iuds/r/update_delete_calendar.result
      mysql-test/suite/engines/iuds/r/update_delete_number.result
      mysql-test/suite/engines/iuds/t/disabled.def
      mysql-test/suite/engines/iuds/t/insert_number.test
      mysql-test/suite/engines/iuds/t/update_delete_calendar.test
      mysql-test/suite/innodb/r/innodb-timeout.result
      mysql-test/suite/innodb/r/innodb.result
      mysql-test/suite/innodb/t/innodb-timeout.test
      mysql-test/suite/innodb/t/innodb.test
      mysql-test/suite/parts/inc/part_supported_sql_funcs_main.inc
      mysql-test/suite/parts/r/part_supported_sql_func_innodb.result
      mysql-test/suite/parts/r/part_supported_sql_func_myisam.result
      mysql-test/suite/perfschema/include/binlog_common.inc
      mysql-test/suite/perfschema/r/binlog_mix.result
      mysql-test/suite/perfschema/r/binlog_row.result
      mysql-test/suite/perfschema/r/binlog_stmt.result
      mysql-test/suite/perfschema/r/server_init.result
      mysql-test/suite/perfschema/t/binlog_mix.test
      mysql-test/suite/perfschema/t/binlog_row.test
      mysql-test/suite/perfschema/t/binlog_stmt.test
      mysql-test/suite/perfschema/t/server_init.test
      mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
      mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
      mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
      mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
      mysql-test/t/auto_increment.test
      mysql-test/t/bug46261.test
      mysql-test/t/fulltext_plugin.test
      mysql-test/t/func_math.test
      mysql-test/t/func_str.test
      mysql-test/t/gis.test
      mysql-test/t/innodb_mysql_sync.test
      mysql-test/t/join_outer.test
      mysql-test/t/mysqlbinlog_row_big.test
      mysql-test/t/mysqldump.test
      mysql-test/t/mysqltest.test
      mysql-test/t/not_embedded_server.test
      mysql-test/t/partition.test
      mysql-test/t/partition_error.test
      mysql-test/t/partition_range.test
      mysql-test/t/plugin.test
      mysql-test/t/plugin_auth_qa_2-master.opt
      mysql-test/t/plugin_auth_qa_3-master.opt
      mysql-test/t/plugin_not_embedded.test
      mysql-test/t/show_check.test
      mysql-test/t/type_timestamp.test
      mysql-test/t/udf.test
      mysql-test/t/union.test
      mysql-test/t/view_grant.test
      mysys/mf_iocache.c
      mysys/mf_iocache2.c
      mysys/mf_keycache.c
      mysys/mf_keycaches.c
      mysys/my_bitmap.c
      mysys/my_fopen.c
      mysys/my_fstream.c
      mysys/my_gethostbyname.c
      mysys/my_getsystime.c
      mysys/my_init.c
      mysys/my_lib.c
      mysys/my_open.c
      mysys/my_pread.c
      mysys/my_pthread.c
      mysys/my_read.c
      mysys/my_static.c
      mysys/my_thr_init.c
      mysys/my_write.c
      mysys/mysys_priv.h
      mysys/thr_alarm.c
      mysys/thr_lock.c
      mysys/thr_mutex.c
      mysys/thr_rwlock.c
      sql-common/client.c
      sql-common/client_plugin.c
      sql/bounded_queue.h
      sql/client_settings.h
      sql/filesort.cc
      sql/handler.cc
      sql/handler.h
      sql/item.cc
      sql/item.h
      sql/item_cmpfunc.cc
      sql/item_func.cc
      sql/item_func.h
      sql/item_geofunc.h
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/item_subselect.cc
      sql/item_timefunc.h
      sql/log.cc
      sql/log_event.cc
      sql/log_event.h
      sql/my_decimal.h
      sql/mysqld.cc
      sql/mysqld.h
      sql/net_serv.cc
      sql/sql_admin.cc
      sql/sql_analyse.cc
      sql/sql_base.cc
      sql/sql_partition.cc
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_show.cc
      sql/sql_string.cc
      sql/sql_string.h
      sql/sql_udf.cc
      sql/sql_view.cc
      sql/sql_yacc.yy
      sql/table.cc
      storage/heap/heapdef.h
      storage/heap/hp_block.c
      storage/heap/hp_create.c
      storage/heap/hp_open.c
      storage/heap/hp_static.c
      storage/heap/hp_test2.c
      storage/innobase/btr/btr0btr.c
      storage/innobase/btr/btr0cur.c
      storage/innobase/buf/buf0buf.c
      storage/innobase/dict/dict0dict.c
      storage/innobase/fsp/fsp0fsp.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/i_s.cc
      storage/innobase/include/btr0cur.h
      storage/innobase/include/data0data.h
      storage/innobase/include/data0data.ic
      storage/innobase/include/row0upd.h
      storage/innobase/include/srv0srv.h
      storage/innobase/include/sync0rw.h
      storage/innobase/include/trx0i_s.h
      storage/innobase/include/trx0purge.h
      storage/innobase/include/univ.i
      storage/innobase/log/log0recv.c
      storage/innobase/row/row0mysql.c
      storage/innobase/row/row0purge.c
      storage/innobase/row/row0umod.c
      storage/innobase/row/row0upd.c
      storage/innobase/srv/srv0srv.c
      storage/innobase/srv/srv0start.c
      storage/innobase/trx/trx0i_s.c
      storage/innobase/trx/trx0purge.c
      storage/innobase/ut/ut0dbg.c
      storage/myisam/ha_myisam.cc
      storage/myisam/mi_check.c
      storage/myisam/mi_close.c
      storage/myisam/mi_delete.c
      storage/myisam/mi_delete_all.c
      storage/myisam/mi_dynrec.c
      storage/myisam/mi_log.c
      storage/myisam/mi_open.c
      storage/myisam/mi_static.c
      storage/myisam/mi_statrec.c
      storage/myisam/mi_update.c
      storage/myisam/mi_write.c
      storage/myisam/myisamdef.h
      storage/myisam/sort.c
      storage/myisammrg/myrg_def.h
      strings/decimal.c
      tests/thread_test.c
      unittest/gunit/CMakeLists.txt
=== modified file 'include/mysql/psi/mysql_socket.h' (properties changed: -x to +x)
--- a/include/mysql/psi/mysql_socket.h	2010-12-07 18:55:54 +0000
+++ b/include/mysql/psi/mysql_socket.h	2011-01-24 22:00:10 +0000
@@ -27,7 +27,14 @@ Foundation, Inc., 51 Franklin St, Fifth
 #include <my_sys.h>
 /* For socket api */
 //#include <sys/socket.h>
-#include <netinet/in.h>
+#ifdef __WIN__
+  #include <ws2def.h>
+  #include <winsock2.h>
+  #define SOCKBUF_T char
+#else
+  #include <netinet/in.h>
+  #define SOCKBUF_T void
+#endif
 /**
   @file mysql/psi/mysql_socket.h
 [...]
@@ -140,14 +147,6 @@ inline_mysql_end_socket_wait(struct PSI_
 #endif
 
 #ifdef HAVE_PSI_INTERFACE
-  #define mysql_socket_socketpair(K, D, T, P, FDS) \
-    inline_mysql_socket_socketpair(K, D, T, P, FDS)
-#else
-  #define mysql_socket_socketpair(K, D, T, P, FDS) \
-    inline_mysql_socket_socketpair(D, T, P, FDS)
-#endif
-
-#ifdef HAVE_PSI_INTERFACE
   #define mysql_socket_bind(FD, A, L) \
     inline_mysql_socket_bind(__FILE__, __LINE__, FD, A, L)
 #else
@@ -212,22 +211,6 @@ inline_mysql_end_socket_wait(struct PSI_
 #endif
 
 #ifdef HAVE_PSI_INTERFACE
-  #define mysql_socket_sendmsg(FD, M, FL) \
-    inline_mysql_socket_sendmsg(__FILE__, __LINE__, FD, M, FL)
-#else
-  #define mysql_socket_sendmsg(FD, M, FL) \
-    inline_mysql_socket_sendmsg(FD, M, FL)
-#endif
-
-#ifdef HAVE_PSI_INTERFACE
-  #define mysql_socket_recvmsg(FD, M, FL) \
-    inline_mysql_socket_recvmsg(__FILE__, __LINE__, FD, M, FL)
-#else
-  #define_mysql_socket_recvmsg(FD, M, FL) \
-    inline_mysql_socket_recvmsg(FD, M, FL)
-#endif
-
-#ifdef HAVE_PSI_INTERFACE
   #define mysql_socket_getsockopt(FD, LV, ON, OP, OL) \
     inline_mysql_socket_getsockopt(__FILE__, __LINE__, FD, LV, ON, OP, OL)
 #else
@@ -259,16 +242,15 @@ inline_mysql_end_socket_wait(struct PSI_
     inline_mysql_socket_accept(FD, A, LP)
 #endif
 
+/** Not supported by P_S */
 #if 0
-
-#ifdef HAVE_PSI_INTERFACE
-  #define mysql_socket_accept4(K, FD, A, LP, FL) \
-    inline_mysql_socket_accept4(K, __FILE__, __LINE__, FD, A, LP, FL)
-#else
-  #define mysql_socket_accept4(FD, A, LP, FL) \
-    inline_mysql_socket_accept4(FD, A, LP, FL)
-#endif
-
+  #ifdef HAVE_PSI_INTERFACE
+    #define mysql_socket_accept4(K, FD, A, LP, FL) \
+      inline_mysql_socket_accept4(K, __FILE__, __LINE__, FD, A, LP, FL)
+  #else
+    #define mysql_socket_accept4(FD, A, LP, FL) \
+      inline_mysql_socket_accept4(FD, A, LP, FL)
+  #endif
 #endif
 
 #ifdef HAVE_PSI_INTERFACE
@@ -287,21 +269,58 @@ inline_mysql_end_socket_wait(struct PSI_
     inline_mysql_socket_shutdown(FD, H)
 #endif
 
-#ifdef HAVE_PSI_INTERFACE
-  #define mysql_socket_sockatmark(FD) \
-    inline_mysql_socket_sockatmark(__FILE__, __LINE__, FD)
-#else
-  #define mysql_socket_sockatmark(FD) \
-    inline_mysql_socket_sockatmark(FD)
-#endif
+/** Not supported by Winsock */
+#ifdef __WIN__
+
+  #define mysql_socket_sendmsg(FD, M, FL)
+  #define mysql_socket_recvmsg(FD, M, FL)
+  #define mysql_socket_sockatmark(FD)
+  #define mysql_socket_isfdtype(FD, FT)
+  #define mysql_socket_socketpair(K, D, T, P, FDS)
 
-#ifdef HAVE_PSI_INTERFACE
-  #define mysql_socket_isfdtype(FD, FT) \
-    inline_mysql_socket_isfdtype(__FILE__, __LINE__, FD, FT)
 #else
-  #define mysql_socket_isfdtype(FD, FT) \
-    inline_mysql_socket_isfdtype(FD, FT)
-#endif
+
+  #ifdef HAVE_PSI_INTERFACE
+	  #define mysql_socket_sendmsg(FD, M, FL) \
+	  inline_mysql_socket_sendmsg(__FILE__, __LINE__, FD, M, FL)
+  #else
+	  #define mysql_socket_sendmsg(FD, M, FL) \
+	  inline_mysql_socket_sendmsg(FD, M, FL)
+  #endif
+
+  #ifdef HAVE_PSI_INTERFACE
+	  #define mysql_socket_recvmsg(FD, M, FL) \
+	  inline_mysql_socket_recvmsg(__FILE__, __LINE__, FD, M, FL)
+  #else
+	  #define_mysql_socket_recvmsg(FD, M, FL) \
+	  inline_mysql_socket_recvmsg(FD, M, FL)
+  #endif
+
+  #ifdef HAVE_PSI_INTERFACE
+	  #define mysql_socket_sockatmark(FD) \
+	  inline_mysql_socket_sockatmark(__FILE__, __LINE__, FD)
+  #else
+	  #define mysql_socket_sockatmark(FD) \
+	  inline_mysql_socket_sockatmark(FD)
+  #endif
+
+  #ifdef HAVE_PSI_INTERFACE
+	  #define mysql_socket_isfdtype(FD, FT) \
+	  inline_mysql_socket_isfdtype(__FILE__, __LINE__, FD, FT)
+  #else
+	  #define mysql_socket_isfdtype(FD, FT) \
+	  inline_mysql_socket_isfdtype(FD, FT)
+  #endif
+
+  #ifdef HAVE_PSI_INTERFACE
+	  #define mysql_socket_socketpair(K, D, T, P, FDS) \
+	  inline_mysql_socket_socketpair(K, D, T, P, FDS)
+  #else
+	  #define mysql_socket_socketpair(K, D, T, P, FDS) \
+	  inline_mysql_socket_socketpair(D, T, P, FDS)
+  #endif
+
+#endif //__WIN__
 
 struct st_mysql_socket
 {
@@ -351,39 +370,6 @@ inline_mysql_socket_socket
   return mysql_socket;
 }
 
-/** mysql_socket_socketpair */
-
-static inline int
-inline_mysql_socket_socketpair
-(
-#ifdef HAVE_PSI_INTERFACE
-  PSI_socket_key key,
-#endif
-  int domain, int type, int protocol, MYSQL_SOCKET mysql_socket[2])
-{
-  int result= 0;
-  int fds[2]= {0, 0};
-
-  mysql_socket[0].m_psi= PSI_server ? PSI_server->init_socket(key, &mysql_socket[0].fd)
-                                    : NULL;
-  mysql_socket[1].m_psi= PSI_server ? PSI_server->init_socket(key, &mysql_socket[1].fd)
-                                    : NULL;
-
-  result= socketpair(domain, type, protocol, fds);
-
-  mysql_socket[0].fd = fds[0];
-  mysql_socket[1].fd = fds[1];
-
-#ifdef HAVE_PSI_INTERFACE
-  if (likely(mysql_socket[0].m_psi != NULL && mysql_socket[1].m_psi != NULL))
-  {
-    PSI_server->set_socket_descriptor(mysql_socket[0].m_psi, fds[0]);
-    PSI_server->set_socket_descriptor(mysql_socket[1].m_psi, fds[1]);
-  }
-#endif
-  return result;
-}
-
 /** mysql_socket_bind */
 
 static inline int
@@ -426,7 +412,7 @@ inline_mysql_socket_getsockname
 #ifdef HAVE_PSI_INTERFACE
   const char *src_file, uint src_line,
 #endif
- MYSQL_SOCKET mysql_socket, __SOCKADDR_ARG addr, socklen_t *len)
+ MYSQL_SOCKET mysql_socket, struct sockaddr *addr, socklen_t *len)
 {
   int result;
 #ifdef HAVE_PSI_INTERFACE
@@ -456,7 +442,7 @@ inline_mysql_socket_connect
 #ifdef HAVE_PSI_INTERFACE
   const char *src_file, uint src_line,
 #endif
- MYSQL_SOCKET mysql_socket, __CONST_SOCKADDR_ARG addr, socklen_t len)
+ MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, socklen_t len)
 {
   int result;
 #ifdef HAVE_PSI_INTERFACE
@@ -486,7 +472,7 @@ inline_mysql_socket_getpeername
 #ifdef HAVE_PSI_INTERFACE
   const char *src_file, uint src_line,
 #endif
- MYSQL_SOCKET mysql_socket, __SOCKADDR_ARG addr, socklen_t *len)
+ MYSQL_SOCKET mysql_socket, struct sockaddr *addr, socklen_t *len)
 {
   int result;
 #ifdef HAVE_PSI_INTERFACE
@@ -516,7 +502,7 @@ inline_mysql_socket_send
 #ifdef HAVE_PSI_INTERFACE
   const char *src_file, uint src_line,
 #endif
- MYSQL_SOCKET mysql_socket, const void *buf, size_t n, int flags)
+ MYSQL_SOCKET mysql_socket, const SOCKBUF_T *buf, size_t n, int flags)
 {
   ssize_t result;
 #ifdef HAVE_PSI_INTERFACE
@@ -549,7 +535,7 @@ inline_mysql_socket_recv
 #ifdef HAVE_PSI_INTERFACE
   const char *src_file, uint src_line,
 #endif
- MYSQL_SOCKET mysql_socket,  void *buf, size_t n, int flags)
+ MYSQL_SOCKET mysql_socket,  SOCKBUF_T *buf, size_t n, int flags)
 {
   ssize_t result;
 #ifdef HAVE_PSI_INTERFACE
@@ -582,7 +568,7 @@ inline_mysql_socket_sendto
 #ifdef HAVE_PSI_INTERFACE
   const char *src_file, uint src_line,
 #endif
- MYSQL_SOCKET mysql_socket, const void *buf, size_t n, int flags, __CONST_SOCKADDR_ARG addr, socklen_t addr_len)
+ MYSQL_SOCKET mysql_socket, const SOCKBUF_T *buf, size_t n, int flags, const struct sockaddr *addr, socklen_t addr_len)
 {
   ssize_t result;
 #ifdef HAVE_PSI_INTERFACE
@@ -615,7 +601,7 @@ inline_mysql_socket_recvfrom
 #ifdef HAVE_PSI_INTERFACE
   const char *src_file, uint src_line,
 #endif
- MYSQL_SOCKET mysql_socket, void *buf, size_t n, int flags, __SOCKADDR_ARG addr, socklen_t *addr_len)
+ MYSQL_SOCKET mysql_socket, SOCKBUF_T *buf, size_t n, int flags, struct sockaddr *addr, socklen_t *addr_len)
 {
   ssize_t result;
 #ifdef HAVE_PSI_INTERFACE
@@ -640,72 +626,6 @@ inline_mysql_socket_recvfrom
   return result;
 }
 
-/** mysql_socket_sendmsg */
-
-static inline ssize_t
-inline_mysql_socket_sendmsg
-(
-#ifdef HAVE_PSI_INTERFACE
-  const char *src_file, uint src_line,
-#endif
- MYSQL_SOCKET mysql_socket, const struct msghdr *message, int flags)
-{
-  ssize_t result;
-#ifdef HAVE_PSI_INTERFACE
-  struct PSI_socket_locker *locker= NULL;
-  PSI_socket_locker_state state;
-
-  if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
-  {
-    locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_SEND);
-    if (likely(locker !=NULL))
-      PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
-  }
-#endif
-  result= sendmsg(mysql_socket.fd, message, flags);
-#ifdef HAVE_PSI_INTERFACE
-  if (likely(locker != NULL))
-  {
-    size_t bytes_written = (result > -1) ? result : 0;
-    PSI_server->end_socket_wait(locker, bytes_written);
-  }
-#endif
-  return result;
-}
-
-/** mysql_socket_recvmsg */
-
-static inline ssize_t
-inline_mysql_socket_recvmsg
-(
-#ifdef HAVE_PSI_INTERFACE
-  const char *src_file, uint src_line,
-#endif
- MYSQL_SOCKET mysql_socket, struct msghdr *message, int flags)
-{
-  ssize_t result;
-#ifdef HAVE_PSI_INTERFACE
-  struct PSI_socket_locker *locker= NULL;
-  PSI_socket_locker_state state;
-
-  if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
-  {
-    locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_RECV);
-    if (likely(locker !=NULL))
-      PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
-  }
-#endif
-  result= recvmsg(mysql_socket.fd, message, flags);
-#ifdef HAVE_PSI_INTERFACE
-  if (likely(locker != NULL))
-  {
-    size_t bytes_written = (result > -1) ? result : 0;
-    PSI_server->end_socket_wait(locker, bytes_written);
-  }
-#endif
-  return result;
-}
-
 /** mysql_socket_getsockopt */
 
 static inline int
@@ -714,7 +634,7 @@ inline_mysql_socket_getsockopt
 #ifdef HAVE_PSI_INTERFACE
   const char *src_file, uint src_line,
 #endif
- MYSQL_SOCKET mysql_socket, int level, int optname, void *optval, socklen_t *optlen)
+ MYSQL_SOCKET mysql_socket, int level, int optname, SOCKBUF_T *optval, socklen_t *optlen)
 {
   int result;
 #ifdef HAVE_PSI_INTERFACE
@@ -744,7 +664,7 @@ inline_mysql_socket_setsockopt
 #ifdef HAVE_PSI_INTERFACE
   const char *src_file, uint src_line,
 #endif
- MYSQL_SOCKET mysql_socket, int level, int optname, const void *optval, socklen_t optlen)
+ MYSQL_SOCKET mysql_socket, int level, int optname, const SOCKBUF_T *optval, socklen_t optlen)
 {
   int result;
 #ifdef HAVE_PSI_INTERFACE
@@ -835,55 +755,83 @@ inline_mysql_socket_accept
 }
 
 /** mysql_socket_accept4 */
+
 #if 0
+  static inline MYSQL_SOCKET
+  inline_mysql_socket_accept4
+  (
+  #ifdef HAVE_PSI_INTERFACE
+    PSI_socket_key key, const char *src_file, uint src_line,
+  #endif
+   MYSQL_SOCKET socket_listen,  addr, socklen_t *addr_len, int flags)
+  {
+    MYSQL_SOCKET socket_accept = {0, NULL};
+  #ifdef HAVE_PSI_INTERFACE
+    struct PSI_socket_locker *locker= NULL;
+    PSI_socket_locker_state state;
+
+    socket_accept.m_psi = PSI_server ? PSI_server->init_socket(key, &socket_accept.fd)
+                                     : NULL;
+    if (likely(PSI_server != NULL && socket_accept.m_psi != NULL))
+    {
+      locker= PSI_server->get_thread_socket_locker(socket_accept.m_psi, PSI_SOCKET_CONNECT);
+      if (likely(locker !=NULL))
+        PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+    }
+  #endif
+    socket_accept.fd= accept4(socket_listen.fd, addr, addr_len, flags);
+  #ifdef HAVE_PSI_INTERFACE
+    /** Set socket address info */
+    if (likely(PSI_server != NULL && socket_accept.m_psi != NULL
+        && socket_accept.fd > -1))
+      PSI_server->set_socket_info(socket_accept.m_psi, socket_accept.fd, addr);
 
-static inline MYSQL_SOCKET
-inline_mysql_socket_accept4
+    if (likely(locker != NULL))
+      PSI_server->end_socket_wait(locker, (size_t)0);
+  #endif
+    return socket_accept;
+  }
+#endif
+
+/** mysql_socket_close */
+
+static inline int
+inline_mysql_socket_close
 (
 #ifdef HAVE_PSI_INTERFACE
-  PSI_socket_key key, const char *src_file, uint src_line,
+  const char *src_file, uint src_line,
 #endif
- MYSQL_SOCKET socket_listen, __SOCKADDR_ARG addr, socklen_t *addr_len, int flags)
+  MYSQL_SOCKET mysql_socket)
 {
-  MYSQL_SOCKET socket_accept = {0, NULL};
+  int result;
 #ifdef HAVE_PSI_INTERFACE
   struct PSI_socket_locker *locker= NULL;
   PSI_socket_locker_state state;
 
-  socket_accept.m_psi = PSI_server ? PSI_server->init_socket(key, &socket_accept.fd)
-                                   : NULL;
-  if (likely(PSI_server != NULL && socket_accept.m_psi != NULL))
+  if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
   {
-    locker= PSI_server->get_thread_socket_locker(socket_accept.m_psi, PSI_SOCKET_CONNECT);
+    locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_CLOSE);
     if (likely(locker !=NULL))
       PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
   }
 #endif
-  socket_accept.fd= accept4(socket_listen.fd, addr, addr_len, flags);
+  result= closesocket(mysql_socket.fd);
 #ifdef HAVE_PSI_INTERFACE
-  /** Set socket address info */
-  if (likely(PSI_server != NULL && socket_accept.m_psi != NULL
-      && socket_accept.fd > -1))
-    PSI_server->set_socket_info(socket_accept.m_psi, socket_accept.fd, addr);
-
   if (likely(locker != NULL))
     PSI_server->end_socket_wait(locker, (size_t)0);
 #endif
-  return socket_accept;
+  return result;
 }
 
-#endif
-
-
-/** mysql_socket_close */
+/** mysql_socket_shutdown */
 
 static inline int
-inline_mysql_socket_close
+inline_mysql_socket_shutdown
 (
 #ifdef HAVE_PSI_INTERFACE
   const char *src_file, uint src_line,
 #endif
-  MYSQL_SOCKET mysql_socket)
+  MYSQL_SOCKET mysql_socket, int how)
 {
   int result;
 #ifdef HAVE_PSI_INTERFACE
@@ -892,12 +840,12 @@ inline_mysql_socket_close
 
   if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
   {
-    locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_CLOSE);
+    locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_SHUTDOWN);
     if (likely(locker !=NULL))
       PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
   }
 #endif
-  result= closesocket(mysql_socket.fd);
+  result= shutdown(mysql_socket.fd, how);
 #ifdef HAVE_PSI_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_socket_wait(locker, (size_t)0);
@@ -905,32 +853,72 @@ inline_mysql_socket_close
   return result;
 }
 
-/** mysql_socket_shutdown */
+/** Not supported by Winsock */
 
-static inline int
-inline_mysql_socket_shutdown
+#ifndef __WIN__
+
+/** mysql_socket_sendmsg */
+
+static inline ssize_t
+inline_mysql_socket_sendmsg
 (
 #ifdef HAVE_PSI_INTERFACE
   const char *src_file, uint src_line,
 #endif
-  MYSQL_SOCKET mysql_socket, int how)
+ MYSQL_SOCKET mysql_socket, const struct msghdr *message, int flags)
 {
-  int result;
+  ssize_t result;
 #ifdef HAVE_PSI_INTERFACE
   struct PSI_socket_locker *locker= NULL;
   PSI_socket_locker_state state;
 
   if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
   {
-    locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_SHUTDOWN);
+    locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_SEND);
     if (likely(locker !=NULL))
       PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
   }
 #endif
-  result= shutdown(mysql_socket.fd, how);
+  result= sendmsg(mysql_socket.fd, message, flags);
 #ifdef HAVE_PSI_INTERFACE
   if (likely(locker != NULL))
-    PSI_server->end_socket_wait(locker, (size_t)0);
+  {
+    size_t bytes_written = (result > -1) ? result : 0;
+    PSI_server->end_socket_wait(locker, bytes_written);
+  }
+#endif
+  return result;
+}
+
+/** mysql_socket_recvmsg */
+
+static inline ssize_t
+inline_mysql_socket_recvmsg
+(
+#ifdef HAVE_PSI_INTERFACE
+  const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, struct msghdr *message, int flags)
+{
+  ssize_t result;
+#ifdef HAVE_PSI_INTERFACE
+  struct PSI_socket_locker *locker= NULL;
+  PSI_socket_locker_state state;
+
+  if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+  {
+    locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_RECV);
+    if (likely(locker !=NULL))
+      PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+  }
+#endif
+  result= recvmsg(mysql_socket.fd, message, flags);
+#ifdef HAVE_PSI_INTERFACE
+  if (likely(locker != NULL))
+  {
+    size_t bytes_written = (result > -1) ? result : 0;
+    PSI_server->end_socket_wait(locker, bytes_written);
+  }
 #endif
   return result;
 }
@@ -995,6 +983,41 @@ inline_mysql_socket_isfdtype
   return result;
 }
 
+/** mysql_socket_socketpair */
+
+static inline int
+inline_mysql_socket_socketpair
+(
+#ifdef HAVE_PSI_INTERFACE
+  PSI_socket_key key,
+#endif
+  int domain, int type, int protocol, MYSQL_SOCKET mysql_socket[2])
+{
+  int result= 0;
+  int fds[2]= {0, 0};
+
+  mysql_socket[0].m_psi= PSI_server ? PSI_server->init_socket(key, &mysql_socket[0].fd)
+                                    : NULL;
+  mysql_socket[1].m_psi= PSI_server ? PSI_server->init_socket(key, &mysql_socket[1].fd)
+                                    : NULL;
+
+  result= socketpair(domain, type, protocol, fds);
+
+  mysql_socket[0].fd = fds[0];
+  mysql_socket[1].fd = fds[1];
+
+#ifdef HAVE_PSI_INTERFACE
+  if (likely(mysql_socket[0].m_psi != NULL && mysql_socket[1].m_psi != NULL))
+  {
+    PSI_server->set_socket_descriptor(mysql_socket[0].m_psi, fds[0]);
+    PSI_server->set_socket_descriptor(mysql_socket[1].m_psi, fds[1]);
+  }
+#endif
+  return result;
+}
+
+#endif // __WIN__
+
 /** @} (end of group Socket_instrumentation) */
 
 #endif

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2010-12-08 03:24:30 +0000
+++ b/storage/perfschema/pfs.cc	2011-01-24 22:00:10 +0000
@@ -17,7 +17,11 @@
   @file storage/perfschema/pfs.cc
   The performance schema implementation of all instruments.
 */
-#include <arpa/inet.h>
+#ifdef __WIN__
+  #include <winsock2.h>
+#else
+  #include <arpa/inet.h>
+#endif
 #include "my_global.h"
 #include "my_pthread.h"
 #include "sql_const.h"
@@ -3443,6 +3447,56 @@ static void set_socket_descriptor_v1(PSI
   pfs->m_fd= fd;
 }
 
+#ifdef __WIN__
+const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt)
+{
+  if (af == AF_INET)
+  {
+    struct sockaddr_in in;
+    memset(&in, 0, sizeof(in));
+    in.sin_family = AF_INET;
+    memcpy(&in.sin_addr, src, sizeof(struct in_addr));
+    getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in), dst, cnt, NULL, 0, NI_NUMERICHOST);
+    return dst;
+  }
+  else if (af == AF_INET6)
+  {
+    struct sockaddr_in6 in;
+    memset(&in, 0, sizeof(in));
+    in.sin6_family = AF_INET6;
+    memcpy(&in.sin6_addr, src, sizeof(struct in_addr6));
+    getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in6), dst, cnt, NULL, 0, NI_NUMERICHOST);
+    return dst;
+  }
+  return NULL;
+}
+
+int inet_pton(int af, const char *src, void *dst)
+{
+  struct addrinfo hints, *res, *ressave;
+
+  memset(&hints, 0, sizeof(struct addrinfo));
+  hints.ai_family = af;
+
+  if (getaddrinfo(src, NULL, &hints, &res) != 0)
+  {
+    // dolog(LOG_ERR, "Couldn't resolve host %s\n", src); //TBD
+    return -1;
+  }
+
+  ressave = res;
+
+  while (res)
+  {
+    memcpy(dst, res->ai_addr, res->ai_addrlen);
+    res = res->ai_next;
+  }
+
+  freeaddrinfo(ressave);
+  return 0;
+}
+#endif // __WIN32
+
 static void set_socket_address_v1(PSI_socket *socket,
                                   const struct sockaddr * socket_addr)
 {

=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h	2010-12-08 03:24:30 +0000
+++ b/storage/perfschema/pfs_instr.h	2011-01-24 22:00:10 +0000
@@ -29,7 +29,11 @@ struct PFS_table_share;
 struct PFS_thread_class;
 struct PFS_socket_class;
 
+#ifdef __WIN__
+#include <winsock2.h>
+#else
 #include <netinet/in.h>
+#endif
 #include "pfs_lock.h"
 #include "pfs_stat.h"
 #include "pfs_instr_class.h"


Attachment: [text/bzr-bundle] bzr/chris.powers@oracle.com-20110124220010-7qdkg07h560u28zk.bundle
Thread
bzr push into mysql-trunk-wl4896 branch (chris.powers:3217 to 3218) WL#4896Christopher Powers24 Jan