$NetBSD: patch-ab,v 1.2 2010/07/22 16:56:04 drochner Exp $

--- libgosm.cpp.orig	2010-07-13 15:15:46.000000000 +0000
+++ libgosm.cpp
@@ -503,7 +503,7 @@ void Route (int recalculate, int plon, i
     // In particular, while gosmore is paused while a page is swapped in, the OS can
     // zero some pages for us.
     int dzero = open ("/dev/zero", O_RDWR);
-    long long ds = sysconf (_SC_PAGESIZE) * (long long) sysconf (_SC_PHYS_PAGES) /
+    long long ds = sysconf (_SC_PAGESIZE) * 200000 /
       (sizeof (*routeHeap) + sizeof (*route) + 40);
     dhashSize = ds > INT_MAX ? INT_MAX : ds;
     routeHeapMaxSize = lrint (sqrt (dhashSize)) * 3;
@@ -1513,7 +1513,7 @@ int RebuildPak(const char* pakfile, cons
   int ndStart;
   wayType *master = NULL;
   if (strcmp(masterpakfile,"")) {
-    if (!(masterf = fopen64 (masterpakfile, "r")) ||
+    if (!(masterf = fopen (masterpakfile, "r")) ||
 	fseek (masterf, -sizeof (ndStart), SEEK_END) != 0 ||
 	fread (&ndStart, sizeof (ndStart), 1, masterf) != 1 ||
 	(long)(master = (wayType *)mmap (NULL, ndStart, PROT_READ,
@@ -1524,7 +1524,7 @@ int RebuildPak(const char* pakfile, cons
     }
   }
   
-  if (!(pak = fopen64 (pakfile, "w+"))) {
+  if (!(pak = fopen (pakfile, "w+"))) {
     fprintf (stderr, "Cannot create %s\n",pakfile);
     return 2;
   }
@@ -1547,7 +1547,7 @@ int RebuildPak(const char* pakfile, cons
   for (int i = 0; i < PAIRGROUP2 (0) + PAIRGROUPS2; i++) {
     sprintf (groupName[i], "%c%c%d.tmp", i / 26 % 26 + 'a', i % 26 + 'a',
 	     i / 26 / 26);
-    if (i < S2GROUP (0) && !(groupf[i] = fopen64 (groupName[i], "w+"))) {
+    if (i < S2GROUP (0) && !(groupf[i] = fopen (groupName[i], "w+"))) {
       fprintf (stderr, "Cannot create temporary file.\n"
 	       "Possibly too many open files, in which case you must run "
 	       "ulimit -n or recompile\n");
@@ -1956,7 +1956,7 @@ int RebuildPak(const char* pakfile, cons
   
   for (int i = 0; i < IDXGROUPS; i++) fclose (groupf[i]);
   for (int i = S2GROUP (0); i < PAIRGROUP2 (0) + PAIRGROUPS2; i++) {
-    assert (groupf[i] = fopen64 (groupName[i], "w+"));
+    assert (groupf[i] = fopen (groupName[i], "w+"));
   } // Avoid exceeding ulimit
   
   nodeType *nodes = (nodeType *) malloc (sizeof (*nodes) * MAX_NODES);
@@ -2211,7 +2211,7 @@ int RebuildPak(const char* pakfile, cons
   }
   
   REBUILDWATCH (for (int i = 0; i < IDXGROUPS; i++)) {
-    assert (groupf[i] = fopen64 (groupName[i], "r+"));
+    assert (groupf[i] = fopen (groupName[i], "r+"));
     fseek (groupf[i], 0, SEEK_END);
     int fsize = ftell (groupf[i]);
     if (fsize > 0) {
