Commit 31569172 authored by jcole@tetra.spaceapes.com's avatar jcole@tetra.spaceapes.com
Browse files

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.
parent 89b5dab2
Loading
Loading
Loading
Loading

include/my_bitmap.h

0 → 100644
+35 −0
Original line number Diff line number Diff line
/* 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 */

#ifndef _my_bitmap_h_
#define _my_bitmap_h_

#define MY_BIT_NONE ~(uint)0

#ifdef	__cplusplus
extern "C" {
#endif

  extern void bitmap_set_bit(uchar *bitmap, uint bitmap_size, uint bitmap_bit);
  extern uint bitmap_set_next(uchar *bitmap, uint bitmap_size);
  extern void bitmap_clear_bit(uchar *bitmap,uint bitmap_size,uint bitmap_bit);

#ifdef	__cplusplus
}
#endif

#endif
+1 −1
Original line number Diff line number Diff line
@@ -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@

mysys/my_bitmap.c

0 → 100644
+60 −0
Original line number Diff line number Diff line
/* 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 <my_bitmap.h>

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<bitmap_size) && (bit_found==MY_BIT_NONE); i++) {
    if(bitmap[i] == 0xff) continue;
    for(b=0; (b<8) && (bit_found==MY_BIT_NONE); b++)
      if((bitmap[i] & 1<<b) == 0) {
        bit_found = (i*8)+b;
        bitmap[i] |= 1<<b;
      };
  };
  pthread_mutex_unlock(&LOCK_bitmap);

  return bit_found;
};

void bitmap_clear_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);
  };
};
+9 −1
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ static my_bool win32_init_tcp_ip();
static my_bool my_init_done=0;



static ulong atoi_octal(const char *str)
{
  long int tmp;
@@ -76,6 +77,7 @@ void my_init(void)
#ifndef __WIN__
  sigfillset(&my_signals);		/* signals blocked by mf_brkhant */
#endif
  pthread_mutex_init(&LOCK_bitmap, NULL);
#endif
  {
    DBUG_ENTER("my_init");
@@ -127,7 +129,12 @@ void my_end(int infoflag)
#ifdef HAVE_GETRUSAGE
    struct rusage rus;
    if (!getrusage(RUSAGE_SELF, &rus))
      fprintf(info_file,"\nUser time %.2f, System time %.2f\nMaximum resident set size %ld, Integral resident set size %ld\nNon physical pagefaults %ld, Physical pagefaults %ld, Swaps %ld\nBlocks in %ld out %ld, Messages in %ld out %ld, Signals %ld\nVouluntary context switches %ld, Invouluntary context switches %ld\n",
      fprintf(info_file,"\n\
User time %.2f, System time %.2f\n\
Maximum resident set size %ld, Integral resident set size %ld\n\
Non-physical pagefaults %ld, Physical pagefaults %ld, Swaps %ld\n\
Blocks in %ld out %ld, Messages in %ld out %ld, Signals %ld\n\
Voluntary context switches %ld, Involuntary context switches %ld\n",
	      (rus.ru_utime.tv_sec * SCALE_SEC +
	       rus.ru_utime.tv_usec / SCALE_USEC) / 100.0,
	      (rus.ru_stime.tv_sec * SCALE_SEC +
@@ -159,6 +166,7 @@ void my_end(int infoflag)
  pthread_mutex_destroy(&THR_LOCK_keycache);
  pthread_mutex_destroy(&THR_LOCK_malloc);
  pthread_mutex_destroy(&THR_LOCK_open);
  pthread_mutex_destroy(&LOCK_bitmap);
  DBUG_POP();				/* Must be done before my_thread_end */
  my_thread_end();
  my_thread_global_end();
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#ifdef THREAD
extern pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
  THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_net,THR_LOCK_charset;
extern pthread_mutex_t LOCK_bitmap;
#else /* THREAD */
#define pthread_mutex_lock(A)
#define pthread_mutex_unlock(A)
Loading