diff options
Diffstat (limited to 'mysys')
-rwxr-xr-x | mysys/CMakeLists.txt | 3 | ||||
-rw-r--r-- | mysys/Makefile.am | 2 | ||||
-rw-r--r-- | mysys/my_getopt.c | 7 | ||||
-rw-r--r-- | mysys/my_getpagesize.c | 41 | ||||
-rw-r--r-- | mysys/my_mmap.c | 7 |
5 files changed, 50 insertions, 10 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_getopt.c b/mysys/my_getopt.c index 95dc5afeae9..878e4b5103c 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -59,13 +59,18 @@ char *disabled_my_option= (char*) "0"; my_bool my_getopt_print_errors= 1; -static void default_reporter(enum loglevel level __attribute__((unused)), +static void default_reporter(enum loglevel level, const char *format, ...) { va_list args; va_start(args, format); + if (level == WARNING_LEVEL) + fprintf(stderr, "%s", "Warning: "); + else if (level == INFORMATION_LEVEL) + fprintf(stderr, "%s", "Info: "); vfprintf(stderr, format, args); va_end(args); + fflush(stderr); } /* 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) { |