2009-11-30 17:49:15 -07:00
|
|
|
# Copyright (C) 2000-2004 MySQL AB, 2008-2009 Sun Microsystems, Inc.
|
2004-08-05 11:59:17 +02:00
|
|
|
#
|
|
|
|
# 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
|
2004-08-05 17:05:11 +02:00
|
|
|
# EXCEPTIONS-CLIENT in the directory of this software distribution.
|
2004-08-05 11:59:17 +02:00
|
|
|
#
|
|
|
|
# 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
|
2000-08-18 14:49:31 -04:00
|
|
|
|
|
|
|
MYSQLDATAdir = $(localstatedir)
|
|
|
|
MYSQLSHAREdir = $(pkgdatadir)
|
|
|
|
MYSQLBASEdir= $(prefix)
|
2010-08-09 11:32:50 +03:00
|
|
|
pkgplugindir = $(pkglibdir)/plugin
|
2000-08-18 14:49:31 -04:00
|
|
|
## We'll use CLIENT_EXTRA_LDFLAGS for threaded and non-threaded
|
|
|
|
## until someone complains that they need separate options.
|
|
|
|
LDADD = @CLIENT_EXTRA_LDFLAGS@ $(target)
|
|
|
|
pkglib_LTLIBRARIES = $(target)
|
|
|
|
|
|
|
|
noinst_PROGRAMS = conf_to_src
|
|
|
|
|
|
|
|
|
2009-10-16 00:53:21 +04:00
|
|
|
target_sources = libmysql.c password.c \
|
2002-07-23 18:31:22 +03:00
|
|
|
get_password.c errmsg.c
|
2000-08-18 14:49:31 -04:00
|
|
|
|
2002-01-02 21:29:41 +02:00
|
|
|
mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
|
2009-12-22 19:23:13 +03:00
|
|
|
strmake.lo strend.lo \
|
2000-08-18 14:49:31 -04:00
|
|
|
strnlen.lo strfill.lo is_prefix.lo \
|
2010-07-23 17:17:14 -03:00
|
|
|
int2str.lo str2int.lo strcont.lo \
|
Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings
generated by GCC 4.4.4 -Wall and -Wextra flags.
One major source of warnings was the in-house function my_bcmp
which (unconventionally) took pointers to unsigned characters
as the byte sequences to be compared. Since my_bcmp and bcmp
are deprecated functions whose only difference with memcmp is
the return value, every use of the function is replaced with
memcmp as the special return value wasn't actually being used
by any caller.
There were also various other warnings, mostly due to type
mismatches, missing return values, missing prototypes, dead
code (unreachable) and ignored return values.
BUILD/SETUP.sh:
Remove flags that are implied by -Wall and -Wextra.
Do not warn about unused parameters in C++.
BUILD/check-cpu:
Print only the compiler version instead of verbose banner.
Although the option is gcc specific, the check was only
being used for GCC specific checks anyway.
client/mysql.cc:
bcmp is no longer defined.
client/mysqltest.cc:
Pass a string to function expecting a format string.
Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
Always define _GNU_SOURCE when compiling GNU readline.
Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
Condition for the code to be meaningful.
configure.in:
Remove check for bcmp.
extra/comp_err.c:
Use appropriate type.
extra/replace.c:
Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
Do not ignore the return value of fgets. Retrieve the file
position if fgets succeed -- if it fails, the function will
bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
Use a single array instead of accessing positions of the sbox_
through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
Do not define type within a anonymous union.
Use a variable to return a value instead of
leaving the result in a register -- compiler
does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
Define handler for pure virtual functions.
Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
Function must have C language linkage.
include/m_string.h:
Remove check which relied on bcmp being defined -- they weren't
being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
Remove bogus helpers which were used only in a few files and
were causing warnings about dead code.
include/my_global.h:
Due to G++ bug, always silence false-positive uninitialized
variables warnings when compiling C++ code with G++.
Remove bogus helper.
libmysql/Makefile.shared:
Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
Leave space of the ending nul.
mysys/mf_pack.c:
Replace bcmp with memcmp.
mysys/my_bitmap.c:
Dead code removal.
mysys/my_gethwaddr.c:
Remove unused variable.
mysys/my_getopt.c:
Silence bogus uninitialized variable warning.
Do not cast away the constant qualifier.
mysys/safemalloc.c:
Cast to expected type.
mysys/thr_lock.c:
Silence bogus uninitialized variable warning.
sql/field.cc:
Replace bogus helper with a more appropriate logic which is
used throughout the code.
sql/item.cc:
Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
Simplify code to avoid signedness related warnings.
sql/log_event.cc:
Replace use of bcmp with memcmp.
No need to use helpers for simple bit operations.
sql/log_event_old.cc:
Replace bmove_align with memcpy.
sql/mysqld.cc:
Move use declaration of variable to the ifdef block where it
is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
Cast to expected type and silence bogus warning.
sql/sql_class.h:
Don't use enum values as bit flags, the supposed type safety is
bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
Only declare variable when necessary.
sql/unireg.h:
Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
Silence bogus warning.
storage/myisam/mi_open.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
storage/myisam/mi_page.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
strings/bcmp.c:
Remove built-in bcmp.
strings/ctype-ucs2.c:
Silence bogus warning.
tests/mysql_client_test.c:
Use a appropriate type as expected by simple_command().
2010-07-02 15:30:47 -03:00
|
|
|
strcend.lo ctype-latin1.lo \
|
2000-08-18 14:49:31 -04:00
|
|
|
bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \
|
2003-01-14 14:28:36 +02:00
|
|
|
strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \
|
2002-10-23 15:40:22 +05:00
|
|
|
ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \
|
2005-01-12 02:58:15 -08:00
|
|
|
ctype-big5.lo ctype-czech.lo ctype-cp932.lo ctype-eucjpms.lo ctype-euc_kr.lo \
|
2003-01-29 15:08:09 +04:00
|
|
|
ctype-win1250ch.lo ctype-utf8.lo ctype-extra.lo \
|
2003-05-21 15:29:44 +05:00
|
|
|
ctype-ucs2.lo ctype-gb2312.lo ctype-gbk.lo \
|
2004-03-24 16:16:08 +04:00
|
|
|
ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo \
|
2009-12-22 19:23:13 +03:00
|
|
|
ctype-uca.lo xml.lo my_strtoll10.lo str_alloc.lo dtoa.lo
|
2002-03-19 20:03:10 +04:00
|
|
|
|
2002-08-06 22:20:11 +03:00
|
|
|
mystringsextra= strto.c
|
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.
Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.
Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost.
The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.
Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.
client/mysqldump.c:
Pass my_free directly as its signature is compatible with the
callback type -- which wasn't the case for free_table_ent.
2010-07-08 18:20:08 -03:00
|
|
|
dbugobjects = dbug.lo
|
2000-08-18 14:49:31 -04:00
|
|
|
mysysheaders = mysys_priv.h my_static.h
|
2003-08-27 02:51:39 +03:00
|
|
|
vioheaders = vio_priv.h
|
2010-07-09 08:18:36 -03:00
|
|
|
mysysobjects1 = my_init.lo my_static.lo my_malloc.lo \
|
2000-10-05 01:00:36 +03:00
|
|
|
my_create.lo my_delete.lo mf_tempfile.lo my_open.lo \
|
2004-02-19 19:33:09 +02:00
|
|
|
my_file.lo my_read.lo my_write.lo errors.lo \
|
2000-08-18 14:49:31 -04:00
|
|
|
my_error.lo my_getwd.lo my_div.lo \
|
2010-05-31 09:27:10 -03:00
|
|
|
mf_pack.lo my_mess.lo mf_dirname.lo mf_fn_ext.lo\
|
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.
Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.
Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost.
The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.
Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.
client/mysqldump.c:
Pass my_free directly as its signature is compatible with the
callback type -- which wasn't the case for free_table_ent.
2010-07-08 18:20:08 -03:00
|
|
|
mf_wcomp.lo typelib.lo my_alloc.lo \
|
2000-08-18 14:49:31 -04:00
|
|
|
mf_format.lo mf_path.lo mf_unixpath.lo my_fopen.lo \
|
Bug #20748: Configuration files should not be read more than once
A user could not override system-wide settings in their ~/.my.cnf,
because the DEFAULT_SYSCONFDIR was being searched last. Also, in
some configurations (especially when the --sysconfdir compile-time
option is set to /etc or /etc/mysql), the system-wide my.cnf file
was read multiple times, causing confusion and potential problems.
Rearrange default directories to conform to the manual and logic.
Move --sysconfdir=<path> (DEFAULT_SYSCONFDIR) from the last default
directory to the middle of the list. $HOME/.my.cnf should be last,
so the user is able to override the system-wide settings.
Change init_default_directories() to remove duplicates from the
list.
include/my_sys.h:
Add array_append_string_unique(), from mf_arr_appstr.c
libmysql/Makefile.shared:
Add new mf_arr_appstr.lo object
mysys/CMakeLists.txt:
Add new mf_arr_appstr.c source.
mysys/Makefile.am:
Add new mf_arr_appstr.c source.
mysys/default.c:
Change order in which defaults files are added to default_directories,
in order to conform to the manual (and to common sense). This fixes
a particularly bad problem on Unix, where ~/.my.cnf was read before
/usr/local/etc/my.cnf.
Also, don't add duplicate entries; move the existing entry to the
end of the list instead.
Here is a comparison of the order of defaults files, BEFORE and AFTER
this patch.
On Windows:
BEFORE: C:\, GetWindowsDirectory(), GetSystemWindowsDirectory(),
$MYSQL_HOME, defaults-extra-file, INSTALLDIR
AFTER: GetSystemWindowsDirectory(), GetWindowsDirectory(), C:\,
INSTALLDIR, $MYSQL_HOME, defaults-extra-file
GetSystemWindowsDirectory() is moved before GetWindowsDirectory() because
the former is shared by all Terminal Services users, while the latter is
private for each user.
On Netware (no change):
BEFORE: sys:/etc/, $MYSQL_HOME, defaults-extra-file
AFTER: sys:/etc, $MYSQL_HOME, defaults-extra-file
On OS/2:
BEFORE: $ETC, /etc, $MYSQL_HOME, defaults-extra-file
AFTER: /etc, $ETC, $MYSQL_HOME, defaults-extra-file
On everything else (general Unix):
BEFORE: /etc, $MYSQL_HOME, defaults-extra-file, ~/, --sysconfdir
AFTER: /etc/, --sysconfdir, $MYSQL_HOME, defaults-extra-file, ~/
The BEFORE code added --sysconfdir on all systems, but only the
Unix build system actually defined a value for it.
mysys/mf_arr_appstr.c:
BitKeeper file /home/tsmith/m/bk/build/50-b20748/mysys/mf_arr_appstr.c
2007-11-07 15:23:50 -07:00
|
|
|
my_symlink.lo my_fstream.lo mf_arr_appstr.lo \
|
2000-08-18 14:49:31 -04:00
|
|
|
mf_loadpath.lo my_pthread.lo my_thr_init.lo \
|
2010-07-23 17:14:35 -03:00
|
|
|
thr_mutex.lo mulalloc.lo string.lo default.lo \
|
|
|
|
my_compress.lo array.lo my_once.lo list.lo \
|
2003-10-06 22:56:34 +03:00
|
|
|
charset.lo charset-def.lo hash.lo mf_iocache.lo \
|
2003-01-28 08:38:28 +02:00
|
|
|
mf_iocache2.lo my_seek.lo my_sleep.lo \
|
2005-01-25 18:32:09 +02:00
|
|
|
my_pread.lo mf_cache.lo md5.lo sha1.lo \
|
|
|
|
my_getopt.lo my_gethostbyname.lo my_port.lo \
|
2009-11-30 17:49:15 -07:00
|
|
|
my_rename.lo my_chsize.lo my_sync.lo \
|
|
|
|
my_getsystime.lo my_symlink2.lo mf_same.lo
|
2002-07-23 18:31:22 +03:00
|
|
|
sqlobjects = net.lo
|
2010-08-09 11:32:50 +03:00
|
|
|
sql_cmn_objects = pack.lo client.lo my_time.lo client_plugin.lo
|
2001-08-29 09:13:29 +03:00
|
|
|
|
2000-08-18 14:49:31 -04:00
|
|
|
# Not needed in the minimum library
|
2007-10-17 20:08:58 +04:00
|
|
|
mysysobjects2 = my_lib.lo mf_qsort.lo
|
2000-08-18 14:49:31 -04:00
|
|
|
mysysobjects = $(mysysobjects1) $(mysysobjects2)
|
2002-06-28 09:18:23 +03:00
|
|
|
target_libadd = $(mysysobjects) $(mystringsobjects) $(dbugobjects) \
|
2003-04-23 19:37:33 +05:00
|
|
|
$(sql_cmn_objects) $(vio_objects) $(sqlobjects)
|
2010-08-09 11:32:50 +03:00
|
|
|
target_ldflags = -version-info @SHARED_LIB_VERSION@ @LD_VERSION_SCRIPT@ @LIBDL@
|
2001-07-24 14:07:46 +08:00
|
|
|
vio_objects= vio.lo viosocket.lo viossl.lo viosslfactories.lo
|
2007-03-27 23:56:48 +02:00
|
|
|
|
|
|
|
BUILT_SOURCES = link_sources
|
|
|
|
|
2000-08-18 14:49:31 -04:00
|
|
|
CLEANFILES = $(target_libadd) $(SHLIBOBJS) \
|
2007-03-27 23:56:48 +02:00
|
|
|
$(target) $(BUILT_SOURCES)
|
2010-08-09 11:32:50 +03:00
|
|
|
DEFS = -DDEFAULT_CHARSET_HOME='"$(MYSQLBASEdir)"' \
|
|
|
|
-DMYSQL_DATADIR='"$(MYSQLDATAdir)"' \
|
2005-01-04 20:13:47 +02:00
|
|
|
-DDEFAULT_HOME_ENV=MYSQL_HOME \
|
2010-08-09 11:32:50 +03:00
|
|
|
-DPLUGINDIR='"$(pkgplugindir)"' \
|
2005-07-18 15:33:18 +03:00
|
|
|
-DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \
|
2010-08-09 11:32:50 +03:00
|
|
|
-DDEFAULT_SYSCONFDIR='"$(sysconfdir)"' \
|
|
|
|
-DSHAREDIR='"$(MYSQLSHAREdir)"' -DDISABLE_DTRACE \
|
2008-12-20 11:01:41 +01:00
|
|
|
$(target_defs)
|
2000-08-18 14:49:31 -04:00
|
|
|
|
2006-04-03 12:07:18 +02:00
|
|
|
if HAVE_YASSL
|
2006-11-27 21:15:25 +01:00
|
|
|
yassl_las = $(top_builddir)/extra/yassl/src/libyassl.la \
|
|
|
|
$(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
|
2006-04-03 12:07:18 +02:00
|
|
|
endif
|
|
|
|
|
2000-08-18 14:49:31 -04:00
|
|
|
# The automatic dependencies miss this
|
2002-03-19 20:03:10 +04:00
|
|
|
#bmove_upp.lo: $(LTCHARSET_OBJS)
|
2000-08-18 14:49:31 -04:00
|
|
|
|
|
|
|
clean-local:
|
|
|
|
rm -f `echo $(mystringsobjects) | sed "s;\.lo;.c;g"` \
|
|
|
|
`echo $(dbugobjects) | sed "s;\.lo;.c;g"` \
|
|
|
|
`echo $(mysysobjects) | sed "s;\.lo;.c;g"` \
|
2002-12-27 17:37:55 +01:00
|
|
|
`echo $(vio_objects) | sed "s;\.lo;.c;g"` \
|
2003-04-23 19:37:33 +05:00
|
|
|
`echo $(sql_cmn_objects) | sed "s;\.lo;.c;g"` \
|
2002-12-27 17:37:55 +01:00
|
|
|
$(CHARSET_SRCS) $(CHARSET_OBJS) \
|
2007-03-27 23:56:48 +02:00
|
|
|
$(mystringsextra) $(mysysheaders) $(vioheaders) \
|
"After Monty's review" changes to the fix for BUG#8325 "Deadlock in replication thread stops replication":
s/sleep/safe_sleep (thread safe); sleep 0/1/2/3/4/5/5/5 (get slave less late);
no message on error log (deadlock is too common sometimes), a global counter
instead (SHOW STATUS LIKE 'slave_retried_transactions').
Plus a fix for libmysql/Makefile.shared
libmysql/Makefile.shared:
When we "make clean" in libmysql/ we remove the symlinks there, so we
need to mark that they have to be recreated later: this is done by removing
../linked_libmysql_sources. If we don't do this, 'make' will fail after 'cd libmysql;make clean'.
This Makefile.shared is used by libmysql_r too.
No reason to remove linked_client_sources as we don't remove the links in client/.
mysql-test/r/rpl_deadlock.result:
result fix
mysql-test/t/rpl_deadlock.test:
small test addition
sql/mysqld.cc:
if active_mi could not be alloced, die. New SHOW STATUS LIKE "slave_retried_transactions".
sql/slave.cc:
If slave retries automatically a transaction, no message on error log
(too common situation); sleep 0 secs at first retry, then 1, 2, 3, 4,
5, 5, 5... Sleeping 0 is to get the least possible late, as deadlocks
are usually resolved at first try. New global counter rli->retried_trans
(for SHOW STATUS: total number of times the slave had to retry
any transaction). safe_sleep() is thread-safe, sleep() was not.
I change the rli->trans_retries counter to go from 0 to max instead
of the other way (better for new sleep()).
sql/slave.h:
new global counter rli->retried_trans
sql/sql_show.cc:
SHOW STATUS LIKE "slave_retried_transactions"; needs replication mutexes.
Can't be a simple SHOW_LONG, because active_mi is unset (not alloced yet)
when the static global status_vars is created (active_mi is set
in init_slave()).
sql/structs.h:
new SHOW_SLAVE_RETRIED_TRANS
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
2005-03-23 19:19:36 +01:00
|
|
|
net.c
|
2000-08-18 14:49:31 -04:00
|
|
|
|
|
|
|
conf_to_src_SOURCES = conf_to_src.c
|
|
|
|
conf_to_src_LDADD=
|
2001-04-18 02:53:21 +03:00
|
|
|
#force static linking of conf_to_src - essential when linking against
|
|
|
|
#custom installation of libc
|
|
|
|
conf_to_src_LDFLAGS=@NOINST_LDFLAGS@
|