List:Internals« Previous MessageNext Message »
From:jwythe Date:April 16 2005 9:15pm
Subject:bk commit into 4.0 tree (jww:1.1659)
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 repository of jww. When jww 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.1659 05/04/16 12:15:34 jww@stripped +20 -0
  Merge

  support-files/Makefile.am
    1.24 05/04/16 12:15:18 jww@stripped +1 -1
    Manual merge completion.

  sql/mysqld.cc
    1.465 05/04/16 12:14:16 jww@stripped +0 -0
    SCCS merged

  scripts/mysqld_safe.sh
    1.72 05/04/16 12:11:00 jww@stripped +1 -1
    Manual merge completion.

  scripts/mysql_install_db.sh
    1.43 05/04/16 12:10:16 jww@stripped +17 -10
    Manual merge completion.

  scripts/make_binary_distribution.sh
    1.63 05/04/16 11:58:39 jww@stripped +1 -1
    Manual merge completion.

  Docs/Makefile.am
    1.54 05/04/16 11:49:01 jww@stripped +2 -2
    Manual merge completion.

  configure.in
    1.292 05/04/16 11:34:39 jww@stripped +2 -4
    Manual merge completion.

  Makefile.am
    1.61 05/04/16 11:22:06 jww@stripped +3 -2
    Manual merge completion.

  sql/Makefile.am
    1.81 05/04/16 03:38:24 jww@stripped +0 -0
    Auto merged

  scripts/Makefile.am
    1.32 05/04/16 03:38:24 jww@stripped +0 -0
    Auto merged

  mysys/my_pthread.c
    1.40 05/04/16 03:38:24 jww@stripped +0 -0
    Auto merged

  libmysqld/Makefile.am
    1.26 05/04/16 03:38:24 jww@stripped +0 -0
    Auto merged

  libmysql_r/Makefile.am
    1.13 05/04/16 03:38:24 jww@stripped +0 -0
    Auto merged

  libmysql/Makefile.shared
    1.36 05/04/16 03:38:24 jww@stripped +0 -0
    Auto merged

  libmysql/Makefile.am
    1.38 05/04/16 03:38:24 jww@stripped +0 -0
    Auto merged

  include/Makefile.am
    1.42 05/04/16 03:38:24 jww@stripped +0 -0
    Auto merged

  ltmain.sh
    1.14 05/04/16 03:38:23 jww@stripped +0 -0
    Auto merged

  acinclude.m4
    1.92 05/04/16 03:38:23 jww@stripped +0 -0
    Auto merged

  BitKeeper/etc/logging_ok
    1.288 05/04/16 03:34:57 jww@stripped +0 -0
    auto-union

  BitKeeper/etc/ignore
    1.168 05/04/16 03:34:57 jww@stripped +3 -3
    auto-union

# 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:	jww
# Host:	lnxdev.silk.ca
# Root:	/usr/src/mysql/mysql-4.0/RESYNC

--- 1.53/Docs/Makefile.am	2004-02-15 00:55:28 -08:00
+++ 1.54/Docs/Makefile.am	2005-04-16 11:49:01 -07:00
@@ -9,210 +9,18 @@
 # If you know how to fix any of this more elegantly please mail
 # docs@stripped
 
-TEXI2HTML_FLAGS =	-iso -number
-DVIPS =			dvips
-MAKEINFO =		@MAKEINFO@
 PERL =			@PERLBIN@
-TEXINFO_TEX =		Support/texinfo.tex
+noinst_SCRIPTS =	Support/generate-text-files.pl
 
-noinst_SCRIPTS =	Support/texi2html Support/generate-text-files.pl \
-			Support/generate-mirror-listing.pl
-info_TEXINFOS =		manual.texi
+EXTRA_DIST =		$(noinst_SCRIPTS) mysql.info INSTALL-BINARY
 
-targets =		manual.txt mysql.info manual.html
+all:			txt_files
 
-build_sources =		$(targets) manual_toc.html include.texi
-EXTRA_DIST =		$(noinst_SCRIPTS) mysqld_error.txt \
-			reservedwords.texi 
-
-all:			$(targets) txt_files
-
-txt_files:		../INSTALL-SOURCE ../COPYING \
+txt_files:		../INSTALL-SOURCE ../COPYING ../EXCEPTIONS-CLIENT \
 			../INSTALL-BINARY ../support-files/MacOSX/ReadMe.txt
 
