diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-06-06 17:51:28 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-06-06 17:51:28 +0200 |
commit | 4749d40c635634e25e07d28ce1a04e9263bcc375 (patch) | |
tree | c5bb3287675cd8676d76c8ee42ef2d79cc599e25 /mysys | |
parent | 1ff1cb10fc236010b5969058cab934c2b306c931 (diff) | |
parent | 33ef993773449cb3917665b188f6b6575d399bd0 (diff) | |
download | mariadb-git-4749d40c635634e25e07d28ce1a04e9263bcc375.tar.gz |
5.5 merge
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/errors.c | 4 | ||||
-rw-r--r-- | mysys/mf_format.c | 2 | ||||
-rw-r--r-- | mysys/mf_keycache.c | 3 | ||||
-rw-r--r-- | mysys/my_lockmem.c | 2 | ||||
-rw-r--r-- | mysys/my_malloc.c | 10 | ||||
-rw-r--r-- | mysys/my_once.c | 2 | ||||
-rw-r--r-- | mysys/my_thr_init.c | 2 | ||||
-rw-r--r-- | mysys/my_write.c | 2 | ||||
-rw-r--r-- | mysys/thr_alarm.c | 21 |
9 files changed, 21 insertions, 27 deletions
diff --git a/mysys/errors.c b/mysys/errors.c index ebbdc410901..11e7d04e79e 100644 --- a/mysys/errors.c +++ b/mysys/errors.c @@ -1,6 +1,6 @@ /* - Copyright (c) 2000, 2010, Oracle and/or its affiliates - Copyright (c) 1995, 2012 Monty Program Ab + Copyright (c) 2000, 2013, Oracle and/or its affiliates + Copyright (c) 1995, 2013, Monty Program Ab 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 5a84b051a23..2f3a5276a59 100644 --- a/mysys/my_malloc.c +++ b/mysys/my_malloc.c @@ -1,5 +1,6 @@ /* Copyright (c) 2000, 2010, Oracle and/or its affiliates + Copyright (c) 2009, 2013, Monty Program Ab. 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 @@ -104,11 +105,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); - DBUG_EXECUTE_IF("simulate_out_of_memory", - DBUG_SET("-d,simulate_out_of_memory");); + my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_WAITTANG + + ME_NOREFRESH + ME_FATALERROR),size); if (my_flags & MY_FAE) exit(1); } @@ -175,7 +173,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); } else { 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 56f7ca8b31a..4d1bc18930a 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -451,7 +451,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 3c94fab2ec7..a7985997036 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); |