# name : remove_fcntl_excessive_calls.patch # introduced : 12 # maintainer : Oleg # #!!! notice !!! # Any small change to this file in the main branch # should be done or reviewed by the maintainer! diff -ruN a/patch_info/remove_fcntl_excessive_calls.info b/patch_info/remove_fcntl_excessive_calls.info --- a/patch_info/remove_fcntl_excessive_calls.info 1970-01-01 03:00:00.000000000 +0300 +++ b/patch_info/remove_fcntl_excessive_calls.info 2010-07-22 21:42:08.560424001 +0400 @@ -0,0 +1,6 @@ +File=remove_fcntl_excessive_calls.patch +Name=remove fcntl excessive calls +Version=1.0 +Author=This is a port of the official fix. +License=GPL +Comment= diff -ruN a/sql/net_serv.cc b/sql/net_serv.cc --- a/sql/net_serv.cc 2010-06-03 19:50:27.000000000 +0400 +++ b/sql/net_serv.cc 2010-07-22 21:40:30.680424001 +0400 @@ -133,7 +133,7 @@ if (vio != 0) /* If real connection */ { net->fd = vio_fd(vio); /* For perl DBI/DBD */ -#if defined(MYSQL_SERVER) && !defined(__WIN__) +#if defined(MYSQL_SERVER) && !defined(__WIN__) && !defined(NO_ALARM) if (!(test_flags & TEST_BLOCKING)) { my_bool old_mode; @@ -642,7 +642,7 @@ if ((long) (length= vio_write(net->vio,pos,(size_t) (end-pos))) <= 0) { my_bool interrupted = vio_should_retry(net->vio); -#if !defined(__WIN__) +#if !defined(NO_ALARM) && !defined(__WIN__) if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed)) { if (!thr_alarm(&alarmed, net->write_timeout, &alarm_buff)) @@ -680,7 +680,7 @@ my_progname); #endif /* EXTRA_DEBUG */ } -#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) +#if defined(THREAD_SAFE_CLIENT) && defined(NO_ALARM) if (vio_errno(net->vio) == SOCKET_EINTR) { DBUG_PRINT("warning",("Interrupted write. Retrying...")); @@ -698,7 +698,7 @@ pos+=length; update_statistics(thd_increment_bytes_sent(length)); } -#ifndef __WIN__ +#if !defined(NO_ALARM) && !defined(__WIN__) end: #endif #ifdef HAVE_COMPRESS @@ -830,6 +830,7 @@ thr_alarm(&alarmed,net->read_timeout,&alarm_buff); #else /* Read timeout is set in my_net_set_read_timeout */ + DBUG_ASSERT(net_blocking); #endif /* NO_ALARM */ pos = net->buff + net->where_b; /* net->packet -4 */ @@ -844,7 +845,7 @@ DBUG_PRINT("info",("vio_read returned %ld errno: %d", (long) length, vio_errno(net->vio))); -#if !defined(__WIN__) || defined(MYSQL_SERVER) +#if !defined(NO_ALARM) && (!defined(__WIN__) || defined(MYSQL_SERVER)) /* We got an error that there was no data on the socket. We now set up an alarm to not 'read forever', change the socket to non blocking @@ -891,7 +892,7 @@ my_progname,vio_errno(net->vio)); #endif /* EXTRA_DEBUG */ } -#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) +#if defined(THREAD_SAFE_CLIENT) && defined(NO_ALARM) if (vio_errno(net->vio) == SOCKET_EINTR) { DBUG_PRINT("warning",("Interrupted read. Retrying..."));