From: Date: April 27 2005 8:56pm Subject: bk commit into 4.1 tree (jimw:1.2169) BUG#9712 List-Archive: http://lists.mysql.com/internals/24397 X-Bug: 9712 Message-Id: <20050427185653.E9677A85A1@rama.trainedmonkey.com> Below is the list of changes that have just been committed into a local 4.1 repository of jimw. When jimw does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2169 05/04/27 11:56:50 jimw@stripped +2 -0 Add workaround for problems with non-blocking I/O using O_NONBLOCK on certain platforms. (Bug #9712) vio/viosocket.c 1.29 05/04/27 11:56:47 jimw@stripped +13 -7 Allow the use of O_NDELAY instead of O_NONBLOCK on platforms where O_NDELAY works as expected but O_NONBLOCK does not. configure.in 1.358 05/04/27 11:56:47 jimw@stripped +9 -3 Force use of O_NDELAY instead of O_NONBLOCK on some problematic platforms. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: jimw # Host: rama.(none) # Root: /home/jimw/my/mysql-4.1-9712 --- 1.357/configure.in 2005-04-01 08:56:42 -08:00 +++ 1.358/configure.in 2005-04-27 11:56:47 -07:00 @@ -1094,7 +1094,7 @@ # don't forget to escape [] like above if test "$ac_cv_prog_gcc" = "yes" then - FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT" + FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DFORCE_NDELAY" CFLAGS="$CFLAGS $FLAGS" CXXFLAGS="$CXXFLAGS $FLAGS" MAX_C_OPTIMIZE="-O" @@ -1131,12 +1131,18 @@ echo "Using --with-named-thread=-lpthread" with_named_thread="-lpthread" fi - CXXFLAGS="$CXXFLAGS -D_BOOL" + CFLAGS="$CFLAGS -DFORCE_NDELAY" + CXXFLAGS="$CXXFLAGS -D_BOOL -DFORCE_NDELAY" ;; *aix4.3*) - echo "Adding defines for AIX" + echo "Adding defines for AIX 4.3" CFLAGS="$CFLAGS -Wa,-many -DUNDEF_HAVE_INITGROUPS -DSIGNALS_DONT_BREAK_READ" CXXFLAGS="$CXXFLAGS -Wa,-many -DUNDEF_HAVE_INITGROUPS -DSIGNALS_DONT_BREAK_READ" + ;; + *aix5*) + echo "Adding defines for AIX 5" + CFLAGS="$CFLAGS -DFORCE_NDELAY" + CXXFLAGS="$CXXFLAGS -DFORCE_NDELAY" ;; dnl Is this the right match for DEC OSF on alpha? *dec-osf*) --- 1.28/vio/viosocket.c 2005-02-15 04:43:25 -08:00 +++ 1.29/vio/viosocket.c 2005-04-27 11:56:47 -07:00 @@ -72,13 +72,19 @@ DBUG_RETURN(r); } +#ifdef FORCE_NDELAY +# define MY_NONBLOCK O_NDELAY +#else +# define MY_NONBLOCK O_NONBLOCK +#endif + int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode, my_bool *old_mode) { int r=0; DBUG_ENTER("vio_blocking"); - *old_mode= test(!(vio->fcntl_mode & O_NONBLOCK)); + *old_mode= test(!(vio->fcntl_mode & MY_NONBLOCK)); DBUG_PRINT("enter", ("set_blocking_mode: %d old_mode: %d", (int) set_blocking_mode, (int) *old_mode)); @@ -88,9 +94,9 @@ { int old_fcntl=vio->fcntl_mode; if (set_blocking_mode) - vio->fcntl_mode &= ~O_NONBLOCK; /* clear bit */ + vio->fcntl_mode &= ~MY_NONBLOCK; /* clear bit */ else - vio->fcntl_mode |= O_NONBLOCK; /* set bit */ + vio->fcntl_mode |= MY_NONBLOCK; /* set bit */ if (old_fcntl != vio->fcntl_mode) r = fcntl(vio->sd, F_SETFL, vio->fcntl_mode); } @@ -107,19 +113,19 @@ if (set_blocking_mode) { arg = 0; - vio->fcntl_mode &= ~O_NONBLOCK; /* clear bit */ + vio->fcntl_mode &= ~MY_NONBLOCK; /* clear bit */ } else { arg = 1; - vio->fcntl_mode |= O_NONBLOCK; /* set bit */ + vio->fcntl_mode |= MY_NONBLOCK; /* set bit */ } if (old_fcntl != vio->fcntl_mode) r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg)); } #ifndef __EMX__ else - r= test(!(vio->fcntl_mode & O_NONBLOCK)) != set_blocking_mode; + r= test(!(vio->fcntl_mode & MY_NONBLOCK)) != set_blocking_mode; #endif /* __EMX__ */ #endif /* !defined(__WIN__) && !defined(__EMX__) */ DBUG_PRINT("exit", ("%d", r)); @@ -131,7 +137,7 @@ { my_bool r; DBUG_ENTER("vio_is_blocking"); - r = !(vio->fcntl_mode & O_NONBLOCK); + r = !(vio->fcntl_mode & MY_NONBLOCK); DBUG_PRINT("exit", ("%d", (int) r)); DBUG_RETURN(r); }