-CLEAN_FILES:		$(build_sources)
-	touch $(build_sources)
-
-# The PostScript and PDF version are so big that they are not included in the
-# standard distribution. It is available for download from the home page.  
-paper: manual_a4.ps manual_letter.ps  $(PDFMANUAL)
-
-#########################################################################
-
-# The Makefile contains the previous version so we can not use that
-include.texi:	$(top_srcdir)/configure.in
-	echo "@c This file is autogenerated by the Makefile" > $@
-	echo -n "@set mysqlversion " >> $@
-	grep "AM_INIT_AUTOMAKE(mysql, " $(top_srcdir)/configure.in | \
-	 sed -e 's;AM_INIT_AUTOMAKE(mysql, ;;' -e 's;);;' >> $@
-	echo -n "@set defaultport " >> $@
-	grep "MYSQL_TCP_PORT_DEFAULT=" $(top_srcdir)/configure.in | \
-	 sed -e 's;MYSQL_TCP_PORT_DEFAULT=;;' >> $@
-	echo -n "@set mysql_prefix $(prefix)" >> $@
-
-
-#
-# English Manual
-#
-
-# GNU Info
-mysql.info:	manual.texi include.texi
-	@if test ! -d Flags; \
-	then \
-		ln -fs $(srcdir)/Flags .; \
-	fi;
-	$(MAKEINFO) --no-split -I $(srcdir) --output $@ $<
-
-# Plain Text
-manual.txt:	manual.texi include.texi
-	@if test ! -d Flags; \
-	then \
-		ln -fs $(srcdir)/Flags .; \
-	fi;
-	$(MAKEINFO) -I $(srcdir) --no-headers --no-split --output $@ $<
-
-# HTML, all in one file
-manual.html:	manual.texi include.texi $(srcdir)/Support/texi2html
-	@if test ! -d Flags; \
-	then \
-		ln -fs $(srcdir)/Flags .; \
-	fi;
-	$(PERL) $(srcdir)/Support/texi2html $(TEXI2HTML_FLAGS) $<
-manual_toc.html: manual.html
-
-# PDF, Portable Document Format
-manual.pdf: manual.texi
-	sed -e 's|@image{[^}]*} *||g' <$< >manual-tmp.texi
-	pdftex --interaction=nonstopmode manual-tmp.texi
-	texindex manual-tmp.??
-	pdftex --interaction=nonstopmode manual-tmp.texi
-	texindex manual-tmp.??
-	pdftex --interaction=nonstopmode manual-tmp.texi
-	mv manual-tmp.pdf $@
-	rm -f manual-tmp.*
-	touch $@
-
-# XML, DocBook 4.0
-mysql.xml: manual.texi include.texi
-	$(MAKEINFO) --force --no-ifinfo --docbook $<
-	mv $@ mysql-tmp.xml
-	Support/docbook-fixup.pl <mysql-tmp.xml >$@
-	rm -f mysql-tmp.xml
-
-# Postscript, A4 Paper
-manual_a4.ps:	manual.texi include.texi
-	TEXINPUTS=$(srcdir):$$TEXINPUTS \
-	  MAKEINFO='$(MAKEINFO) -I $(srcdir)' \
-	    $(TEXI2DVI) --batch --texinfo --quiet '@afourpaper' $<
-	$(DVIPS) -t a4 manual.dvi -o $@
-	touch $@
-
-# Postscript, US Letter Paper
-manual_letter.ps:	manual.texi include.texi
-	TEXINPUTS=$(srcdir):$$TEXINPUTS \
-	  MAKEINFO='$(MAKEINFO) -I $(srcdir)' \
-	    $(TEXI2DVI) --batch $<
-	$(DVIPS) -t letter manual.dvi -o $@
-	touch $@
-
-
-#
-# German Manual
-#
-
-# GNU Info
-mysql.de.info:	manual.de.texi include.texi
-	@if test ! -d Flags; \
-	then \
-		ln -fs $(srcdir)/Flags .; \
-	fi;
-	$(MAKEINFO) --no-split -I $(srcdir) --output $@ $<
-
-# Plain Text
-manual.de.txt:	manual.de.texi include.texi
-	@if test ! -d Flags; \
-	then \
-		ln -fs $(srcdir)/Flags .; \
-	fi;
-	$(MAKEINFO) -I $(srcdir) --no-headers --no-split --output $@ $<
-
-# HTML, all in one file
-manual.de.html:	manual.de.texi include.texi $(srcdir)/Support/texi2html
-	@if test ! -d Flags; \
-	then \
-		ln -fs $(srcdir)/Flags .; \
-	fi;
-	@PERL@ $(srcdir)/Support/texi2html $(TEXI2HTML_FLAGS) $<
-manual_toc.de.html: manual.html
-
-# PDF, Portable Document Format
-manual.de.pdf: manual.de.texi
-	sed -e 's|@image{[^}]*} *||g' <$< >manual-tmp.texi
-	pdftex --interaction=nonstopmode manual-tmp.texi
-	texindex manual-tmp.??
-	pdftex --interaction=nonstopmode manual-tmp.texi
-	texindex manual-tmp.??
-	pdftex --interaction=nonstopmode manual-tmp.texi
-	mv manual-tmp.pdf $@
-	rm -f manual-tmp.*
-	touch $@
-
-# XML, DocBook 4.0
-mysql.de.xml: manual.de.texi include.texi
-	$(MAKEINFO) --force --no-ifinfo --docbook $<
-	mv $@ mysql-tmp.xml
-	Support/docbook-fixup.pl <mysql-tmp.xml >$@
-	rm -f mysql-tmp.xml
-
-# Postscript, A4 Paper
-manual_a4.de.ps:	manual.de.texi include.texi
-	TEXINPUTS=$(srcdir):$$TEXINPUTS \
-	  MAKEINFO='$(MAKEINFO) -I $(srcdir)' \
-	    $(TEXI2DVI) --batch --texinfo --quiet '@afourpaper' $<
-	$(DVIPS) -t a4 manual.de.dvi -o $@
-	touch $@
-
-# Postscript, US Letter Paper
-manual_letter.de.ps:	manual.de.texi include.texi
-	TEXINPUTS=$(srcdir):$$TEXINPUTS \
-	  MAKEINFO='$(MAKEINFO) -I $(srcdir)' \
-	    $(TEXI2DVI) --batch $<
-	$(DVIPS) -t letter manual.de.dvi -o $@
-	touch $@
-
-
-#
-# Miscellaneous
-#
-
-# Target to produce NuSphere Manual
-nusphere.pdf: manual.texi
-	sed -e 's/@example/@smallexample/g' \
-	    -e 's/@end example/@end smallexample/g' \
-	    -e 's/@c ifnusphere //g' \
-	    -e 's|@image{[^}]*} *||g' \
-	<$< >manual-tmp.texi
-	pdftex --interaction=nonstopmode manual-tmp.texi
-	texindex manual-tmp.??
-	pdftex --interaction=nonstopmode manual-tmp.texi
-	texindex manual-tmp.??
-	pdftex --interaction=nonstopmode manual-tmp.texi
-	mv manual-tmp.pdf $@
-	rm -f manual-tmp.*
-	touch $@
-
-# Include images for the manual in the distribution
-dist-hook:
-	BD=`cd $(top_srcdir); pwd`; \
-	if test ! -d $(distdir)/Flags; then mkdir -p $(distdir)/Flags; fi; \
-	$(INSTALL_DATA) $(srcdir)/Flags/*.gif $(srcdir)/Flags/*.eps \
-		$(srcdir)/Flags/*.txt $(distdir)/Flags;
-	echo "PostScript and PDF versions suitable for printing" \
-		> $(distdir)/manual.ps
-	echo "are available from http://www.mysql.com/Manual/" \
-		>> $(distdir)/manual.ps
-	echo "or any mirror site" \
-		>> $(distdir)/manual.ps
+CLEAN_FILES:		$(txt_files)
+	touch $(txt_files)
 
 GT = $(srcdir)/Support/generate-text-files.pl
 
@@ -227,9 +35,9 @@
 	if test ! -f mysql.info; then d="$(srcdir)/"; else d=;fi;\
 	$(PERL) -w $(GT) $${d}mysql.info "Installing binary" "Installing source" > $@
 
-../COPYING:		mysql.info $(GT)
+../EXCEPTIONS-CLIENT: mysql.info $(GT)
 	if test ! -f mysql.info; then d="$(srcdir)/"; else d=;fi;\
-	$(PERL) -w $(GT) $${d}mysql.info "GPL license" "LGPL license" > $@
+	$(PERL) -w $(GT) $${d}mysql.info "MySQL FLOSS License Exception" "Function Index" >
$@
 
 ../support-files/MacOSX/ReadMe.txt:	mysql.info $(GT)
 	if test ! -f mysql.info; then d="$(srcdir)/"; else d=;fi;\

--- 1.60/Makefile.am	2004-02-18 22:15:45 -08:00
+++ 1.61/Makefile.am	2005-04-16 11:22:06 -07:00
@@ -19,11 +19,13 @@
 AUTOMAKE_OPTIONS =	foreign
 
 # These are built from source in the Docs directory
-BUILT_SOURCES =		INSTALL-SOURCE README COPYING INSTALL-BINARY
+BUILT_SOURCES =		INSTALL-SOURCE README COPYING \
+	INSTALL-BINARY EXCEPTIONS-CLIENT
+#EXTRA_DIST =		INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT
 SUBDIRS =		. include @docs_dirs@ @readline_dir@ \
 			@thread_dirs@ pstack @sql_client_dirs@ \
-			@sql_server_dirs@ scripts man tests \
-			BUILD @netware_dir@ os2 @libmysqld_dirs@ \
+			@sql_server_dirs@ scripts @man_dirs@ tests \
+			BUILD netware os2 @libmysqld_dirs@ \
 			@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
 
 EXTRA_DIST = @extra_sql_client_dirs@ @extra_sql_server_dirs@ \

--- 1.91/acinclude.m4	2003-12-11 11:00:31 -08:00
+++ 1.92/acinclude.m4	2005-04-16 03:38:23 -07:00
@@ -754,14 +754,15 @@
     ---)
       for d in /usr/ssl/include /usr/local/ssl/include /usr/include \
 /usr/include/ssl /opt/ssl/include /opt/openssl/include \
-/usr/local/ssl/include /usr/local/include ; do
+/usr/local/ssl/include /usr/local/include /usr/freeware/include ; do
        if test -f $d/openssl/ssl.h  ; then
          OPENSSL_INCLUDE=-I$d
        fi
       done
 
       for d in /usr/ssl/lib /usr/local/ssl/lib /usr/lib/openssl \
-/usr/lib /usr/lib64 /opt/ssl/lib /opt/openssl/lib /usr/local/lib/ ; do
+/usr/lib /usr/lib64 /opt/ssl/lib /opt/openssl/lib \
+/usr/freeware/lib32 /usr/local/lib/ ; do
       if test -f $d/libssl.a || test -f $d/libssl.so || test -f $d/libssl.dylib ; then
         OPENSSL_LIB=$d
       fi
@@ -804,7 +805,7 @@
 AC_DEFUN(MYSQL_CHECK_OPENSSL, [
 AC_MSG_CHECKING(for OpenSSL)
   AC_ARG_WITH([openssl],
-              [  --with-openssl          Include the OpenSSL support],
+              [  --with-openssl[=DIR]    Include the OpenSSL support],
               [openssl="$withval"],
               [openssl=no])
 
@@ -822,8 +823,19 @@
               [openssl_libs="$withval"],
               [openssl_libs=""])
 
-  if test "$openssl" = "yes"
+  if test "$openssl" != "no"
   then
+	if test "$openssl" != "yes"
+	then
+		if test -z "$openssl_includes" 
+		then
+			openssl_includes="$openssl/include"
+		fi
+		if test -z "$openssl_libs" 
+		then
+			openssl_libs="$openssl/lib"
+		fi
+	fi
     MYSQL_FIND_OPENSSL([$openssl_includes], [$openssl_libs])
     #force VIO use
     vio_dir="vio"
@@ -859,12 +871,48 @@
     NON_THREADED_CLIENT_LIBS="$NON_THREADED_CLIENT_LIBS $openssl_libs"
   else
     AC_MSG_RESULT(no)
+	if test ! -z "$openssl_includes"
+	then
+		AC_MSG_ERROR(Can't have --with-openssl-includes without --with-openssl);
+	fi
+	if test ! -z "$openssl_libs"
+	then
+		AC_MSG_ERROR(Can't have --with-openssl-libs without --with-openssl);
+	fi
   fi
   AC_SUBST(openssl_libs)
   AC_SUBST(openssl_includes)
 ])
 
 
+dnl ---------------------------------------------------------------------------
+dnl Macro: MYSQL_CHECK_BIG_TABLES
+dnl Sets BIG_TABLES if --with-big-tables is used
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([MYSQL_CHECK_BIG_TABLES], [
+  AC_ARG_WITH([big-tables],
+              [
+  --with-big-tables       Support tables with more than 4 G rows even on 32 bit
platforms],
+              [bigtables="$withval"],
+              [bigtables=no])
+  AC_MSG_CHECKING([for big tables support])
+
+  case "$bigtables" in
+    yes )
+      AC_DEFINE([BIG_TABLES], [1], [Support big tables])
+      AC_MSG_RESULT([yes])
+      ;;
+    * )
+      AC_MSG_RESULT([no])
+      ;;
+  esac
+
+])
+dnl ---------------------------------------------------------------------------
+dnl END OF MYSQL_CHECK_BIG_TABLES SECTION
+dnl ---------------------------------------------------------------------------
+
+
 AC_DEFUN(MYSQL_CHECK_MYSQLFS, [
   AC_ARG_WITH([mysqlfs],
               [
@@ -1224,7 +1272,6 @@
 dnl circular references.
       innodb_libs="\
  \$(top_builddir)/innobase/usr/libusr.a\
- \$(top_builddir)/innobase/odbc/libodbc.a\
  \$(top_builddir)/innobase/srv/libsrv.a\
  \$(top_builddir)/innobase/dict/libdict.a\
  \$(top_builddir)/innobase/que/libque.a\
@@ -1248,7 +1295,6 @@
  \$(top_builddir)/innobase/page/libpage.a\
  \$(top_builddir)/innobase/rem/librem.a\
  \$(top_builddir)/innobase/thr/libthr.a\
- \$(top_builddir)/innobase/com/libcom.a\
  \$(top_builddir)/innobase/sync/libsync.a\
  \$(top_builddir)/innobase/data/libdata.a\
  \$(top_builddir)/innobase/mach/libmach.a\

--- 1.291/configure.in	2004-02-15 00:55:18 -08:00
+++ 1.292/configure.in	2005-04-16 11:34:39 -07:00
@@ -4,7 +4,7 @@
 AC_INIT(sql/mysqld.cc)
 AC_CANONICAL_SYSTEM
 # The Docs Makefile.am parses this line!
-AM_INIT_AUTOMAKE(mysql, 4.0.18)
+AM_INIT_AUTOMAKE(mysql, 4.0.25)
 AM_CONFIG_HEADER(config.h)
 
 # Handle prefix and suffix with in script files
@@ -55,13 +55,13 @@
     netware* | modesto*)
 		echo "$i/errmsg.sys: $i/errmsg.txt
 		if test ! -d $i; then mkdir $i; fi; \
-		\$(top_builddir)/extra/comp_err.linux \$^ $i/errmsg.sys" \
+		\$(top_builddir)/extra/comp_err.linux $i/errmsg.sys" \
 			>> $AVAILABLE_LANGUAGES_ERRORS_RULES
       ;;
     *)
 		echo "$i/errmsg.sys: $i/errmsg.txt
 		if test ! -d $i; then mkdir $i; fi; \
-		\$(top_builddir)/extra/comp_err \$^ $i/errmsg.sys" \
+		\$(top_builddir)/extra/comp_err $i/errmsg.sys" \
 			>> $AVAILABLE_LANGUAGES_ERRORS_RULES
       ;;
   esac
@@ -144,8 +144,10 @@
 
 # The following hack should ensure that configure doesn't add optimizing
 # or debugging flags to CFLAGS or CXXFLAGS
-CFLAGS="$CFLAGS "
-CXXFLAGS="$CXXFLAGS "
+# C_EXTRA_FLAGS are flags that are automaticly added to both
+# CFLAGS and CXXFLAGS
+CFLAGS="$CFLAGS $C_EXTRA_FLAGS "
+CXXFLAGS="$CXXFLAGS $C_EXTRA_FLAGS "
 
 dnl Checks for programs.
 AC_PROG_AWK
@@ -210,6 +212,11 @@
 #AC_LIBTOOL_WIN32_DLL
 AC_PROG_LIBTOOL
 
+# Ensure that we have --preserve-dup-deps defines, otherwise we get link
+# problems of 'mysql' with CXX=g++
+LIBTOOL="$LIBTOOL --preserve-dup-deps"
+AC_SUBST(LIBTOOL)dnl
+
 #AC_LIBTOOL_DLOPEN AC_LIBTOOL_WIN32_DLL AC_DISABLE_FAST_INSTALL AC_DISABLE_SHARED
AC_DISABLE_STATIC
 
 # AC_PROG_INSTALL
@@ -461,7 +468,7 @@
 then
   FIND_PROC="$PS p \$\$PID | grep ${program_prefix_}mysqld${program_suffix_} >
/dev/null"
 # Solaris
-elif $PS -p $$ 2> /dev/null | grep $0 > /dev/null
+elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
 then
   FIND_PROC="$PS -p \$\$PID | grep ${program_prefix_}mysqld${program_suffix_} >
/dev/null"
 # BSD style
@@ -792,7 +799,14 @@
 AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4, sem_init))
 
 # For compress in zlib
-MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib)
+case $SYSTEM_TYPE in
+  *netware* | *modesto*)
+    AC_DEFINE(HAVE_COMPRESS)
+    ;;
+  *)
+    MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib)
+    ;;
+esac
 
 #--------------------------------------------------------------------
 # Check for TCP wrapper support
@@ -954,6 +968,16 @@
 MAX_C_OPTIMIZE="-O3"
 MAX_CXX_OPTIMIZE="-O3"
 
+# workaround for Sun Forte/x86 see BUG#4681
+case $SYSTEM_TYPE-$MACHINE_TYPE-$ac_cv_prog_gcc in
+  *solaris*-i?86-no)
+    CFLAGS="$CFLAGS -DBIG_TABLES"
+    CXXFLAGS="$CXXFLAGS -DBIG_TABLES"
+    ;;
+  *) ;;
+esac
+
+
 case $SYSTEM_TYPE in
   *solaris2.7*)
     # Solaris 2.7 has a broken /usr/include/widec.h
@@ -1039,7 +1063,7 @@
   *darwin5*)
     if test "$ac_cv_prog_gcc" = "yes"
     then
-      FLAGS="-traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE
-DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH
-DFN_NO_CASE_SENCE"
+      FLAGS="-traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE
-DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
       CFLAGS="$CFLAGS $FLAGS"
       CXXFLAGS="$CXXFLAGS $FLAGS"
       MAX_C_OPTIMIZE="-O"
@@ -1049,7 +1073,17 @@
   *darwin6*)
     if test "$ac_cv_prog_gcc" = "yes"
     then
-      FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE
-DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DFN_NO_CASE_SENCE"
+      FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE
-DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
+      CFLAGS="$CFLAGS $FLAGS"
+      CXXFLAGS="$CXXFLAGS $FLAGS"
+      MAX_C_OPTIMIZE="-O"
+    fi
+    ;;
+  *darwin[[7-8]]*)
+    # 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"
       CFLAGS="$CFLAGS $FLAGS"
       CXXFLAGS="$CXXFLAGS $FLAGS"
       MAX_C_OPTIMIZE="-O"
@@ -1137,8 +1171,8 @@
           # Add library dependencies to mysqld_DEPENDENCIES
           lib_DEPENDENCIES="\$(bdb_libs_with_path) \$(innodb_libs) \$(pstack_libs)
\$(innodb_system_libs) \$(openssl_libs)"
           cat > $filesed << EOF
-s,\(^.*\$(MAKE) gen_lex_hash\),#\1,
-s,\(\./gen_lex_hash\),\1.linux,
+s,\(^.*\$(MAKE) gen_lex_hash\)\$(EXEEXT),#\1,
+s,\(\./gen_lex_hash\)\$(EXEEXT),\1.linux,
 s%\(mysqld_DEPENDENCIES = \) %\1$lib_DEPENDENCIES %
 EOF
           ;;
@@ -1293,6 +1327,7 @@
           mkdir ./include
       fi
       touch ./include/sched.h
+      touch ./include/semaphore.h
 
       # We must have gcc
       if expr "$CC" : ".*gcc.*" >/dev/null 2>&1
@@ -1637,12 +1672,12 @@
 then
   # Medium debug.
   CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS"
-  CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
+  CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DDBUG_ON -DSAFE_MUTEX $CXXFLAGS"
 elif test "$with_debug" = "full"
 then
   # Full debug. Very slow in some cases
   CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
-  CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
+  CXXFLAGS="$DEBUG_CXXFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
 else
   # Optimized version. No debug
   CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS"
@@ -2205,6 +2240,21 @@
 fi
 AC_SUBST(docs_dirs)
 
+# Shall we build the man pages?
+AC_ARG_WITH(man,
+    [  --without-man          Skip building of the man pages.],
+    [with_man=$withval],
+    [with_man=yes]
+)
+
+if test "$with_man" = "yes"
+then
+  man_dirs="man"
+else
+  man_dirs=""
+fi
+AC_SUBST(man_dirs)
+
 # Shall we build the bench code?
 AC_ARG_WITH(bench,
     [  --without-bench         Skip building of the benchmark suite.],
@@ -2286,9 +2336,11 @@
   CHARSETS=`/bin/ls -1 $srcdir/strings/ctype-*.c | \
                   sed -e 's;^.*/ctype-;;' -e 's;.c$;;'`
   CHARSETS=`echo $CHARSETS`     # get rid of line breaks
+  AC_DEFINE([DEFINE_ALL_CHARACTER_SETS])
 else
   if test "$extra_charsets" = all; then
     CHARSETS="$CHARSETS_AVAILABLE $CHARSETS_DEPRECATED"
+    AC_DEFINE([DEFINE_ALL_CHARACTER_SETS])
   else
     CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'`
   fi
@@ -2489,6 +2541,7 @@
 AC_MSG_RESULT([default: $default_charset; compiled in: $CHARSETS])
 
 
+MYSQL_CHECK_BIG_TABLES
 MYSQL_CHECK_ISAM
 MYSQL_CHECK_BDB
 MYSQL_CHECK_INNODB
@@ -2534,6 +2587,10 @@
 fi
 AC_SUBST(netware_dir)
 AC_SUBST(linked_netware_sources)
+AM_CONDITIONAL(HAVE_NETWARE, test "$netware_dir" = "netware")
+
+# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
+export CC CXX CFLAGS CXXFLAGS LD LDFLAGS AR
 
 if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no"
 then
@@ -2797,6 +2854,7 @@
  include/Makefile sql-bench/Makefile tools/Makefile dnl
  tests/Makefile Docs/Makefile support-files/Makefile dnl
  support-files/MacOSX/Makefile mysql-test/Makefile dnl
