summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-11-23 17:23:29 +0100
committerunknown <msvensson@neptunus.(none)>2006-11-23 17:23:29 +0100
commit026355d34a27d398ce1d7049b492f41bff361865 (patch)
tree05fb90d75d7fa858a23feb048c7340bcd4db8816 /mysys
parentdf333b1ffe189b1338203abf08e6004b86e058d1 (diff)
downloadmariadb-git-026355d34a27d398ce1d7049b492f41bff361865.tar.gz
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''
Diffstat (limited to 'mysys')
-rwxr-xr-xmysys/CMakeLists.txt3
-rw-r--r--mysys/Makefile.am2
-rw-r--r--mysys/my_getpagesize.c41
-rw-r--r--mysys/my_mmap.c7
4 files changed, 44 insertions, 9 deletions
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
index 7926cb916c1..b1a3e7441fb 100755
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
@@ -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)
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 041130fdf5c..47480e8f363 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -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 \
diff --git a/mysys/my_getpagesize.c b/mysys/my_getpagesize.c
new file mode 100644
index 00000000000..ac4bd775ba9
--- /dev/null
+++ b/mysys/my_getpagesize.c
@@ -0,0 +1,41 @@
+/* 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
+
diff --git a/mysys/my_mmap.c b/mysys/my_mmap.c
index 21bfddae46c..eb74aaeaae4 100644
--- a/mysys/my_mmap.c
+++ b/mysys/my_mmap.c
@@ -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)
{