Changeset: c23b833b9452 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c23b833b9452
Added Files:
        gdk/gdk_utils.c
        gdk/gdk_utils.h
Removed Files:
        gdk/gdk_utils.mx
Modified Files:
        gdk/Makefile.ag
Branch: default
Log Message:

Converted gdk_utils.mx to .c/.h.


diffs (truncated from 913 to 300 lines):

diff --git a/gdk/Makefile.ag b/gdk/Makefile.ag
--- a/gdk/Makefile.ag
+++ b/gdk/Makefile.ag
@@ -36,7 +36,7 @@ lib_gdk = {
                gdk_scanselect_defs_var.mx \
                gdk_scanselect.mx gdk.h gdk_batop.mx \
                gdk_search.mx gdk_tm.c gdk_align.c gdk_bbp.mx \
-               gdk_heap.c gdk_setop.mx gdk_utils.mx gdk_atoms.mx \
+               gdk_heap.c gdk_setop.mx gdk_utils.c gdk_utils.h gdk_atoms.mx \
                gdk_qsort.mx gdk_ssort.mx gdk_storage.c gdk_bat.c gdk_bat.h \
                gdk_delta.c gdk_relop.mx gdk_system.c gdk_value.mx \
                gdk_rangejoin.mx \
diff --git a/gdk/gdk_utils.mx b/gdk/gdk_utils.c
rename from gdk/gdk_utils.mx
rename to gdk/gdk_utils.c
--- a/gdk/gdk_utils.mx
+++ b/gdk/gdk_utils.c
@@ -1,42 +1,30 @@
-@/
-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://www.monetdb.org/Legal/MonetDBLicense
+/*
+ * 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://www.monetdb.org/Legal/MonetDBLicense
+ *
+ * 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-2012 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.
-
-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-2012 MonetDB B.V.
-All Rights Reserved.
-@
-
-@f gdk_utils
-
-@c
 /*
  * @a M. L. Kersten, P. Boncz, N. Nes
  *
  * @* Utilities
- * The utility section contains functions to initialize the Monet database
- * system, memory allocation details, and a basic system logging scheme.
- * @-
+ * The utility section contains functions to initialize the Monet
+ * database system, memory allocation details, and a basic system
+ * logging scheme.
  */
-@h
-#ifndef _GDK_UTILS_H_
-#define _GDK_UTILS_H_
-
-#include <monet_options.h>
-
-gdk_export BAT *GDKenv;
-
-@c
 #include "monetdb_config.h"
 
 #include "gdk.h"
@@ -88,18 +76,17 @@ static int GDKgetHome(void);
 
 /*
  * @+ Monet configuration file
- * Parse a possible MonetDB config file
- * (if specified by command line option -c/--config)
- * to extract pre-settings of system variables.
- * Un-recognized parameters are simply skipped, because they  may be
- * picked up by other components of the system.
- * The consequence is that making a typing error in the configuration file
- * may be unnoticed for a long time.
- * Syntax errors are immediately flagged, though.
+ * Parse a possible MonetDB config file (if specified by command line
+ * option -c/--config) to extract pre-settings of system variables.
+ * Un-recognized parameters are simply skipped, because they may be
+ * picked up by other components of the system.  The consequence is
+ * that making a typing error in the configuration file may be
+ * unnoticed for a long time.  Syntax errors are immediately flagged,
+ * though.
  *
- * Since the GDK kernel moves into the database directory, we need
- * to keep the absolute path to the MonetDB config file for top-levels
- * to access its information.
+ * Since the GDK kernel moves into the database directory, we need to
+ * keep the absolute path to the MonetDB config file for top-levels to
+ * access its information.
  */
 
 static int
@@ -126,10 +113,6 @@ GDKenvironment(str dbname, str dbfarm)
        return 1;
 }
 
-@h
-gdk_export char *GDKgetenv(const char *name);
-
-@c
 char *
 GDKgetenv(const char *name)
 {
@@ -142,10 +125,6 @@ GDKgetenv(const char *name)
        return NULL;
 }
 
-@h
-gdk_export int GDKgetenv_isyes(const char *name);
-
-@c
 int
 GDKgetenv_isyes(const char *name)
 {
@@ -157,10 +136,6 @@ GDKgetenv_isyes(const char *name)
        return 0;
 }
 
-@h
-gdk_export int GDKgetenv_istrue(const char *name);
-
-@c
 int
 GDKgetenv_istrue(const char *name)
 {
@@ -182,10 +157,6 @@ GDKgetenv_int(const char *name, int def)
        return def;
 }
 