+ netware/Makefile dnl
  include/mysql_version.h dnl
  , , [
   test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h

--- 1.41/include/Makefile.am	2003-05-12 15:20:25 -07:00
+++ 1.42/include/Makefile.am	2005-04-16 03:38:24 -07:00
@@ -25,7 +25,7 @@
 noinst_HEADERS =	config-win.h config-os2.h config-netware.h \
 			nisam.h heap.h merge.h my_bitmap.h\
 			myisam.h myisampack.h myisammrg.h ft_global.h\
-			mysys_err.h my_base.h \
+			mysys_err.h my_base.h help_start.h help_end.h \
 			my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
 			my_aes.h my_tree.h hash.h thr_alarm.h \
 			thr_lock.h t_ctype.h violite.h md5.h mysql_version.h.in \

--- 1.37/libmysql/Makefile.am	2004-02-18 22:18:04 -08:00
+++ 1.38/libmysql/Makefile.am	2005-04-16 03:38:24 -07:00
@@ -1,9 +1,12 @@
-# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+# Copyright (C) 2000-2004 MySQL AB
 # 
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 GNU General Public License as
+# published by the Free Software Foundation.
+#
+# There are special exceptions to the terms and conditions of the GPL as it
+# is applied to this software. View the full text of the exception in file
+# EXCEPTIONS-CLIENT in the directory of this software distribution.
 # 
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,7 +17,7 @@
 # License along with this library; if not, write to the Free
 # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 # MA 02111-1307, USA
-
+#
 # This file is public domain and comes with NO WARRANTY of any kind
 
 target =	libmysqlclient.la
@@ -28,7 +31,7 @@
 libmysqlclient_la_SOURCES = $(target_sources)
 libmysqlclient_la_LIBADD = $(target_libadd)
 libmysqlclient_la_LDFLAGS = $(target_ldflags)
-EXTRA_DIST = Makefile.shared
+EXTRA_DIST = Makefile.shared libmysql.def
 
 # This is called from the toplevel makefile
 link_sources:

--- 1.13/ltmain.sh	2004-02-15 01:55:34 -08:00
+++ 1.14/ltmain.sh	2005-04-16 03:38:23 -07:00
@@ -48,6 +48,12 @@
   exit 0
 fi
 
+# libtool 1.4.2 workaround
+SED=${SED:-sed}
+
+# workaround against unset 'max_cmd_len': assume at least 4 kB
+max_cmd_len=${max_cmd_len:-4096}
+
 # The name of this program.
 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
 modename="$progname"

--- 1.39/mysys/my_pthread.c	2003-09-13 01:00:56 -07:00
+++ 1.40/mysys/my_pthread.c	2005-04-16 03:38:24 -07:00
@@ -102,16 +102,20 @@
   NXContext_t ctx;
   char name[PATH_MAX] = "";
 
-  NXThreadGetContext(tid, &ctx);
-  NXContextGetName(ctx, name, PATH_MAX);
-
-  /*
-    "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread"
-    with a debug build of LibC the reaper can have different names
-  */
-  if (!strindex(name, "\'s"))
+  /* Do not call pthread_exit if it is not a LibC thread */
+  if (tid != 0)
   {
-    pthread_exit(status);
+    NXThreadGetContext(tid, &ctx);
+    NXContextGetName(ctx, name, PATH_MAX);
+
+    /*
+      "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread"
+      with a debug build of LibC the reaper can have different names
+    */
+    if (!strindex(name, "\'s"))
+    {
+      pthread_exit(status);
+    }
   }
 }
 #endif

--- 1.31/scripts/Makefile.am	2004-03-02 20:50:03 -08:00
+++ 1.32/scripts/Makefile.am	2005-04-16 03:38:24 -07:00
@@ -33,12 +33,14 @@
 			mysql_explain_log \
 			mysql_tableinfo \
 			mysqld_multi \
-			make_win_src_distribution
+			make_win_src_distribution \
+			make_win_binary_distribution
 
 BUILT_SOURCES = mysqlbug
 EXTRA_SCRIPTS =		make_binary_distribution.sh \
 			make_sharedlib_distribution.sh \
 			make_win_src_distribution.sh \
+			make_win_binary_distribution.sh \
 			msql2mysql.sh \
 			mysql_config.sh \
 			mysql_fix_privilege_tables.sh \

--- 1.62/scripts/make_binary_distribution.sh	2004-03-01 00:14:11 -08:00
+++ 1.63/scripts/make_binary_distribution.sh	2005-04-16 11:58:39 -07:00
@@ -129,8 +129,8 @@
   fi
 done
 
-for i in COPYING README INSTALL-BINARY \
-         MySQLEULA.txt LICENSE.doc README.NW 
+for i in COPYING COPYING.LIB README INSTALL-BINARY \
+         EXCEPTIONS-CLIENT MySQLEULA.txt LICENSE.doc README.NW
 do
   if [ -f $i ]
   then
@@ -195,6 +195,7 @@
 
 if [ $BASE_SYSTEM = "netware" ] ; then
     $CP -r netware/*.pl $BASE/scripts
+    $CP scripts/mysqlhotcopy $BASE/scripts/mysqlhotcopy.pl
 fi
 
 for i in \
@@ -211,7 +212,7 @@
    fi
 done
 
-# convert the libs to .lib for NetWare
+# convert the .a to .lib for NetWare
 if [ $BASE_SYSTEM = "netware" ] ; then
     for i in $BASE/lib/*.a
     do
@@ -266,6 +267,7 @@
 $CP ${top_srcdir}/mysql-test/r/*result ${top_srcdir}/mysql-test/r/*.require
$BASE/mysql-test/r
 
 if [ $BASE_SYSTEM != "netware" ] ; then
+  chmod a+x $BASE/bin/*
   $CP scripts/* $BASE/bin
   $CP scripts/mysql_install scripts/mysql_uninstall $BASE/scripts
   $CP ${top_srcdir}/scripts/mysql_install_bootup.sh $BASE/scripts/mysql_install_bootup
@@ -343,6 +345,16 @@
 
 rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh $BASE/bin/mysql_install_db
$BASE/bin/make_binary_distribution $BASE/bin/setsomevars $BASE/support-files/Makefile*
$BASE/support-files/*.sh $BASE/support-files/Makefile* $BASE/bin/mysql_install
$BASE/bin/mysql_uninstall $BASE/mysql_install_bootup $BASE/bin/mysql_install_bootup
 
+
+#
+# Remove system dependent files
+#
+if [ $BASE_SYSTEM = "netware" ] ; then
+    rm -f $BASE/MySQLEULA.txt
+else
+    rm -f $BASE/README.NW
+fi
+
 # Make safe_mysqld a symlink to mysqld_safe for backwards portability
 # To be removed in MySQL 4.1
 (cd $BASE/bin ; ln -s mysqld_safe safe_mysqld )
@@ -404,29 +416,47 @@
   exit 1
 }
 
-#
-# Create the result tar file
-#
-
-tar=`which_1 gnutar gtar`
-if test "$?" = "1" -o "$tar" = ""
-then
-  tar=tar
-fi
+if [ $BASE_SYSTEM != "netware" ] ; then
 
-echo "Using $tar to create archive"
-cd $TMP
+  #
+  # Create the result tar file
+  #
+  
+  tar=`which_1 gnutar gtar`
+  if test "$?" = "1" -o "$tar" = ""
+  then
+    tar=tar
+  fi
+  
+  echo "Using $tar to create archive"
+  cd $TMP
+  
+  OPT=cvf
+  if [ x$SILENT = x1 ] ; then
+    OPT=cf
+  fi
+  
+  $tar $OPT $SOURCE/$NEW_NAME.tar $NEW_NAME
+  cd $SOURCE
+  echo "Compressing archive"
+  rm -f $NEW_NAME.tar.gz
+  gzip -9 $NEW_NAME.tar
+  echo "Removing temporary directory"
+  rm -r -f $BASE
+  
+  echo "$NEW_NAME.tar.gz created"
+else
 
-OPT=cvf
-if [ x$SILENT = x1 ] ; then
-  OPT=cf
-fi
+  #
+  # Create a zip file for NetWare users
+  #
+
+  cd $TMP
+  if test -e "$SOURCE/$NEW_NAME.zip"; then rm $SOURCE/$NEW_NAME.zip; fi
+  zip -r $SOURCE/$NEW_NAME.zip $NEW_NAME
+  echo "Removing temporary directory"
+  rm -r -f $BASE
 
-$tar $OPT $SOURCE/$NEW_NAME.tar $NEW_NAME
-cd $SOURCE
-echo "Compressing archive"
-gzip -9 $NEW_NAME.tar
-echo "Removing temporary directory"
-rm -r -f $BASE
+  echo "$NEW_NAME.zip created"
 
-echo "$NEW_NAME.tar.gz created"
+fi

--- 1.42/scripts/mysql_install_db.sh	2004-02-15 00:55:32 -08:00
+++ 1.43/scripts/mysql_install_db.sh	2005-04-16 12:10:16 -07:00
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002 MySQL AB
+# Copyright (C) 2002-2004 MySQL AB
 # For a more info consult the file COPYRIGHT distributed with this file.
 
 # This scripts creates the privilege tables db, host, user, tables_priv,
@@ -7,13 +7,15 @@
 #
 # All unrecognized arguments to this script are passed to mysqld.
 
-IN_RPM=0
+in_rpm=0
+windows=0
+defaults=""
+user=""
 case "$1" in
     -IN-RPM)
-      IN_RPM="1"; shift
+      in_rpm="1"; shift
       ;;
 esac
-defaults=
 case "$1" in
     --no-defaults|--defaults-file=*|--defaults-extra-file=*)
       defaults="$1"; shift
@@ -36,8 +38,15 @@
       --force) force=1 ;;
       --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
       --ldata=*|--datadir=*) ldata=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
-      --user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+      --user=*)
+        # Note that the user will be passed to mysqld so that it runs
+        # as 'user' (crucial e.g. if log-bin=/some_other_path/
+        # where a chown of datadir won't help)
+	 user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
       --skip-name-resolve) ip_only=1 ;;
+      --verbose) verbose=1 ;;
+      --rpm) in_rpm=1 ;;
+      --windows) windows=1 ;;
       *)
         if test -n "$pick_args"
         then
@@ -55,6 +64,9 @@
 if test -x ./bin/my_print_defaults
 then
   print_defaults="./bin/my_print_defaults"
+elif test -x ./extra/my_print_defaults
+then
+  print_defaults="./extra/my_print_defaults"
 elif test -x @bindir@/my_print_defaults
 then
   print_defaults="@bindir@/my_print_defaults"
@@ -67,6 +79,7 @@
 
 args=
 ldata=
+pkgdatadir=
 execdir=
 bindir=
 basedir=
@@ -96,29 +109,46 @@
 then
   bindir=@bindir@
 fi
-if test -x "$basedir/libexec/mysqld"
-then
-  execdir="$basedir/libexec"
-elif test -x "@libexecdir@/mysqld"
+if test -z "$execdir"
 then
-  execdir="@libexecdir@"
-elif test -x "`pwd`/bin/mysqld"
+	if test -x "$basedir/libexec/mysqld"
+	then
+		execdir="$basedir/libexec"
+	elif test -x "$basedir/sbin/mysqld"
+	then
+		execdir="$basedir/sbin"
+	elif test -x "`pwd`/bin/mysqld"
+	then
+		execdir="`pwd`/bin"
+	else
+		execdir="$basedir/bin"
+	fi
+fi
+if test -z "$pkgdatadir"
 then
-  execdir="`pwd`/bin"
-else
-  execdir="$basedir/bin"
+  pkgdatadir=@pkgdatadir@
 fi
 
 mdata=$ldata/mysql
+mysqld=$execdir/mysqld
+mysqld_opt=""
+scriptdir=$bindir
+
+if test "$windows" = 1
+then
+  mysqld="./sql/mysqld"
+  mysqld_opt="--language=./sql/share/english"
+  scriptdir="./scripts"
+fi
 
-if test ! -x $execdir/mysqld
+if test ! -x $mysqld
 then
-  if test "$IN_RPM" = "1"
+  if test "$in_rpm" = 1
   then
-    echo "FATAL ERROR $execdir/mysqld not found!"
+    echo "FATAL ERROR $mysqld not found!"
     exit 1
   else
-    echo "Didn't find $execdir/mysqld"
+    echo "Didn't find $mysqld"
     echo "You should do a 'make install' before executing this script"
     exit 1
   fi
@@ -128,15 +158,15 @@
 hostname=`@HOSTNAME@`
 
 # Check if hostname is valid
-if test "$IN_RPM" = "0" -a $force = "0"
+if test "$windows" = 0 -a "$in_rpm" = 0 -a $force = 0
 then
   resolved=`$bindir/resolveip $hostname 2>&1`
   if [ $? -ne 0 ]
   then
     resolved=`$bindir/resolveip localhost 2>&1`
-    if [ $? -eq 0 ]
+    if [ $? -ne 0 ]
     then
-      echo "Neither host '$hostname' and 'localhost' could not be looked up with"
+      echo "Neither host '$hostname' nor 'localhost' could not be looked up with"
       echo "$bindir/resolveip"
       echo "Please configure the 'hostname' command to return a correct hostname."
       echo "If you want to solve this at a later stage, restart this script with"
@@ -270,14 +300,16 @@
   c_u="$c_u )"
   c_u="$c_u comment='Users and global privileges';"
 
-  i_u="INSERT INTO user VALUES
('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
-  INSERT INTO user VALUES
('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
-  
-  REPLACE INTO user VALUES
('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
-  REPLACE INTO user VALUES
('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
-  
-  INSERT INTO user (host,user) values ('localhost','');
-  INSERT INTO user (host,user) values ('$hostname','');"
+  if test "$windows" = 1
+  then
+    i_u="INSERT INTO user VALUES
('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+         INSERT INTO user (host,user) values ('localhost','');"
+  else
+    i_u="INSERT INTO user VALUES
('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+         REPLACE INTO user VALUES
('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
+         INSERT INTO user (host,user) values ('localhost','');
+         REPLACE INTO user (host,user) values ('$hostname','');"
+  fi
 fi
 
 if test ! -f $mdata/func.frm
@@ -302,7 +334,7 @@
   c_t="$c_t   Host char(60) binary DEFAULT '' NOT NULL,"
   c_t="$c_t   Db char(64) binary DEFAULT '' NOT NULL,"
   c_t="$c_t   User char(16) binary DEFAULT '' NOT NULL,"
-  c_t="$c_t   Table_name char(60) binary DEFAULT '' NOT NULL,"
+  c_t="$c_t   Table_name char(64) binary DEFAULT '' NOT NULL,"
   c_t="$c_t   Grantor char(77) DEFAULT '' NOT NULL,"
   c_t="$c_t   Timestamp timestamp(14),"
   c_t="$c_t   Table_priv
set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter')
DEFAULT '' NOT NULL,"
@@ -330,9 +362,14 @@
   c_c="$c_c   comment='Column privileges';"
 fi
 
+if test -n "$user"; then
+  args="$args --user=$user"
+fi
+
 echo "Installing all prepared tables"
-if eval "$execdir/mysqld $defaults --bootstrap --skip-grant-tables \
-         --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args" <<
END_OF_DATA
+if eval "$mysqld $defaults $mysqld_opt --bootstrap --skip-grant-tables \
+         --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb \
+         $args" << END_OF_DATA
 use mysql;
 $c_d
 $i_d
@@ -351,7 +388,7 @@
 END_OF_DATA
 then
   echo ""
-  if test "$IN_RPM" = "0"
+  if test "$in_rpm" = "0"
   then
     echo "To start mysqld at boot time you have to copy support-files/mysql.server"
     echo "to the right place for your system"
@@ -376,7 +413,7 @@
     echo "able to use the new GRANT command!"
   fi
   echo
-  if test "$IN_RPM" = "0"
+  if test "$in_rpm" = "0"
   then
     echo "You can start the MySQL daemon with:"
     echo "cd @prefix@ ; $bindir/mysqld_safe &"

--- 1.71/scripts/mysqld_safe.sh	2004-02-28 00:00:56 -08:00
+++ 1.72/scripts/mysqld_safe.sh	2005-04-16 12:11:00 -07:00
@@ -49,13 +49,7 @@
       --basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e "s;--basedir=;;"` ;;
       --datadir=*) DATADIR=`echo "$arg" | sed -e "s;--datadir=;;"` ;;
       --pid-file=*) pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"` ;;
-      --user=*)
-        if test $SET_USER -eq 0
-        then
-          user=`echo "$arg" | sed -e "s;--[^=]*=;;"`
-        fi
-        SET_USER=1
-        ;;
+      --user=*) user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1 ;;
 
       # these two might have been set in a [mysqld_safe] section of my.cnf
       # they are added to mysqld command line to override settings from my.cnf
@@ -168,6 +162,8 @@
   echo "Please do a cd to the mysql installation directory and restart"
   echo "this script from there as follows:"
   echo "./bin/@PROGRAM_PREFIX@mysqld_safe@PROGRAM_SUFFIX@".
+  echo "See http://dev.mysql.com/doc/mysql/en/mysqld_safe.html for more"
+  echo "information"
   exit 1
 fi
 
@@ -321,34 +317,37 @@
   fi
   if test ! -f $pid_file		# This is removed if normal shutdown
   then
+    echo "STOPPING server from pid file $pid_file"
     break
   fi
 
-  if test @IS_LINUX@ -a $KILL_MYSQLD -eq 1
+  if @IS_LINUX@ && test $KILL_MYSQLD -eq 1
   then
     # Test if one process was hanging.
     # This is only a fix for Linux (running as base 3 mysqld processes)
     # but should work for the rest of the servers.
     # The only thing is ps x => redhat 5 gives warnings when using ps -x.
     # kill -9 is used or the process won't react on the kill.
-    numofproces=`ps xa | grep -v "grep" | grep -c $ledir/$MYSQLD`
+    numofproces=`ps xa | grep -v "grep" | grep "$ledir/$MYSQLD\>" | grep -c
"pid-file=$pid_file"`
+
     echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log
     I=1
     while test "$I" -le "$numofproces"
     do 
-      PROC=`ps xa | grep $ledir/$MYSQLD | grep -v "grep" | sed -n '$p'` 
-	for T in $PROC
-	do
-	  break
-	done
-	#    echo "TEST $I - $T **"
-	if kill -9 $T
-	then
-	  echo "$MYSQLD process hanging, pid $T - killed" | tee -a $err_log
-	else 
-	  break
-	fi
-	I=`expr $I + 1`
+      PROC=`ps xa | grep "$ledir/$MYSQLD\>" | grep -v "grep" | grep
"pid-file=$pid_file" | sed -n '$p'` 
+
+      for T in $PROC
+      do
+        break
+      done
+      #    echo "TEST $I - $T **"
+      if kill -9 $T
+      then
+        echo "$MYSQLD process hanging, pid $T - killed" | tee -a $err_log
+      else 
+        break
+      fi
+      I=`expr $I + 1`
     done
   fi
   echo "`date +'%y%m%d %H:%M:%S'`  $MYSQLD restarted" | tee -a $err_log
@@ -356,3 +355,4 @@
 
 echo "`date +'%y%m%d %H:%M:%S'`  $MYSQLD ended" | tee -a $err_log
 echo "" | tee -a $err_log
+

--- 1.80/sql/Makefile.am	2004-03-03 22:26:46 -08:00
+++ 1.81/sql/Makefile.am	2005-04-16 03:38:24 -07:00
@@ -51,7 +51,7 @@
 			item_create.h mysql_priv.h \
 			procedure.h sql_class.h sql_lex.h sql_list.h \
 			sql_manager.h sql_map.h sql_string.h unireg.h \
-			field.h handler.h \
+			field.h handler.h mysqld_suffix.h \
 			ha_isammrg.h ha_isam.h ha_myisammrg.h\
 			ha_heap.h ha_myisam.h ha_berkeley.h ha_innodb.h \
 			opt_range.h opt_ft.h \
@@ -83,7 +83,7 @@
 			sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
 			slave.cc sql_repl.cc sql_union.cc \
 			mini_client.cc \
-			stacktrace.c repl_failsafe.h repl_failsafe.cc sql_olap.cc
+			stacktrace.c repl_failsafe.h repl_failsafe.cc
 gen_lex_hash_SOURCES =	gen_lex_hash.cc
 gen_lex_hash_LDADD =	$(LDADD) $(CXXLDFLAGS)
 
@@ -112,7 +112,7 @@
 sql_yacc.cc:	sql_yacc.yy
 sql_yacc.h:	sql_yacc.yy sql_yacc.cc
 
-sql_yacc.o:	sql_yacc.cc sql_yacc.h
+sql_yacc.o:	sql_yacc.cc sql_yacc.h $(noinst_HEADERS)
 		@echo "Note: The following compile may take a long time."
 		@echo "If it fails, re-run configure with --with-low-memory"
 		$(CXXCOMPILE) $(LM_CFLAGS) -c $<
@@ -129,8 +129,8 @@
 udf_example.so:	udf_example.cc
 		$(CXXCOMPILE) -shared -o $@ $<
 
-#distclean:
-#		rm -f lex_hash.h
+distclean:
+		rm -f lex_hash.h
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%

--- 1.464/sql/mysqld.cc	2004-02-15 01:57:41 -08:00
+++ 1.465/sql/mysqld.cc	2005-04-16 12:14:16 -07:00
@@ -22,6 +22,7 @@
 #include "sql_repl.h"
 #include "repl_failsafe.h"
 #include "stacktrace.h"
+#include "mysqld_suffix.h"
 #ifdef HAVE_BERKELEY_DB
 #include "ha_berkeley.h"
 #endif
@@ -106,15 +107,6 @@
 int allow_severity = LOG_INFO;
 int deny_severity = LOG_WARNING;
 
-#ifdef __STDC__
-#define my_fromhost(A)	   fromhost(A)
-#define my_hosts_access(A) hosts_access(A)
-#define my_eval_client(A)  eval_client(A)
-#else
-#define my_fromhost(A)	   fromhost()
-#define my_hosts_access(A) hosts_access()
-#define my_eval_client(A)  eval_client()
-#endif
 #endif /* HAVE_LIBWRAP */
 
 #ifdef HAVE_SYS_MMAN_H
