diff options
Diffstat (limited to 'innobase/os')
-rw-r--r-- | innobase/os/os0file.c | 28 | ||||
-rw-r--r-- | innobase/os/os0shm.c | 6 | ||||
-rw-r--r-- | innobase/os/os0sync.c | 26 | ||||
-rw-r--r-- | innobase/os/os0thread.c | 13 |
4 files changed, 44 insertions, 29 deletions
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index 9e45c2981de..1da95c8ba9c 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -166,6 +166,8 @@ os_file_handle_error( int input_char; ulint err; + UT_NOT_USED(file); + err = os_file_get_last_error(); if (err == OS_FILE_DISK_FULL) { @@ -316,8 +318,11 @@ try_again: UT_NOT_USED(purpose); if (create_mode == OS_FILE_CREATE) { - file = open(name, create_flag, S_IRUSR | S_IRGRP | S_IROTH - | S_IWUSR | S_IWGRP | S_IWOTH); +#ifndef S_IRWXU + file = open(name, create_flag); +#else + file = open(name, create_flag, S_IRWXU | S_IRWXG | S_IRWXO); +#endif } else { file = open(name, create_flag); } @@ -445,6 +450,8 @@ try_again: low = size; #if (UNIV_WORD_SIZE == 8) low = low + (size_high << 32); +#else + UT_NOT_USED(size_high); #endif while (offset < low) { if (low - offset < UNIV_PAGE_SIZE * 64) { @@ -478,6 +485,8 @@ error_handling: } ut_error; + + return(FALSE); } /*************************************************************************** @@ -660,6 +669,8 @@ try_again: #if (UNIV_WORD_SIZE == 8) offset = offset + (offset_high << 32); +#else + UT_NOT_USED(offset_high); #endif try_again: /* Protect the seek / read operation with a mutex */ @@ -669,7 +680,7 @@ try_again: ret = os_file_pread(file, buf, n, (off_t) offset); - if (ret == n) { + if ((ulint)ret == n) { os_mutex_exit(os_file_seek_mutexes[i]); return(TRUE); @@ -751,16 +762,17 @@ try_again: #if (UNIV_WORD_SIZE == 8) offset = offset + (offset_high << 32); +#else + UT_NOT_USED(offset_high); #endif try_again: ret = pwrite(file, buf, n, (off_t) offset); - if (ret == n) { + if ((ulint)ret == n) { return(TRUE); } #endif - -error_handling: +error_handling: retry = os_file_handle_error(file, name); if (retry) { @@ -1411,7 +1423,6 @@ try_again: return(TRUE); } -error_handling: os_aio_array_free_slot(array, slot); retry = os_file_handle_error(file, name); @@ -1908,7 +1919,8 @@ loop: if (slot->reserved) { n_reserved++; printf("Reserved slot, messages %lx %lx\n", - slot->message1, slot->message2); + (ulint)slot->message1, + (ulint)slot->message2); ut_a(slot->len > 0); } } diff --git a/innobase/os/os0shm.c b/innobase/os/os0shm.c index e03440cd4f4..f49aa2922b0 100644 --- a/innobase/os/os0shm.c +++ b/innobase/os/os0shm.c @@ -90,6 +90,8 @@ os_shm_free( } #else UT_NOT_USED(shm); + + return(FALSE); #endif } @@ -116,6 +118,8 @@ os_shm_map( return(mem); #else UT_NOT_USED(shm); + + return(NULL); #endif } @@ -142,5 +146,7 @@ os_shm_unmap( } #else UT_NOT_USED(addr); + + return(FALSE); #endif } diff --git a/innobase/os/os0sync.c b/innobase/os/os0sync.c index 9f9b2605884..4c283431575 100644 --- a/innobase/os/os0sync.c +++ b/innobase/os/os0sync.c @@ -19,14 +19,14 @@ Created 9/6/1995 Heikki Tuuri #include "ut0mem.h" /* Type definition for an operating system mutex struct */ -struct os_mutex_struct{ +struct os_mutex_struct{ void* handle; /* OS handle to mutex */ ulint count; /* we use this counter to check that the same thread does not recursively lock the mutex: we do not assume that the OS mutex supports recursive locking, though - NT seems to do that */ + NT seems to do that */ }; /************************************************************* @@ -44,7 +44,7 @@ os_event_create( { #ifdef __WIN__ HANDLE event; - + event = CreateEvent(NULL, /* No security attributes */ TRUE, /* Manual reset */ FALSE, /* Initial state nonsignaled */ @@ -108,7 +108,7 @@ os_event_set( /*=========*/ os_event_t event) /* in: event to set */ { -#ifdef __WIN__ +#ifdef __WIN__ ut_a(event); ut_a(SetEvent(event)); #else @@ -124,7 +124,7 @@ os_event_set( } os_fast_mutex_unlock(&(event->os_mutex)); -#endif +#endif } /************************************************************** @@ -162,7 +162,7 @@ void os_event_free( /*==========*/ os_event_t event) /* in: event to free */ - + { #ifdef __WIN__ ut_a(event); @@ -238,7 +238,7 @@ os_event_wait_time( } else { err = WaitForSingleObject(event, INFINITE); } - + if (err == WAIT_OBJECT_0) { return(0); @@ -250,7 +250,7 @@ os_event_wait_time( } #else UT_NOT_USED(time); - + /* In Posix this is just an ordinary, infinite wait */ os_event_wait(event); @@ -290,7 +290,7 @@ os_event_wait_multiple( return(index - WAIT_OBJECT_0); #else ut_a(n == 0); - + /* In Posix we can only wait for a single event */ os_event_wait(*event_array); @@ -331,7 +331,7 @@ os_mutex_create( os_mutex_t mutex_str; UT_NOT_USED(name); - + os_mutex = ut_malloc(sizeof(os_fast_mutex_t)); os_fast_mutex_init(os_mutex); @@ -342,7 +342,7 @@ os_mutex_create( mutex_str->count = 0; return(mutex_str); -#endif +#endif } /************************************************************** @@ -398,7 +398,7 @@ os_mutex_exit( (mutex->count)--; os_fast_mutex_unlock(mutex->handle); -#endif +#endif } /************************************************************** @@ -432,7 +432,7 @@ os_fast_mutex_init( { #ifdef __WIN__ ut_a(fast_mutex); - + InitializeCriticalSection((LPCRITICAL_SECTION) fast_mutex); #else pthread_mutex_init(fast_mutex, NULL); diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c index a33613267ac..8fea31ecf8e 100644 --- a/innobase/os/os0thread.c +++ b/innobase/os/os0thread.c @@ -30,9 +30,6 @@ os_thread_get_curr_id(void) #endif } -/* Define a function pointer type to use in a typecast */ -typedef void* (*os_posix_f_t) (void*); - /******************************************************************** Creates a new thread of execution. The execution starts from the function given. The start function takes a void* parameter @@ -42,8 +39,12 @@ os_thread_t os_thread_create( /*=============*/ /* out: handle to the thread */ +#ifndef __WIN__ + os_posix_f_t start_f, +#else ulint (*start_f)(void*), /* in: pointer to function from which to start */ +#endif void* arg, /* in: argument to start function */ os_thread_id_t* thread_id) /* out: id of created @@ -65,11 +66,7 @@ os_thread_create( int ret; os_thread_t pthread; - /* Note that below we cast the start function returning an integer - to a function returning a pointer: this may cause error - if the return value is used somewhere! */ - - ret = pthread_create(&pthread, NULL, (os_posix_f_t) start_f, arg); + ret = pthread_create(&pthread, NULL, start_f, arg); return(pthread); #endif |