-@h
-gdk_export void GDKsetenv(str name, str value);
-
-@c
 void
 GDKsetenv(str name, str value)
 {
@@ -196,18 +167,16 @@ GDKsetenv(str name, str value)
 
 /*
  * @+ System logging
- * Per database a log file can be maintained for collection
- * of system management information. Its contents is driven
- * by the upper layers, which encode information such as
- * who logged on and how long the session went on.
- * The lower layers merely store error information on the file.
- * It should not be used for crash recovery, because this should be
- * dealt with on a per client basis.
+ * Per database a log file can be maintained for collection of system
+ * management information. Its contents is driven by the upper layers,
+ * which encode information such as who logged on and how long the
+ * session went on.  The lower layers merely store error information
+ * on the file.  It should not be used for crash recovery, because
+ * this should be dealt with on a per client basis.
  *
- * @-
- * A system log can be maintained in the database to keep track
- * of session and crash information. It should regularly be
- * refreshed to avoid disk overflow.
+ * A system log can be maintained in the database to keep track of
+ * session and crash information. It should regularly be refreshed to
+ * avoid disk overflow.
  */
 #define GDKLOCK        ".gdk_lock"
 
@@ -219,9 +188,8 @@ static FILE *GDKlockFile = 0;
 #define GDKCRASH       "CRASH"
 
 /*
- * @-
- * Single-lined comments can now be logged safely, together with process, 
thread
- * and user ID, and the current time.
+ * Single-lined comments can now be logged safely, together with
+ * process, thread and user ID, and the current time.
  */
 void
 GDKlog(const char *format, ...)
@@ -241,14 +209,14 @@ GDKlog(const char *format, ...)
        /* remove forbidden characters from message */
        for (p = buf; (p = strchr(p, '\n')) != NULL; *p = ' ')
                ;
-       for (p = buf; (p = strchr(p, '\@')) != NULL; *p = ' ')
+       for (p = buf; (p = strchr(p, '@')) != NULL; *p = ' ')
                ;
 
        fseek(GDKlockFile, 0, SEEK_END);
 #ifndef HAVE_GETUID
 #define getuid() 0
 #endif
-       fprintf(GDKlockFile, "USR=%d PID=%d TIME=%s \@ %s", (int) getuid(), 
(int) getpid(), ctime(&tm), buf);
+       fprintf(GDKlockFile, "USR=%d PID=%d TIME=%s @ %s", (int) getuid(), 
(int) getpid(), ctime(&tm), buf);
        fflush(GDKlockFile);
 
        if (mustopen)
@@ -312,52 +280,8 @@ BATSIGinit(void)
 }
 #endif /* NATIVE_WIN32 */
 
-@h
-/*
- * @+ Memory management
- * Memory management in GDK mostly relies on the facilities offered by the
- * underlying OS.  The below routines monitor the available memory resources
- * which consist of physical swap space and logical vm space.
- * There are three kinds of memory, that affect these two resources in 
different ways:
- * @table @samp
- *
- * @item memory mapping
- *  which ask for a logical region of virtual memory space.
- * In principal, no physical memory is needed to keep the system afloat here,
- * as the memory mapped file is swapped onto a disk object that already exists.
- *
- * Actually, there are two kings of memory mapping used in GDK, namely
- * read-only direct mapped and writable copy-on write. For the dirty
- * pages, the latter actually also consumes physical memory resources,
- * but that is ignored here for simplicity.
- *
- * @item anonymous virtual memory
- * This is virtual memory that is mapped on the swap file. Hence, this consumes
- * both logical VM space resources and physical memory space.
- *
- * @item malloced memory
- * comes from the heap and directly consumes physical memory resources.
- * @end table
- *
- * We check the resource consumption with preset target values, and if these
- * are exceeded, the routine BBPtrim is called that will unload the
- * least recently used BATs in order to decrease memory usage.
- *
- * The malloc routine checks the memory consumption every 1000 calls,
- * or for calls larger that 50000 bytes. Consequently, at least every
- * 50MB increase, alloc memory is checked. The VM calls always check
- * the memory consumption.
- */
-/* default setting to administer everything */
-#define GDK_MEM_NULLALLOWED
-
-#if SIZEOF_VOID_P==8
-#define GDK_VM_MAXSIZE LL_CONSTANT(4398046511104)      /* :-) a 64-bit OS: 4TB 
*/
-#else
-#define GDK_VM_MAXSIZE LL_CONSTANT(1610612736) /* :-| a 32-bit OS: 1.5GB */
-#endif
-@c
-/* memory thresholds; these values some "sane" constants only, really set in 
GDKinit() */
+/* memory thresholds; these values some "sane" constants only, really
+ * set in GDKinit() */
 size_t GDK_mmap_minsize = GDK_VM_MAXSIZE;
 size_t GDK_mem_maxsize_max = GDK_VM_MAXSIZE;
 size_t GDK_mem_maxsize = GDK_VM_MAXSIZE;
@@ -417,16 +341,6 @@ static MT_Lock mbyteslock;
 #define malloc_lock_init()
 #endif
 
-@h
-/* virtual memory defines */
-gdk_export size_t _MT_npages;
-gdk_export size_t _MT_pagesize;
-
-#define MT_pagesize()  _MT_pagesize
-#define MT_npages()    _MT_npages
-
-gdk_export void MT_init(void); /*  init the package. */
-@c
 size_t _MT_pagesize = 0;       /* variable holding memory size */
 size_t _MT_npages = 0;         /* variable holding page size */
 
@@ -446,7 +360,7 @@ MT_init(void)
                size_t len = sizeof(int);
                int mib[2];
 
-               /* Everyone should have permission to make this call, 
+               /* Everyone should have permission to make this call,
                 * if we get a failure something is really wrong. */
                mib[0] = CTL_HW;
                mib[1] = HW_PAGESIZE;
@@ -481,7 +395,7 @@ MT_init(void)
                size_t len = sizeof(size);
                int mib[2];
 
-               /* Everyone should have permission to make this call, 
+               /* Everyone should have permission to make this call,
                 * if we get a failure something is really wrong. */
                mib[0] = CTL_HW;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to