summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorSeppo Jaakola <seppo.jaakola@codership.com>2013-05-26 11:26:58 +0300
committerSeppo Jaakola <seppo.jaakola@codership.com>2013-05-26 11:26:58 +0300
commitbd0eae595fc5d050913ea01bd4c6a8e47f379176 (patch)
treedc2915fa2f49d6c015d7f6f4d54fda9ae0ae046e /mysys
parent9d1546fe2cdced5efb4af831fa2e560b7f80fb54 (diff)
parentcb246b20d6e0dad16797b9e09bef6f0431b88d37 (diff)
downloadmariadb-git-bd0eae595fc5d050913ea01bd4c6a8e47f379176.tar.gz
References: MDEV-4572 - merge with mariaDB 5.5.31
bzr merge lp:maria/5.5 -rtag:mariadb-5.5.31 Text conflict in cmake/cpack_rpm.cmake Text conflict in debian/dist/Debian/control Text conflict in debian/dist/Ubuntu/control Text conflict in sql/CMakeLists.txt Conflict adding file sql/db.opt. Moved existing file to sql/db.opt.moved. Conflict adding file sql/db.opt.moved. Moved existing file to sql/db.opt.moved.moved. Text conflict in sql/mysqld.cc Text conflict in support-files/mysql.spec.sh 8 conflicts encountered.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/default.c2
-rw-r--r--mysys/errors.c2
-rw-r--r--mysys/mf_format.c2
-rw-r--r--mysys/mf_keycache.c3
-rw-r--r--mysys/my_lockmem.c2
-rw-r--r--mysys/my_malloc.c12
-rw-r--r--mysys/my_once.c2
-rw-r--r--mysys/my_thr_init.c2
-rw-r--r--mysys/my_write.c2
-rw-r--r--mysys/thr_alarm.c21
10 files changed, 25 insertions, 25 deletions
diff --git a/mysys/default.c b/mysys/default.c
index 0ba7ed494af..fa9576d16f2 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -826,7 +826,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
continue;
/* Configuration File Directives */
- if ((*ptr == '!'))
+ if (*ptr == '!')
{
if (recursion_level >= max_recursion_level)
{
diff --git a/mysys/errors.c b/mysys/errors.c
index 1063cae8856..84b406792af 100644
--- a/mysys/errors.c
+++ b/mysys/errors.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2010, Oracle and/or its affiliates
+ Copyright (c) 2000, 2013, Oracle and/or its affiliates
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
diff --git a/mysys/mf_format.c b/mysys/mf_format.c
index 2b2356c08df..d20ce882459 100644
--- a/mysys/mf_format.c
+++ b/mysys/mf_format.c
@@ -46,7 +46,7 @@ char * fn_format(char * to, const char *name, const char *dir,
else if ((flag & MY_RELATIVE_PATH) && !test_if_hard_path(dev))
{
/* Put 'dir' before the given path */
- strmake(buff,dev,sizeof(buff)-1);
+ strmake_buf(buff, dev);
pos=convert_dirname(dev,dir,NullS);
strmake(pos,buff,sizeof(buff)-1- (int) (pos-dev));
}
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 30f269454c2..5b52998f3ca 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -553,7 +553,8 @@ int init_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache, uint key_cache_block_si
if (blocks < 8)
{
my_errno= ENOMEM;
- my_error(EE_OUTOFMEMORY, MYF(0), blocks * keycache->key_cache_block_size);
+ my_error(EE_OUTOFMEMORY, MYF(ME_FATALERROR),
+ blocks * keycache->key_cache_block_size);
goto err;
}
blocks= blocks / 4*3;
diff --git a/mysys/my_lockmem.c b/mysys/my_lockmem.c
index 8f06192d9f8..2e036936c70 100644
--- a/mysys/my_lockmem.c
+++ b/mysys/my_lockmem.c
@@ -43,7 +43,7 @@ uchar *my_malloc_lock(uint size,myf MyFlags)
if (!(ptr=memalign(pagesize,size)))
{
if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size);
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG+ME_FATALERROR), size);
DBUG_RETURN(0);
}
success = mlock((uchar*) ptr,size);
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index 1a9caf71380..570ab9675ee 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -44,6 +44,11 @@ void *my_malloc(size_t size, myf my_flags)
my_free(point);
point= NULL;
});
+ DBUG_EXECUTE_IF("simulate_persistent_out_of_memory",
+ {
+ free(point);
+ point= NULL;
+ });
if (point == NULL)
{
@@ -51,9 +56,8 @@ void *my_malloc(size_t size, myf my_flags)
if (my_flags & MY_FAE)
error_handler_hook=fatal_error_handler_hook;
if (my_flags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY,
- MYF(ME_BELL | ME_WAITTANG | ME_NOREFRESH | (my_flags & ME_JUST_INFO)),
- size);
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_WAITTANG +
+ ME_NOREFRESH + ME_FATALERROR),size);
DBUG_EXECUTE_IF("simulate_out_of_memory",
DBUG_SET("-d,simulate_out_of_memory"););
if (my_flags & MY_FAE)
@@ -94,7 +98,7 @@ void *my_realloc(void *oldpoint, size_t size, myf my_flags)
DBUG_RETURN(oldpoint);
my_errno=errno;
if (my_flags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), size);
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_WAITTANG + ME_FATALERROR), size);
}
DBUG_PRINT("exit",("ptr: %p", point));
DBUG_RETURN(point);
diff --git a/mysys/my_once.c b/mysys/my_once.c
index 7df9b0a1981..b9232db9b2e 100644
--- a/mysys/my_once.c
+++ b/mysys/my_once.c
@@ -59,7 +59,7 @@ void* my_once_alloc(size_t Size, myf MyFlags)
{
my_errno=errno;
if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),get_size);
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG+ME_FATALERROR), get_size);
return((uchar*) 0);
}
DBUG_PRINT("test",("my_once_malloc %lu byte malloced", (ulong) get_size));
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index ac16189f3a7..b9ad379f4c4 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -446,7 +446,7 @@ const char *my_thread_name(void)
{
my_thread_id id= my_thread_dbug_id();
sprintf(name_buff,"T@%lu", (ulong) id);
- strmake(tmp->name,name_buff,THREAD_NAME_SIZE);
+ strmake_buf(tmp->name, name_buff);
}
return tmp->name;
}
diff --git a/mysys/my_write.c b/mysys/my_write.c
index 4997a4a804a..10a500c3fb3 100644
--- a/mysys/my_write.c
+++ b/mysys/my_write.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
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
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index 9c21033eca4..7fd87edda6c 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -66,6 +66,8 @@ static QUEUE alarm_queue;
static uint max_used_alarms=0;
pthread_t alarm_thread;
+#define MY_THR_ALARM_QUEUE_EXTENT 10
+
#ifdef USE_ALARM_THREAD
static void *alarm_handler(void *arg);
#define reschedule_alarms() mysql_cond_signal(&COND_alarm)
@@ -89,7 +91,8 @@ void init_thr_alarm(uint max_alarms)
alarm_aborted=0;
next_alarm_expire_time= ~ (time_t) 0;
init_queue(&alarm_queue, max_alarms+1, offsetof(ALARM,expire_time), 0,
- compare_ulong, NullS, offsetof(ALARM, index_in_queue)+1, 0);
+ compare_ulong, NullS, offsetof(ALARM, index_in_queue)+1,
+ MY_THR_ALARM_QUEUE_EXTENT);
sigfillset(&full_signal_set); /* Neaded to block signals */
mysql_mutex_init(key_LOCK_alarm, &LOCK_alarm, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_COND_alarm, &COND_alarm, NULL);
@@ -140,7 +143,10 @@ void resize_thr_alarm(uint max_alarms)
than max_alarms
*/
if (alarm_queue.elements < max_alarms)
+ {
resize_queue(&alarm_queue,max_alarms+1);
+ max_used_alarms= alarm_queue.elements;
+ }
mysql_mutex_unlock(&LOCK_alarm);
}
@@ -209,16 +215,10 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
mysql_mutex_lock(&LOCK_alarm); /* Lock from threads & alarms */
if (alarm_queue.elements >= max_used_alarms)
{
- if (alarm_queue.elements == alarm_queue.max_elements)
- {
- DBUG_PRINT("info", ("alarm queue full"));
- fprintf(stderr,"Warning: thr_alarm queue is full\n");
- goto abort;
- }
max_used_alarms=alarm_queue.elements+1;
}
reschedule= (ulong) next_alarm_expire_time > (ulong) next;
- queue_insert(&alarm_queue,(uchar*) alarm_data);
+ queue_insert_safe(&alarm_queue, (uchar*) alarm_data);
assert(alarm_data->index_in_queue > 0);
/* Reschedule alarm if the current one has more than sec left */
@@ -238,11 +238,6 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
(*alrm)= &alarm_data->alarmed;
DBUG_RETURN(0);
-abort:
- if (alarm_data->malloced)
- my_free(alarm_data);
- mysql_mutex_unlock(&LOCK_alarm);
- one_signal_hand_sigmask(SIG_SETMASK,&old_mask,NULL);
abort_no_unlock:
*alrm= 0; /* No alarm */
DBUG_RETURN(1);