1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

mmap portability layer, mmap for Windows

new macro: thread_safe_decrement, thread_safe_dec_and_test, statistic_decrement


mysys/my_chsize.c:
  cleanup
include/config-win.h:
  mmap portability layer, mmap for Windows
include/my_pthread.h:
  thread_safe_decrement, thread_safe_dec_and_test, statistic_decrement
include/my_sys.h:
  mmap portability layer, mmap for Windows
mysys/Makefile.am:
  mmap portability layer, mmap for Windows
This commit is contained in:
unknown
2004-11-04 22:55:47 +01:00
parent fac533bb14
commit cce44b148c
6 changed files with 148 additions and 14 deletions

View File

@@ -48,9 +48,9 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize));
if (oldsize > newlength)
{
#if defined(HAVE_SETFILEPOINTER)
/* This is for the moment only true on windows */
{
long is_success;
HANDLE win_file= (HANDLE) _get_osfhandle(fd);
long length_low, length_high;
@@ -63,35 +63,29 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
DBUG_RETURN(0);
my_errno= GetLastError();
goto err;
}
#elif defined(HAVE_FTRUNCATE)
{
if (ftruncate(fd, (off_t) newlength))
{
my_errno= errno;
goto err;
}
DBUG_RETURN(0);
}
#elif defined(HAVE_CHSIZE)
{
if (chsize(fd, (off_t) newlength))
{
my_errno=errno;
goto err;
}
DBUG_RETURN(0);
}
#else
{
/*
Fill space between requested length and true length with 'filler'
We should never come here on any modern machine
*/
VOID(my_seek(fd, newlength, MY_SEEK_SET, MYF(MY_WME+MY_FAE)));
swap_variables(my_off_t, newlength, oldsize);
}
#endif
}
/* Full file with 'filler' until it's as big as requested */
bfill(buff, IO_SIZE, filler);