From 882f16d0369b4cd0742ac37650a71fc6f3b00a57 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 27 Jan 2001 03:24:05 -0600 Subject: Added --temp-pool option to mysqld. This will cause temporary files created to use a small set of filenames, to try and avoid problems in the Linux kernel. mysys/Makefile.am: Added my_bitmap.c mysys/my_init.c: my_bitmap code added mysys/mysys_priv.h: my_bitmap sql/mysql_priv.h: temp pool stuff. sql/mysqld.cc: --temp-pool option added sql/sql_select.cc: temp pool stuff sql/table.h: temp pool --- mysys/Makefile.am | 2 +- mysys/my_bitmap.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ mysys/my_init.c | 10 ++++++++- mysys/mysys_priv.h | 1 + 4 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 mysys/my_bitmap.c (limited to 'mysys') diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 7615b85fa29..6674132bdca 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -44,7 +44,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\ my_quick.c my_lockmem.c my_static.c \ getopt.c getopt1.c getvar.c my_mkdir.c \ default.c my_compress.c checksum.c raid.cc my_net.c \ - my_vsnprintf.c charset.c + my_vsnprintf.c charset.c my_bitmap.c EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \ thr_mutex.c thr_rwlock.c libmysys_a_LIBADD = @THREAD_LOBJECTS@ diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c new file mode 100644 index 00000000000..1434f472f98 --- /dev/null +++ b/mysys/my_bitmap.c @@ -0,0 +1,60 @@ +/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 */ + +/* + Handling of uchar arrays as large bitmaps. +*/ + +#include "mysys_priv.h" +#include + +pthread_mutex_t LOCK_bitmap; + +void bitmap_set_bit(uchar *bitmap, uint bitmap_size, uint bitmap_bit) { + if((bitmap_bit != MY_BIT_NONE) && (bitmap_bit < bitmap_size*8)) { + pthread_mutex_lock(&LOCK_bitmap); + bitmap[bitmap_bit / 8] |= (1 << bitmap_bit % 8); + pthread_mutex_unlock(&LOCK_bitmap); + }; +}; + +uint bitmap_set_next(uchar *bitmap, uint bitmap_size) { + uint bit_found = MY_BIT_NONE; + int i, b; + + pthread_mutex_lock(&LOCK_bitmap); + for(i=0; (i