Commit 12b5327f authored by unknown's avatar unknown

Rework my_getpagesize function

 - Put 'my_getpagesize' in it's own .c file
 - Map the call 'my_getpagesize' directly to 'getpagesize' if it exists
 - Add default implementation for 'my_getpagesize' to be used if no platform
   specfic function exists


include/my_sys.h:
  Break out the defines for my_getpagesize from HAVE_SYS_MMAN_H as they don't depend on that.
  There is a check for the function in configure which defines HAVE_GETPAGESIZE if the function
  exists
mysys/CMakeLists.txt:
  Add new fil my_getpagesize.c
mysys/Makefile.am:
  Add new fil my_getpagesize.c
mysys/my_mmap.c:
  Remove my_getpagesize from my_mmap.c as it's now implemented in my_getpagesize.c
mysys/my_getpagesize.c:
  New BitKeeper file ``mysys/my_getpagesize.c''
parent 6871a9c8
......@@ -842,12 +842,6 @@ my_bool my_gethwaddr(uchar *to);
#endif
#define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f)
#ifdef HAVE_GETPAGESIZE
#define my_getpagesize() getpagesize()
#else
/* qnx ? */
#define my_getpagesize() 8192
#endif
#define my_munmap(a,b) munmap((a),(b))
#else
......@@ -863,11 +857,17 @@ my_bool my_gethwaddr(uchar *to);
#define HAVE_MMAP
#endif
int my_getpagesize(void);
void *my_mmap(void *, size_t, int, int, int, my_off_t);
int my_munmap(void *, size_t);
#endif
/* my_getpagesize */
#ifdef HAVE_GETPAGESIZE
#define my_getpagesize() getpagesize()
#else
int my_getpagesize(void);
#endif
int my_msync(int, void *, size_t, int);
/* character sets */
......
......@@ -26,4 +26,5 @@ ADD_LIBRARY(mysys array.c charset-def.c charset.c checksum.c default.c default_m
my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c my_wincond.c
my_windac.c my_winsem.c my_winthread.c my_write.c ptr_cmp.c queues.c
rijndael.c safemalloc.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c
thr_rwlock.c tree.c typelib.c base64.c my_memmem.c)
thr_rwlock.c tree.c typelib.c base64.c my_memmem.c
my_getpagesize.c)
......@@ -29,7 +29,7 @@ noinst_HEADERS = mysys_priv.h my_static.h \
libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
mf_path.c mf_loadpath.c my_file.c \
my_open.c my_create.c my_dup.c my_seek.c my_read.c \
my_pread.c my_write.c \
my_pread.c my_write.c my_getpagesize.c \
mf_keycache.c mf_keycaches.c my_crc32.c \
mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \
mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \
......
/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysys_priv.h"
#ifndef HAVE_GETPAGESIZE
#if defined __WIN__
int my_getpagesize(void)
{
SYSTEM_INFO si;
GetSystemInfo(&si);
return si.dwPageSize;
}
#else
/* Default implementation */
int my_getpagesize(void)
{
return (int)8192;
}
#endif
#endif
......@@ -33,13 +33,6 @@ int my_msync(int fd, void *addr, size_t len, int flags)
static SECURITY_ATTRIBUTES mmap_security_attributes=
{sizeof(SECURITY_ATTRIBUTES), 0, TRUE};
int my_getpagesize(void)
{
SYSTEM_INFO si;
GetSystemInfo(&si);
return si.dwPageSize;
}
void *my_mmap(void *addr, size_t len, int prot,
int flags, int fd, my_off_t offset)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment