Changeset: 851be7266757 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=851be7266757
Modified Files:
        gdk/Makefile.ag
        gdk/gdk_posix.c
        gdk/gdk_posix.h
        gdk/gdk_posix.mx
        gdk/gdk_system.c
        gdk/gdk_system.h
        gdk/gdk_system.mx
        gdk/gdk_tm.c
        gdk/gdk_tm.h
        gdk/gdk_tm.mx
Branch: headless
Log Message:

Pass through gdk_{tm,system,posix}.


diffs (truncated from 1861 to 300 lines):

diff --git a/gdk/Makefile.ag b/gdk/Makefile.ag
--- a/gdk/Makefile.ag
+++ b/gdk/Makefile.ag
@@ -39,12 +39,12 @@
                gdk_scanselect_defs_fix.mx \
                gdk_scanselect_defs_var.mx \
                gdk_scanselect.mx gdk_batop.mx \
-               gdk_search.mx gdk_tm.mx gdk_align.mx gdk_bbp.mx \
+               gdk_search.mx gdk_tm.c gdk_align.mx gdk_bbp.c \
                gdk_heap.mx gdk_setop.mx gdk_utils.mx gdk_atoms.mx \
-               gdk_qsort.mx gdk_ssort.mx gdk_storage.mx gdk_bat.mx \
-               gdk_delta.mx gdk_relop.mx gdk_system.mx gdk_value.mx \
+               gdk_qsort.mx gdk_ssort.mx gdk_storage.c gdk_bat.mx \
+               gdk_delta.mx gdk_relop.mx gdk_system.c gdk_value.mx \
                gdk_rangejoin.mx \
-               gdk_posix.mx gdk_logger.mx bat.feps bat1.feps bat2.feps \
+               gdk_posix.c gdk_logger.mx bat.feps bat1.feps bat2.feps \
                libbat.rc
        LIBS = ../common/options/libmoptions \
                ../common/stream/libstream \
@@ -53,4 +53,4 @@
                $(MALLOC_LIBS) $(PTHREAD_LIBS) $(DL_LIBS)
 }
 
-EXTRA_DIST = gdk.h
+EXTRA_DIST = gdk.h gdk_bbp.h gdk_posix.h gdk_storage.h gdk_system.h gdk_tm.h
diff --git a/gdk/gdk_posix.mx b/gdk/gdk_posix.c
rename from gdk/gdk_posix.mx
rename to gdk/gdk_posix.c
--- a/gdk/gdk_posix.mx
+++ b/gdk/gdk_posix.c
@@ -1,293 +1,34 @@
-@/
-The contents of this file are subject to the MonetDB Public License
-Version 1.1 (the "License"); you may not use this file except in
-compliance with the License. You may obtain a copy of the License at
-http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
+/*
+ * The contents of this file are subject to the MonetDB Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the MonetDB Database System.
+ *
+ * The Initial Developer of the Original Code is CWI.
+ * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
+ * Copyright August 2008-2011 MonetDB B.V.
+ * All Rights Reserved.
+ */
 
-Software distributed under the License is distributed on an "AS IS"
-basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-License for the specific language governing rights and limitations
-under the License.
+/*
+ * @f gdk_posix
+ * @a Niels Nes, Peter Boncz
+ * @* System Independent Layer
+ *
+ * GDK is built on Posix. Exceptions are made for memory mapped files and
+ * anonymous virtual memory, for which somewhat higher-level functions are
+ * defined here.
+ * Most of this file concerns itself with emulation of Posix functionality on
+ * the WIN32 native platform.
+  */
 
