summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2010-11-19 22:33:47 +0100
committerunknown <knielsen@knielsen-hq.org>2010-11-19 22:33:47 +0100
commit95b37a254b0797499b4a940ca8eb8fa907a7664f (patch)
treebcd57843b07d10746160f485e039446bf4bd616e /mysys
parent01d41622ba4cdb99327f98d0d1c1772ad842c66a (diff)
parenta967802ae94e1b0ce75436648446621a381838e7 (diff)
downloadmariadb-git-95b37a254b0797499b4a940ca8eb8fa907a7664f.tar.gz
Merge MariaDB 5.1->5.2
Diffstat (limited to 'mysys')
-rw-r--r--mysys/Makefile.am16
-rw-r--r--mysys/my_redel.c33
-rw-r--r--mysys/my_uuid.c2
3 files changed, 37 insertions, 14 deletions
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 95358883f4e..515791be7f1 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -19,10 +19,11 @@ MYSQLBASEdir= $(prefix)
INCLUDES = @ZLIB_INCLUDES@ -I$(top_builddir)/include \
-I$(top_srcdir)/include -I$(srcdir)
pkglib_LIBRARIES = libmysys.a
+noinst_LTLIBRARIES = libmysys.la
LDADD = libmysys.a $(top_builddir)/strings/libmystrings.a $(top_builddir)/dbug/libdbug.a
noinst_HEADERS = mysys_priv.h my_static.h my_handler_errors.h \
my_safehash.h
-libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
+libmysys_la_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
mf_path.c mf_loadpath.c my_file.c \
my_open.c my_create.c my_dup.c my_seek.c my_read.c \
my_pread.c my_write.c my_getpagesize.c \
@@ -57,19 +58,22 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
my_memmem.c stacktrace.c \
my_windac.c my_access.c base64.c my_libwrap.c \
wqueue.c
+libmysys_la_LDFLAGS = $(AM_LDFLAGS) @WRAPLIBS@
+libmysys_la_LIBADD = $(ZLIB_LIBS)
if NEED_THREAD
# mf_keycache is used only in the server, so it is safe to leave the file
# out of the non-threaded library.
# In fact, it will currently not compile without thread support.
-libmysys_a_SOURCES += mf_keycache.c mf_keycaches.c
+libmysys_la_SOURCES += thr_alarm.c thr_lock.c thr_mutex.c thr_rwlock.c \
+ my_pthread.c my_thr_init.c waiting_threads.c \
+ mf_keycache.c mf_keycaches.c
endif
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
thr_mutex.c thr_rwlock.c waiting_threads.c \
CMakeLists.txt mf_soundex.c \
my_conio.c my_wincond.c my_winthread.c
-libmysys_a_LIBADD = @THREAD_LOBJECTS@
# test_dir_DEPENDENCIES= $(LIBRARIES)
# testhash_DEPENDENCIES= $(LIBRARIES)
# test_charset_DEPENDENCIES= $(LIBRARIES)
@@ -83,8 +87,6 @@ DEFS = -DDEFAULT_BASEDIR='"$(prefix)"' \
-DDEFAULT_SYSCONFDIR='"$(sysconfdir)"' \
@DEFS@
-libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@
-
# I hope this always does the right thing. Otherwise this is only test programs
FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
@@ -95,6 +97,10 @@ CLEANFILES = test_bitmap$(EXEEXT) test_priority_queue$(EXEEXT) \
testhash$(EXEEXT) test_gethwaddr$(EXEEXT) \
test_base64$(EXEEXT) test_thr_mutex$(EXEEXT)
+libmysys_a_SOURCES=
+libmysys.a: libmysys.la
+ $(CP) .libs/libmysys.a $@
+
#
# The CP .. RM stuff is to avoid problems with some compilers (like alpha ccc)
# which automaticly removes the object files you use to compile a final program
diff --git a/mysys/my_redel.c b/mysys/my_redel.c
index cf0986a7821..2de989a2854 100644
--- a/mysys/my_redel.c
+++ b/mysys/my_redel.c
@@ -40,7 +40,8 @@ struct utimbuf {
#define REDEL_EXT ".BAK"
-int my_redel(const char *org_name, const char *tmp_name, myf MyFlags)
+int my_redel(const char *org_name, const char *tmp_name,
+ time_t backup_time_stamp, myf MyFlags)
{
int error=1;
DBUG_ENTER("my_redel");
@@ -51,13 +52,9 @@ int my_redel(const char *org_name, const char *tmp_name, myf MyFlags)
goto end;
if (MyFlags & MY_REDEL_MAKE_BACKUP)
{
- char name_buff[FN_REFLEN+20];
- char ext[20];
- ext[0]='-';
- get_date(ext+1,2+4,(time_t) 0);
- strmov(strend(ext),REDEL_EXT);
- if (my_rename(org_name, fn_format(name_buff, org_name, "", ext, 2),
- MyFlags))
+ char name_buff[FN_REFLEN + MY_BACKUP_NAME_EXTRA_LENGTH];
+ my_create_backup_name(name_buff, org_name, backup_time_stamp);
+ if (my_rename(org_name, name_buff, MyFlags))
goto end;
}
else if (my_delete_allow_opened(org_name, MyFlags))
@@ -149,3 +146,23 @@ int my_copystat(const char *from, const char *to, int MyFlags)
#endif
return 0;
} /* my_copystat */
+
+
+/**
+ Create a backup file name.
+ @fn my_create_backup_name()
+ @param to Store new file name here
+ @param from Original name
+
+ @info
+ The backup name is made by adding -YYMMDDHHMMSS.BAK to the file name
+*/
+
+void my_create_backup_name(char *to, const char *from, time_t backup_start)
+{
+ char ext[MY_BACKUP_NAME_EXTRA_LENGTH+1];
+ ext[0]='-';
+ get_date(ext+1, GETDATE_SHORT_DATE | GETDATE_HHMMSSTIME, backup_start);
+ strmov(strend(ext),REDEL_EXT);
+ strmov(strmov(to, from), ext);
+}
diff --git a/mysys/my_uuid.c b/mysys/my_uuid.c
index f115806b4e9..e2372391b06 100644
--- a/mysys/my_uuid.c
+++ b/mysys/my_uuid.c
@@ -50,7 +50,7 @@ static ulonglong uuid_time= 0;
static uchar uuid_suffix[2+6]; /* clock_seq and node */
#ifdef THREAD
-pthread_mutex_t LOCK_uuid_generator;
+static pthread_mutex_t LOCK_uuid_generator;
#endif
/*