diff options
Diffstat (limited to 'storage')
73 files changed, 406 insertions, 569 deletions
diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c index bad02835d86..ce4be92a521 100644 --- a/storage/archive/archive_reader.c +++ b/storage/archive/archive_reader.c @@ -201,7 +201,7 @@ int main(int argc, char *argv[]) ptr= (char *)my_malloc(sizeof(char) * reader_handle.frm_length, MYF(0)); azread_frm(&reader_handle, ptr); azwrite_frm(&writer_handle, ptr, reader_handle.frm_length); - my_free(ptr, MYF(0)); + my_free(ptr); } if (reader_handle.comment_length) @@ -210,7 +210,7 @@ int main(int argc, char *argv[]) ptr= (char *)my_malloc(sizeof(char) * reader_handle.comment_length, MYF(0)); azread_comment(&reader_handle, ptr); azwrite_comment(&writer_handle, ptr, reader_handle.comment_length); - my_free(ptr, MYF(0)); + my_free(ptr); } while ((read= azread(&reader_handle, (uchar *)size_buffer, @@ -265,7 +265,7 @@ int main(int argc, char *argv[]) azread_frm(&reader_handle, ptr); my_write(frm_file, (uchar*) ptr, reader_handle.frm_length, MYF(0)); my_close(frm_file, MYF(0)); - my_free(ptr, MYF(0)); + my_free(ptr); } end: diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 2bcfc3ff672..63848370ff1 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -387,7 +387,7 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc) { *rc= my_errno ? my_errno : -1; mysql_mutex_unlock(&archive_mutex); - my_free(share, MYF(0)); + my_free(share); DBUG_RETURN(NULL); } stats.auto_increment_value= archive_tmp.auto_increment + 1; @@ -447,7 +447,7 @@ int ha_archive::free_share() if (azclose(&(share->archive_write))) rc= 1; } - my_free((uchar*) share, MYF(0)); + my_free(share); } mysql_mutex_unlock(&archive_mutex); @@ -706,7 +706,7 @@ int ha_archive::create(const char *name, TABLE *table_arg, { my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0)); azwrite_frm(&create_stream, (char *)frm_ptr, file_stat.st_size); - my_free((uchar*)frm_ptr, MYF(0)); + my_free(frm_ptr); } } my_close(frm_file, MYF(0)); @@ -932,8 +932,7 @@ int ha_archive::write_row(uchar *buf) rc= real_write_row(buf, &(share->archive_write)); error: mysql_mutex_unlock(&share->mutex); - if (read_buf) - my_free((uchar*) read_buf, MYF(0)); + my_free(read_buf); DBUG_RETURN(rc); } @@ -1696,7 +1695,7 @@ archive_record_buffer *ha_archive::create_record_buffer(unsigned int length) if (!(r->buffer= (uchar*) my_malloc(r->length, MYF(MY_WME)))) { - my_free((char*) r, MYF(MY_ALLOW_ZERO_PTR)); + my_free(r); DBUG_RETURN(NULL); /* purecov: inspected */ } @@ -1706,8 +1705,8 @@ archive_record_buffer *ha_archive::create_record_buffer(unsigned int length) void ha_archive::destroy_record_buffer(archive_record_buffer *r) { DBUG_ENTER("ha_archive::destroy_record_buffer"); - my_free((char*) r->buffer, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) r, MYF(MY_ALLOW_ZERO_PTR)); + my_free(r->buffer); + my_free(r); DBUG_VOID_RETURN; } diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc index 7ec60aad88a..6591c3a2c78 100644 --- a/storage/blackhole/ha_blackhole.cc +++ b/storage/blackhole/ha_blackhole.cc @@ -335,7 +335,7 @@ static st_blackhole_share *get_share(const char *table_name) if (my_hash_insert(&blackhole_open_tables, (uchar*) share)) { - my_free((uchar*) share, MYF(0)); + my_free(share); share= NULL; goto error; } @@ -360,7 +360,7 @@ static void free_share(st_blackhole_share *share) static void blackhole_free_key(st_blackhole_share *share) { thr_lock_delete(&share->lock); - my_free((uchar*) share, MYF(0)); + my_free(share); } static uchar* blackhole_get_key(st_blackhole_share *share, size_t *length, diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 11edf690f2a..30c4c4d58ca 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -251,7 +251,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table) error: mysql_mutex_unlock(&tina_mutex); - my_free((uchar*) share, MYF(0)); + my_free(share); return NULL; } @@ -429,7 +429,7 @@ static int free_share(TINA_SHARE *share) my_hash_delete(&tina_open_tables, (uchar*) share); thr_lock_delete(&share->lock); mysql_mutex_destroy(&share->mutex); - my_free((uchar*) share, MYF(0)); + my_free(share); } mysql_mutex_unlock(&tina_mutex); @@ -1529,7 +1529,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) free_root(&blobroot, MYF(0)); - my_free((char*)buf, MYF(0)); + my_free(buf); if (rc == HA_ERR_END_OF_FILE) { @@ -1735,7 +1735,7 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt) free_root(&blobroot, MYF(0)); - my_free((char*)buf, MYF(0)); + my_free(buf); thd_proc_info(thd, old_proc_info); if ((rc != HA_ERR_END_OF_FILE) || count) diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 7bb80170e87..845b50e3869 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -95,7 +95,7 @@ public: ~ha_tina() { if (chain_alloced) - my_free(chain, 0); + my_free(chain); if (file_buff) delete file_buff; free_root(&blobroot, MYF(0)); diff --git a/storage/csv/transparent_file.cc b/storage/csv/transparent_file.cc index 44ca2df026f..f92746c7b93 100644 --- a/storage/csv/transparent_file.cc +++ b/storage/csv/transparent_file.cc @@ -29,7 +29,7 @@ Transparent_file::Transparent_file() : lower_bound(0), buff_size(IO_SIZE) Transparent_file::~Transparent_file() { - my_free((uchar*)buff, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buff); } void Transparent_file::init_buff(File filedes_arg) diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 2fbb17e46bd..899f55a33f7 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -232,7 +232,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table) error: mysql_mutex_destroy(&share->mutex); - my_free(share, MYF(0)); + my_free(share); return NULL; } @@ -252,7 +252,7 @@ static int free_share(EXAMPLE_SHARE *share) my_hash_delete(&example_open_tables, (uchar*) share); thr_lock_delete(&share->lock); mysql_mutex_destroy(&share->mutex); - my_free(share, MYF(0)); + my_free(share); } mysql_mutex_unlock(&example_mutex); diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 541650bd5e8..350958f8230 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -112,7 +112,7 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked) create_info.pin_share= TRUE; rc= heap_create(name, &create_info, &internal_share, &created_new_share); - my_free((uchar*) create_info.keydef, MYF(0)); + my_free(create_info.keydef); if (rc) goto end; @@ -764,7 +764,7 @@ int ha_heap::create(const char *name, TABLE *table_arg, hp_create_info.auto_increment= (create_info->auto_increment_value ? create_info->auto_increment_value - 1 : 0); error= heap_create(name, &hp_create_info, &internal_share, &created); - my_free((uchar*) hp_create_info.keydef, MYF(0)); + my_free(hp_create_info.keydef); DBUG_ASSERT(file == 0); return (error); } diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c index c622a9e52f8..7f6cc1ef90a 100644 --- a/storage/heap/hp_block.c +++ b/storage/heap/hp_block.c @@ -145,7 +145,7 @@ uchar *hp_free_level(HP_BLOCK *block, uint level, HP_PTRS *pos, uchar *last_pos) } if ((uchar*) pos != last_pos) { - my_free((uchar*) pos,MYF(0)); + my_free(pos); return last_pos; } return next_ptr; /* next memory position */ diff --git a/storage/heap/hp_close.c b/storage/heap/hp_close.c index 49d8ec376bb..e5a826423db 100644 --- a/storage/heap/hp_close.c +++ b/storage/heap/hp_close.c @@ -46,6 +46,6 @@ int hp_close(register HP_INFO *info) heap_open_list=list_delete(heap_open_list,&info->open_list); if (!--info->s->open_count && info->s->delete_on_close) hp_free(info->s); /* Table was deleted */ - my_free((uchar*) info,MYF(0)); + my_free(info); DBUG_RETURN(error); } diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c index cf0f5d5ba6d..bbf649c5e46 100644 --- a/storage/heap/hp_create.c +++ b/storage/heap/hp_create.c @@ -189,7 +189,7 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, /* Must be allocated separately for rename to work */ if (!(share->name= my_strdup(name,MYF(0)))) { - my_free((uchar*) share,MYF(0)); + my_free(share); goto err; } #ifdef THREAD @@ -305,7 +305,7 @@ void hp_free(HP_SHARE *share) thr_lock_delete(&share->lock); mysql_mutex_destroy(&share->intern_lock); #endif - my_free((uchar*) share->name, MYF(0)); - my_free((uchar*) share, MYF(0)); + my_free(share->name); + my_free(share); return; } diff --git a/storage/heap/hp_open.c b/storage/heap/hp_open.c index ef2ce15f9b3..12d9bfe1ed3 100644 --- a/storage/heap/hp_open.c +++ b/storage/heap/hp_open.c @@ -16,10 +16,6 @@ /* open a heap-database */ #include "heapdef.h" -#ifdef VMS -#include "hp_static.c" /* Stupid vms-linker */ -#endif - #include "my_sys.h" /* diff --git a/storage/heap/hp_rename.c b/storage/heap/hp_rename.c index c4e8390cc43..cf0d2b2b387 100644 --- a/storage/heap/hp_rename.c +++ b/storage/heap/hp_rename.c @@ -33,7 +33,7 @@ int heap_rename(const char *old_name, const char *new_name) mysql_mutex_unlock(&THR_LOCK_heap); DBUG_RETURN(my_errno); } - my_free(info->name,MYF(0)); + my_free(info->name); info->name=name_buff; } mysql_mutex_unlock(&THR_LOCK_heap); diff --git a/storage/ibmdb2i/db2i_constraints.cc b/storage/ibmdb2i/db2i_constraints.cc index cc2821238b6..3afa12032d0 100644 --- a/storage/ibmdb2i/db2i_constraints.cc +++ b/storage/ibmdb2i/db2i_constraints.cc @@ -421,7 +421,7 @@ void ha_ibmdb2i::free_foreign_key_create_info(char* info) if (info) { - my_free(info, MYF(0)); + my_free(info); } DBUG_VOID_RETURN; } diff --git a/storage/ibmdb2i/db2i_conversion.cc b/storage/ibmdb2i/db2i_conversion.cc index 9a85eb01c9b..71a30802bf9 100644 --- a/storage/ibmdb2i/db2i_conversion.cc +++ b/storage/ibmdb2i/db2i_conversion.cc @@ -292,7 +292,7 @@ static void get_field_default_value(Field *field, if (iconv(iconvD, (char**)&tempIn, &ilen, &tempOut, &olen, &substitutedChars) < 0) { warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name); - my_free(out, MYF(0)); + my_free(out); return; } // Now we process the converted string to represent it as @@ -310,7 +310,7 @@ static void get_field_default_value(Field *field, if (length > 16370) { warning(current_thd, DB2I_ERR_WARN_COL_ATTRS, field->field_name); - my_free(out, MYF(0)); + my_free(out); return; } @@ -335,7 +335,7 @@ static void get_field_default_value(Field *field, if (field->charset() == &my_charset_bin) defaultClause.append(")"); - my_free(out, MYF(0)); + my_free(out); } } else diff --git a/storage/ibmdb2i/db2i_file.cc b/storage/ibmdb2i/db2i_file.cc index a16aa927527..2d83248eea7 100644 --- a/storage/ibmdb2i/db2i_file.cc +++ b/storage/ibmdb2i/db2i_file.cc @@ -280,12 +280,9 @@ void db2i_table::renameAssocFiles(const char* from, const char* to) db2i_table::~db2i_table() { - if (blobFieldActualSizes) - my_free(blobFieldActualSizes, MYF(0)); + my_free(blobFieldActualSizes); + my_free(conversionDefinitions[toMySQL]); - if (conversionDefinitions[toMySQL]) - my_free(conversionDefinitions[toMySQL], MYF(0)); - if (logicalFiles) { for (int k = 0; k < logicalFileCount; ++k) @@ -296,8 +293,8 @@ db2i_table::~db2i_table() delete[] logicalFiles; } delete physicalFile; - - my_free(db2LibNameEbcdic, 0); + + my_free(db2LibNameEbcdic); } void db2i_table::getDB2QualifiedName(char* to) @@ -334,14 +331,14 @@ size_t db2i_table::smartFilenameToTableName(const char *in, char* out, size_t ou if ((*cur <= 0x20) || (*cur >= 0x80)) { strncpy(out, in, outlen); - my_free(test, MYF(0)); + my_free(test); return min(outlen, strlen(out)); } ++cur; } strncpy(out, test, outlen); - my_free(test, MYF(0)); + my_free(test); return min(outlen, strlen(out)); } diff --git a/storage/ibmdb2i/db2i_file.h b/storage/ibmdb2i/db2i_file.h index ff35a473b05..6cc6ae8947b 100644 --- a/storage/ibmdb2i/db2i_file.h +++ b/storage/ibmdb2i/db2i_file.h @@ -353,7 +353,7 @@ public: db2i_ileBridge::getBridgeForThread()->deallocateFile(masterDefn); if (db2FileName != (char*)db2Table->getDB2TableName(db2i_table::EBCDIC_NATIVE)) - my_free(db2FileName, MYF(0)); + my_free(db2FileName); } // This is roughly equivalent to an "open". It tells ILE to allocate a descriptor diff --git a/storage/ibmdb2i/db2i_global.h b/storage/ibmdb2i/db2i_global.h index d201fbd8124..1cf8a9a7c61 100644 --- a/storage/ibmdb2i/db2i_global.h +++ b/storage/ibmdb2i/db2i_global.h @@ -131,7 +131,7 @@ void free_aligned(void* p) { if (likely(p)) { - my_free(*(char**)((char*)p-sizeof(void*)), MYF(0)); + my_free(*(char**)((char*)p-sizeof(void*))); } } diff --git a/storage/ibmdb2i/db2i_ileBridge.cc b/storage/ibmdb2i/db2i_ileBridge.cc index 68ae2c2bb72..fac98dd7107 100644 --- a/storage/ibmdb2i/db2i_ileBridge.cc +++ b/storage/ibmdb2i/db2i_ileBridge.cc @@ -102,7 +102,7 @@ db2i_ileBridge* db2i_ileBridge::createNewBridge(CONNECTION_HANDLE connID) void db2i_ileBridge::destroyBridge(db2i_ileBridge* bridge) { bridge->freeErrorStorage(); - my_free(bridge, MYF(0)); + my_free(bridge); } @@ -1306,7 +1306,7 @@ FILE_HANDLE db2i_ileBridge::PreservedHandleList::findAndRemove(const char* fileN prev->next = next; if (current == head) head = next; - my_free(current, MYF(0)); + my_free(current); DBUG_PRINT("db2i_ileBridge", ("Found handle %d for %s", uint32(tmp), fileName)); return tmp; } diff --git a/storage/ibmdb2i/db2i_ileBridge.h b/storage/ibmdb2i/db2i_ileBridge.h index 10b9820d983..3a3ca141f69 100644 --- a/storage/ibmdb2i/db2i_ileBridge.h +++ b/storage/ibmdb2i/db2i_ileBridge.h @@ -320,7 +320,7 @@ public: { if (likely(connErrText)) { - my_free(connErrText, MYF(0)); + my_free(connErrText); connErrText = NULL; } } diff --git a/storage/ibmdb2i/ha_ibmdb2i.cc b/storage/ibmdb2i/ha_ibmdb2i.cc index 81d7e59d8e3..947df8ad2fe 100644 --- a/storage/ibmdb2i/ha_ibmdb2i.cc +++ b/storage/ibmdb2i/ha_ibmdb2i.cc @@ -404,7 +404,7 @@ IBMDB2I_SHARE *ha_ibmdb2i::get_share(const char *table_name, TABLE *table) error: pthread_mutex_destroy(&share->mutex); - my_free((uchar*) share, MYF(0)); + my_free(share); pthread_mutex_unlock(&ibmdb2i_mutex); return NULL; @@ -423,7 +423,7 @@ int ha_ibmdb2i::free_share(IBMDB2I_SHARE *share) my_hash_delete(&ibmdb2i_open_tables, (uchar*) share); thr_lock_delete(&share->lock); pthread_mutex_destroy(&share->mutex); - my_free(share, MYF(0)); + my_free(share); pthread_mutex_unlock(&ibmdb2i_mutex); return 1; } @@ -571,9 +571,9 @@ ha_ibmdb2i::~ha_ibmdb2i() DBUG_ASSERT(activeReferences == 0 || outstanding_start_bulk_insert); if (indexHandles) - my_free(indexHandles, MYF(0)); + my_free(indexHandles); if (indexReadSizeEstimates) - my_free(indexReadSizeEstimates, MYF(0)); + my_free(indexReadSizeEstimates); cleanupBuffers(); } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index b3445f86274..f5227add6f1 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -187,10 +187,6 @@ static ulong innobase_active_counter = 0; static hash_table_t* innobase_open_tables; -#ifdef __NETWARE__ /* some special cleanup for NetWare */ -bool nw_panic = FALSE; -#endif - /** Allowed values of innodb_change_buffering */ static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = { "none", /* IBUF_USE_NONE */ @@ -2199,8 +2195,7 @@ innobase_init( "InnoDB: syntax error in innodb_data_file_path"); mem_free_and_error: srv_free_paths_and_sizes(); - my_free(internal_innobase_data_file_path, - MYF(MY_ALLOW_ZERO_PTR)); + my_free(internal_innobase_data_file_path); goto error; } @@ -2470,11 +2465,6 @@ innobase_end( DBUG_ENTER("innobase_end"); DBUG_ASSERT(hton == innodb_hton_ptr); -#ifdef __NETWARE__ /* some special cleanup for NetWare */ - if (nw_panic) { - set_panic_flag_for_netware(); - } -#endif if (innodb_inited) { srv_fast_shutdown = (ulint) innobase_fast_shutdown; @@ -2485,8 +2475,7 @@ innobase_end( err = 1; } srv_free_paths_and_sizes(); - my_free(internal_innobase_data_file_path, - MYF(MY_ALLOW_ZERO_PTR)); + my_free(internal_innobase_data_file_path); mysql_mutex_destroy(&innobase_share_mutex); mysql_mutex_destroy(&prepare_commit_mutex); mysql_mutex_destroy(&commit_threads_m); @@ -3439,7 +3428,7 @@ innobase_build_index_translation( func_exit: if (!ret) { /* Build translation table failed. */ - my_free(index_mapping, MYF(MY_ALLOW_ZERO_PTR)); + my_free(index_mapping); share->idx_trans_tbl.array_size = 0; share->idx_trans_tbl.index_count = 0; @@ -3673,7 +3662,7 @@ retry: "how you can resolve the problem.\n", norm_name); free_share(share); - my_free(upd_buff, MYF(0)); + my_free(upd_buff); my_errno = ENOENT; DBUG_RETURN(HA_ERR_NO_SUCH_TABLE); @@ -3689,7 +3678,7 @@ retry: "how you can resolve the problem.\n", norm_name); free_share(share); - my_free(upd_buff, MYF(0)); + my_free(upd_buff); my_errno = ENOENT; dict_table_decrement_handle_count(ib_table, FALSE); @@ -3883,7 +3872,7 @@ ha_innobase::close(void) row_prebuilt_free(prebuilt, FALSE); - my_free(upd_buff, MYF(0)); + my_free(upd_buff); free_share(share); /* Tell InnoDB server that there might be work for @@ -6404,7 +6393,7 @@ create_index( error = convert_error_code_to_mysql(error, flags, NULL); - my_free(field_lengths, MYF(0)); + my_free(field_lengths); DBUG_RETURN(error); } @@ -7215,7 +7204,7 @@ innobase_drop_database( trx = innobase_trx_allocate(thd); #endif error = row_drop_database_for_mysql(namebuf, trx); - my_free(namebuf, MYF(0)); + my_free(namebuf); /* Flush the log to reduce probability that the .frm files and the InnoDB data dictionary get out-of-sync if the user runs @@ -7291,8 +7280,8 @@ innobase_rename_table( log_buffer_flush_to_disk(); } - my_free(norm_to, MYF(0)); - my_free(norm_from, MYF(0)); + my_free(norm_to); + my_free(norm_from); return error; } @@ -7455,7 +7444,7 @@ ha_innobase::records_in_range( mem_heap_free(heap); func_exit: - my_free(key_val_buff2, MYF(0)); + my_free(key_val_buff2); prebuilt->trx->op_info = (char*)""; @@ -8464,7 +8453,7 @@ ha_innobase::free_foreign_key_create_info( char* str) /*!< in, own: create info string to free */ { if (str) { - my_free(str, MYF(0)); + my_free(str); } } @@ -9008,7 +8997,7 @@ innodb_show_status( STRING_WITH_LEN(""), str, flen)) { result= TRUE; } - my_free(str, MYF(0)); + my_free(str); DBUG_RETURN(FALSE); } @@ -9279,10 +9268,9 @@ static void free_share(INNOBASE_SHARE* share) thr_lock_delete(&share->lock); /* Free any memory from index translation table */ - my_free(share->idx_trans_tbl.index_mapping, - MYF(MY_ALLOW_ZERO_PTR)); + my_free(share->idx_trans_tbl.index_mapping); - my_free(share, MYF(0)); + my_free(share); /* TODO: invoke HASH_MIGRATE if innobase_open_tables shrinks too much */ @@ -10797,14 +10785,8 @@ static MYSQL_SYSVAR_ULONG(purge_threads, srv_n_purge_threads, static MYSQL_SYSVAR_ULONG(fast_shutdown, innobase_fast_shutdown, PLUGIN_VAR_OPCMDARG, "Speeds up the shutdown process of the InnoDB storage engine. Possible " - "values are 0, 1 (faster)" - /* - NetWare can't close unclosed files, can't automatically kill remaining - threads, etc, so on this OS we disable the crash-like InnoDB shutdown. - */ - IF_NETWARE("", " or 2 (fastest - crash-like)") - ".", - NULL, NULL, 1, 0, IF_NETWARE(1,2), 0); + "values are 0, 1 (faster) or 2 (fastest - crash-like).", + NULL, NULL, 1, 0, 2, 0); static MYSQL_SYSVAR_BOOL(file_per_table, srv_file_per_table, PLUGIN_VAR_NOCMDARG, diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index a112cb06697..197e361b2b1 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -194,12 +194,12 @@ various file I/O operations with performance schema. used to register file creation, opening, closing and renaming. 2) register_pfs_file_io_begin() and register_pfs_file_io_end() are used to register actual file read, write and flush */ -# define register_pfs_file_open_begin(locker, key, op, name, \ +# define register_pfs_file_open_begin(state, locker, key, op, name, \ src_file, src_line) \ do { \ if (PSI_server) { \ locker = PSI_server->get_thread_file_name_locker( \ - key, op, name, &locker); \ + state, key, op, name, &locker); \ if (locker) { \ PSI_server->start_file_open_wait( \ locker, src_file, src_line); \ @@ -215,12 +215,12 @@ do { \ } \ } while (0) -# define register_pfs_file_io_begin(locker, file, count, op, \ +# define register_pfs_file_io_begin(state, locker, file, count, op, \ src_file, src_line) \ do { \ if (PSI_server) { \ locker = PSI_server->get_thread_file_descriptor_locker( \ - file, op); \ + state, file, op); \ if (locker) { \ PSI_server->start_file_wait( \ locker, count, src_file, src_line); \ @@ -383,8 +383,6 @@ os_io_init_simple(void); /***********************************************************************//** Creates a temporary file. This function is like tmpfile(3), but the temporary file is created in the MySQL temporary directory. -On Netware, this function is like tmpfile(3), because the C run-time -library of Netware does not expose the delete-on-close flag. @return temporary file handle, or NULL on error */ FILE* @@ -1166,7 +1164,7 @@ os_file_get_status( os_file_stat_t* stat_info); /*!< information of a file in a directory */ -#if !defined(UNIV_HOTBACKUP) && !defined(__NETWARE__) +#if !defined(UNIV_HOTBACKUP) /*********************************************************************//** Creates a temporary file that will be deleted on close. This function is defined in ha_innodb.cc. @@ -1175,7 +1173,7 @@ UNIV_INTERN int innobase_mysql_tmpfile(void); /*========================*/ -#endif /* !UNIV_HOTBACKUP && !__NETWARE__ */ +#endif /* !UNIV_HOTBACKUP */ #if defined(LINUX_NATIVE_AIO) diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic index 32f0e7cf666..648070c6909 100644 --- a/storage/innobase/include/os0file.ic +++ b/storage/innobase/include/os0file.ic @@ -55,9 +55,10 @@ pfs_os_file_create_simple_func( { os_file_t file; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin(locker, key, + register_pfs_file_open_begin(&state, locker, key, ((create_mode == OS_FILE_CREATE) ? PSI_FILE_CREATE : PSI_FILE_OPEN), @@ -101,9 +102,10 @@ pfs_os_file_create_simple_no_error_handling_func( { os_file_t file; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin(locker, key, + register_pfs_file_open_begin(&state, locker, key, ((create_mode == OS_FILE_CREATE) ? PSI_FILE_CREATE : PSI_FILE_OPEN), @@ -153,9 +155,10 @@ pfs_os_file_create_func( { os_file_t file; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin(locker, key, + register_pfs_file_open_begin(&state, locker, key, ((create_mode == OS_FILE_CREATE) ? PSI_FILE_CREATE : PSI_FILE_OPEN), @@ -183,9 +186,10 @@ pfs_os_file_close_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register the file close */ - register_pfs_file_io_begin(locker, file, 0, PSI_FILE_CLOSE, + register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_CLOSE, src_file, src_line); result = os_file_close_func(file); @@ -230,9 +234,10 @@ pfs_os_aio_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* Register the read or write I/O depending on "type" */ - register_pfs_file_io_begin(locker, file, n, + register_pfs_file_io_begin(&state, locker, file, n, (type == OS_FILE_WRITE) ? PSI_FILE_WRITE : PSI_FILE_READ, @@ -268,8 +273,9 @@ pfs_os_file_read_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, n, PSI_FILE_READ, + register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ, src_file, src_line); result = os_file_read_func(file, buf, offset, offset_high, n); @@ -303,8 +309,9 @@ pfs_os_file_read_no_error_handling_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, n, PSI_FILE_READ, + register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ, src_file, src_line); result = os_file_read_no_error_handling_func(file, buf, offset, @@ -339,8 +346,9 @@ pfs_os_file_write_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, n, PSI_FILE_WRITE, + register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_WRITE, src_file, src_line); result = os_file_write_func(name, file, buf, offset, offset_high, n); @@ -366,8 +374,9 @@ pfs_os_file_flush_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, 0, PSI_FILE_SYNC, + register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_SYNC, src_file, src_line); result = os_file_flush_func(file); @@ -395,8 +404,9 @@ pfs_os_file_rename_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_open_begin(locker, key, PSI_FILE_RENAME, newpath, + register_pfs_file_open_begin(&state, locker, key, PSI_FILE_RENAME, newpath, src_file, src_line); result = os_file_rename_func(oldpath, newpath); diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h index 8abf15da9c1..796d2cade3b 100644 --- a/storage/innobase/include/srv0start.h +++ b/storage/innobase/include/srv0start.h @@ -91,10 +91,6 @@ extern ib_uint64_t srv_shutdown_lsn; /** Log sequence number immediately after startup */ extern ib_uint64_t srv_start_lsn; -#ifdef __NETWARE__ -void set_panic_flag_for_netware(void); -#endif - #ifdef HAVE_DARWIN_THREADS /** TRUE if the F_FULLFSYNC option is available */ extern ibool srv_have_fullfsync; diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic index 73405759bce..2ffd9fdafb5 100644 --- a/storage/innobase/include/sync0rw.ic +++ b/storage/innobase/include/sync0rw.ic @@ -675,12 +675,13 @@ pfs_rw_lock_x_lock_func( const char* file_name,/*!< in: file name where lock requested */ ulint line) /*!< in: line where requested */ { - struct PSI_rwlock_locker* locker = NULL; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; /* Record the entry of rw x lock request in performance schema */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_WRITELOCK); + &state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK); if (locker) { PSI_server->start_rwlock_wrwait(locker, @@ -709,13 +710,14 @@ pfs_rw_lock_x_lock_func_nowait( requested */ ulint line) /*!< in: line where requested */ { - struct PSI_rwlock_locker* locker = NULL; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; ibool ret; /* Record the entry of rw x lock request in performance schema */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_WRITELOCK); + &state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK); if (locker) { PSI_server->start_rwlock_wrwait(locker, @@ -764,12 +766,13 @@ pfs_rw_lock_s_lock_func( requested */ ulint line) /*!< in: line where requested */ { - struct PSI_rwlock_locker* locker = NULL; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; /* Instrumented to inform we are aquiring a shared rwlock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_READLOCK); + &state, lock->pfs_psi, PSI_RWLOCK_READLOCK); if (locker) { PSI_server->start_rwlock_rdwait(locker, file_name, line); @@ -798,14 +801,14 @@ pfs_rw_lock_s_lock_low( const char* file_name, /*!< in: file name where lock requested */ ulint line) /*!< in: line where requested */ { - - struct PSI_rwlock_locker* locker = NULL; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; ibool ret; /* Instrumented to inform we are aquiring a shared rwlock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_READLOCK); + &state, lock->pfs_psi, PSI_RWLOCK_READLOCK); if (locker) { PSI_server->start_rwlock_rdwait(locker, file_name, line); @@ -838,11 +841,7 @@ pfs_rw_lock_x_unlock_func( { /* Inform performance schema we are unlocking the lock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { - struct PSI_thread* thread; - thread = PSI_server->get_thread(); - if (thread) { - PSI_server->unlock_rwlock(thread, lock->pfs_psi); - } + PSI_server->unlock_rwlock(lock->pfs_psi); } rw_lock_x_unlock_func( @@ -869,11 +868,7 @@ pfs_rw_lock_s_unlock_func( { /* Inform performance schema we are unlocking the lock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { - struct PSI_thread* thread; - thread = PSI_server->get_thread(); - if (thread) { - PSI_server->unlock_rwlock(thread, lock->pfs_psi); - } + PSI_server->unlock_rwlock(lock->pfs_psi); } rw_lock_s_unlock_func( diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic index cf080e2e3ce..2977f71154a 100644 --- a/storage/innobase/include/sync0sync.ic +++ b/storage/innobase/include/sync0sync.ic @@ -237,11 +237,12 @@ pfs_mutex_enter_func( ulint line) /*!< in: line where locked */ { struct PSI_mutex_locker* locker = NULL; + PSI_mutex_locker_state state; int result = 0; if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) { locker = PSI_server->get_thread_mutex_locker( - mutex->pfs_psi, PSI_MUTEX_LOCK); + &state, mutex->pfs_psi, PSI_MUTEX_LOCK); if (locker) { PSI_server->start_mutex_wait(locker, file_name, line); } @@ -270,11 +271,12 @@ pfs_mutex_enter_nowait_func( { ulint ret; struct PSI_mutex_locker* locker = NULL; + PSI_mutex_locker_state state; int result = 0; if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) { locker = PSI_server->get_thread_mutex_locker( - mutex->pfs_psi, PSI_MUTEX_LOCK); + &state, mutex->pfs_psi, PSI_MUTEX_LOCK); if (locker) { PSI_server->start_mutex_wait(locker, file_name, line); } @@ -300,12 +302,7 @@ pfs_mutex_exit_func( mutex_t* mutex) /*!< in: pointer to mutex */ { if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) { - struct PSI_thread* thread; - thread = PSI_server->get_thread(); - - if (thread) { - PSI_server->unlock_mutex(thread, mutex->pfs_psi); - } + PSI_server->unlock_mutex(mutex->pfs_psi); } mutex_exit_func(mutex); diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 11cec113fc8..ea213486445 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -115,7 +115,7 @@ if we are compiling on Windows. */ /* Include <sys/stat.h> to get S_I... macros defined for os0file.c */ # include <sys/stat.h> -# if !defined(__NETWARE__) && !defined(__WIN__) +# if !defined(__WIN__) # include <sys/mman.h> /* mmap() for os0proc.c */ # endif diff --git a/storage/innobase/include/ut0dbg.h b/storage/innobase/include/ut0dbg.h index 78b525c38ab..d7ec90db0fb 100644 --- a/storage/innobase/include/ut0dbg.h +++ b/storage/innobase/include/ut0dbg.h @@ -54,29 +54,18 @@ ut_dbg_assertion_failed( const char* file, /*!< in: source file containing the assertion */ ulint line); /*!< in: line number of the assertion */ -#ifdef __NETWARE__ -/** Flag for ignoring further assertion failures. This is set to TRUE -when on NetWare there happens an InnoDB assertion failure or other -fatal error condition that requires an immediate shutdown. */ -extern ibool panic_shutdown; -/* Abort the execution. */ -void ut_dbg_panic(void); -# define UT_DBG_PANIC ut_dbg_panic() -/* Stop threads in ut_a(). */ -# define UT_DBG_STOP do {} while (0) /* We do not do this on NetWare */ -#else /* __NETWARE__ */ -# if defined(__WIN__) || defined(__INTEL_COMPILER) -# undef UT_DBG_USE_ABORT -# elif defined(__GNUC__) && (__GNUC__ > 2) -# define UT_DBG_USE_ABORT -# endif - -# ifndef UT_DBG_USE_ABORT +#if defined(__WIN__) || defined(__INTEL_COMPILER) +# undef UT_DBG_USE_ABORT +#elif defined(__GNUC__) && (__GNUC__ > 2) +# define UT_DBG_USE_ABORT +#endif + +#ifndef UT_DBG_USE_ABORT /** A null pointer that will be dereferenced to trigger a memory trap */ extern ulint* ut_dbg_null_ptr; -# endif +#endif -# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) +#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) /** If this is set to TRUE by ut_dbg_assertion_failed(), all threads will stop at the next ut_a() or ut_ad(). */ extern ibool ut_dbg_stop_threads; @@ -89,24 +78,23 @@ ut_dbg_stop_thread( /*===============*/ const char* file, ulint line); -# endif +#endif -# ifdef UT_DBG_USE_ABORT +#ifdef UT_DBG_USE_ABORT /** Abort the execution. */ -# define UT_DBG_PANIC abort() +# define UT_DBG_PANIC abort() /** Stop threads (null operation) */ -# define UT_DBG_STOP do {} while (0) -# else /* UT_DBG_USE_ABORT */ +# define UT_DBG_STOP do {} while (0) +#else /* UT_DBG_USE_ABORT */ /** Abort the execution. */ -# define UT_DBG_PANIC \ +# define UT_DBG_PANIC \ if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL /** Stop threads in ut_a(). */ -# define UT_DBG_STOP do \ +# define UT_DBG_STOP do \ if (UNIV_UNLIKELY(ut_dbg_stop_threads)) { \ ut_dbg_stop_thread(__FILE__, (ulint) __LINE__); \ } while (0) -# endif /* UT_DBG_USE_ABORT */ -#endif /* __NETWARE__ */ +#endif /* UT_DBG_USE_ABORT */ /** Abort execution if EXPR does not evaluate to nonzero. @param EXPR assertion expression that should hold */ diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index c07f8f4bf95..7c502d616d3 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -623,7 +623,7 @@ os_file_handle_error_no_exit( #undef USE_FILE_LOCK #define USE_FILE_LOCK -#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__NETWARE__) +#if defined(UNIV_HOTBACKUP) || defined(__WIN__) /* InnoDB Hot Backup does not lock the data files. * On Windows, mandatory locking is used. */ @@ -683,35 +683,27 @@ os_io_init_simple(void) /***********************************************************************//** Creates a temporary file. This function is like tmpfile(3), but the temporary file is created in the MySQL temporary directory. -On Netware, this function is like tmpfile(3), because the C run-time -library of Netware does not expose the delete-on-close flag. @return temporary file handle, or NULL on error */ UNIV_INTERN FILE* os_file_create_tmpfile(void) /*========================*/ { -#ifdef __NETWARE__ - FILE* file = tmpfile(); -#else /* __NETWARE__ */ FILE* file = NULL; int fd = innobase_mysql_tmpfile(); if (fd >= 0) { file = fdopen(fd, "w+b"); } -#endif /* __NETWARE__ */ if (!file) { ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Error: unable to create temporary file;" " errno: %d\n", errno); -#ifndef __NETWARE__ if (fd >= 0) { close(fd); } -#endif /* !__NETWARE__ */ } return(file); diff --git a/storage/innobase/os/os0proc.c b/storage/innobase/os/os0proc.c index 48922886f23..0f56a608f38 100644 --- a/storage/innobase/os/os0proc.c +++ b/storage/innobase/os/os0proc.c @@ -145,7 +145,7 @@ skip: os_fast_mutex_unlock(&ut_list_mutex); UNIV_MEM_ALLOC(ptr, size); } -#elif defined __NETWARE__ || !defined OS_MAP_ANON +#elif !defined OS_MAP_ANON size = *n; ptr = ut_malloc_low(size, TRUE, FALSE); #else @@ -213,7 +213,7 @@ os_mem_free_large( os_fast_mutex_unlock(&ut_list_mutex); UNIV_MEM_FREE(ptr, size); } -#elif defined __NETWARE__ || !defined OS_MAP_ANON +#elif !defined OS_MAP_ANON ut_free(ptr); #else if (munmap(ptr, size)) { diff --git a/storage/innobase/os/os0thread.c b/storage/innobase/os/os0thread.c index 78df66d7834..632199b56bc 100644 --- a/storage/innobase/os/os0thread.c +++ b/storage/innobase/os/os0thread.c @@ -163,16 +163,6 @@ os_thread_create( exit(1); } #endif -#ifdef __NETWARE__ - ret = pthread_attr_setstacksize(&attr, - (size_t) NW_THD_STACKSIZE); - if (ret) { - fprintf(stderr, - "InnoDB: Error: pthread_attr_setstacksize" - " returned %d\n", ret); - exit(1); - } -#endif os_mutex_enter(os_sync_mutex); os_thread_count++; os_mutex_exit(os_sync_mutex); @@ -275,8 +265,6 @@ os_thread_sleep( { #ifdef __WIN__ Sleep((DWORD) tm / 1000); -#elif defined(__NETWARE__) - delay(tm / 1000); #else struct timeval t; diff --git a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c index d9084bb4ffd..eac2f9fb377 100644 --- a/storage/innobase/row/row0merge.c +++ b/storage/innobase/row/row0merge.c @@ -2164,8 +2164,9 @@ row_merge_file_create( /* This temp file open does not go through normal file APIs, add instrumentation to register with performance schema */ - struct PSI_file_locker* locker = NULL; - register_pfs_file_open_begin(locker, innodb_file_temp_key, + struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; + register_pfs_file_open_begin(&state, locker, innodb_file_temp_key, PSI_FILE_OPEN, "Innodb Merge Temp File", __FILE__, __LINE__); @@ -2187,8 +2188,9 @@ row_merge_file_destroy( merge_file_t* merge_file) /*!< out: merge file structure */ { #ifdef UNIV_PFS_IO - struct PSI_file_locker* locker = NULL; - register_pfs_file_io_begin(locker, merge_file->fd, 0, PSI_FILE_CLOSE, + struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; + register_pfs_file_io_begin(&state, locker, merge_file->fd, 0, PSI_FILE_CLOSE, __FILE__, __LINE__); #endif if (merge_file->fd != -1) { diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index 4a0ecc5154f..686ee6a4198 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -1231,14 +1231,6 @@ innobase_start_or_create_for_mysql(void) maximum number of threads that can wait in the 'srv_conc array' for their time to enter InnoDB. */ -#if defined(__NETWARE__) - - /* Create less event semaphores because Win 98/ME had - difficulty creating 40000 event semaphores. Comment from - Novell, Inc.: also, these just take a lot of memory on - NetWare. */ - srv_max_n_threads = 1000; -#else if (srv_buf_pool_size >= 1000 * 1024 * 1024) { /* If buffer pool is less than 1000 MB, assume fewer threads. Also use only one @@ -1255,7 +1247,7 @@ innobase_start_or_create_for_mysql(void) especially in 64-bit computers */ } -#endif + err = srv_boot(); if (err != DB_SUCCESS) { @@ -1932,9 +1924,6 @@ innobase_shutdown_for_mysql(void) /*=============================*/ { ulint i; -#ifdef __NETWARE__ - extern ibool panic_shutdown; -#endif if (!srv_was_started) { if (srv_is_being_started) { ut_print_timestamp(stderr); @@ -1963,10 +1952,7 @@ innobase_shutdown_for_mysql(void) "InnoDB will do a crash recovery!\n"); } -#ifdef __NETWARE__ - if (!panic_shutdown) -#endif - logs_empty_and_mark_files_at_shutdown(); + logs_empty_and_mark_files_at_shutdown(); if (srv_conc_n_threads != 0) { fprintf(stderr, @@ -2133,12 +2119,4 @@ innobase_shutdown_for_mysql(void) return((int) DB_SUCCESS); } - -#ifdef __NETWARE__ -void set_panic_flag_for_netware() -{ - extern ibool panic_shutdown; - panic_shutdown = TRUE; -} -#endif /* __NETWARE__ */ #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/ut/ut0dbg.c b/storage/innobase/ut/ut0dbg.c index 4484e6c36de..e79217d5b86 100644 --- a/storage/innobase/ut/ut0dbg.c +++ b/storage/innobase/ut/ut0dbg.c @@ -37,12 +37,7 @@ UNIV_INTERN ulint ut_dbg_zero = 0; will stop at the next ut_a() or ut_ad(). */ UNIV_INTERN ibool ut_dbg_stop_threads = FALSE; #endif -#ifdef __NETWARE__ -/** Flag for ignoring further assertion failures. This is set to TRUE -when on NetWare there happens an InnoDB assertion failure or other -fatal error condition that requires an immediate shutdown. */ -UNIV_INTERN ibool panic_shutdown = FALSE; -#elif !defined(UT_DBG_USE_ABORT) +#ifndef UT_DBG_USE_ABORT /** A null pointer that will be dereferenced to trigger a memory trap */ UNIV_INTERN ulint* ut_dbg_null_ptr = NULL; #endif @@ -86,22 +81,7 @@ ut_dbg_assertion_failed( #endif } -#ifdef __NETWARE__ -/*************************************************************//** -Shut down MySQL/InnoDB after assertion failure. */ -UNIV_INTERN -void -ut_dbg_panic(void) -/*==============*/ -{ - if (!panic_shutdown) { - panic_shutdown = TRUE; - innobase_shutdown_for_mysql(); - } - exit(1); -} -#else /* __NETWARE__ */ -# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) +#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) /*************************************************************//** Stop a thread after assertion failure. */ UNIV_INTERN @@ -117,8 +97,7 @@ ut_dbg_stop_thread( os_thread_sleep(1000000000); #endif /* !UNIV_HOTBACKUP */ } -# endif -#endif /* __NETWARE__ */ +#endif #ifdef UNIV_COMPILE_TEST_FUNCS diff --git a/storage/innobase/ut/ut0mem.c b/storage/innobase/ut/ut0mem.c index f2baab67f09..53f15029e1b 100644 --- a/storage/innobase/ut/ut0mem.c +++ b/storage/innobase/ut/ut0mem.c @@ -179,9 +179,6 @@ retry: /* Make an intentional seg fault so that we get a stack trace */ - /* Intentional segfault on NetWare causes an abend. Avoid this - by graceful exit handling in ut_a(). */ -#if (!defined __NETWARE__) if (assert_on_error) { ut_print_timestamp(stderr); @@ -194,9 +191,6 @@ retry: } else { return(NULL); } -#else - ut_a(0); -#endif } if (set_to_zero) { diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 52ad6b11aa1..33c1e092a00 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -608,7 +608,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, uchar *query, return ftb; err: free_root(& ftb->mem_root, MYF(0)); - my_free((uchar*)ftb,MYF(0)); + my_free(ftb); return 0; } @@ -1032,7 +1032,7 @@ void ft_boolean_close_search(FT_INFO *ftb) delete_tree(& ftb->no_dupes); } free_root(& ftb->mem_root, MYF(0)); - my_free((uchar*)ftb,MYF(0)); + my_free(ftb); } diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c index 5317da78ee4..7d9b13b7714 100644 --- a/storage/myisam/ft_nlq_search.c +++ b/storage/myisam/ft_nlq_search.c @@ -357,7 +357,7 @@ float ft_nlq_find_relevance(FT_INFO *handler, void ft_nlq_close_search(FT_INFO *handler) { - my_free((uchar*)handler,MYF(0)); + my_free(handler); } diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c index 9838b15af34..1467cc56759 100644 --- a/storage/myisam/ft_stopwords.c +++ b/storage/myisam/ft_stopwords.c @@ -38,7 +38,7 @@ static void FT_STOPWORD_free(FT_STOPWORD *w, TREE_FREE action, void *arg __attribute__((unused))) { if (action == free_free) - my_free((uchar*) w->pos, MYF(0)); + my_free((void*)w->pos); } static int ft_add_stopword(const char *w) @@ -87,7 +87,7 @@ int ft_init_stopwords() } error=0; err1: - my_free(buffer, MYF(0)); + my_free(buffer); err0: my_close(fd, MYF(MY_WME)); return error; @@ -121,7 +121,7 @@ void ft_free_stopwords() if (stopwords3) { delete_tree(stopwords3); /* purecov: inspected */ - my_free((char*) stopwords3,MYF(0)); + my_free(stopwords3); stopwords3=0; } ft_stopword_file= 0; diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index e0e104a4878..87de58076cd 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -756,7 +756,7 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) recinfo must be freed. */ if (recinfo) - my_free((uchar*) recinfo, MYF(0)); + my_free(recinfo); return my_errno; } @@ -1883,7 +1883,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg, records, recinfo, 0, (MI_UNIQUEDEF*) 0, &create_info, create_flags); - my_free((uchar*) recinfo, MYF(0)); + my_free(recinfo); DBUG_RETURN(error); } @@ -2069,7 +2069,7 @@ mysql_declare_plugin(myisam) &myisam_storage_engine, "MyISAM", "MySQL AB", - "Default engine as of MySQL 3.23 with great performance", + "MyISAM storage engine", PLUGIN_LICENSE_GPL, myisam_init, /* Plugin Init */ NULL, /* Plugin Deinit */ diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 0bcc022a0dc..13427130069 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -1369,12 +1369,12 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) printf("Lost space: %12s Linkdata: %10s\n", llstr(empty,llbuff),llstr(link_used,llbuff2)); } - my_free(mi_get_rec_buff_ptr(info, record), MYF(0)); + my_free(mi_get_rec_buff_ptr(info, record)); DBUG_RETURN (error); err: mi_check_print_error(param,"got error: %d when reading datafile at record: %s",my_errno, llstr(records,llbuff)); err2: - my_free(mi_get_rec_buff_ptr(info, record), MYF(0)); + my_free(mi_get_rec_buff_ptr(info, record)); param->testflag|=T_RETRY_WITHOUT_QUICK; DBUG_RETURN(1); } /* chk_data_link */ @@ -1736,6 +1736,21 @@ err: { mysql_file_close(new_file, MYF(0)); info->dfile=new_file= -1; + /* + On Windows, the old data file cannot be deleted if it is either + open, or memory mapped. Closing the file won't remove the memory + map implicilty on Windows. We closed the data file, but we keep + the MyISAM table open. A memory map will be closed on the final + mi_close() only. So we need to unmap explicitly here. After + renaming the new file under the hook, we couldn't use the map of + the old file any more anyway. + */ + if (info->s->file_map) + { + (void) my_munmap((char*) info->s->file_map, + (size_t) info->s->mmaped_length); + info->s->file_map= NULL; + } if (change_to_newfile(share->data_file_name,MI_NAME_DEXT, DATA_TMP_EXT, share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? @@ -1759,11 +1774,9 @@ err: } mi_mark_crashed_on_repair(info); } - my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff), - MYF(MY_ALLOW_ZERO_PTR)); - my_free(mi_get_rec_buff_ptr(info, sort_param.record), - MYF(MY_ALLOW_ZERO_PTR)); - my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff)); + my_free(mi_get_rec_buff_ptr(info, sort_param.record)); + my_free(sort_info.buff); (void) end_io_cache(¶m->read_cache); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); (void) end_io_cache(&info->rec_cache); @@ -2193,11 +2206,11 @@ int filecopy(MI_CHECK *param, File to,File from,my_off_t start, mysql_file_write(to, (uchar*) buff, (uint) length, param->myf_rw)) goto err; if (buff != tmp_buff) - my_free(buff,MYF(0)); + my_free(buff); DBUG_RETURN(0); err: if (buff != tmp_buff) - my_free(buff,MYF(0)); + my_free(buff); mi_check_print_error(param,"Can't copy %s to tempfile, error %d", type,my_errno); DBUG_RETURN(1); @@ -2580,13 +2593,11 @@ err: share->state.changed&= ~STATE_NOT_OPTIMIZED_KEYS; share->state.changed|=STATE_NOT_SORTED_PAGES; - my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff), - MYF(MY_ALLOW_ZERO_PTR)); - my_free(mi_get_rec_buff_ptr(info, sort_param.record), - MYF(MY_ALLOW_ZERO_PTR)); - my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); - my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); - my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff)); + my_free(mi_get_rec_buff_ptr(info, sort_param.record)); + my_free(sort_info.key_block); + my_free(sort_info.ft_buf); + my_free(sort_info.buff); (void) end_io_cache(¶m->read_cache); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); if (!got_error && (param->testflag & T_UNPACK)) @@ -3127,10 +3138,10 @@ err: mysql_mutex_destroy(¶m->print_msg_mutex); param->need_print_msg_lock= 0; - my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); - my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); - my_free((uchar*) sort_param,MYF(MY_ALLOW_ZERO_PTR)); - my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); + my_free(sort_info.ft_buf); + my_free(sort_info.key_block); + my_free(sort_param); + my_free(sort_info.buff); (void) end_io_cache(¶m->read_cache); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); if (!got_error && (param->testflag & T_UNPACK)) @@ -4536,7 +4547,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, if (my_errno != HA_ERR_END_OF_FILE) { mi_extra(info,HA_EXTRA_NO_KEYREAD,0); - my_free(mi_get_rec_buff_ptr(info, record), MYF(0)); + my_free(mi_get_rec_buff_ptr(info, record)); mi_check_print_error(param,"%d when reading last record",my_errno); DBUG_VOID_RETURN; } @@ -4551,7 +4562,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, set_if_bigger(info->s->state.auto_increment, param->auto_increment_value); } mi_extra(info,HA_EXTRA_NO_KEYREAD,0); - my_free(mi_get_rec_buff_ptr(info, record), MYF(0)); + my_free(mi_get_rec_buff_ptr(info, record)); update_state_info(param, info, UPDATE_AUTO_INC); DBUG_VOID_RETURN; } diff --git a/storage/myisam/mi_close.c b/storage/myisam/mi_close.c index 8ec0bf14e0a..51408ab191c 100644 --- a/storage/myisam/mi_close.c +++ b/storage/myisam/mi_close.c @@ -57,7 +57,7 @@ int mi_close(register MI_INFO *info) myisam_open_list=list_delete(myisam_open_list,&info->open_list); mysql_mutex_unlock(&share->intern_lock); - my_free(mi_get_rec_buff_ptr(info, info->rec_buff), MYF(MY_ALLOW_ZERO_PTR)); + my_free(mi_get_rec_buff_ptr(info, info->rec_buff)); if (flag) { DBUG_EXECUTE_IF("crash_before_flush_keys", @@ -88,8 +88,8 @@ int mi_close(register MI_INFO *info) #endif if (share->decode_trees) { - my_free((uchar*) share->decode_trees,MYF(0)); - my_free((uchar*) share->decode_tables,MYF(0)); + my_free(share->decode_trees); + my_free(share->decode_tables); } #ifdef THREAD thr_lock_delete(&share->lock); @@ -103,19 +103,19 @@ int mi_close(register MI_INFO *info) } } #endif - my_free((uchar*) info->s,MYF(0)); + my_free(info->s); } mysql_mutex_unlock(&THR_LOCK_myisam); if (info->ftparser_param) { - my_free((uchar*)info->ftparser_param, MYF(0)); + my_free(info->ftparser_param); info->ftparser_param= 0; } if (info->dfile >= 0 && mysql_file_close(info->dfile, MYF(0))) error = my_errno; myisam_log_command(MI_LOG_CLOSE,info,NULL,0,error); - my_free((uchar*) info,MYF(0)); + my_free(info); if (error) { diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index 3db03e23637..4a91c2d939b 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -19,12 +19,8 @@ #include "sp_defs.h" #include <my_bit.h> -#if defined(MSDOS) || defined(__WIN__) #ifdef __WIN__ #include <fcntl.h> -#else -#include <process.h> /* Prototype for getpid */ -#endif #endif #include <m_ctype.h> @@ -834,7 +830,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, mysql_mutex_unlock(&THR_LOCK_myisam); if (mysql_file_close(file, MYF(0))) goto err; - my_free((char*) rec_per_key_part,MYF(0)); + my_free(rec_per_key_part); DBUG_RETURN(0); err: @@ -860,7 +856,7 @@ err: MY_UNPACK_FILENAME | MY_APPEND_EXT), MYF(0)); } - my_free((char*) rec_per_key_part, MYF(0)); + my_free(rec_per_key_part); DBUG_RETURN(my_errno=save_errno); /* return the fatal errno */ } diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 02a8f21e3e2..59b895b5e64 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -44,7 +44,7 @@ static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos, #undef my_alloca #undef my_afree #define my_alloca(A) my_malloc((A),MYF(0)) -#define my_afree(A) my_free((A),MYF(0)) +#define my_afree(A) my_free((A)) #endif /* Interface function from MI_INFO */ @@ -1575,7 +1575,7 @@ int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def, error=mi_unique_comp(def, record, old_record, def->null_are_equal); if (info->s->base.blobs) { - my_free(mi_get_rec_buff_ptr(info, info->rec_buff), MYF(MY_ALLOW_ZERO_PTR)); + my_free(mi_get_rec_buff_ptr(info, info->rec_buff)); info->rec_buff=rec_buff; } my_afree(old_record); diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c index 54498393f15..f6bbaab1f87 100644 --- a/storage/myisam/mi_log.c +++ b/storage/myisam/mi_log.c @@ -19,14 +19,8 @@ */ #include "myisamdef.h" -#if defined(MSDOS) || defined(__WIN__) +#ifdef __WIN__ #include <fcntl.h> -#ifndef __WIN__ -#include <process.h> -#endif -#endif -#ifdef VMS -#include <processes.h> #endif #undef GETPID /* For HPUX */ diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 1d877748b31..5b3da9841b8 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -20,15 +20,8 @@ #include "rt_index.h" #include <m_ctype.h> -#if defined(MSDOS) || defined(__WIN__) #ifdef __WIN__ #include <fcntl.h> -#else -#include <process.h> /* Prototype for getpid */ -#endif -#endif -#ifdef VMS -#include "static.c" #endif static void setup_key_functions(MI_KEYDEF *keyinfo); @@ -676,7 +669,7 @@ err: mi_report_error(save_errno, name); switch (errpos) { case 6: - my_free((uchar*) m_info,MYF(0)); + my_free(m_info); /* fall through */ case 5: (void) mysql_file_close(info.dfile, MYF(0)); @@ -684,7 +677,7 @@ err: break; /* Don't remove open table */ /* fall through */ case 4: - my_free((uchar*) share,MYF(0)); + my_free(share); /* fall through */ case 3: if (! lock_error) diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index 580c58e6ea1..0ba495fdd68 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -298,9 +298,9 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) err3: my_errno=HA_ERR_WRONG_IN_RECORD; err2: - my_free((uchar*) share->decode_tables,MYF(0)); + my_free(share->decode_tables); err1: - my_free((uchar*) share->decode_trees,MYF(0)); + my_free(share->decode_trees); err0: DBUG_RETURN(1); } diff --git a/storage/myisam/mi_preload.c b/storage/myisam/mi_preload.c index ae45014eab5..31537f7054b 100644 --- a/storage/myisam/mi_preload.c +++ b/storage/myisam/mi_preload.c @@ -113,11 +113,11 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) } while (pos != key_file_length); - my_free((char*) buff, MYF(0)); + my_free(buff); DBUG_RETURN(0); err: - my_free((char*) buff, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buff); DBUG_RETURN(my_errno= errno); } diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c index 81d063a58fd..baa01a507eb 100644 --- a/storage/myisam/mi_static.c +++ b/storage/myisam/mi_static.c @@ -23,9 +23,9 @@ #endif LIST *myisam_open_list=0; -uchar NEAR myisam_file_magic[]= +uchar myisam_file_magic[]= { (uchar) 254, (uchar) 254,'\007', '\001', }; -uchar NEAR myisam_pack_file_magic[]= +uchar myisam_pack_file_magic[]= { (uchar) 254, (uchar) 254,'\010', '\002', }; char * myisam_log_filename=(char*) "myisam.log"; File myisam_log_file= -1; @@ -55,7 +55,7 @@ int (*myisam_test_invalid_symlink)(const char *filename)= always_valid; Position is , == , >= , <= , > , < */ -uint NEAR myisam_read_vec[]= +uint myisam_read_vec[]= { SEARCH_FIND, SEARCH_FIND | SEARCH_BIGGER, SEARCH_FIND | SEARCH_SMALLER, SEARCH_NO_FIND | SEARCH_BIGGER, SEARCH_NO_FIND | SEARCH_SMALLER, @@ -63,7 +63,7 @@ uint NEAR myisam_read_vec[]= MBR_CONTAIN, MBR_INTERSECT, MBR_WITHIN, MBR_DISJOINT, MBR_EQUAL }; -uint NEAR myisam_readnext_vec[]= +uint myisam_readnext_vec[]= { SEARCH_BIGGER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c index 31e20754314..513b390ee68 100644 --- a/storage/myisam/mi_test2.c +++ b/storage/myisam/mi_test2.c @@ -21,9 +21,6 @@ #ifdef DBUG_OFF #undef DBUG_OFF #endif -#ifndef SAFEMALLOC -#define SAFEMALLOC -#endif #include "myisamdef.h" #include <m_ctype.h> #include <my_bit.h> @@ -31,7 +28,7 @@ #define STANDARD_LENGTH 37 #define MYISAM_KEYS 6 #define MAX_PARTS 4 -#if !defined(MSDOS) && !defined(labs) +#if !defined(labs) #define labs(a) abs(a) #endif @@ -856,7 +853,7 @@ reads: %10lu\n", } end_key_cache(dflt_key_cache,1); if (blob_buffer) - my_free(blob_buffer,MYF(0)); + my_free(blob_buffer); my_end(silent ? MY_CHECK_ERROR : MY_CHECK_ERROR | MY_GIVE_INFO); return(0); err: diff --git a/storage/myisam/mi_test3.c b/storage/myisam/mi_test3.c index 7b16d6c05d6..bf36d8df7f4 100644 --- a/storage/myisam/mi_test3.c +++ b/storage/myisam/mi_test3.c @@ -15,8 +15,6 @@ /* Test av locking */ -#ifndef __NETWARE__ - #include "myisam.h" #include <sys/types.h> #ifdef HAVE_SYS_WAIT_H @@ -489,15 +487,3 @@ int test_update(MI_INFO *file,int id,int lock_type) } #include "mi_extrafunc.h" - -#else /* __NETWARE__ */ - -#include <stdio.h> - -main() -{ - fprintf(stderr,"this test has not been ported to NetWare\n"); - return 0; -} - -#endif /* __NETWARE__ */ diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c index 5b46db111b3..f2d43585eef 100644 --- a/storage/myisam/mi_write.c +++ b/storage/myisam/mi_write.c @@ -286,7 +286,7 @@ int _mi_ck_write_btree(register MI_INFO *info, uint keynr, uchar *key, if (!error) error= _mi_ft_convert_to_ft2(info, keynr, key); delete_dynamic(info->ft1_to_ft2); - my_free((uchar*)info->ft1_to_ft2, MYF(0)); + my_free(info->ft1_to_ft2); info->ft1_to_ft2=0; } DBUG_RETURN(error); @@ -1045,7 +1045,7 @@ void mi_end_bulk_insert(MI_INFO *info) delete_tree(& info->bulk_insert[i]); } } - my_free((void *)info->bulk_insert, MYF(0)); + my_free(info->bulk_insert); info->bulk_insert=0; } } diff --git a/storage/myisam/myisam_ftdump.c b/storage/myisam/myisam_ftdump.c index 74fa506a5b5..4718abc3481 100644 --- a/storage/myisam/myisam_ftdump.c +++ b/storage/myisam/myisam_ftdump.c @@ -253,18 +253,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), return 0; } -#include <help_start.h> static void usage() { printf("Use: myisam_ftdump <table_name> <index_num>\n"); my_print_help(my_long_options); my_print_variables(my_long_options); - NETWARE_SET_SCREEN_MODE(1); exit(1); } -#include <help_end.h> static void complain(int val) /* Kinda assert :-) */ { diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 11ec52fd123..e1cedf6bc31 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -148,7 +148,7 @@ enum options_mc { OPT_READ_BUFFER_SIZE, OPT_WRITE_BUFFER_SIZE, OPT_SORT_BUFFER_SIZE, OPT_SORT_KEY_BLOCKS, OPT_DECODE_BITS, OPT_FT_MIN_WORD_LEN, OPT_FT_MAX_WORD_LEN, OPT_FT_STOPWORD_FILE, - OPT_MAX_RECORD_LENGTH, OPT_AUTO_CLOSE, OPT_STATS_METHOD + OPT_MAX_RECORD_LENGTH, OPT_STATS_METHOD }; static struct my_option my_long_options[] = @@ -156,10 +156,6 @@ static struct my_option my_long_options[] = {"analyze", 'a', "Analyze distribution of keys. Will make some joins in MySQL faster. You can check the calculated distribution.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"block-search", 'b', "No help available.", 0, 0, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -336,13 +332,10 @@ static struct my_option my_long_options[] = }; -#include <help_start.h> - static void print_version(void) { printf("%s Ver 2.7 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -364,7 +357,7 @@ static void usage(void) -?, --help Display this help and exit.\n\ -t, --tmpdir=path Path for temporary files. Multiple paths can be\n\ specified, separated by "); -#if defined( __WIN__) || defined(__NETWARE__) +#if defined( __WIN__) printf("semicolon (;)"); #else printf("colon (:)"); @@ -460,7 +453,6 @@ static void usage(void) my_print_variables(my_long_options); } -#include <help_end.h> const char *myisam_stats_method_names[] = {"nulls_unequal", "nulls_equal", "nulls_ignored", NullS}; @@ -476,11 +468,6 @@ get_one_option(int optid, char *argument) { switch (optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'a': if (argument == disabled_my_option) check_param.testflag&= ~T_STATISTICS; @@ -1629,11 +1616,10 @@ err: { my_afree((uchar*) temp_buff); } - my_free(mi_get_rec_buff_ptr(info, sort_param.record), - MYF(MY_ALLOW_ZERO_PTR)); + my_free(mi_get_rec_buff_ptr(info, sort_param.record)); info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); (void) end_io_cache(&info->rec_cache); - my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR)); + my_free(sort_info.buff); sort_info.buff=0; share->state.sortkey=sort_key; DBUG_RETURN(flush_blocks(param, share->key_cache, share->kfile) | @@ -1673,7 +1659,6 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info, endpos=buff+used_length; for ( ;; ) { - _sanity(__FILE__,__LINE__); if (nod_flag) { next_page=_mi_kpos(nod_flag,keypos); @@ -1689,7 +1674,6 @@ static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info, new_file, update_index)) goto err; } - _sanity(__FILE__,__LINE__); if (keypos >= endpos || (key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,lastkey)) == 0) diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index d88ebdf5f12..130a96bc9e0 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -347,11 +347,11 @@ typedef struct st_mi_sort_param int (*key_read)(struct st_mi_sort_param *,void *); int (*key_write)(struct st_mi_sort_param *, const void *); void (*lock_in_memory)(MI_CHECK *); - NEAR int (*write_keys)(struct st_mi_sort_param *, register uchar **, - uint , struct st_buffpek *, IO_CACHE *); - NEAR uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint); - NEAR int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *, - uint, uint); + int (*write_keys)(struct st_mi_sort_param *, register uchar **, + uint , struct st_buffpek *, IO_CACHE *); + uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint); + int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *, + uint, uint); } MI_SORT_PARAM; /* Some defines used by isam-funktions */ @@ -475,8 +475,8 @@ extern mysql_mutex_t THR_LOCK_myisam; /* Some extern variables */ extern LIST *myisam_open_list; -extern uchar NEAR myisam_file_magic[],NEAR myisam_pack_file_magic[]; -extern uint NEAR myisam_read_vec[],NEAR myisam_readnext_vec[]; +extern uchar myisam_file_magic[], myisam_pack_file_magic[]; +extern uint myisam_read_vec[], myisam_readnext_vec[]; extern uint myisam_quick_table_bits; extern File myisam_log_file; extern ulong myisam_pid; @@ -774,9 +774,9 @@ void _mi_report_crashed(MI_INFO *file, const char *message, /* Functions needed by mi_check */ volatile int *killed_ptr(MI_CHECK *param); -void mi_check_print_error _VARARGS((MI_CHECK *param, const char *fmt,...)); -void mi_check_print_warning _VARARGS((MI_CHECK *param, const char *fmt,...)); -void mi_check_print_info _VARARGS((MI_CHECK *param, const char *fmt,...)); +void mi_check_print_error(MI_CHECK *param, const char *fmt,...); +void mi_check_print_warning(MI_CHECK *param, const char *fmt,...); +void mi_check_print_info(MI_CHECK *param, const char *fmt,...); int flush_pending_blocks(MI_SORT_PARAM *param); int sort_ft_buf_flush(MI_SORT_PARAM *sort_param); int thr_write_keys(MI_SORT_PARAM *sort_param); diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c index 089e3480da6..d3da0eab22c 100644 --- a/storage/myisam/myisamlog.c +++ b/storage/myisam/myisamlog.c @@ -248,7 +248,6 @@ static void get_options(register int *argc, register char ***argv) /* Fall through */ case 'I': case '?': -#include <help_start.h> printf("%s Ver 1.4 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE); puts("By Monty, for your professional use\n"); @@ -270,7 +269,6 @@ static void get_options(register int *argc, register char ***argv) puts("If a recover is done all writes and all possibly updates and deletes is done\nand errors are only counted."); puts("If one gives table names as arguments only these tables will be updated\n"); help=1; -#include <help_end.h> break; default: printf("illegal option: \"-%c\"\n",*pos); @@ -616,7 +614,7 @@ static int examine_log(char * file_name, char **table_names) } } } - my_free(buff,MYF(0)); + my_free(buff); break; case MI_LOG_LOCK: if (my_b_read(&cache,(uchar*) head,sizeof(lock_command))) @@ -683,12 +681,12 @@ static int read_string(IO_CACHE *file, register uchar* *to, register uint length DBUG_ENTER("read_string"); if (*to) - my_free((uchar*) *to,MYF(0)); + my_free(*to); if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) || my_b_read(file,(uchar*) *to,length)) { if (*to) - my_free(*to,MYF(0)); + my_free(*to); *to= 0; DBUG_RETURN(1); } @@ -759,10 +757,10 @@ static void file_info_free(struct file_info *fileinfo) if (!fileinfo->closed) (void) mi_close(fileinfo->isam); if (fileinfo->record) - my_free(fileinfo->record,MYF(0)); + my_free(fileinfo->record); } - my_free(fileinfo->name,MYF(0)); - my_free(fileinfo->show_name,MYF(0)); + my_free(fileinfo->name); + my_free(fileinfo->show_name); DBUG_VOID_RETURN; } diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index 18810a60166..4cd305fdc69 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -23,9 +23,6 @@ #include <queues.h> #include <my_tree.h> #include "mysys_err.h" -#ifdef MSDOS -#include <io.h> -#endif #ifndef __GNU_LIBRARY__ #define __GNU_LIBRARY__ /* Skip warnings in getopt.h */ #endif @@ -256,14 +253,10 @@ int main(int argc, char **argv) #endif } -enum options_mp {OPT_CHARSETS_DIR_MP=256, OPT_AUTO_CLOSE}; +enum options_mp {OPT_CHARSETS_DIR_MP=256}; static struct my_option my_long_options[] = { -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"backup", 'b', "Make a backup of the table as table_name.OLD.", &backup, &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR_MP, @@ -295,13 +288,11 @@ static struct my_option my_long_options[] = { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; -#include <help_start.h> static void print_version(void) { printf("%s Ver 1.23 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -323,7 +314,6 @@ static void usage(void) my_print_variables(my_long_options); } -#include <help_end.h> static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -332,11 +322,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), uint length; switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'f': force_pack= 1; tmpfile_createflag= O_RDWR | O_TRUNC; @@ -486,7 +471,7 @@ static my_bool open_isam_files(PACK_MRG_INFO *mrg, char **names, uint count) error: while (i--) mi_close(mrg->file[i]); - my_free((uchar*) mrg->file,MYF(0)); + my_free(mrg->file); return 1; } @@ -534,10 +519,10 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) my_write(join_isam_file,buff,length, MYF(MY_WME | MY_NABP | MY_WAIT_IF_FULL))) { - my_free(buff,MYF(0)); + my_free(buff); goto err; } - my_free(buff,MYF(0)); + my_free(buff); (void) fn_format(new_name,result_table,"",MI_NAME_DEXT,2); } else if (!tmp_dir[0]) @@ -564,7 +549,6 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) } trees=fields=share->base.fields; huff_counts=init_huff_count(isam_file,mrg->records); - QUICK_SAFEMALLOC; /* Read the whole data file(s) for statistics. @@ -574,7 +558,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) printf("- Calculating statistics\n"); if (get_statistic(mrg,huff_counts)) goto err; - NORMAL_SAFEMALLOC; + old_length=0; for (i=0; i < mrg->count ; i++) old_length+= (mrg->file[i]->s->state.state.data_file_length - @@ -857,11 +841,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees, for (i=0 ; i < trees ; i++) { if (huff_trees[i].element_buffer) - my_free((uchar*) huff_trees[i].element_buffer,MYF(0)); + my_free(huff_trees[i].element_buffer); if (huff_trees[i].code) - my_free((uchar*) huff_trees[i].code,MYF(0)); + my_free(huff_trees[i].code); } - my_free((uchar*) huff_trees,MYF(0)); + my_free(huff_trees); } if (huff_counts) { @@ -869,11 +853,11 @@ static void free_counts_and_tree_and_queue(HUFF_TREE *huff_trees, uint trees, { if (huff_counts[i].tree_buff) { - my_free((uchar*) huff_counts[i].tree_buff,MYF(0)); + my_free(huff_counts[i].tree_buff); delete_tree(&huff_counts[i].int_tree); } } - my_free((uchar*) huff_counts,MYF(0)); + my_free(huff_counts); } delete_queue(&queue); /* This is safe to free */ return; @@ -977,7 +961,7 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts) count->int_tree.elements_in_tree > 1)) { delete_tree(&count->int_tree); - my_free(count->tree_buff,MYF(0)); + my_free(count->tree_buff); count->tree_buff=0; } else @@ -1374,12 +1358,12 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees, } else { - my_free((uchar*) huff_counts->tree_buff,MYF(0)); + my_free(huff_counts->tree_buff); delete_tree(&huff_counts->int_tree); huff_counts->tree_buff=0; } if (tree.element_buffer) - my_free((uchar*) tree.element_buffer,MYF(0)); + my_free(tree.element_buffer); } if (huff_counts->pack_type & PACK_TYPE_SPACE_FIELDS) space_fields++; @@ -1496,8 +1480,8 @@ static HUFF_TREE* make_huff_trees(HUFF_COUNTS *huff_counts, uint trees) if (make_huff_tree(huff_tree+tree,huff_counts+tree)) { while (tree--) - my_free((uchar*) huff_tree[tree].element_buffer,MYF(0)); - my_free((uchar*) huff_tree,MYF(0)); + my_free(huff_tree[tree].element_buffer); + my_free(huff_tree); DBUG_RETURN(0); } } @@ -1907,7 +1891,7 @@ static uint join_same_trees(HUFF_COUNTS *huff_counts, uint trees) { memcpy_fixed((uchar*) i->counts,(uchar*) count.counts, sizeof(count.counts[0])*256); - my_free((uchar*) j->tree->element_buffer,MYF(0)); + my_free(j->tree->element_buffer); j->tree->element_buffer=0; j->tree=i->tree; bmove((uchar*) i->counts,(uchar*) count.counts, @@ -2913,7 +2897,7 @@ static int flush_buffer(ulong neaded_length) static void end_file_buffer(void) { - my_free((uchar*) file_buffer.buffer,MYF(0)); + my_free(file_buffer.buffer); } /* output `bits` low bits of `value' */ @@ -3117,7 +3101,7 @@ static int mrg_close(PACK_MRG_INFO *mrg) for (i=0 ; i < mrg->count ; i++) error|=mi_close(mrg->file[i]); if (mrg->free_file) - my_free((uchar*) mrg->file,MYF(0)); + my_free(mrg->file); return error; } @@ -3180,7 +3164,7 @@ static void fakebigcodes(HUFF_COUNTS *huff_counts, HUFF_COUNTS *end_count) */ if (huff_counts->tree_buff) { - my_free((uchar*) huff_counts->tree_buff, MYF(0)); + my_free(huff_counts->tree_buff); delete_tree(&huff_counts->int_tree); huff_counts->tree_buff= NULL; DBUG_PRINT("fakebigcodes", ("freed distinct column values")); diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c index 410badd3145..32cf1fd924d 100644 --- a/storage/myisam/rt_index.c +++ b/storage/myisam/rt_index.c @@ -972,7 +972,7 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length) goto err1; } if (ReinsertList.pages) - my_free((uchar*) ReinsertList.pages, MYF(0)); + my_free(ReinsertList.pages); /* check for redundant root (not leaf, 1 child) and eliminate */ if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR) diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index 539630899f4..9532b9f0474 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -19,7 +19,7 @@ */ #include "fulltext.h" -#if defined(MSDOS) || defined(__WIN__) +#if defined(__WIN__) #include <fcntl.h> #else #include <stddef.h> @@ -41,46 +41,46 @@ Pointers of functions for store and read keys from temp file */ -extern void print_error _VARARGS((const char *fmt,...)); +extern void print_error(const char *fmt,...); /* Functions defined in this file */ -static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info,uint keys, - uchar **sort_keys, - DYNAMIC_ARRAY *buffpek,int *maxbuffer, - IO_CACHE *tempfile, - IO_CACHE *tempfile_for_exceptions); -static int NEAR_F write_keys(MI_SORT_PARAM *info,uchar **sort_keys, - uint count, BUFFPEK *buffpek,IO_CACHE *tempfile); -static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, - IO_CACHE *tempfile); -static int NEAR_F write_index(MI_SORT_PARAM *info,uchar * *sort_keys, - uint count); -static int NEAR_F merge_many_buff(MI_SORT_PARAM *info,uint keys, - uchar * *sort_keys, - BUFFPEK *buffpek,int *maxbuffer, - IO_CACHE *t_file); -static uint NEAR_F read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek, - uint sort_length); -static int NEAR_F merge_buffers(MI_SORT_PARAM *info,uint keys, - IO_CACHE *from_file, IO_CACHE *to_file, - uchar * *sort_keys, BUFFPEK *lastbuff, - BUFFPEK *Fb, BUFFPEK *Tb); -static int NEAR_F merge_index(MI_SORT_PARAM *,uint,uchar **,BUFFPEK *, int, - IO_CACHE *); +static ha_rows find_all_keys(MI_SORT_PARAM *info,uint keys, + uchar **sort_keys, + DYNAMIC_ARRAY *buffpek,int *maxbuffer, + IO_CACHE *tempfile, + IO_CACHE *tempfile_for_exceptions); +static int write_keys(MI_SORT_PARAM *info,uchar **sort_keys, + uint count, BUFFPEK *buffpek,IO_CACHE *tempfile); +static int write_key(MI_SORT_PARAM *info, uchar *key, + IO_CACHE *tempfile); +static int write_index(MI_SORT_PARAM *info,uchar * *sort_keys, + uint count); +static int merge_many_buff(MI_SORT_PARAM *info,uint keys, + uchar * *sort_keys, + BUFFPEK *buffpek,int *maxbuffer, + IO_CACHE *t_file); +static uint read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek, + uint sort_length); +static int merge_buffers(MI_SORT_PARAM *info,uint keys, + IO_CACHE *from_file, IO_CACHE *to_file, + uchar * *sort_keys, BUFFPEK *lastbuff, + BUFFPEK *Fb, BUFFPEK *Tb); +static int merge_index(MI_SORT_PARAM *,uint,uchar **,BUFFPEK *, int, + IO_CACHE *); static int flush_ft_buf(MI_SORT_PARAM *info); -static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,uchar **sort_keys, - uint count, BUFFPEK *buffpek, - IO_CACHE *tempfile); -static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek, - uint sort_length); -static int NEAR_F write_merge_key(MI_SORT_PARAM *info, IO_CACHE *to_file, - uchar *key, uint sort_length, uint count); -static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, - IO_CACHE *to_file, - uchar* key, uint sort_length, - uint count); +static int write_keys_varlen(MI_SORT_PARAM *info,uchar **sort_keys, + uint count, BUFFPEK *buffpek, + IO_CACHE *tempfile); +static uint read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek, + uint sort_length); +static int write_merge_key(MI_SORT_PARAM *info, IO_CACHE *to_file, + uchar *key, uint sort_length, uint count); +static int write_merge_key_varlen(MI_SORT_PARAM *info, + IO_CACHE *to_file, + uchar* key, uint sort_length, + uint count); static inline int my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs); @@ -162,7 +162,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer, maxbuffer/2)) { - my_free((uchar*) sort_keys,MYF(0)); + my_free(sort_keys); sort_keys= 0; } else @@ -242,8 +242,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, error =0; err: - if (sort_keys) - my_free((uchar*) sort_keys,MYF(0)); + my_free(sort_keys); delete_dynamic(&buffpek); close_cached_file(&tempfile); close_cached_file(&tempfile_for_exceptions); @@ -254,10 +253,10 @@ err: /* Search after all keys and place them in a temp. file */ -static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, uint keys, - uchar **sort_keys, DYNAMIC_ARRAY *buffpek, - int *maxbuffer, IO_CACHE *tempfile, - IO_CACHE *tempfile_for_exceptions) +static ha_rows find_all_keys(MI_SORT_PARAM *info, uint keys, + uchar **sort_keys, DYNAMIC_ARRAY *buffpek, + int *maxbuffer, IO_CACHE *tempfile, + IO_CACHE *tempfile_for_exceptions) { int error; uint idx; @@ -382,7 +381,7 @@ pthread_handler_t thr_find_all_keys(void *arg) if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK), maxbuffer, maxbuffer/2)) { - my_free((uchar*) sort_keys,MYF(0)); + my_free(sort_keys); sort_keys= (uchar **) NULL; /* for err: label */ } else @@ -451,8 +450,7 @@ pthread_handler_t thr_find_all_keys(void *arg) err: DBUG_PRINT("error", ("got some error")); sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */ - if (sort_keys) - my_free((uchar*) sort_keys,MYF(0)); + my_free(sort_keys); sort_param->sort_keys= 0; delete_dynamic(& sort_param->buffpek); close_cached_file(&sort_param->tempfile); @@ -509,8 +507,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) if (!sinfo->sort_keys) { got_error=1; - my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff), - MYF(MY_ALLOW_ZERO_PTR)); + my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff)); continue; } if (!got_error) @@ -528,9 +525,8 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) got_error=1; } } - my_free((uchar*) sinfo->sort_keys,MYF(0)); - my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff), - MYF(MY_ALLOW_ZERO_PTR)); + my_free(sinfo->sort_keys); + my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff)); sinfo->sort_keys=0; } @@ -638,15 +634,15 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) sinfo->notnull : NULL, (ulonglong) info->state->records); } - my_free((uchar*) mergebuf,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mergebuf); DBUG_RETURN(got_error); } #endif /* THREAD */ /* Write all keys in memory to file for later merge */ -static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, - uint count, BUFFPEK *buffpek, IO_CACHE *tempfile) +static int write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, + uint count, BUFFPEK *buffpek, IO_CACHE *tempfile) { uchar **end; uint sort_length=info->key_length; @@ -686,10 +682,10 @@ my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs) } -static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, - register uchar **sort_keys, - uint count, BUFFPEK *buffpek, - IO_CACHE *tempfile) +static int write_keys_varlen(MI_SORT_PARAM *info, + register uchar **sort_keys, + uint count, BUFFPEK *buffpek, + IO_CACHE *tempfile) { uchar **end; int err; @@ -713,8 +709,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, } /* write_keys_varlen */ -static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, - IO_CACHE *tempfile) +static int write_key(MI_SORT_PARAM *info, uchar *key, IO_CACHE *tempfile) { uint key_length=info->real_key_length; DBUG_ENTER("write_key"); @@ -733,8 +728,8 @@ static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, /* Write index */ -static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys, - register uint count) +static int write_index(MI_SORT_PARAM *info, register uchar **sort_keys, + register uint count) { DBUG_ENTER("write_index"); @@ -751,9 +746,9 @@ static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys, /* Merge buffers to make < MERGEBUFF2 buffers */ -static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, uint keys, - uchar **sort_keys, BUFFPEK *buffpek, - int *maxbuffer, IO_CACHE *t_file) +static int merge_many_buff(MI_SORT_PARAM *info, uint keys, + uchar **sort_keys, BUFFPEK *buffpek, + int *maxbuffer, IO_CACHE *t_file) { register int i; IO_CACHE t_file2, *from_file, *to_file, *temp; @@ -814,8 +809,8 @@ cleanup: -1 Error */ -static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, - uint sort_length) +static uint read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, + uint sort_length) { register uint count; uint length; @@ -834,8 +829,8 @@ static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, return (count*sort_length); } /* read_to_buffer */ -static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, - uint sort_length) +static uint read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, + uint sort_length) { register uint count; uint16 length_of_key = 0; @@ -866,9 +861,9 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, } /* read_to_buffer_varlen */ -static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, - IO_CACHE *to_file, uchar* key, - uint sort_length, uint count) +static int write_merge_key_varlen(MI_SORT_PARAM *info, + IO_CACHE *to_file, uchar* key, + uint sort_length, uint count) { uint idx; uchar *bufs = key; @@ -884,9 +879,9 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, } -static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), - IO_CACHE *to_file, uchar *key, - uint sort_length, uint count) +static int write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), + IO_CACHE *to_file, uchar *key, + uint sort_length, uint count) { return my_b_write(to_file, key, (size_t) sort_length*count); } @@ -896,7 +891,7 @@ static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), If to_file == 0 then use info->key_write */ -static int NEAR_F +static int merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, IO_CACHE *to_file, uchar **sort_keys, BUFFPEK *lastbuff, BUFFPEK *Fb, BUFFPEK *Tb) @@ -1039,7 +1034,7 @@ err: /* Do a merge to output-file (save only positions) */ -static int NEAR_F +static int merge_index(MI_SORT_PARAM *info, uint keys, uchar **sort_keys, BUFFPEK *buffpek, int maxbuffer, IO_CACHE *tempfile) { @@ -1057,7 +1052,7 @@ flush_ft_buf(MI_SORT_PARAM *info) if (info->sort_info->ft_buf) { err=sort_ft_buf_flush(info); - my_free((uchar*)info->sort_info->ft_buf, MYF(0)); + my_free(info->sort_info->ft_buf); info->sort_info->ft_buf=0; } return err; diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 1b0dbb3fd0b..bac8cb7a0b7 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -103,6 +103,7 @@ #include "myrg_def.h" #include "thr_malloc.h" // int_sql_alloc #include "sql_class.h" // THD +#include "debug_sync.h" static handler *myisammrg_create_handler(handlerton *hton, TABLE_SHARE *table, @@ -754,6 +755,7 @@ int ha_myisammrg::attach_children(void) /* Must not call this with attached children. */ DBUG_ASSERT(!this->file->children_attached); + DEBUG_SYNC(current_thd, "before_myisammrg_attach"); /* Must call this with children list in place. */ DBUG_ASSERT(this->table->pos_in_table_list->next_global == this->children_l); @@ -828,7 +830,7 @@ int ha_myisammrg::attach_children(void) error= HA_ERR_WRONG_MRG_TABLE_DEF; if (!(this->test_if_locked & HA_OPEN_FOR_REPAIR)) { - my_free((uchar*) recinfo, MYF(0)); + my_free(recinfo); goto err; } /* purecov: begin inspected */ @@ -836,7 +838,7 @@ int ha_myisammrg::attach_children(void) /* purecov: end */ } } - my_free((uchar*) recinfo, MYF(0)); + my_free(recinfo); if (error == HA_ERR_WRONG_MRG_TABLE_DEF) goto err; /* purecov: inspected */ diff --git a/storage/myisammrg/myrg_close.c b/storage/myisammrg/myrg_close.c index 45e0a82913a..066a09cadbc 100644 --- a/storage/myisammrg/myrg_close.c +++ b/storage/myisammrg/myrg_close.c @@ -53,13 +53,13 @@ int myrg_close(MYRG_INFO *info) } } else - my_free((uchar*) info->rec_per_key_part, MYF(MY_ALLOW_ZERO_PTR)); + my_free(info->rec_per_key_part); delete_queue(&info->by_key); mysql_mutex_lock(&THR_LOCK_open); myrg_open_list=list_delete(myrg_open_list,&info->open_list); mysql_mutex_unlock(&THR_LOCK_open); mysql_mutex_destroy(&info->mutex); - my_free((uchar*) info,MYF(0)); + my_free(info); if (error) { DBUG_RETURN(my_errno=error); diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c index 915680ab64c..c9e19d32e96 100644 --- a/storage/myisammrg/myrg_open.c +++ b/storage/myisammrg/myrg_open.c @@ -18,9 +18,6 @@ #include "myrg_def.h" #include <stddef.h> #include <errno.h> -#ifdef VMS -#include "mrg_static.c" -#endif /* open a MyISAM MERGE table @@ -186,7 +183,7 @@ err: case 3: while (files) (void) mi_close(m_info->open_tables[--files].table); - my_free((char*) m_info,MYF(0)); + my_free(m_info); /* Fall through */ case 2: end_io_cache(&file); @@ -339,7 +336,7 @@ MYRG_INFO *myrg_parent_open(const char *parent_name, save_errno= my_errno; switch (errpos) { case 3: - my_free((char*) m_info, MYF(0)); + my_free(m_info); /* Fall through */ case 2: end_io_cache(&file_cache); @@ -422,7 +419,7 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking, key_parts= myisam->s->base.key_parts; if (*need_compat_check && m_info->rec_per_key_part) { - my_free((char *) m_info->rec_per_key_part, MYF(0)); + my_free(m_info->rec_per_key_part); m_info->rec_per_key_part= NULL; } if (!m_info->rec_per_key_part) @@ -491,7 +488,7 @@ err: save_errno= my_errno; switch (errpos) { case 1: - my_free((char*) m_info->rec_per_key_part, MYF(0)); + my_free(m_info->rec_per_key_part); m_info->rec_per_key_part= NULL; } mysql_mutex_unlock(&m_info->mutex); diff --git a/storage/ndb/config/win-lib.am b/storage/ndb/config/win-lib.am index 05ac1ec8a40..1e7bbfae19b 100644 --- a/storage/ndb/config/win-lib.am +++ b/storage/ndb/config/win-lib.am @@ -68,7 +68,7 @@ LIB32=xilink6.exe -lib # PROP Intermediate_Dir "debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /Gf /D "WIN32" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /Gf /D "WIN32" /D "_DEBUG" /D "SAFE_MUTEX" /D "_WINDOWS" /FD /c # ADD BASE CPP @includes@ # ADD CPP @includes@ # SUBTRACT CPP /YX diff --git a/storage/ndb/config/win-prg.am b/storage/ndb/config/win-prg.am index 70c19a70c6d..5d56d79c41e 100644 --- a/storage/ndb/config/win-prg.am +++ b/storage/ndb/config/win-prg.am @@ -71,7 +71,7 @@ LINK32=xilink6.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "NDB_WIN32" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /D "NDB_WIN32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /D "NDB_WIN32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c # ADD BASE CPP @includes@ # ADD CPP @includes@ # SUBTRACT CPP /Fr /YX diff --git a/storage/ndb/include/util/NdbAutoPtr.hpp b/storage/ndb/include/util/NdbAutoPtr.hpp index 5210fbc6dde..f11b8f0d5bc 100644 --- a/storage/ndb/include/util/NdbAutoPtr.hpp +++ b/storage/ndb/include/util/NdbAutoPtr.hpp @@ -51,8 +51,8 @@ class My_auto_ptr { T * m_obj; public: My_auto_ptr(T * obj = 0){ m_obj = obj;} - void reset(T * obj = 0) { if (m_obj) my_free(m_obj,MYF(0)); m_obj = obj; } - ~My_auto_ptr() { if (m_obj) my_free(m_obj,MYF(0));} + void reset(T * obj = 0) { if (m_obj) my_free(m_obj); m_obj = obj; } + ~My_auto_ptr() { if (m_obj) my_free(m_obj);} }; #endif diff --git a/storage/ndb/src/mgmapi/mgmapi.cpp b/storage/ndb/src/mgmapi/mgmapi.cpp index 662e5c22f48..78c767c31c6 100644 --- a/storage/ndb/src/mgmapi/mgmapi.cpp +++ b/storage/ndb/src/mgmapi/mgmapi.cpp @@ -212,7 +212,7 @@ extern "C" void ndb_mgm_set_name(NdbMgmHandle handle, const char *name) { - my_free(handle->m_name, MYF(MY_ALLOW_ZERO_PTR)); + my_free(handle->m_name); handle->m_name= my_strdup(name, MYF(MY_WME)); } @@ -278,10 +278,10 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle) } #endif (*handle)->cfg.~LocalConfig(); - my_free((*handle)->m_name, MYF(MY_ALLOW_ZERO_PTR)); + my_free((*handle)->m_name); if ((*handle)->m_bindaddress) free((*handle)->m_bindaddress); - my_free((char*)* handle,MYF(MY_ALLOW_ZERO_PTR)); + my_free(* handle); * handle = 0; DBUG_VOID_RETURN; } diff --git a/storage/ndb/src/mgmapi/ndb_logevent.cpp b/storage/ndb/src/mgmapi/ndb_logevent.cpp index fbf026fd79d..c372f852144 100644 --- a/storage/ndb/src/mgmapi/ndb_logevent.cpp +++ b/storage/ndb/src/mgmapi/ndb_logevent.cpp @@ -82,7 +82,7 @@ void ndb_mgm_destroy_logevent_handle(NdbLogEventHandle * h) if ( *h ) close((*h)->socket); - my_free((char*)* h,MYF(MY_ALLOW_ZERO_PTR)); + my_free(* h); * h = 0; } diff --git a/storage/ndb/src/mgmclient/main.cpp b/storage/ndb/src/mgmclient/main.cpp index fbd81c71700..980530953ad 100644 --- a/storage/ndb/src/mgmclient/main.cpp +++ b/storage/ndb/src/mgmclient/main.cpp @@ -20,7 +20,7 @@ extern "C" { #if defined( __WIN__) #include <conio.h> -#elif !defined(__NETWARE__) +#else #include <readline/readline.h> extern "C" int add_history(const char *command); /* From readline directory */ extern "C" int read_history(const char *command); diff --git a/storage/ndb/src/mgmsrv/main.cpp b/storage/ndb/src/mgmsrv/main.cpp index 16c560868ef..26198a44a23 100644 --- a/storage/ndb/src/mgmsrv/main.cpp +++ b/storage/ndb/src/mgmsrv/main.cpp @@ -48,7 +48,7 @@ const char *load_default_groups[]= { "mysql_cluster","ndb_mgmd",0 }; extern "C" { #if defined( __WIN__) #include <conio.h> -#elif !defined(__NETWARE__) +#else #include <readline/readline.h> extern "C" int add_history(const char *command); /* From readline directory */ #define HAVE_READLINE diff --git a/storage/ndb/test/ndbapi/testIndexStat.cpp b/storage/ndb/test/ndbapi/testIndexStat.cpp index 0e15cdd80d1..559fade3132 100644 --- a/storage/ndb/test/ndbapi/testIndexStat.cpp +++ b/storage/ndb/test/ndbapi/testIndexStat.cpp @@ -404,9 +404,9 @@ static void freekeys() { if (g_keys != 0) - my_free((char*)g_keys, MYF(0)); + my_free(g_keys); if (g_sortkeys != 0) - my_free((char*)g_sortkeys, MYF(0)); + my_free(g_sortkeys); g_keys = 0; g_sortkeys = 0; } @@ -896,7 +896,7 @@ static void freeranges() { if (g_ranges != 0) - my_free((char*)g_ranges, MYF(0)); + my_free(g_ranges); g_ranges = 0; } diff --git a/storage/ndb/tools/restore/consumer_restore.cpp b/storage/ndb/tools/restore/consumer_restore.cpp index e8e8d584f09..f63cbdd2aa2 100644 --- a/storage/ndb/tools/restore/consumer_restore.cpp +++ b/storage/ndb/tools/restore/consumer_restore.cpp @@ -449,13 +449,13 @@ bool BackupRestore::translate_frm(NdbDictionary::Table *table) } if (map_in_frm(new_data, (const char*)data, data_len, &new_data_len)) { - my_free(new_data, MYF(0)); + my_free(new_data); DBUG_RETURN(TRUE); } if (packfrm((uchar*) new_data, new_data_len, &new_pack_data, &new_pack_len)) { - my_free(new_data, MYF(0)); + my_free(new_data); DBUG_RETURN(TRUE); } table->setFrm(new_pack_data, new_pack_len); diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index f5901540ab0..f0e2e5574fc 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -1009,7 +1009,7 @@ void* pfs_spawn_thread(void *arg) */ user_start_routine= typed_arg->m_user_start_routine; user_arg= typed_arg->m_user_arg; - my_free(typed_arg, MYF(0)); + my_free(typed_arg); /* Then, execute the user code for this thread. */ (*user_start_routine)(user_arg); @@ -1037,7 +1037,7 @@ static int spawn_thread_v1(PSI_thread_key key, int result= pthread_create(thread, attr, pfs_spawn_thread, psi_arg); if (unlikely(result != 0)) - my_free(psi_arg, MYF(0)); + my_free(psi_arg); return result; } @@ -1093,7 +1093,8 @@ static void delete_thread_v1(PSI_thread *thread) } static PSI_mutex_locker* -get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op) +get_thread_mutex_locker_v1(PSI_mutex_locker_state *state, + PSI_mutex *mutex, PSI_mutex_operation op) { PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex); DBUG_ASSERT((int) op >= 0); @@ -1138,7 +1139,8 @@ get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op) } static PSI_rwlock_locker* -get_thread_rwlock_locker_v1(PSI_rwlock *rwlock, PSI_rwlock_operation op) +get_thread_rwlock_locker_v1(PSI_rwlock_locker_state *state, + PSI_rwlock *rwlock, PSI_rwlock_operation op) { PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock*> (rwlock); DBUG_ASSERT(static_cast<int> (op) >= 0); @@ -1184,7 +1186,8 @@ get_thread_rwlock_locker_v1(PSI_rwlock *rwlock, PSI_rwlock_operation op) } static PSI_cond_locker* -get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex * /* unused: mutex */, +get_thread_cond_locker_v1(PSI_cond_locker_state *state, + PSI_cond *cond, PSI_mutex * /* unused: mutex */, PSI_cond_operation op) { /* @@ -1242,7 +1245,8 @@ get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex * /* unused: mutex */, } static PSI_table_locker* -get_thread_table_locker_v1(PSI_table *table) +get_thread_table_locker_v1(PSI_table_locker_state *state, + PSI_table *table) { PFS_table *pfs_table= reinterpret_cast<PFS_table*> (table); DBUG_ASSERT(pfs_table != NULL); @@ -1284,7 +1288,8 @@ get_thread_table_locker_v1(PSI_table *table) } static PSI_file_locker* -get_thread_file_name_locker_v1(PSI_file_key key, +get_thread_file_name_locker_v1(PSI_file_locker_state *state, + PSI_file_key key, PSI_file_operation op, const char *name, const void *identity) { @@ -1341,7 +1346,8 @@ get_thread_file_name_locker_v1(PSI_file_key key, } static PSI_file_locker* -get_thread_file_stream_locker_v1(PSI_file *file, PSI_file_operation op) +get_thread_file_stream_locker_v1(PSI_file_locker_state *state, + PSI_file *file, PSI_file_operation op) { PFS_file *pfs_file= reinterpret_cast<PFS_file*> (file); @@ -1392,7 +1398,8 @@ get_thread_file_stream_locker_v1(PSI_file *file, PSI_file_operation op) } static PSI_file_locker* -get_thread_file_descriptor_locker_v1(File file, PSI_file_operation op) +get_thread_file_descriptor_locker_v1(PSI_file_locker_state *state, + File file, PSI_file_operation op) { int index= static_cast<int> (file); @@ -1462,7 +1469,7 @@ get_thread_file_descriptor_locker_v1(File file, PSI_file_operation op) return NULL; } -static void unlock_mutex_v1(PSI_thread * thread, PSI_mutex *mutex) +static void unlock_mutex_v1(PSI_mutex *mutex) { PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex); DBUG_ASSERT(pfs_mutex != NULL); @@ -1501,7 +1508,7 @@ static void unlock_mutex_v1(PSI_thread * thread, PSI_mutex *mutex) #endif } -static void unlock_rwlock_v1(PSI_thread *thread, PSI_rwlock *rwlock) +static void unlock_rwlock_v1(PSI_rwlock *rwlock) { PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock*> (rwlock); DBUG_ASSERT(pfs_rwlock != NULL); @@ -1577,7 +1584,7 @@ static void unlock_rwlock_v1(PSI_thread *thread, PSI_rwlock *rwlock) #endif } -static void signal_cond_v1(PSI_thread *thread, PSI_cond* cond) +static void signal_cond_v1(PSI_cond* cond) { PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond); DBUG_ASSERT(pfs_cond != NULL); @@ -1585,7 +1592,7 @@ static void signal_cond_v1(PSI_thread *thread, PSI_cond* cond) pfs_cond->m_cond_stat.m_signal_count++; } -static void broadcast_cond_v1(PSI_thread *thread, PSI_cond* cond) +static void broadcast_cond_v1(PSI_cond* cond) { PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond); DBUG_ASSERT(pfs_cond != NULL); diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc index 2f3fb2792fc..238111ecaee 100644 --- a/storage/perfschema/unittest/pfs-t.cc +++ b/storage/perfschema/unittest/pfs-t.cc @@ -941,9 +941,13 @@ void test_locker_disabled() ok(file_A1 != NULL, "instrumented"); PSI_mutex_locker *mutex_locker; + PSI_mutex_locker_state mutex_state; PSI_rwlock_locker *rwlock_locker; + PSI_rwlock_locker_state rwlock_state; PSI_cond_locker *cond_locker; + PSI_cond_locker_state cond_state; PSI_file_locker *file_locker; + PSI_file_locker_state file_state; /* Pretend thread T-1 is disabled */ /* ------------------------------ */ @@ -955,17 +959,17 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); /* Pretend the consumer is disabled */ @@ -978,17 +982,17 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); /* Pretend the instrument is disabled */ @@ -1001,17 +1005,17 @@ void test_locker_disabled() cond_class_A->m_enabled= false; file_class_A->m_enabled= false; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); /* Pretend everything is enabled */ @@ -1024,27 +1028,27 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker != NULL, "locker"); psi->start_mutex_wait(mutex_locker, __FILE__, __LINE__); psi->end_mutex_wait(mutex_locker, 0); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker != NULL, "locker"); psi->start_rwlock_rdwait(rwlock_locker, __FILE__, __LINE__); psi->end_rwlock_rdwait(rwlock_locker, 0); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker != NULL, "locker"); psi->start_cond_wait(cond_locker, __FILE__, __LINE__); psi->end_cond_wait(cond_locker, 0); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker != NULL, "locker"); psi->start_file_open_wait(file_locker, __FILE__, __LINE__); psi->end_file_open_wait(file_locker); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 10, __FILE__, __LINE__); psi->end_file_wait(file_locker, 10); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 10, __FILE__, __LINE__); psi->end_file_wait(file_locker, 10); @@ -1059,17 +1063,17 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); shutdown_performance_schema(); @@ -1102,6 +1106,7 @@ void test_file_instrumentation_leak() PFS_file_class *file_class_A; PFS_file_class *file_class_B; + PSI_file_locker_state file_state; PSI_thread *thread_1; /* Preparation */ @@ -1130,24 +1135,24 @@ void test_file_instrumentation_leak() /* Simulate OPEN + READ of 100 bytes + CLOSE on descriptor 12 */ - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "AAA", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "AAA", NULL); ok(file_locker != NULL, "locker"); psi->start_file_open_wait(file_locker, __FILE__, __LINE__); psi->end_file_open_wait_and_bind_to_descriptor(file_locker, 12); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 100, __FILE__, __LINE__); psi->end_file_wait(file_locker, 100); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_CLOSE); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_CLOSE); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 0, __FILE__, __LINE__); psi->end_file_wait(file_locker, 0); /* Simulate uninstrumented-OPEN + WRITE on descriptor 24 */ - file_locker= psi->get_thread_file_descriptor_locker((File) 24, PSI_FILE_WRITE); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 24, PSI_FILE_WRITE); ok(file_locker == NULL, "no locker, since the open was not instrumented"); /* @@ -1155,7 +1160,7 @@ void test_file_instrumentation_leak() the instrumentation should not leak (don't charge the file io on unknown B to "AAA") */ - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_WRITE); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_WRITE); ok(file_locker == NULL, "no locker, no leak"); shutdown_performance_schema(); |