From 455ac66af81bf2a85f48e4e59b23bd988ba4dcb0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 7 Feb 2001 23:27:19 +0200 Subject: [PATCH] Force sockets to be blocking on HPUX 11.0 Changed BITMAP to MY_BITMAP to avoid type conflict on windows configure.in: Force sockets to be blocking on HPUX 11.0 include/my_bitmap.h: Changed BITMAP to MY_BITMAP to avoid type conflict on windows mysys/my_bitmap.c: Changed BITMAP to MY_BITMAP to avoid type conflict on windows mysys/my_init.c: Removed LOCK_bitmap sql/mysql_priv.h: Changed BITMAP to MY_BITMAP to avoid type conflict on windows sql/mysqld.cc: Changed BITMAP to MY_BITMAP to avoid type conflict on windows sql/violite.c: Force sockets to be blocking on HPUX 11.0 --- configure.in | 4 ++-- include/my_bitmap.h | 12 ++++++------ mysys/my_bitmap.c | 12 +++++------- mysys/my_init.c | 1 - sql/mysql_priv.h | 2 +- sql/mysqld.cc | 2 +- sql/violite.c | 9 +++++++-- 7 files changed, 22 insertions(+), 20 deletions(-) diff --git a/configure.in b/configure.in index 828ff2a315d..fc175fbce47 100644 --- a/configure.in +++ b/configure.in @@ -709,8 +709,8 @@ case $SYSTEM_TYPE in ;; *hpux11.*) echo "Enabling pread/pwrite workaround for hpux 11" - CFLAGS="$CFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS" - CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG" + CFLAGS="$CFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK" + CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK" if test "$with_named_thread" = "no" then echo "Using --with-named-thread=-lpthread" diff --git a/include/my_bitmap.h b/include/my_bitmap.h index 370f45576ff..a48858f275c 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -29,16 +29,16 @@ typedef struct st_bitmap #ifdef THREAD pthread_mutex_t mutex; #endif -} BITMAP; +} MY_BITMAP; #ifdef __cplusplus extern "C" { #endif - extern my_bool bitmap_init(BITMAP *bitmap, uint bitmap_size); - extern void bitmap_free(BITMAP *bitmap); - extern void bitmap_set_bit(BITMAP *bitmap, uint bitmap_bit); - extern uint bitmap_set_next(BITMAP *bitmap); - extern void bitmap_clear_bit(BITMAP *bitmap, uint bitmap_bit); + extern my_bool bitmap_init(MY_BITMAP *bitmap, uint bitmap_size); + extern void bitmap_free(MY_BITMAP *bitmap); + extern void bitmap_set_bit(MY_BITMAP *bitmap, uint bitmap_bit); + extern uint bitmap_set_next(MY_BITMAP *bitmap); + extern void bitmap_clear_bit(MY_BITMAP *bitmap, uint bitmap_bit); #ifdef __cplusplus } #endif diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c index 2601aa96727..b4990816b56 100644 --- a/mysys/my_bitmap.c +++ b/mysys/my_bitmap.c @@ -27,9 +27,7 @@ #include #include -pthread_mutex_t LOCK_bitmap; - -my_bool bitmap_init(BITMAP *map, uint bitmap_size) +my_bool bitmap_init(MY_BITMAP *map, uint bitmap_size) { if (!(map->bitmap=(uchar*) my_malloc((bitmap_size+7)/8,MYF(MY_WME)))) return 1; @@ -41,7 +39,7 @@ my_bool bitmap_init(BITMAP *map, uint bitmap_size) return 0; } -void bitmap_free(BITMAP *map) +void bitmap_free(MY_BITMAP *map) { if (map->bitmap) { @@ -53,7 +51,7 @@ void bitmap_free(BITMAP *map) } } -void bitmap_set_bit(BITMAP *map, uint bitmap_bit) +void bitmap_set_bit(MY_BITMAP *map, uint bitmap_bit) { if (bitmap_bit < map->bitmap_size) { @@ -64,7 +62,7 @@ void bitmap_set_bit(BITMAP *map, uint bitmap_bit) } -uint bitmap_set_next(BITMAP *map) +uint bitmap_set_next(MY_BITMAP *map) { uchar *bitmap=map->bitmap; uint bit_found = MY_BIT_NONE; @@ -94,7 +92,7 @@ uint bitmap_set_next(BITMAP *map) } -void bitmap_clear_bit(BITMAP *map, uint bitmap_bit) +void bitmap_clear_bit(MY_BITMAP *map, uint bitmap_bit) { if (bitmap_bit < map->bitmap_size) { diff --git a/mysys/my_init.c b/mysys/my_init.c index 62e48deb6a1..225b3115fbe 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -168,7 +168,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", 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(); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 0232fad0411..4e324704a31 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -509,7 +509,7 @@ extern ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count, ha_read_key_count, ha_read_next_count, ha_read_prev_count, ha_read_first_count, ha_read_last_count, ha_read_rnd_count, ha_read_rnd_next_count; -extern BITMAP temp_pool; +extern MY_BITMAP temp_pool; extern bool use_temp_pool; extern char f_fyllchar; extern uchar *days_in_month; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index dcd27ec2852..3c56120e542 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -284,7 +284,7 @@ I_List threads,thread_cache; time_t start_time; -BITMAP temp_pool; +MY_BITMAP temp_pool; bool use_temp_pool=0; pthread_key(MEM_ROOT*,THR_MALLOC); diff --git a/sql/violite.c b/sql/violite.c index 25ab5db31d2..6594261172e 100644 --- a/sql/violite.c +++ b/sql/violite.c @@ -35,11 +35,13 @@ #ifdef HAVE_POLL #include #endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif #if defined(__EMX__) -#include #define ioctlsocket ioctl -#endif /* defined(__EMX__) */ +#endif /* defined(__EMX__) */ #if defined(MSDOS) || defined(__WIN__) #ifdef __WIN__ @@ -106,6 +108,9 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost) #if !defined(___WIN__) && !defined(__EMX__) #if !defined(NO_FCNTL_NONBLOCK) vio->fcntl_mode = fcntl(sd, F_GETFL); +#elif defined(HAVE_SYS_IOCTL_H) /* hpux */ + /* Non blocking sockets doesn't work good on HPUX 11.0 */ + (void) ioctl(net->fd,FIOSNBIO,0); #endif #else /* !defined(__WIN__) && !defined(__EMX__) */ {