@@ -125,11 +117,28 @@
 #include <nks/vm.h>
 #include <library.h>
 #include <monitor.h>
-
+#include <zOmni.h>                              //For NEB
+#include <neb.h>                                //For NEB
+#include <nebpub.h>                             //For NEB
+#include <zEvent.h>                             //For NSS event structures
+#include <zPublics.h>
+
+void *neb_consumer_id=NULL;                     //For storing NEB consumer id
+char datavolname[256]={0};
+VolumeID_t datavolid;
 event_handle_t eh;
 Report_t ref;
+void *refneb=NULL;
+int volumeid=-1;
+
+  /* NEB event callback */
+unsigned long neb_event_callback(struct EventBlock *eblock);
+void registerwithneb();
+void getvolumename();
+void getvolumeID(BYTE *volumeName);
 #endif /* __NETWARE__ */
 
+
 #ifdef _AIX41
 int initgroups(const char *,unsigned int);
 #endif
@@ -189,7 +198,7 @@
 #endif
 
 #ifdef __NT__
-static char szPipeName [ 257 ];
+static char pipe_name[512];
 static SECURITY_ATTRIBUTES saPipeSecurity;
 static SECURITY_DESCRIPTOR sdPipeDescriptor;
 static HANDLE hPipe = INVALID_HANDLE_VALUE;
@@ -202,22 +211,6 @@
 static char **opt_argv;
 #endif
 
-/* Set prefix for windows binary */
-#ifdef __WIN__
-#undef MYSQL_SERVER_SUFFIX
-#ifdef __NT__
-#if defined(HAVE_BERKELEY_DB)
-#define MYSQL_SERVER_SUFFIX "-max-nt"
-#else
-#define MYSQL_SERVER_SUFFIX "-nt"
-#endif /* ...DB */
-#elif defined(HAVE_BERKELEY_DB)
-#define MYSQL_SERVER_SUFFIX "-max"
-#else
-#define MYSQL_SERVER_SUFFIX ""
-#endif /* __NT__ */
-#endif /* __WIN__ */
-
 #ifdef HAVE_BERKELEY_DB
 SHOW_COMP_OPTION have_berkeley_db=SHOW_OPTION_YES;
 #else
@@ -287,8 +280,10 @@
 bool opt_log, opt_update_log, opt_bin_log, opt_slow_log;
 bool opt_error_log= IF_WIN(1,0);
 bool opt_disable_networking=0, opt_skip_show_db=0;
+bool lower_case_table_names_used= 0;
 my_bool opt_enable_named_pipe= 0, opt_debugging= 0;
 my_bool opt_local_infile, opt_external_locking, opt_slave_compressed_protocol;
+my_bool lower_case_file_system= 0;
 uint delay_key_write_options= (uint) DELAY_KEY_WRITE_ON;
 uint lower_case_table_names;
 
@@ -307,7 +302,7 @@
 static my_bool opt_noacl=0, opt_bootstrap=0, opt_myisam_log=0;
 my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
 my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
-my_bool opt_log_slave_updates= 0, opt_console= 0;
+my_bool opt_log_slave_updates= 0, opt_console= 0, opt_allow_suspicious_udfs;
 my_bool opt_readonly = 0, opt_sync_bdb_logs, opt_sync_frm;
 
 volatile bool  mqh_used = 0;
@@ -399,7 +394,7 @@
 ulong select_full_range_join_count,select_full_join_count;
 ulong specialflag=0,opened_tables=0,created_tmp_tables=0,
       created_tmp_disk_tables=0;
-ulong max_connections,max_insert_delayed_threads,max_used_connections,
+ulong max_connections, max_used_connections,
       max_connect_errors, max_user_connections = 0;
 ulong thread_id=1L,current_pid;
 ulong slow_launch_threads = 0;
@@ -410,6 +405,7 @@
      max_sort_char,*mysqld_user,*mysqld_chroot, *opt_init_file;
 char *language_ptr= language;
 char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
+struct passwd *user_info;
 #ifndef EMBEDDED_LIBRARY
 bool mysql_embedded=0;
 #else
@@ -418,7 +414,7 @@
 
 static char *opt_bin_logname = 0;
 char *opt_relay_logname = 0, *opt_relaylog_index_name=0;
-char server_version[SERVER_VERSION_LENGTH]=MYSQL_SERVER_VERSION;
+char server_version[SERVER_VERSION_LENGTH];
 const char *first_keyword="first";
 const char **errmesg;			/* Error messages */
 const char *myisam_recover_options_str="OFF";
@@ -483,6 +479,7 @@
 extern "C" pthread_handler_decl(signal_hand, arg);
 static void set_options(void);
 static void get_options(int argc,char **argv);
+static void set_server_version(void);
 static char *get_relative_path(const char *path);
 static void fix_paths(void);
 extern "C" pthread_handler_decl(handle_connections_sockets,arg);
@@ -580,7 +577,7 @@
     DBUG_PRINT( "quit", ("Closing named pipes") );
      
     /* Create connection to the handle named pipe handler to break the loop */