-The Original Code is the MonetDB Database System.
-
-The Initial Developer of the Original Code is CWI.
-Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
-Copyright August 2008-2011 MonetDB B.V.
-All Rights Reserved.
-@
-
-@f gdk_posix
-@a Niels Nes, Peter Boncz
-@* System Independent Layer
-
-GDK is built on Posix. Exceptions are made for memory mapped files and 
-anonymous virtual memory, for which somewhat higher-level functions are 
-defined here.
-Most of this file concerns itself with emulation of Posix functionality on 
-the WIN32 native platform.
-@-
-@{
-@h
-#ifndef GDK_POSIX_H
-#define GDK_POSIX_H
-
-#include <sys/types.h>
-
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>           /* mallopt, mallinfo, and  malloc, free etc. */
-#endif
-
-#ifdef HAVE_FTIME
-#include <sys/timeb.h>
-#endif
-
-#ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# ifdef HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
-#if defined(HAVE_WINSOCK_H) && defined(NATIVE_WIN32)
-#include <winsock.h>           /* for timeval */
-#endif
-
-#include "gdk_system.h" /* gdk_export */
-
-#ifdef NATIVE_WIN32
-#include <io.h>
-#include <direct.h>
-#endif
-
-/* Some systems (SGI, Sun) call malloc before we get a chance to call
-   mallopt, and mallopt should be called before the first call to
-   malloc.  Therefore we do as if we don't have mallopt, even though
-   in reality we do.
- */
-#ifdef HAVE_MALLOPT
-#undef HAVE_MALLOPT
-#endif
-
-#ifndef M_MXFAST
-#define M_MXFAST       1       /* set size of blocks to be fast */
-#endif
-#ifndef M_NLBLKS
-#define M_NLBLKS       2       /* set number of block in a holding block */
-#endif
-#ifndef M_GRAIN
-#define M_GRAIN                3       /* set number of sizes mapped to one, 
for */
-                          /* small blocks */
-#endif
-#ifndef M_KEEP
-#define M_KEEP         4       /* retain contents of block after a free */
-                          /* until another allocation */
-#endif
-
-/* our version of struct mallinfo */
-struct Mallinfo {
-       size_t arena;           /* total space in arena */
-       size_t ordblks;         /* number of ordinary blocks */
-       size_t smblks;          /* number of small blocks */
-       size_t hblks;           /* number of holding blocks */
-       size_t hblkhd;          /* space in holding block headers */
-       size_t usmblks;         /* space in small blocks in use */
-       size_t fsmblks;         /* space in free small blocks */
-       size_t uordblks;        /* space in ordinary blocks in use */
-       size_t fordblks;        /* space in free ordinary blocks */
-       size_t keepcost;        /* cost of enabling keep option */
-};
-
-gdk_export struct Mallinfo MT_mallinfo(void);
-
-@- locking, sleep
-@h
-
-gdk_export void MT_sleep_ms(unsigned int ms);
-
-@- virtual memory
-@h
-#define MT_VMUNITLOG   16
-#define MT_VMUNITSIZE  (1 << MT_VMUNITLOG)
-
-gdk_export int MT_alloc_register(void *p, size_t size, char mode);
-gdk_export int MT_alloc_print(void);
-gdk_export int MT_alloc_table(void);
-
-/* make sure POSIX_MADV_* and posix_madvise() are defined somehow */
-#ifdef HAVE_SYS_MMAN_H
-# ifndef __USE_BSD
-#  define __USE_BSD
-# endif
-# include <sys/mman.h>
-#endif
-
-#ifdef __linux__
-/* on Linux, posix_madvise does not seem to work, fall back to classic madvise 
*/
-#undef HAVE_POSIX_MADVISE
-#undef POSIX_MADV_NORMAL
-#undef POSIX_MADV_RANDOM
-#undef POSIX_MADV_SEQUENTIAL
-#undef POSIX_MADV_WILLNEED
-#undef POSIX_MADV_DONTNEED
-#endif
-
-#ifndef HAVE_POSIX_MADVISE
-# ifdef HAVE_MADVISE
-#  define posix_madvise madvise
-#  ifndef MADV_RANDOM
-#   define MADV_RANDOM 0
-#  endif
-#  ifndef POSIX_MADV_NORMAL
-#   define POSIX_MADV_NORMAL     MADV_NORMAL
-#   define POSIX_MADV_RANDOM     MADV_RANDOM
-#   define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
-#   define POSIX_MADV_WILLNEED   MADV_WILLNEED
-#   define POSIX_MADV_DONTNEED   MADV_DONTNEED
-#  endif
-# else
-#  define posix_madvise(x,y,z) 0
-#  ifndef POSIX_MADV_NORMAL
-#   define POSIX_MADV_NORMAL     0
-#   define POSIX_MADV_RANDOM     0
-#   define POSIX_MADV_SEQUENTIAL 0
-#   define POSIX_MADV_WILLNEED   0
-#   define POSIX_MADV_DONTNEED   0
-#  endif
-# endif
-#endif
-
-/* in case they are still not defined, define these values as
-   something that doesn't do anything */
-#ifndef POSIX_MADV_NORMAL
-#define POSIX_MADV_NORMAL 0
-#endif
-#ifndef POSIX_MADV_RANDOM
-#define POSIX_MADV_RANDOM 0
-#endif
-#ifndef POSIX_MADV_SEQUENTIAL
-#define POSIX_MADV_SEQUENTIAL 0
-#endif
-#ifndef POSIX_MADV_WILLNEED
-#define POSIX_MADV_WILLNEED 0
-#endif
-#ifndef POSIX_MADV_DONTNEED
-#define POSIX_MADV_DONTNEED 0
-#endif
-
-/* the new mmap modes, mimic default MADV_* madvise POSIX constants */
-#define MMAP_NORMAL            POSIX_MADV_NORMAL       /* no further special 
treatment */
-#define MMAP_RANDOM            POSIX_MADV_RANDOM       /* expect random page 
references */
-#define MMAP_SEQUENTIAL        POSIX_MADV_SEQUENTIAL   /* expect sequential 
page references */
-#define MMAP_WILLNEED          POSIX_MADV_WILLNEED     /* will need these 
pages */
-#define MMAP_DONTNEED          POSIX_MADV_DONTNEED     /* don't need these 
pages */
-
-#define MMAP_READ              1024    /* region is readable (default if 
ommitted) */
-#define MMAP_WRITE             2048    /* region may be written into */
-#define MMAP_COPY              4096    /* writable, but changes never reach 
file */
-#define MMAP_ASYNC             8192    /* asynchronous writes (default if 
ommitted) */
-#define MMAP_SYNC              16384   /* writing is done synchronously */
-
-#define MT_MMAP_LOG 27
-#define MT_MMAP_TILE (1<<MT_MMAP_LOG)
-#define MT_MMAP_BUFSIZE 4096
-
-/* in order to be sure of madvise and msync modes, pass them to mmap() call as 
well */
-
-/* a hook function to add any initialization required for the MT_ 
functionality */
-gdk_export char *MT_heapbase;
-gdk_export char *MT_heapcur(void);
-
-gdk_export void MT_init_posix(int alloc_map);
-gdk_export size_t MT_getrss(void);
-
-gdk_export void *MT_mmap(char *path, int mode, off_t off, size_t len);
-gdk_export int MT_munmap(void *p, size_t len);
-gdk_export int MT_msync(void *p, size_t off, size_t len, int mode);
-gdk_export int MT_madvise(void *p, size_t len, int advice);
-
-typedef struct MT_mmap_hdl_t {
-       void *hdl;
-       int mode;
-       void *fixed;
-#ifdef NATIVE_WIN32
-       int hasLock;
-       void *map;
-#endif
-} MT_mmap_hdl;
-
-gdk_export void *MT_mmap_open(MT_mmap_hdl *hdl, char *path, int mode, off_t 
off, size_t len, size_t nremaps);
-gdk_export void *MT_mmap_remap(MT_mmap_hdl *hdl, off_t off, size_t len);
-gdk_export void MT_mmap_close(MT_mmap_hdl *hdl);
-
-gdk_export int MT_mmap_trim(size_t lim, void *err);
-gdk_export void MT_mmap_inform(void *p, size_t len, int preload, int pattern, 
int writable);
-
-gdk_export void *MT_vmalloc(size_t size, size_t *maxsize);
-gdk_export void MT_vmfree(void *p, size_t size);
-gdk_export void *MT_vmrealloc(void *voidptr, size_t oldsize, size_t newsize, 
size_t oldmaxsize, size_t *newmaxsize);
-gdk_export int MT_path_absolute(const char *path);
-
-@}
-
-@+ Posix under WIN32 
-WIN32 actually supports many Posix functions directly.  Some it does not, 
though. 
-For some functionality we move in Monet from Posix calls to MT_*() calls, 
which translate easier 
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to