Merge next-mr -> next-4284

This commit is contained in:
Konstantin Osipov 2009-12-03 14:37:42 +03:00
commit c659143c1e
251 changed files with 6916 additions and 3228 deletions

View file

@ -1,4 +1,4 @@
# Copyright (C) 2006 MySQL AB
# Copyright (C) 2006 MySQL AB, 2009 Sun Microsystems, Inc
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -41,7 +41,8 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c default_
rijndael.c safemalloc.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c
thr_rwlock.c tree.c typelib.c my_vle.c base64.c my_memmem.c my_getpagesize.c
lf_alloc-pin.c lf_dynarray.c lf_hash.c
my_atomic.c my_getncpus.c)
my_atomic.c my_getncpus.c
my_rdtsc.c)
IF(NOT SOURCE_SUBLIBS)
ADD_LIBRARY(mysys ${MYSYS_SOURCES})

View file

@ -16,7 +16,8 @@
MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
INCLUDES = @ZLIB_INCLUDES@ -I$(top_builddir)/include \
INCLUDES = @ZLIB_INCLUDES@ @RDTSC_SPARC_ASSEMBLY@ \
-I$(top_builddir)/include \
-I$(top_srcdir)/include -I$(srcdir)
pkglib_LIBRARIES = libmysys.a
LDADD = libmysys.a $(top_builddir)/strings/libmystrings.a $(top_builddir)/dbug/libdbug.a
@ -53,7 +54,8 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
my_gethostbyname.c rijndael.c my_aes.c sha1.c \
my_handler.c my_netware.c my_largepage.c \
my_memmem.c stacktrace.c \
my_windac.c my_access.c base64.c my_libwrap.c
my_windac.c my_access.c base64.c my_libwrap.c \
my_rdtsc.c
if NEED_THREAD
# mf_keycache is used only in the server, so it is safe to leave the file
@ -65,7 +67,9 @@ endif
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
thr_mutex.c thr_rwlock.c \
CMakeLists.txt mf_soundex.c \
my_conio.c my_wincond.c my_winthread.c my_winerr.c my_winfile.c
my_conio.c my_wincond.c my_winthread.c my_winerr.c \
my_winfile.c \
my_timer_cycles.il
libmysys_a_LIBADD = @THREAD_LOBJECTS@
# test_dir_DEPENDENCIES= $(LIBRARIES)
# testhash_DEPENDENCIES= $(LIBRARIES)

View file

@ -37,7 +37,7 @@ int my_delete(const char *name, myf MyFlags)
} /* my_delete */
#if defined(__WIN__)
/*
/**
Delete file which is possibly not closed.
This function is intended to be used exclusively as a temporal solution
@ -53,6 +53,20 @@ int my_delete(const char *name, myf MyFlags)
renamed to <name>.<num>.deleted where <name> - the initial name of the
file, <num> - a hexadecimal number chosen to make the temporal name to
be unique.
@param the name of the being deleted file
@param the flags instructing how to react on an error internally in
the function
@note The per-thread @c my_errno holds additional info for a caller to
decide how critical the error can be.
@retval
0 ok
@retval
1 error
*/
int nt_share_delete(const char *name, myf MyFlags)
{
@ -63,6 +77,7 @@ int nt_share_delete(const char *name, myf MyFlags)
for (cnt= GetTickCount(); cnt; cnt--)
{
errno= 0;
sprintf(buf, "%s.%08X.deleted", name, cnt);
if (MoveFile(name, buf))
break;
@ -78,15 +93,23 @@ int nt_share_delete(const char *name, myf MyFlags)
name, buf, errno));
break;
}
if (DeleteFile(buf))
DBUG_RETURN(0);
my_errno= GetLastError();
if (errno == ERROR_FILE_NOT_FOUND)
{
my_errno= ENOENT; // marking, that `name' doesn't exist
}
else if (errno == 0)
{
if (DeleteFile(buf))
DBUG_RETURN(0);
else if ((my_errno= GetLastError()) == 0)
my_errno= ENOENT; // marking, that `buf' doesn't exist
} else
my_errno= errno;
if (MyFlags & (MY_FAE+MY_WME))
my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)),
name, my_errno);
my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)),
name, my_errno);
DBUG_RETURN(-1);
}
#endif

1004
mysys/my_rdtsc.c Normal file

File diff suppressed because it is too large Load diff

38
mysys/my_timer_cycles.il Normal file
View file

@ -0,0 +1,38 @@
/* Copyright (C) 2008 Sun Microsystems, Inc
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Sun Studio SPARC inline templates for cycle timer */
/* Sun Studio i386 and x86_64 inline templates for cycle timer */
/* I didn't say ".volatile" or ".nonvolatile". */
.inline my_timer_cycles_il_sparc64,0
rd %tick,%o0
.end
.inline my_timer_cycles_il_sparc32,0
rd %tick,%o2
srlx %o2,32,%o0
sra %o2,0,%o1
.end
.inline my_timer_cycles_il_i386,0
rdtsc
.end
.inline my_timer_cycles_il_x86_64,0
rdtsc
shlq $32,%rdx
orq %rdx,%rax
.end