-    if ((temp = CreateFile(szPipeName,
+    if ((temp = CreateFile(pipe_name,
 			   GENERIC_READ | GENERIC_WRITE,
 			   0,
 			   NULL,
@@ -588,7 +585,7 @@
 			   0,
 			   NULL )) != INVALID_HANDLE_VALUE)
     {
-      WaitNamedPipe(szPipeName, 1000);
+      WaitNamedPipe(pipe_name, 1000);
       DWORD dwMode = PIPE_READMODE_BYTE | PIPE_WAIT;
       SetNamedPipeHandleState(temp, &dwMode, NULL, NULL);
       CancelIo(temp);
@@ -1023,27 +1020,26 @@
   }
 }
 
-/* Change to run as another user if started with --user */
 
-static void set_user(const char *user)
+static struct passwd *check_user(const char *user)
 {
-#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
-  struct passwd *ent;
+#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) 
+  struct passwd *user_info;
   uid_t user_id= geteuid();
-
-  // don't bother if we aren't superuser
+  
+  // Don't bother if we aren't superuser
   if (user_id)
   {
     if (user)
     {
-      /* Don't give a warning, if real user is same as given with --user */
-      struct passwd *user_info= getpwnam(user);
-
-      if (!user_info || user_id != user_info->pw_uid)
-	fprintf(stderr,
-		"Warning: One can only use the --user switch if running as root\n");
+      // Don't give a warning, if real user is same as given with --user
+      user_info= getpwnam(user);
+      if ((!user_info || user_id != user_info->pw_uid) &&
+          global_system_variables.log_warnings)
+        fprintf(stderr,
+	        "Warning: One can only use the --user switch if running as root\n");
     }
-    return;
+    return NULL;
   }
   if (!user)
   {
@@ -1052,38 +1048,52 @@
       fprintf(stderr,"Fatal error: Please read \"Security\" section of the manual to find
out how to run mysqld as root!\n");
       unireg_abort(1);
     }
-    return;
+    return NULL;
   }
   if (!strcmp(user,"root"))
-    return;				// Avoid problem with dynamic libraries
-
-  uid_t uid;
-  if (!(ent = getpwnam(user)))
+    return NULL;             // Avoid problem with dynamic libraries
+  if (!(user_info= getpwnam(user)))
   {
-    // allow a numeric uid to be used
+    // Allow a numeric uid to be used
     const char *pos;
-    for (pos=user; isdigit(*pos); pos++) ;
-    if (*pos)					// Not numeric id
-    {
-      fprintf(stderr,"Fatal error: Can't change to run as user '%s' ;  Please check that
the user exists!\n",user);
-      unireg_abort(1);
-    }
-    uid=atoi(user);				// Use numberic uid
+    for (pos= user; isdigit(*pos); pos++);
+    if (*pos)                // Not numeric id
+      goto err;
+    if (!(user_info= getpwuid(atoi(user))))
+      goto err;
+    else
+      return user_info;
   }
   else
   {
+    return user_info;
+  }
+
+err:
+  fprintf(stderr,
+          "Fatal error: Can't change to run as user '%s'.  Please check that the user
exists!\n",
+	  user);
+  unireg_abort(1);
+  return NULL;	  
+#else
+  return NULL;  
+#endif  
+}
+
+
+static void set_user(const char *user, struct passwd *user_info)
+{
+#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
+  DBUG_ASSERT(user_info);
 #ifdef HAVE_INITGROUPS
-    initgroups((char*) user,ent->pw_gid);
+  initgroups((char*) user, user_info->pw_gid);
 #endif
-    if (setgid(ent->pw_gid) == -1)
-    {
-      sql_perror("setgid");
-      unireg_abort(1);
-    }
-    uid=ent->pw_uid;
+  if (setgid(user_info->pw_gid) == -1)
+  {
+    sql_perror("setgid");
+    unireg_abort(1);
   }
-
-  if (setuid(uid) == -1)
+  if (setuid(user_info->pw_uid) == -1)
   {
     sql_perror("setuid");
     unireg_abort(1);
@@ -1091,6 +1101,24 @@
 #endif
 }
 
+static void set_effective_user(struct passwd *user_info)
+{
+#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
+  DBUG_ASSERT(user_info);
+  if (setregid((gid_t)-1,user_info->pw_gid) == -1)
+  {
+    sql_perror("setregid");
+    unireg_abort(1);
+  }  
+  if (setreuid((uid_t)-1,user_info->pw_uid) == -1)
+  {
+    sql_perror("setreuid");
+    unireg_abort(1);
+  }
+#endif
+}
+
+
 /* Change root user if started with  --chroot */
 
 static void set_root(const char *path)
@@ -1166,18 +1194,32 @@
       unireg_abort(1);
     }
   }
-  set_user(mysqld_user);		// Works also with mysqld_user==NULL
+
+  if ((user_info= check_user(mysqld_user)))
+  {
+#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
+    if (locked_in_memory && !getuid())
+      set_effective_user(user_info);
+    else
+      set_user(mysqld_user, user_info);
+#else
+    set_user(mysqld_user, user_info);
+#endif
+  }
 
 #ifdef __NT__
   /* create named pipe */
   if (Service.IsNT() && mysql_unix_port[0] && !opt_bootstrap &&
       opt_enable_named_pipe)
   {
-    sprintf( szPipeName, "\\\\.\\pipe\\%s", mysql_unix_port );
-    ZeroMemory( &saPipeSecurity, sizeof(saPipeSecurity) );
-    ZeroMemory( &sdPipeDescriptor, sizeof(sdPipeDescriptor) );
-    if ( !InitializeSecurityDescriptor(&sdPipeDescriptor,
-				       SECURITY_DESCRIPTOR_REVISION) )
+    
+    pipe_name[sizeof(pipe_name)-1]= 0;		/* Safety if too long string */
+    strxnmov(pipe_name, sizeof(pipe_name)-1, "\\\\.\\pipe\\",
+	     mysql_unix_port, NullS);
+    bzero((char*) &saPipeSecurity, sizeof(saPipeSecurity) );
+    bzero((char*) &sdPipeDescriptor, sizeof(sdPipeDescriptor) );
+    if (!InitializeSecurityDescriptor(&sdPipeDescriptor,
+				      SECURITY_DESCRIPTOR_REVISION) )
     {
       sql_perror("Can't start server : Initialize security descriptor");
       unireg_abort(1);
@@ -1190,16 +1232,16 @@
     saPipeSecurity.nLength = sizeof( SECURITY_ATTRIBUTES );
     saPipeSecurity.lpSecurityDescriptor = &sdPipeDescriptor;
     saPipeSecurity.bInheritHandle = FALSE;
-    if ((hPipe = CreateNamedPipe(szPipeName,
-				 PIPE_ACCESS_DUPLEX,
-				 PIPE_TYPE_BYTE |
-				 PIPE_READMODE_BYTE |
-				 PIPE_WAIT,
-				 PIPE_UNLIMITED_INSTANCES,
-				 (int) global_system_variables.net_buffer_length,
-				 (int) global_system_variables.net_buffer_length,
-				 NMPWAIT_USE_DEFAULT_WAIT,
-				 &saPipeSecurity )) == INVALID_HANDLE_VALUE)
+    if ((hPipe= CreateNamedPipe(pipe_name,
+				PIPE_ACCESS_DUPLEX,
+				PIPE_TYPE_BYTE |
+				PIPE_READMODE_BYTE |
+				PIPE_WAIT,
+				PIPE_UNLIMITED_INSTANCES,
+				(int) global_system_variables.net_buffer_length,
+				(int) global_system_variables.net_buffer_length,
+				NMPWAIT_USE_DEFAULT_WAIT,
+				&saPipeSecurity)) == INVALID_HANDLE_VALUE)
       {
 	LPVOID lpMsgBuf;
 	int error=GetLastError();
@@ -1419,6 +1461,7 @@
 static void check_data_home(const char *path)
 {}
 
+
 #elif defined(__NETWARE__)
 
 // down server event callback
@@ -1427,27 +1470,199 @@
   kill_server(0);
 }
 
+
 // destroy callback resources
 void mysql_cb_destroy(void *)
 {
   UnRegisterEventNotification(eh);  // cleanup down event notification
   NX_UNWRAP_INTERFACE(ref);
+
+  /* Deregister NSS volume deactivation event */
+  NX_UNWRAP_INTERFACE(refneb);
+  if (neb_consumer_id)
+    UnRegisterConsumer(neb_consumer_id, NULL);	
 }
 
+
 // initialize callbacks
 void mysql_cb_init()
 {
   // register for down server event
   void *handle = getnlmhandle();
-  rtag_t rt = AllocateResourceTag(handle, "MySQL Down Server Callback",
-                                  EventSignature);
+  rtag_t rt= AllocateResourceTag(handle, "MySQL Down Server Callback",
+                                 EventSignature);
   NX_WRAP_INTERFACE((void *)mysql_down_server_cb, 2, (void **)&ref);
-  eh = RegisterForEventNotification(rt, EVENT_DOWN_SERVER,
-                                    EVENT_PRIORITY_APPLICATION,
-                                    NULL, ref, NULL);
+  eh= RegisterForEventNotification(rt, EVENT_PRE_DOWN_SERVER,
+                                   EVENT_PRIORITY_APPLICATION,
+                                   NULL, ref, NULL);
+
+  /*
+    Register for volume deactivation event
+    Wrap the callback function, as it is called by non-LibC thread
+  */
+  (void)NX_WRAP_INTERFACE(neb_event_callback, 1, &refneb);
+  registerwithneb();
+
   NXVmRegisterExitHandler(mysql_cb_destroy, NULL);  // clean-up
 }
 
+
+/* To get the name of the NetWare volume having MySQL data folder */
+
+void getvolumename()
+{
+  char *p;
+  /*
+    We assume that data path is already set.
+    If not it won't come here. Terminate after volume name
+  */
+  if ((p= strchr(mysql_real_data_home, ':')))
+    strmake(datavolname, mysql_real_data_home,
+            (uint) (p - mysql_real_data_home));
+}
+
+
+/*
+  Registering with NEB for NSS Volume Deactivation event
+*/
+
+void registerwithneb()
+{
+
+  ConsumerRegistrationInfo reg_info;
+    
+  /* Clear NEB registration structure */
+  bzero((char*) &reg_info, sizeof(struct ConsumerRegistrationInfo));
+
+  /* Fill the NEB consumer information structure */
+  reg_info.CRIVersion= 1;  	            // NEB version
+  /* NEB Consumer name */
+  reg_info.CRIConsumerName= (BYTE *) "MySQL Database Server";
+  /* Event of interest */
+  reg_info.CRIEventName= (BYTE *) "NSS.ChangeVolState.Enter";
+  reg_info.CRIUserParameter= NULL;	    // Consumer Info
+  reg_info.CRIEventFlags= 0;	            // Event flags
+  /* Consumer NLM handle */
+  reg_info.CRIOwnerID= (LoadDefinitionStructure *)getnlmhandle();
+  reg_info.CRIConsumerESR= NULL;	    // No consumer ESR required
+  reg_info.CRISecurityToken= 0;	            // No security token for the event
+  reg_info.CRIConsumerFlags= 0;             // SMP_ENABLED_BIT;	
+  reg_info.CRIFilterName= 0;	            // No event filtering
+  reg_info.CRIFilterDataLength= 0;          // No filtering data
+  reg_info.CRIFilterData= 0;	            // No filtering data
+  /* Callback function for the event */
+  (void *)reg_info.CRIConsumerCallback= (void *) refneb;
+  reg_info.CRIOrder= 0;	                    // Event callback order
+  reg_info.CRIConsumerType= CHECK_CONSUMER; // Consumer type
+
+  /* Register for the event with NEB */
+  if (RegisterConsumer(&reg_info))
+  {
+    consoleprintf("Failed to register for NSS Volume Deactivation event \n");
+    return;
+  }
+  /* This ID is required for deregistration */
+  neb_consumer_id= reg_info.CRIConsumerID;
+
+  /* Get MySQL data volume name, stored in global variable datavolname */
+  getvolumename();
+
+  /*
+    Get the NSS volume ID of the MySQL Data volume.
+    Volume ID is stored in a global variable
+  */
+  getvolumeID((BYTE*) datavolname);	
+}
+
+
+/*
+  Callback for NSS Volume Deactivation event
+*/
+ulong neb_event_callback(struct EventBlock *eblock)
+{
+  EventChangeVolStateEnter_s *voldata;
+  extern bool nw_panic;
+
+  voldata= (EventChangeVolStateEnter_s *)eblock->EBEventData;
+
+  /* Deactivation of a volume */
+  if ((voldata->oldState == 6 && voldata->newState == 2))
+  {
+    /*
+      Ensure that we bring down MySQL server only for MySQL data
+      volume deactivation
+    */
+    if (!memcmp(&voldata->volID, &datavolid, sizeof(VolumeID_t)))
+    {
+      consoleprintf("MySQL data volume is deactivated, shutting down MySQL Server \n");
+      nw_panic = TRUE;
+      kill_server(0);
+    }
+  }
+  return 0;
+}
+
+
+/*
+  Function to get NSS volume ID of the MySQL data
+*/
+
+#define ADMIN_VOL_PATH					"_ADMIN:/Volumes/"
+
+void getvolumeID(BYTE *volumeName)
+{
+  char path[zMAX_FULL_NAME];
+  Key_t rootKey= 0, fileKey= 0;
+  QUAD getInfoMask;
+  zInfo_s info;
+  STATUS status;
+
+  /* Get the  root key */
+  if ((status= zRootKey(0, &rootKey)) != zOK)
+  {
+    consoleprintf("\nGetNSSVolumeProperties - Failed to get root key, status: %d\n.",
(int) status);
+    goto exit;
+  }
+
+  /*
+    Get the file key. This is the key to the volume object in the
+    NSS admin volumes directory.
+  */
+
+  strxmov(path, (const char *) ADMIN_VOL_PATH, (const char *) volumeName,
+          NullS);
+  if ((status= zOpen(rootKey, zNSS_TASK, zNSPACE_LONG|zMODE_UTF8, 
+                     (BYTE *) path, zRR_READ_ACCESS, &fileKey)) != zOK)
+  {
+    consoleprintf("\nGetNSSVolumeProperties - Failed to get file, status: %d\n.", (int)
status);
+    goto exit;
+  }
+
+  getInfoMask= zGET_IDS | zGET_VOLUME_INFO ;
+  if ((status= zGetInfo(fileKey, getInfoMask, sizeof(info), 
+                        zINFO_VERSION_A, &info)) != zOK)
+  {
+    consoleprintf("\nGetNSSVolumeProperties - Failed in zGetInfo, status: %d\n.", (int)
status);
+    goto exit;
+  }
+
+  /* Copy the data to global variable */
+  datavolid.timeLow= info.vol.volumeID.timeLow;
+  datavolid.timeMid= info.vol.volumeID.timeMid;
+  datavolid.timeHighAndVersion= info.vol.volumeID.timeHighAndVersion;
+  datavolid.clockSeqHighAndReserved= info.vol.volumeID.clockSeqHighAndReserved;
+  datavolid.clockSeqLow= info.vol.volumeID.clockSeqLow;
+  /* This is guranteed to be 6-byte length (but sizeof() would be better) */
+  memcpy(datavolid.node, info.vol.volumeID.node, (unsigned int) 6);
+		
+exit:
+  if (rootKey)
+    zClose(rootKey);
+  if (fileKey)
+    zClose(fileKey);
+}
+
+
 static void init_signals(void)
 {
   int signals[] = {SIGINT,SIGILL,SIGFPE,SIGSEGV,SIGTERM,SIGABRT};
@@ -1457,6 +1672,7 @@
   mysql_cb_init();  // initialize callbacks
 }
 
+
 static void start_signal_handler(void)
 {
   // Save vm id of this process
@@ -1466,7 +1682,12 @@
 }
 
 
-/*  Warn if the data is on a Traditional volume */
+/*
+  Warn if the data is on a Traditional volume
+
+  NOTE
+    Already done by mysqld_safe
+*/
 
 static void check_data_home(const char *path)
 {
@@ -1652,9 +1873,11 @@
   sigaddset(&set,SIGPIPE);
 #endif
   sigaddset(&set,SIGINT);
+#ifndef IGNORE_SIGHUP_SIGQUIT
   sigaddset(&set,SIGQUIT);
-  sigaddset(&set,SIGTERM);
   sigaddset(&set,SIGHUP);
+#endif
+  sigaddset(&set,SIGTERM);
 
   /* Fix signals if blocked by parents (can happen on Mac OS X) */
   sigemptyset(&sa.sa_mask);
@@ -1723,7 +1946,8 @@
     This should actually be '+ max_number_of_slaves' instead of +10,
     but the +10 should be quite safe.
   */
-  init_thr_alarm(max_connections+max_insert_delayed_threads+10);
+  init_thr_alarm(max_connections +
+		 global_system_variables.max_insert_delayed_threads + 10);
 #if SIGINT != THR_KILL_SIGNAL
   if (test_flags & TEST_SIGINT)
   {
@@ -1736,11 +1960,13 @@
 #ifdef USE_ONE_SIGNAL_HAND
   (void) sigaddset(&set,THR_SERVER_ALARM);	// For alarms
 #endif
+#ifndef IGNORE_SIGHUP_SIGQUIT
   (void) sigaddset(&set,SIGQUIT);
-  (void) sigaddset(&set,SIGTERM);
 #if THR_CLIENT_ALARM != SIGHUP
   (void) sigaddset(&set,SIGHUP);
 #endif
+#endif
+  (void) sigaddset(&set,SIGTERM);
   (void) sigaddset(&set,SIGTSTP);
 
   /* Save pid to this process (or thread on Linux) */
@@ -1813,7 +2039,7 @@
 			     (REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
 			      REFRESH_STATUS | REFRESH_GRANT |
 			      REFRESH_THREADS | REFRESH_HOSTS),
-			     (TABLE_LIST*) 0); // Flush logs
+			     (TABLE_LIST*) 0);  // Flush logs
 	mysql_print_status((THD*) 0);		// Send debug some info
       }
       break;
@@ -1845,8 +2071,7 @@
 
 
 /* ARGSUSED */
-extern "C" int my_message_sql(uint error, const char *str,
-			      myf MyFlags __attribute__((unused)))
+extern "C" int my_message_sql(uint error, const char *str, myf MyFlags)
 {
   NET *net;
   DBUG_ENTER("my_message_sql");
@@ -1859,7 +2084,7 @@
       net->last_errno=error ? error : ER_UNKNOWN_ERROR;
     }
   }
-  else
+  if (!net || MyFlags & ME_NOREFRESH)
     sql_print_error("%s: %s",my_progname,str); /* purecov: inspected */
   DBUG_RETURN(0);
 }
@@ -1904,6 +2129,7 @@
   return 0;
 }
 
+
 int STDCALL handle_kill(ulong ctrl_type)
 {
   if (ctrl_type == CTRL_CLOSE_EVENT ||
@@ -1916,6 +2142,7 @@
 }
 #endif
 
+
 #ifdef OS2
 extern "C" pthread_handler_decl(handle_shutdown,arg)
 {
@@ -2031,11 +2258,7 @@
     strmov(glob_hostname,"mysql");
   strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
   strmov(fn_ext(pidfile_name),".pid");		// Add proper extension
-#ifndef DBUG_OFF
-  strxmov(strend(server_version),MYSQL_SERVER_SUFFIX,"-debug",NullS);
-#else
-  strmov(strend(server_version),MYSQL_SERVER_SUFFIX);
-#endif
+
 #ifdef _CUSTOMSTARTUPCONFIG_
   if (_cust_check_startup())
   {
@@ -2057,10 +2280,14 @@
   if (!opt_mysql_tmpdir || !opt_mysql_tmpdir[0])
     opt_mysql_tmpdir=(char*) P_tmpdir;		/* purecov: inspected */
 
+  /* needed by get_options */
+
+  (void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST);
+
   set_options();
   get_options(argc,argv);
-  if (opt_log || opt_update_log || opt_slow_log || opt_bin_log)
-    strcat(server_version,"-log");
+  set_server_version();
+
   DBUG_PRINT("info",("%s  Ver %s for %s on %s\n",my_progname,
 		     server_version, SYSTEM_TYPE,MACHINE_TYPE));
 
@@ -2073,7 +2300,6 @@
   (void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST);
   (void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW);
   (void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST);
-  (void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST);
   (void) pthread_mutex_init(&LOCK_delayed_insert,MY_MUTEX_INIT_FAST);
   (void) pthread_mutex_init(&LOCK_delayed_status,MY_MUTEX_INIT_FAST);
   (void) pthread_mutex_init(&LOCK_delayed_create,MY_MUTEX_INIT_SLOW);
@@ -2102,11 +2328,27 @@
     insensitive names.  If this is not done the users MyISAM tables will
     get corrupted if accesses with names of different case.
   */
+  DBUG_PRINT("info", ("lower_case_table_names: %d", lower_case_table_names));
   if (!lower_case_table_names &&
-      test_if_case_insensitive(mysql_real_data_home) == 1)
+      (lower_case_file_system=
+       (test_if_case_insensitive(mysql_real_data_home) == 1)))
   {
-    sql_print_error("Warning: Setting lower_case_table_names=2 because file system for %s
is case insensitive", mysql_real_data_home);
-    lower_case_table_names= 2;
+    if (lower_case_table_names_used)
+    {
+      if (global_system_variables.log_warnings)
+	sql_print_error("\
+Warning: You have forced lower_case_table_names to 0 through a command-line \
+option, even though your file system '%s' is case insensitive.  This means \
+that you can corrupt a MyISAM table by accessing it with different cases. \
+You should consider changing lower_case_table_names to 1 or 2",
+			mysql_real_data_home);
+    }
+    else
+    {
+      if (global_system_variables.log_warnings)
+	sql_print_error("Warning: Setting lower_case_table_names=2 because file system for %s is
case insensitive", mysql_real_data_home);
+      lower_case_table_names= 2;
+    }
   }
 
 #ifdef HAVE_OPENSSL
@@ -2168,7 +2410,8 @@
       DBUG_PRINT("warning",
 		 ("Changed limits: max_connections: %ld  table_cache: %ld",
 		  max_connections,table_cache_size));
-      sql_print_error("Warning: Changed limits: max_connections: %ld  table_cache:
%ld",max_connections,table_cache_size);
+      if (global_system_variables.log_warnings)
+	sql_print_error("Warning: Changed limits: max_connections: %ld  table_cache:
%ld",max_connections,table_cache_size);
     }
     open_files_limit= files;
   }
@@ -2202,8 +2445,10 @@
   mysql_data_home[0]=FN_CURLIB;		// all paths are relative from here
   mysql_data_home[1]=0;
   server_init();
-  table_cache_init();
-  hostname_cache_init();
+  if (table_cache_init() || hostname_cache_init())
+  {
+    unireg_abort(1);
+  }
   query_cache_result_size_limit(query_cache_limit);
   query_cache_resize(query_cache_size);
   randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
@@ -2254,14 +2499,22 @@
   }
   ha_key_cache();
 #if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
-  if (locked_in_memory && !geteuid())
+  if (locked_in_memory && !getuid())
   {
+    if (setreuid((uid_t)-1,0) == -1)
+    {                        // this should never happen
+      sql_perror("setreuid");
+      unireg_abort(1);
+    }
     if (mlockall(MCL_CURRENT))
     {
-      sql_print_error("Warning: Failed to lock memory. Errno: %d\n",errno);
+      if (global_system_variables.log_warnings)
+	sql_print_error("Warning: Failed to lock memory. Errno: %d\n",errno);
     }
     else
       locked_in_memory=1;
+    if (user_info)
+      set_user(mysqld_user, user_info);
   }
 #else
   locked_in_memory=0;
@@ -2328,15 +2581,15 @@
 #ifdef EXTRA_DEBUG
     case 1:
       sql_print_error("\
-Warning: You have enabled the binary log, but you haven't set server-id:\n\
-Updates will be logged to the binary log, but connections to slaves will\n\
-not be accepted.");
+Warning: You have enabled the binary log, but you haven't set server-id to \
+a non-zero value: we force server id to 1; updates will be logged to the \
+binary log, but connections from slaves will not be accepted.");
       break;
 #endif
     case 2:
       sql_print_error("\
-Warning: You should set server-id to a non-0 value if master_host is set.\n\
-The server will not act as a slave.");
+Warning: You should set server-id to a non-0 value if master_host is set; \
+we force server id to 2, but this MySQL server will not act as a slave.");
       break;
     }
   }
@@ -2353,6 +2606,15 @@
 Now disabling --log-slave-updates.");
   }
 
+  if (opt_log_slave_updates && replicate_same_server_id)
+  {
+      sql_print_error("\
+Error: using --replicate-same-server-id in conjunction with \
+--log-slave-updates is impossible, it would lead to infinite loops in this \
+server.");
+      unireg_abort(1);
+  }
+
   if (opt_bootstrap)
   {
     int error=bootstrap(stdin);
@@ -2402,6 +2664,9 @@
   printf(ER(ER_READY),my_progname,server_version,
 	 ((unix_sock == INVALID_SOCKET) ? (char*) "" : mysql_unix_port),
 	 mysql_port);
+  if (MYSQL_COMPILATION_COMMENT[0] != '\0')
+    fputs("  " MYSQL_COMPILATION_COMMENT, stdout);
+  putchar('\n');
   fflush(stdout);
 
 #ifdef __NT__
@@ -2409,7 +2674,7 @@
       (!have_tcpip || opt_disable_networking))
   {
     sql_print_error("TCP/IP or --enable-named-pipe should be configured on NT OS");
-	unireg_abort(1);
+    unireg_abort(1);
   }
   else
   {
@@ -2444,6 +2709,13 @@
     pthread_mutex_unlock(&LOCK_thread_count);
   }
 #else
+#ifdef __WIN__
+  if ( !have_tcpip || opt_disable_networking)
+  {
+    sql_print_error("TCP/IP unavailable or disabled with --skip-networking; no available
interfaces");
+    unireg_abort(1);
+  }
+#endif
   handle_connections_sockets(0);
 #ifdef EXTRA_DEBUG2
   sql_print_error("Exiting main thread");
@@ -2959,8 +3231,8 @@
 	struct request_info req;
 	signal(SIGCHLD, SIG_DFL);
 	request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, new_sock, NULL);
-	my_fromhost(&req);
-	if (!my_hosts_access(&req))
+	fromhost(&req);
+	if (!hosts_access(&req))
 	{
 	  /*
 	    This may be stupid but refuse() includes an exit(0)
@@ -2968,7 +3240,7 @@
 	    clean_exit() - same stupid thing ...
 	  */
 	  syslog(deny_severity, "refused connect from %s",
-		 my_eval_client(&req));
+		 eval_client(&req));
 
 	  /*
 	    C++ sucks (the gibberish in front just translates the supplied
@@ -3074,7 +3346,7 @@
     if (!fConnected)
     {
       CloseHandle( hPipe );
-      if ((hPipe = CreateNamedPipe(szPipeName,
+      if ((hPipe = CreateNamedPipe(pipe_name,
 				   PIPE_ACCESS_DUPLEX,
 				   PIPE_TYPE_BYTE |
 				   PIPE_READMODE_BYTE |
@@ -3092,7 +3364,7 @@
     }
     hConnectedPipe = hPipe;
     /* create new pipe for new connection */
-    if ((hPipe = CreateNamedPipe(szPipeName,
+    if ((hPipe = CreateNamedPipe(pipe_name,
 				 PIPE_ACCESS_DUPLEX,
 				 PIPE_TYPE_BYTE |
 				 PIPE_READMODE_BYTE |
@@ -3177,7 +3449,7 @@
   OPT_SKIP_SLAVE_START,        OPT_SKIP_INNOBASE,
   OPT_SAFEMALLOC_MEM_LIMIT,    OPT_REPLICATE_DO_TABLE, 
   OPT_REPLICATE_IGNORE_TABLE,  OPT_REPLICATE_WILD_DO_TABLE, 
-  OPT_REPLICATE_WILD_IGNORE_TABLE, 
+  OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID,
   OPT_DISCONNECT_SLAVE_EVENT_COUNT, 
   OPT_ABORT_SLAVE_EVENT_COUNT,
   OPT_INNODB_DATA_HOME_DIR,
@@ -3225,7 +3497,7 @@
   OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT,
   OPT_OPEN_FILES_LIMIT, 
   OPT_QUERY_CACHE_LIMIT, OPT_QUERY_CACHE_SIZE,
-  OPT_QUERY_CACHE_TYPE, OPT_RECORD_BUFFER,
+  OPT_QUERY_CACHE_TYPE, OPT_QUERY_CACHE_WLOCK_INVALIDATE, OPT_RECORD_BUFFER,
   OPT_RECORD_RND_BUFFER, OPT_RELAY_LOG_SPACE_LIMIT,
   OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME,
   OPT_READONLY, OPT_DEBUGGING,
@@ -3239,17 +3511,21 @@
   OPT_INNODB_LOG_BUFFER_SIZE,
   OPT_INNODB_BUFFER_POOL_SIZE,
   OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE,
+  OPT_INNODB_MAX_PURGE_LAG,
   OPT_INNODB_FILE_IO_THREADS,
   OPT_INNODB_LOCK_WAIT_TIMEOUT,
   OPT_INNODB_THREAD_CONCURRENCY,
   OPT_INNODB_FORCE_RECOVERY,
+  OPT_INNODB_STATUS_FILE,
   OPT_INNODB_MAX_DIRTY_PAGES_PCT,
+  OPT_INNODB_AUTOEXTEND_INCREMENT,
+  OPT_INNODB_TABLE_LOCKS,
   OPT_BDB_CACHE_SIZE,
   OPT_BDB_LOG_BUFFER_SIZE,
   OPT_BDB_MAX_LOCK,
   OPT_ERROR_LOG_FILE,
   OPT_DEFAULT_WEEK_FORMAT,
-  OPT_RANGE_ALLOC_BLOCK_SIZE,
+  OPT_RANGE_ALLOC_BLOCK_SIZE, OPT_ALLOW_SUSPICIOUS_UDFS,
   OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE,
   OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE,
   OPT_SYNC_FRM, OPT_BDB_NOSYNC
@@ -3262,6 +3538,13 @@
 {
   {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax", 0, 0, 0,
    GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"allow-suspicious-udfs", OPT_ALLOW_SUSPICIOUS_UDFS,
+   "Allows use of UDFs consisting of only one symbol xxx() "
+   "without corresponding xxx_init() or xxx_deinit(). That also means "
+   "that one can load any function from any library, for example exit() "
+   "from libc.so",
+   (gptr*) &opt_allow_suspicious_udfs, (gptr*) &opt_allow_suspicious_udfs,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"basedir", 'b',
    "Path to installation directory. All paths are usually resolved relative to this.",
    (gptr*) &mysql_home_ptr, (gptr*) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG,
@@ -3386,6 +3669,11 @@
   {"innodb_data_file_path", OPT_INNODB_DATA_FILE_PATH,
    "Path to individual files and their sizes",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"innodb_autoextend_increment", OPT_INNODB_AUTOEXTEND_INCREMENT,
+   "Data file autoextend increment in megabytes",
+   (gptr*) &srv_auto_extend_increment,
+   (gptr*) &srv_auto_extend_increment,
+   0, GET_LONG, REQUIRED_ARG, 8L, 1L, 1000L, 0, 1L, 0},
   {"innodb_data_home_dir", OPT_INNODB_DATA_HOME_DIR,
    "The common part for Innodb table spaces", (gptr*) &innobase_data_home_dir,
    (gptr*) &innobase_data_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0,
@@ -3412,10 +3700,23 @@
   {"innodb_fast_shutdown", OPT_INNODB_FAST_SHUTDOWN,
    "Speeds up server shutdown process", (gptr*) &innobase_fast_shutdown,
    (gptr*) &innobase_fast_shutdown, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
+  {"innodb_status_file", OPT_INNODB_STATUS_FILE,
+   "Enable SHOW INNODB STATUS output in the innodb_status.<pid> file",
+   (gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file,
+   0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT,
    "Percentage of dirty pages allowed in bufferpool", (gptr*)
&srv_max_buf_pool_modified_pct,
    (gptr*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0,
0, 0},
-   
+  {"innodb_max_purge_lag", OPT_INNODB_MAX_PURGE_LAG,
+   "Desired maximum length of the purge queue (0 = no limit)",
+   (gptr*) &srv_max_purge_lag,
+   (gptr*) &srv_max_purge_lag, 0, GET_LONG, REQUIRED_ARG, 0, 0, ~0L,
+   0, 1L, 0},
+  {"innodb_table_locks", OPT_INNODB_TABLE_LOCKS,
+   "Enable InnoDB locking in LOCK TABLES",
+   (gptr*) &global_system_variables.innodb_table_locks,
+   (gptr*) &global_system_variables.innodb_table_locks,
+   0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
 #endif /* End HAVE_INNOBASE_DB */
   {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
    0, 0, 0, 0, 0},
@@ -3589,6 +3890,13 @@
   {"replicate-rewrite-db", OPT_REPLICATE_REWRITE_DB,
    "Updates to a database with a different name than the original. Example:
replicate-rewrite-db=master_db_name->slave_db_name",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"replicate-same-server-id", OPT_REPLICATE_SAME_SERVER_ID,
+   "In replication, if set to 1, do not skip events having our server id. \
+Default value is 0 (to break infinite loops in circular replication). \
+Can't be set to 1 if --log-slave-updates is used.",
+   (gptr*) &replicate_same_server_id,
+   (gptr*) &replicate_same_server_id,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   // In replication, we may need to tell the other servers how to connect
   {"report-host", OPT_REPORT_HOST,
    "Hostname or IP of the slave to be reported to to the master during slave
registration. Will appear in the output of SHOW SLAVE HOSTS. Leave unset if you do not
want the slave to register itself with the master. Note that it is not sufficient for the
master to simply read the IP of the slave off the socket once the slave connects. Due to
NAT and other routing issues, that IP may not be valid for connecting to the slave from
the master or other hosts.",
@@ -3634,7 +3942,7 @@
    "Change the value of a variable. Please note that this option is deprecated;you can
set variables directly with --variable-name=value.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"show-slave-auth-info", OPT_SHOW_SLAVE_AUTH_INFO,
-   "Show user and password in SHOW SLAVE STATUS",
+   "Show user and password in SHOW SLAVE HOSTS on this master",
    (gptr*) &opt_show_slave_auth_info, (gptr*) &opt_show_slave_auth_info, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"concurrent-insert", OPT_CONCURRENT_INSERT,
@@ -3733,11 +4041,11 @@
    0, 0, 0, 0},
   {"log-warnings", 'W', "Log some not critical warnings to the log file",
    (gptr*) &global_system_variables.log_warnings,
-   (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, ~0L,
    0, 0, 0},
   {"warnings", 'W', "Deprecated ; Use --log-warnings instead",
    (gptr*) &global_system_variables.log_warnings,
-   (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+   (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, ~0L,
    0, 0, 0},
   { "back_log", OPT_BACK_LOG,
     "The number of outstanding connection requests MySQL can have. This comes into play
when the main MySQL thread gets very many connection requests in a very short time.",
@@ -3859,7 +4167,7 @@
   {"key_buffer_size", OPT_KEY_BUFFER_SIZE,
    "The size of the buffer used for index blocks. Increase this to get better index
handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M
machine that mainly runs MySQL is quite common.",
    (gptr*) &keybuff_size, (gptr*) &keybuff_size, 0, GET_ULL,
-   REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, (long) ~0, MALLOC_OVERHEAD,
+   REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, UINT_MAX32, MALLOC_OVERHEAD,
    IO_SIZE, 0},
   {"long_query_time", OPT_LONG_QUERY_TIME,
    "Log all queries that have taken more than long_query_time seconds to execute to
file.",
@@ -3901,7 +4209,8 @@
     REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ~0L, 0, 1, 0},
   {"max_delayed_threads", OPT_MAX_DELAYED_THREADS,
    "Don't start more than this number of threads to handle INSERT DELAYED statements. If
set to zero, which means INSERT DELAYED is not used.",
-   (gptr*) &max_insert_delayed_threads, (gptr*) &max_insert_delayed_threads,
+   (gptr*) &global_system_variables.max_insert_delayed_threads,
+   (gptr*) &max_system_variables.max_insert_delayed_threads,
    0, GET_ULONG, REQUIRED_ARG, 20, 0, 16384, 0, 1, 0},
   {"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE,
    "Don't allow creation of heap tables bigger than this.",
@@ -4020,12 +4329,17 @@
    (gptr*) &global_system_variables.query_cache_type,
    (gptr*) &max_system_variables.query_cache_type,
    0, GET_ULONG, REQUIRED_ARG, 1, 0, 2, 0, 1, 0},
+  {"query_cache_wlock_invalidate", OPT_QUERY_CACHE_WLOCK_INVALIDATE,
+   "Invalidate queries in query cache on LOCK for write",
+   (gptr*) &global_system_variables.query_cache_wlock_invalidate,
+   (gptr*) &max_system_variables.query_cache_wlock_invalidate,
+   0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
+#endif /*HAVE_QUERY_CACHE*/
   {"query_prealloc_size", OPT_QUERY_PREALLOC_SIZE,
    "Persistent buffer for query parsing and execution",
    (gptr*) &global_system_variables.query_prealloc_size,
    (gptr*) &max_system_variables.query_prealloc_size, 0, GET_ULONG,
    REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, 1024, ~0L, 0, 1024, 0},
-#endif /*HAVE_QUERY_CACHE*/
   {"read_buffer_size", OPT_RECORD_BUFFER,
    "Each thread that does a sequential scan allocates a buffer of this size for each
table it scans. If you do many sequential scans, you may want to increase this value.",
    (gptr*) &global_system_variables.read_buff_size,
@@ -4078,8 +4392,8 @@
    1, 0},
   {"table_cache", OPT_TABLE_CACHE,
    "The number of open tables for all threads.", (gptr*) &table_cache_size,
-   (gptr*) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, 64, 1, ~0L, 0, 1,
-   0},
+   (gptr*) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, 64, 1, 512*1024L,
+   0, 1, 0},
   {"thread_concurrency", OPT_THREAD_CONCURRENCY,
    "Permits the application to give the threads system a hint for the desired number of
threads that should be run at the same time.",
    (gptr*) &concurrency, (gptr*) &concurrency, 0, GET_ULONG, REQUIRED_ARG,
@@ -4194,6 +4508,7 @@
   {"Com_truncate",	       (char*) (com_stat+(uint) SQLCOM_TRUNCATE),SHOW_LONG},
   {"Com_unlock_tables",	       (char*) (com_stat+(uint) SQLCOM_UNLOCK_TABLES),SHOW_LONG},
   {"Com_update",	       (char*) (com_stat+(uint) SQLCOM_UPDATE),SHOW_LONG},
+  {"Com_update_multi",	       (char*) (com_stat+(uint) SQLCOM_MULTI_UPDATE),SHOW_LONG},
   {"Connections",              (char*) &thread_id,              SHOW_LONG_CONST},
   {"Created_tmp_disk_tables",  (char*) &created_tmp_disk_tables,SHOW_LONG},
   {"Created_tmp_tables",       (char*) &created_tmp_tables,     SHOW_LONG},
@@ -4290,6 +4605,7 @@
 
 static void print_version(void)
 {
+  set_server_version();
   printf("%s  Ver %s for %s on %s (%s)\n",my_progname,
 	 server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT);
 }
@@ -4406,7 +4722,7 @@
     mysql_data_home= mysql_real_data_home;
     break;
   case 'u':
-    if (!mysqld_user)
+    if (!mysqld_user || !strcmp(mysqld_user, argument))
       mysqld_user= argument;
     else
       fprintf(stderr, "Warning: Ignoring user change to '%s' because the user was set to
'%s' earlier on the command line\n", argument, mysqld_user);
@@ -4438,6 +4754,14 @@
   case 'V':
     print_version();
     exit(0);
+  case 'W':
+    if (!argument)
+      global_system_variables.log_warnings++;
+    else if (argument == disabled_my_option)
+      global_system_variables.log_warnings= 0L;
+    else
+      global_system_variables.log_warnings= atoi(argument);
+    break;
   case 'I':
   case '?':
     usage();
@@ -4622,6 +4946,10 @@
     opt_specialflag|=SPECIAL_LONG_LOG_FORMAT;
     break;
   case (int) OPT_SKIP_NETWORKING:
+#if defined(__NETWARE__)
+    sql_perror("Can't start server: skip-networking option is currently not supported on
NetWare");
+    exit(1);
+#endif 
     opt_disable_networking=1;
     mysql_port=0;
     break;
@@ -4850,17 +5178,29 @@
     break;
   case OPT_LOWER_CASE_TABLE_NAMES:
     lower_case_table_names= argument ? atoi(argument) : 1;
+    lower_case_table_names_used= 1;
     break;
   }
   return 0;
 }
+
+
+void option_error_reporter(enum loglevel level, const char *format, ...)
+{
+  va_list args;
+  va_start(args, format);
+  vprint_msg_to_log(level, format, args);
+  va_end(args);
+}
+
 	/* Initiates DEBUG - but no debugging here ! */
 
 static void get_options(int argc,char **argv)
 {
   int ho_error;
 
-  if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
+  my_getopt_error_reporter= option_error_reporter;
+  if ((ho_error= handle_options(&argc, &argv, my_long_options, get_one_option)))
     exit(ho_error);
 
 #if defined(HAVE_BROKEN_REALPATH)
@@ -4903,6 +5243,29 @@
 }
 
 
+/*
+  Create version name for running mysqld version
+  We automaticly add suffixes -debug, -embedded and -log to the version
+  name to make the version more descriptive.
+  (MYSQL_SERVER_SUFFIX is set by the compilation environment)
+*/
+
+static void set_server_version(void)
+{
+  char *end= strxmov(server_version, MYSQL_SERVER_VERSION,
+                     MYSQL_SERVER_SUFFIX_STR, NullS);
+#ifdef EMBEDDED_LIBRARY
+  end= strmov(end, "-embedded");
+#endif
+#ifndef DBUG_OFF
+  if (!strstr(MYSQL_SERVER_SUFFIX_STR, "-debug"))
+    end= strmov(end, "-debug");
+#endif
+  if (opt_log || opt_update_log || opt_slow_log || opt_bin_log)
+    strmov(end, "-log");                        // This may slow down system
+}
+
+
 static char *get_relative_path(const char *path)
 {
   if (test_if_hard_path(path) &&
@@ -5014,14 +5377,16 @@
     rlimit.rlim_cur=rlimit.rlim_max=max_file_limit;
     if (setrlimit(RLIMIT_NOFILE,&rlimit))
     {
-      sql_print_error("Warning: setrlimit couldn't increase number of open files to more
than %lu (request: %u)",
-		      old_cur, max_file_limit);	/* purecov: inspected */
+      if (global_system_variables.log_warnings)
+	sql_print_error("Warning: setrlimit couldn't increase number of open files to more than
%lu (request: %u)",
+			old_cur, max_file_limit);	/* purecov: inspected */
       max_file_limit=old_cur;
     }
     else
     {
       (void) getrlimit(RLIMIT_NOFILE,&rlimit);
-      if ((uint) rlimit.rlim_cur != max_file_limit)
+      if ((uint) rlimit.rlim_cur != max_file_limit &&
+	  global_system_variables.log_warnings)
 	sql_print_error("Warning: setrlimit returned ok, but didn't change limits. Max open
files is %ld (request: %u)",
 			(ulong) rlimit.rlim_cur,
 			max_file_limit); /* purecov: inspected */
@@ -5046,10 +5411,12 @@
    // set new limit
    cbReqCount = max_file_limit - cbCurMaxFH0;
    ulrc = DosSetRelMaxFH( &cbReqCount, &cbCurMaxFH);
-   if (ulrc) {
-      sql_print_error("Warning: DosSetRelMaxFH couldn't increase number of open files to
more than %d",
-         cbCurMaxFH0);
-      cbCurMaxFH = cbCurMaxFH0;
+   if (ulrc)
+   {
+     if (global_system_variables.log_warnings)
+       sql_print_error("Warning: DosSetRelMaxFH couldn't increase number of open files to
more than %d",
+		       cbCurMaxFH0);
+     cbCurMaxFH = cbCurMaxFH0;
    }
 
    return cbCurMaxFH;
@@ -5135,6 +5502,7 @@
   File file;
   char buff[FN_REFLEN], buff2[FN_REFLEN];
   MY_STAT stat_info;
+  DBUG_ENTER("test_if_case_insensitive");
 
   fn_format(buff, glob_hostname, dir_name, ".lower-test",
 	    MY_UNPACK_FILENAME | MY_REPLACE_EXT | MY_REPLACE_DIR);
@@ -5144,13 +5512,14 @@
   if ((file= my_create(buff, 0666, O_RDWR, MYF(0))) < 0)
   {
     sql_print_error("Warning: Can't create test file %s", buff);
-    return -1;
+    DBUG_RETURN(-1);
   }
   my_close(file, MYF(0));
   if (my_stat(buff2, &stat_info, MYF(0)))
     result= 1;					// Can access file
   (void) my_delete(buff, MYF(MY_WME));
-  return result;
+  DBUG_PRINT("exit", ("result: %d", result));
+  DBUG_RETURN(result);
 }
 
 

--- 1.23/support-files/Makefile.am	2004-02-16 00:32:08 -08:00
+++ 1.24/support-files/Makefile.am	2005-04-16 12:15:18 -07:00
@@ -22,6 +22,7 @@
 			my-medium.cnf.sh \
 			my-large.cnf.sh \
 			my-huge.cnf.sh \
+			my-innodb-heavy-4G.cnf.sh \
 			mysql-log-rotate.sh \
 			mysql.server.sh \
 			binary-configure.sh \
@@ -34,6 +35,7 @@
 			my-medium.cnf \
 			my-large.cnf \
 			my-huge.cnf \
+			my-innodb-heavy-4G.cnf \
 			mysql-@VERSION@.spec \
 			MySQL-shared-compat.spec
 
@@ -44,6 +46,7 @@
 			my-medium.cnf \
 			my-large.cnf \
 			my-huge.cnf \
+			my-innodb-heavy-4G.cnf \
 			mysql.spec \
 			mysql-@VERSION@.spec \
 			mysql-log-rotate \

--- 1.287/BitKeeper/etc/logging_ok	2004-02-15 00:35:46 -08:00
+++ 1.288/BitKeeper/etc/logging_ok	2005-04-16 03:34:57 -07:00
@@ -2,23 +2,34 @@
 Administrator@co3064164-a.
 Administrator@stripped
 Administrator@fred.
+Greg@greg-laptop.
 Miguel@stripped
 Sinisa@stripped
+acurtis@stripped
 ahlentz@stripped
 akishkin@stripped
+antony@stripped
+antony@stripped
+arjen@stripped
 arjen@stripped
 arjen@stripped
 arjen@stripped
 bar@stripped
 bar@stripped
 bar@stripped
+bar@stripped
 bell@stripped
 bell@stripped
 bk@stripped
+brian@stripped
 carsten@stripped
 davida@stripped
+dean@stripped
+dellis@goetia.(none)
+dlenev@stripped
 dlenev@stripped
 dlenev@stripped
+gbichot@stripped
 gerberb@stripped
 gluh@gluh.(none)
 gluh@stripped
@@ -27,6 +38,7 @@
 guilhem@stripped
 gweir@stripped
 gweir@stripped
+hartmut@stripped
 heikki@stripped
 heikki@stripped
 heikki@rescue.
@@ -36,6 +48,10 @@
 hf@genie.(none)
 igor@stripped
 igor@stripped
+ingo@stripped
+jani@stripped
+jani@stripped
+jani@stripped
 jani@stripped
 jani@hynda.(none)
 jani@stripped
@@ -44,23 +60,32 @@
 jani@stripped
 jani@stripped
 jani@stripped
+jani@stripped
 jcole@stripped
 jcole@stripped
 jcole@stripped
 jcole@stripped
 jcole@stripped
+jimw@stripped
+joerg@stripped
 jorge@stripped
 jww@stripped
 jww@stripped
 jww@stripped
 kaj@stripped
+kent@stripped
 konstantin@stripped
 kostja@stripped
 lenz@stripped
 lenz@stripped
+marko@stripped
+mats@stripped
+matt@stripped
 miguel@hegel.(none)
 miguel@stripped
 miguel@stripped
+miguel@stripped
+miguel@stripped
 miguel@light.
 miguel@stripped
 miguel@stripped
@@ -82,13 +107,18 @@
 monty@stripped
 mwagner@stripped
 mwagner@stripped
+mwagner@stripped
 mwagner@stripped
 mysqldev@stripped
 nick@stripped
 nick@stripped
+patg@stripped
 paul@stripped
+paul@stripped
 paul@stripped
 paul@stripped
+paul@stripped
+paul@stripped
 paul@stripped
 pem@stripped
 peter@stripped
@@ -98,7 +128,9 @@
 ram@stripped
 ram@stripped
 ram@ram.(none)
+ramil@stripped
 ranger@stripped
+rburnett@stripped
 root@stripped
 salle@geopard.(none)
 salle@stripped
@@ -118,14 +150,18 @@
 tim@stripped
 tim@stripped
 tim@stripped
+tim@stripped
+tim@stripped
 tim@stripped
 tim@stripped
 tim@stripped
+timour@stripped
 tom@stripped
 tonu@stripped
 tonu@stripped
 tonu@stripped
 tonu@stripped
+ulli@morbus.(none)
 venu@stripped
 vva@stripped
 vva@genie.(none)

--- 1.25/libmysqld/Makefile.am	2003-12-05 21:23:08 -08:00
+++ 1.26/libmysqld/Makefile.am	2005-04-16 03:38:24 -07:00
@@ -46,7 +46,7 @@
 	item_uniq.cc key.cc lock.cc log.cc log_event.cc mf_iocache.cc\
 	mini_client.cc net_pkg.cc net_serv.cc opt_ft.cc opt_range.cc \
 	opt_sum.cc procedure.cc records.cc sql_acl.cc \
-	repl_failsafe.cc slave.cc sql_load.cc sql_olap.cc \
+	repl_failsafe.cc slave.cc sql_load.cc \
 	sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
 	sql_crypt.cc sql_db.cc sql_delete.cc sql_insert.cc sql_lex.cc \
 	sql_list.cc sql_manager.cc sql_map.cc set_var.cc sql_parse.cc \
@@ -71,29 +71,35 @@
 		@innodb_libs@ @bdb_libs_with_path@ \
 		$(top_builddir)/mysys/libmysys.a \
 		$(top_builddir)/strings/libmystrings.a \
-		$(top_builddir)/dbug/libdbug.a \
-		$(top_builddir)/regex/libregex.a
+		$(top_builddir)/dbug/libdbug.a
 
 #
-# To make it easy for the end user to use the embedded library we 
-# generate a total libmysqld.a from all library files, 
+# To make it easy for the end user to use the embedded library we
+# generate a total libmysqld.a from all library files,
 
 libmysqld.a:	libmysqld_int.a $(INC_LIB)
-		if test ! -d tmp ; then mkdir tmp ; fi
-		rm -f $@ libmysqld_int2.a tmp/*.o tmp/*.a
-		cp $(INC_LIB) tmp
-		cp libmysqld_int.a libmysqld_int2.a ; \
-		cd tmp ; \
-		for file in *.a ; do \
-		  bfile=`basename $$file .a` ; \
-		  ar x $$file; \
-		  for obj in *.o ; do mv $$obj $${bfile}_$$obj ; done ; \
-		  ar q ../libmysqld_int2.a *.o ; \
-		  rm -f *.o ; \
-		done
-		mv libmysqld_int2.a libmysqld.a
-		rm -f tmp/*
-		$(RANLIB) libmysqld.a
+		if test "$(host_os)" = "netware" ; \
+		then \
+		  $(libmysqld_a_AR) libmysqld.a libmysqld_int.a $(INC_LIB) ; \
+		else \
+		  if test ! -d tmp ; then mkdir tmp ; fi ; \
+		  rm -f $@ libmysqld_int2.a tmp/*.o tmp/*.a ; \
+		  cp $(INC_LIB) tmp ; \
+		  cp libmysqld_int.a libmysqld_int2.a ; \
+		  cd tmp ; \
+		  for file in *.a ; do \
+		    bfile=`basename $$file .a` ; \
+		    $(AR) x $$file; \
+		    for obj in *.o ; do mv $$obj $${bfile}_$$obj ; done ; \
+		    $(AR) q ../libmysqld_int2.a *.o ; \
+		    rm -f *.o ; \
+		  done ; \
+		  cd .. ; \
+		  mv libmysqld_int2.a libmysqld.a ; \
+		  rm -f tmp/* ; \
+		  $(RANLIB) libmysqld.a	; \
+		fi
+
 
 ## XXX: any time the client interface changes, we'll need to bump
 ## the version info for libmysqld; however, it's possible for the

--- 1.167/BitKeeper/etc/ignore	2004-02-29 01:48:37 -08:00
+++ 1.168/BitKeeper/etc/ignore	2005-04-16 03:34:57 -07:00
@@ -68,6 +68,7 @@
 Docs/safe-mysql.xml
 Docs/tex.fmt
 Docs/texi2dvi.out
+EXCEPTIONS-CLIENT
 INSTALL-SOURCE
 Logs/*
 MIRRORS
@@ -1795,6 +1796,7 @@
 repl-tests/test-repl/sum-wlen-slave.master.reje
 scripts/make_binary_distribution
 scripts/make_sharedlib_distribution
+scripts/make_win_binary_distribution
 scripts/make_win_src_distribution
 scripts/msql2mysql
 scripts/mysql_config
@@ -1878,6 +1880,7 @@
 support-files/MacOSX/preinstall
 support-files/binary-configure
 support-files/my-huge.cnf
+support-files/my-innodb-heavy-4G.cnf
 support-files/my-large.cnf
 support-files/my-medium.cnf
 support-files/my-small.cnf

--- 1.35/libmysql/Makefile.shared	2003-09-13 01:00:42 -07:00
+++ 1.36/libmysql/Makefile.shared	2005-04-16 03:38:24 -07:00
@@ -1,21 +1,24 @@
-## Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
-## 
-## This library is free software; you can redistribute it and/or
-## modify it under the terms of the GNU Library General Public
-## License as published by the Free Software Foundation; either
-## version 2 of the License, or (at your option) any later version.
-## 
-## This library 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
-## Library General Public License for more details.
-## 
-## You should have received a copy of the GNU Library General Public
-## License along with this library; if not, write to the Free
-## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-## MA 02111-1307, USA
-##
-## This file is public domain and comes with NO WARRANTY of any kind
+# Copyright (C) 2000-2004 MySQL AB
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 GNU General Public License as
+# published by the Free Software Foundation.
+#
+# There are special exceptions to the terms and conditions of the GPL as it
+# is applied to this software. View the full text of the exception in file
+# EXCEPTIONS-CLIENT in the directory of this software distribution.
+# 
+# This library 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
+# Library General Public License for more details.
+# 
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA
+#
+# This file is public domain and comes with NO WARRANTY of any kind
 
 MYSQLDATAdir =			$(localstatedir)
 MYSQLSHAREdir =			$(pkgdatadir)

--- 1.12/libmysql_r/Makefile.am	2003-12-05 21:23:07 -08:00
+++ 1.13/libmysql_r/Makefile.am	2005-04-16 03:38:24 -07:00
@@ -1,9 +1,12 @@
-# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+# Copyright (C) 2000-2004 MySQL AB
 # 
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 GNU General Public License as
+# published by the Free Software Foundation.
+#
+# There are special exceptions to the terms and conditions of the GPL as it
+# is applied to this software. View the full text of the exception in file
+# EXCEPTIONS-CLIENT in the directory of this software distribution.
 # 
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,11 +17,11 @@
 # License along with this library; if not, write to the Free
 # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 # MA 02111-1307, USA
-
-
+#
+# This file is public domain and comes with NO WARRANTY of any kind
 
 target = libmysqlclient_r.la
-target_defs = -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
+target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
 LIBS = @LIBS@ @openssl_libs@
 
 INCLUDES =	@MT_INCLUDES@ -I../include -I$(srcdir)/../include \
Thread
bk commit into 4.0 tree (jww:1.1659)jwythe16 Apr